iclient-mapboxgl-es6.js 3.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389
  1. /*!
  2. *
  3. * iclient-mapboxgl.(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 = 11);
  93. /******/ })
  94. /************************************************************************/
  95. /******/ ([
  96. /* 0 */
  97. /***/ (function(module, exports) {
  98. module.exports = mapboxgl;
  99. /***/ }),
  100. /* 1 */
  101. /***/ (function(module, exports) {
  102. module.exports = function(){try{return mapv}catch(e){return {}}}();
  103. /***/ }),
  104. /* 2 */
  105. /***/ (function(module, exports) {
  106. module.exports = function(){try{return THREE}catch(e){return {}}}();
  107. /***/ }),
  108. /* 3 */
  109. /***/ (function(module, exports) {
  110. var g;
  111. // This works in non-strict mode
  112. g = (function() {
  113. return this;
  114. })();
  115. try {
  116. // This works if eval is allowed (see CSP)
  117. g = g || new Function("return this")();
  118. } catch (e) {
  119. // This works if the window reference is available
  120. if (typeof window === "object") g = window;
  121. }
  122. // g can still be undefined, but nothing to do about it...
  123. // We return undefined, instead of nothing here, so it's
  124. // easier to handle this case. if(!global) { ...}
  125. module.exports = g;
  126. /***/ }),
  127. /* 4 */
  128. /***/ (function(module, exports, __webpack_require__) {
  129. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  130. if (true) {
  131. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  132. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  133. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  134. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  135. } else { var mod; }
  136. })(this, function (exports, module) {
  137. 'use strict';
  138. var defaultOptions = {
  139. timeout: 5000,
  140. jsonpCallback: 'callback',
  141. jsonpCallbackFunction: null
  142. };
  143. function generateCallbackFunction() {
  144. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  145. }
  146. function clearFunction(functionName) {
  147. // IE8 throws an exception when you try to delete a property on window
  148. // http://stackoverflow.com/a/1824228/751089
  149. try {
  150. delete window[functionName];
  151. } catch (e) {
  152. window[functionName] = undefined;
  153. }
  154. }
  155. function removeScript(scriptId) {
  156. var script = document.getElementById(scriptId);
  157. if (script) {
  158. document.getElementsByTagName('head')[0].removeChild(script);
  159. }
  160. }
  161. function fetchJsonp(_url) {
  162. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  163. // to avoid param reassign
  164. var url = _url;
  165. var timeout = options.timeout || defaultOptions.timeout;
  166. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  167. var timeoutId = undefined;
  168. return new Promise(function (resolve, reject) {
  169. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  170. var scriptId = jsonpCallback + '_' + callbackFunction;
  171. window[callbackFunction] = function (response) {
  172. resolve({
  173. ok: true,
  174. // keep consistent with fetch API
  175. json: function json() {
  176. return Promise.resolve(response);
  177. }
  178. });
  179. if (timeoutId) clearTimeout(timeoutId);
  180. removeScript(scriptId);
  181. clearFunction(callbackFunction);
  182. };
  183. // Check if the user set their own params, and if not add a ? to start a list of params
  184. url += url.indexOf('?') === -1 ? '?' : '&';
  185. var jsonpScript = document.createElement('script');
  186. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  187. if (options.charset) {
  188. jsonpScript.setAttribute('charset', options.charset);
  189. }
  190. jsonpScript.id = scriptId;
  191. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  192. timeoutId = setTimeout(function () {
  193. reject(new Error('JSONP request to ' + _url + ' timed out'));
  194. clearFunction(callbackFunction);
  195. removeScript(scriptId);
  196. window[callbackFunction] = function () {
  197. clearFunction(callbackFunction);
  198. };
  199. }, timeout);
  200. // Caught if got 404/500
  201. jsonpScript.onerror = function () {
  202. reject(new Error('JSONP request to ' + _url + ' failed'));
  203. clearFunction(callbackFunction);
  204. removeScript(scriptId);
  205. if (timeoutId) clearTimeout(timeoutId);
  206. };
  207. });
  208. }
  209. // export as global function
  210. /*
  211. let local;
  212. if (typeof global !== 'undefined') {
  213. local = global;
  214. } else if (typeof self !== 'undefined') {
  215. local = self;
  216. } else {
  217. try {
  218. local = Function('return this')();
  219. } catch (e) {
  220. throw new Error('polyfill failed because global object is unavailable in this environment');
  221. }
  222. }
  223. local.fetchJsonp = fetchJsonp;
  224. */
  225. module.exports = fetchJsonp;
  226. });
  227. /***/ }),
  228. /* 5 */
  229. /***/ (function(module, exports) {
  230. module.exports = function(){try{return XLSX}catch(e){return {}}}();
  231. /***/ }),
  232. /* 6 */
  233. /***/ (function(module, exports) {
  234. module.exports = function(){try{return convert}catch(e){return {}}}();
  235. /***/ }),
  236. /* 7 */
  237. /***/ (function(module, exports) {
  238. module.exports = function(){try{return elasticsearch}catch(e){return {}}}();
  239. /***/ }),
  240. /* 8 */
  241. /***/ (function(module, exports, __webpack_require__) {
  242. /* WEBPACK VAR INJECTION */(function(global) {/**
  243. * lodash (Custom Build) <https://lodash.com/>
  244. * Build: `lodash modularize exports="npm" -o ./`
  245. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  246. * Released under MIT license <https://lodash.com/license>
  247. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  248. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  249. */
  250. /** Used as references for various `Number` constants. */
  251. var MAX_SAFE_INTEGER = 9007199254740991;
  252. /** `Object#toString` result references. */
  253. var argsTag = '[object Arguments]',
  254. funcTag = '[object Function]',
  255. genTag = '[object GeneratorFunction]',
  256. mapTag = '[object Map]',
  257. objectTag = '[object Object]',
  258. promiseTag = '[object Promise]',
  259. setTag = '[object Set]',
  260. weakMapTag = '[object WeakMap]';
  261. var dataViewTag = '[object DataView]';
  262. /**
  263. * Used to match `RegExp`
  264. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  265. */
  266. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  267. /** Used to detect host constructors (Safari). */
  268. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  269. /** Used to detect unsigned integer values. */
  270. var reIsUint = /^(?:0|[1-9]\d*)$/;
  271. /** Detect free variable `global` from Node.js. */
  272. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  273. /** Detect free variable `self`. */
  274. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  275. /** Used as a reference to the global object. */
  276. var root = freeGlobal || freeSelf || Function('return this')();
  277. /**
  278. * A specialized version of `_.map` for arrays without support for iteratee
  279. * shorthands.
  280. *
  281. * @private
  282. * @param {Array} [array] The array to iterate over.
  283. * @param {Function} iteratee The function invoked per iteration.
  284. * @returns {Array} Returns the new mapped array.
  285. */
  286. function arrayMap(array, iteratee) {
  287. var index = -1,
  288. length = array ? array.length : 0,
  289. result = Array(length);
  290. while (++index < length) {
  291. result[index] = iteratee(array[index], index, array);
  292. }
  293. return result;
  294. }
  295. /**
  296. * The base implementation of `_.times` without support for iteratee shorthands
  297. * or max array length checks.
  298. *
  299. * @private
  300. * @param {number} n The number of times to invoke `iteratee`.
  301. * @param {Function} iteratee The function invoked per iteration.
  302. * @returns {Array} Returns the array of results.
  303. */
  304. function baseTimes(n, iteratee) {
  305. var index = -1,
  306. result = Array(n);
  307. while (++index < n) {
  308. result[index] = iteratee(index);
  309. }
  310. return result;
  311. }
  312. /**
  313. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  314. * of key-value pairs for `object` corresponding to the property names of `props`.
  315. *
  316. * @private
  317. * @param {Object} object The object to query.
  318. * @param {Array} props The property names to get values for.
  319. * @returns {Object} Returns the key-value pairs.
  320. */
  321. function baseToPairs(object, props) {
  322. return arrayMap(props, function(key) {
  323. return [key, object[key]];
  324. });
  325. }
  326. /**
  327. * Gets the value at `key` of `object`.
  328. *
  329. * @private
  330. * @param {Object} [object] The object to query.
  331. * @param {string} key The key of the property to get.
  332. * @returns {*} Returns the property value.
  333. */
  334. function getValue(object, key) {
  335. return object == null ? undefined : object[key];
  336. }
  337. /**
  338. * Checks if `value` is a host object in IE < 9.
  339. *
  340. * @private
  341. * @param {*} value The value to check.
  342. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  343. */
  344. function isHostObject(value) {
  345. // Many host objects are `Object` objects that can coerce to strings
  346. // despite having improperly defined `toString` methods.
  347. var result = false;
  348. if (value != null && typeof value.toString != 'function') {
  349. try {
  350. result = !!(value + '');
  351. } catch (e) {}
  352. }
  353. return result;
  354. }
  355. /**
  356. * Converts `map` to its key-value pairs.
  357. *
  358. * @private
  359. * @param {Object} map The map to convert.
  360. * @returns {Array} Returns the key-value pairs.
  361. */
  362. function mapToArray(map) {
  363. var index = -1,
  364. result = Array(map.size);
  365. map.forEach(function(value, key) {
  366. result[++index] = [key, value];
  367. });
  368. return result;
  369. }
  370. /**
  371. * Creates a unary function that invokes `func` with its argument transformed.
  372. *
  373. * @private
  374. * @param {Function} func The function to wrap.
  375. * @param {Function} transform The argument transform.
  376. * @returns {Function} Returns the new function.
  377. */
  378. function overArg(func, transform) {
  379. return function(arg) {
  380. return func(transform(arg));
  381. };
  382. }
  383. /**
  384. * Converts `set` to its value-value pairs.
  385. *
  386. * @private
  387. * @param {Object} set The set to convert.
  388. * @returns {Array} Returns the value-value pairs.
  389. */
  390. function setToPairs(set) {
  391. var index = -1,
  392. result = Array(set.size);
  393. set.forEach(function(value) {
  394. result[++index] = [value, value];
  395. });
  396. return result;
  397. }
  398. /** Used for built-in method references. */
  399. var funcProto = Function.prototype,
  400. objectProto = Object.prototype;
  401. /** Used to detect overreaching core-js shims. */
  402. var coreJsData = root['__core-js_shared__'];
  403. /** Used to detect methods masquerading as native. */
  404. var maskSrcKey = (function() {
  405. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  406. return uid ? ('Symbol(src)_1.' + uid) : '';
  407. }());
  408. /** Used to resolve the decompiled source of functions. */
  409. var funcToString = funcProto.toString;
  410. /** Used to check objects for own properties. */
  411. var hasOwnProperty = objectProto.hasOwnProperty;
  412. /**
  413. * Used to resolve the
  414. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  415. * of values.
  416. */
  417. var objectToString = objectProto.toString;
  418. /** Used to detect if a method is native. */
  419. var reIsNative = RegExp('^' +
  420. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  421. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  422. );
  423. /** Built-in value references. */
  424. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  425. /* Built-in method references for those with the same name as other `lodash` methods. */
  426. var nativeKeys = overArg(Object.keys, Object);
  427. /* Built-in method references that are verified to be native. */
  428. var DataView = getNative(root, 'DataView'),
  429. Map = getNative(root, 'Map'),
  430. Promise = getNative(root, 'Promise'),
  431. Set = getNative(root, 'Set'),
  432. WeakMap = getNative(root, 'WeakMap');
  433. /** Used to detect maps, sets, and weakmaps. */
  434. var dataViewCtorString = toSource(DataView),
  435. mapCtorString = toSource(Map),
  436. promiseCtorString = toSource(Promise),
  437. setCtorString = toSource(Set),
  438. weakMapCtorString = toSource(WeakMap);
  439. /**
  440. * Creates an array of the enumerable property names of the array-like `value`.
  441. *
  442. * @private
  443. * @param {*} value The value to query.
  444. * @param {boolean} inherited Specify returning inherited property names.
  445. * @returns {Array} Returns the array of property names.
  446. */
  447. function arrayLikeKeys(value, inherited) {
  448. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  449. // Safari 9 makes `arguments.length` enumerable in strict mode.
  450. var result = (isArray(value) || isArguments(value))
  451. ? baseTimes(value.length, String)
  452. : [];
  453. var length = result.length,
  454. skipIndexes = !!length;
  455. for (var key in value) {
  456. if ((inherited || hasOwnProperty.call(value, key)) &&
  457. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  458. result.push(key);
  459. }
  460. }
  461. return result;
  462. }
  463. /**
  464. * The base implementation of `getTag`.
  465. *
  466. * @private
  467. * @param {*} value The value to query.
  468. * @returns {string} Returns the `toStringTag`.
  469. */
  470. function baseGetTag(value) {
  471. return objectToString.call(value);
  472. }
  473. /**
  474. * The base implementation of `_.isNative` without bad shim checks.
  475. *
  476. * @private
  477. * @param {*} value The value to check.
  478. * @returns {boolean} Returns `true` if `value` is a native function,
  479. * else `false`.
  480. */
  481. function baseIsNative(value) {
  482. if (!isObject(value) || isMasked(value)) {
  483. return false;
  484. }
  485. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  486. return pattern.test(toSource(value));
  487. }
  488. /**
  489. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  490. *
  491. * @private
  492. * @param {Object} object The object to query.
  493. * @returns {Array} Returns the array of property names.
  494. */
  495. function baseKeys(object) {
  496. if (!isPrototype(object)) {
  497. return nativeKeys(object);
  498. }
  499. var result = [];
  500. for (var key in Object(object)) {
  501. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  502. result.push(key);
  503. }
  504. }
  505. return result;
  506. }
  507. /**
  508. * Creates a `_.toPairs` or `_.toPairsIn` function.
  509. *
  510. * @private
  511. * @param {Function} keysFunc The function to get the keys of a given object.
  512. * @returns {Function} Returns the new pairs function.
  513. */
  514. function createToPairs(keysFunc) {
  515. return function(object) {
  516. var tag = getTag(object);
  517. if (tag == mapTag) {
  518. return mapToArray(object);
  519. }
  520. if (tag == setTag) {
  521. return setToPairs(object);
  522. }
  523. return baseToPairs(object, keysFunc(object));
  524. };
  525. }
  526. /**
  527. * Gets the native function at `key` of `object`.
  528. *
  529. * @private
  530. * @param {Object} object The object to query.
  531. * @param {string} key The key of the method to get.
  532. * @returns {*} Returns the function if it's native, else `undefined`.
  533. */
  534. function getNative(object, key) {
  535. var value = getValue(object, key);
  536. return baseIsNative(value) ? value : undefined;
  537. }
  538. /**
  539. * Gets the `toStringTag` of `value`.
  540. *
  541. * @private
  542. * @param {*} value The value to query.
  543. * @returns {string} Returns the `toStringTag`.
  544. */
  545. var getTag = baseGetTag;
  546. // Fallback for data views, maps, sets, and weak maps in IE 11,
  547. // for data views in Edge < 14, and promises in Node.js.
  548. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  549. (Map && getTag(new Map) != mapTag) ||
  550. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  551. (Set && getTag(new Set) != setTag) ||
  552. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  553. getTag = function(value) {
  554. var result = objectToString.call(value),
  555. Ctor = result == objectTag ? value.constructor : undefined,
  556. ctorString = Ctor ? toSource(Ctor) : undefined;
  557. if (ctorString) {
  558. switch (ctorString) {
  559. case dataViewCtorString: return dataViewTag;
  560. case mapCtorString: return mapTag;
  561. case promiseCtorString: return promiseTag;
  562. case setCtorString: return setTag;
  563. case weakMapCtorString: return weakMapTag;
  564. }
  565. }
  566. return result;
  567. };
  568. }
  569. /**
  570. * Checks if `value` is a valid array-like index.
  571. *
  572. * @private
  573. * @param {*} value The value to check.
  574. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  575. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  576. */
  577. function isIndex(value, length) {
  578. length = length == null ? MAX_SAFE_INTEGER : length;
  579. return !!length &&
  580. (typeof value == 'number' || reIsUint.test(value)) &&
  581. (value > -1 && value % 1 == 0 && value < length);
  582. }
  583. /**
  584. * Checks if `func` has its source masked.
  585. *
  586. * @private
  587. * @param {Function} func The function to check.
  588. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  589. */
  590. function isMasked(func) {
  591. return !!maskSrcKey && (maskSrcKey in func);
  592. }
  593. /**
  594. * Checks if `value` is likely a prototype object.
  595. *
  596. * @private
  597. * @param {*} value The value to check.
  598. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  599. */
  600. function isPrototype(value) {
  601. var Ctor = value && value.constructor,
  602. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  603. return value === proto;
  604. }
  605. /**
  606. * Converts `func` to its source code.
  607. *
  608. * @private
  609. * @param {Function} func The function to process.
  610. * @returns {string} Returns the source code.
  611. */
  612. function toSource(func) {
  613. if (func != null) {
  614. try {
  615. return funcToString.call(func);
  616. } catch (e) {}
  617. try {
  618. return (func + '');
  619. } catch (e) {}
  620. }
  621. return '';
  622. }
  623. /**
  624. * Checks if `value` is likely an `arguments` object.
  625. *
  626. * @static
  627. * @memberOf _
  628. * @since 0.1.0
  629. * @category Lang
  630. * @param {*} value The value to check.
  631. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  632. * else `false`.
  633. * @example
  634. *
  635. * _.isArguments(function() { return arguments; }());
  636. * // => true
  637. *
  638. * _.isArguments([1, 2, 3]);
  639. * // => false
  640. */
  641. function isArguments(value) {
  642. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  643. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  644. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  645. }
  646. /**
  647. * Checks if `value` is classified as an `Array` object.
  648. *
  649. * @static
  650. * @memberOf _
  651. * @since 0.1.0
  652. * @category Lang
  653. * @param {*} value The value to check.
  654. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  655. * @example
  656. *
  657. * _.isArray([1, 2, 3]);
  658. * // => true
  659. *
  660. * _.isArray(document.body.children);
  661. * // => false
  662. *
  663. * _.isArray('abc');
  664. * // => false
  665. *
  666. * _.isArray(_.noop);
  667. * // => false
  668. */
  669. var isArray = Array.isArray;
  670. /**
  671. * Checks if `value` is array-like. A value is considered array-like if it's
  672. * not a function and has a `value.length` that's an integer greater than or
  673. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  674. *
  675. * @static
  676. * @memberOf _
  677. * @since 4.0.0
  678. * @category Lang
  679. * @param {*} value The value to check.
  680. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  681. * @example
  682. *
  683. * _.isArrayLike([1, 2, 3]);
  684. * // => true
  685. *
  686. * _.isArrayLike(document.body.children);
  687. * // => true
  688. *
  689. * _.isArrayLike('abc');
  690. * // => true
  691. *
  692. * _.isArrayLike(_.noop);
  693. * // => false
  694. */
  695. function isArrayLike(value) {
  696. return value != null && isLength(value.length) && !isFunction(value);
  697. }
  698. /**
  699. * This method is like `_.isArrayLike` except that it also checks if `value`
  700. * is an object.
  701. *
  702. * @static
  703. * @memberOf _
  704. * @since 4.0.0
  705. * @category Lang
  706. * @param {*} value The value to check.
  707. * @returns {boolean} Returns `true` if `value` is an array-like object,
  708. * else `false`.
  709. * @example
  710. *
  711. * _.isArrayLikeObject([1, 2, 3]);
  712. * // => true
  713. *
  714. * _.isArrayLikeObject(document.body.children);
  715. * // => true
  716. *
  717. * _.isArrayLikeObject('abc');
  718. * // => false
  719. *
  720. * _.isArrayLikeObject(_.noop);
  721. * // => false
  722. */
  723. function isArrayLikeObject(value) {
  724. return isObjectLike(value) && isArrayLike(value);
  725. }
  726. /**
  727. * Checks if `value` is classified as a `Function` object.
  728. *
  729. * @static
  730. * @memberOf _
  731. * @since 0.1.0
  732. * @category Lang
  733. * @param {*} value The value to check.
  734. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  735. * @example
  736. *
  737. * _.isFunction(_);
  738. * // => true
  739. *
  740. * _.isFunction(/abc/);
  741. * // => false
  742. */
  743. function isFunction(value) {
  744. // The use of `Object#toString` avoids issues with the `typeof` operator
  745. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  746. var tag = isObject(value) ? objectToString.call(value) : '';
  747. return tag == funcTag || tag == genTag;
  748. }
  749. /**
  750. * Checks if `value` is a valid array-like length.
  751. *
  752. * **Note:** This method is loosely based on
  753. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  754. *
  755. * @static
  756. * @memberOf _
  757. * @since 4.0.0
  758. * @category Lang
  759. * @param {*} value The value to check.
  760. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  761. * @example
  762. *
  763. * _.isLength(3);
  764. * // => true
  765. *
  766. * _.isLength(Number.MIN_VALUE);
  767. * // => false
  768. *
  769. * _.isLength(Infinity);
  770. * // => false
  771. *
  772. * _.isLength('3');
  773. * // => false
  774. */
  775. function isLength(value) {
  776. return typeof value == 'number' &&
  777. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  778. }
  779. /**
  780. * Checks if `value` is the
  781. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  782. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  783. *
  784. * @static
  785. * @memberOf _
  786. * @since 0.1.0
  787. * @category Lang
  788. * @param {*} value The value to check.
  789. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  790. * @example
  791. *
  792. * _.isObject({});
  793. * // => true
  794. *
  795. * _.isObject([1, 2, 3]);
  796. * // => true
  797. *
  798. * _.isObject(_.noop);
  799. * // => true
  800. *
  801. * _.isObject(null);
  802. * // => false
  803. */
  804. function isObject(value) {
  805. var type = typeof value;
  806. return !!value && (type == 'object' || type == 'function');
  807. }
  808. /**
  809. * Checks if `value` is object-like. A value is object-like if it's not `null`
  810. * and has a `typeof` result of "object".
  811. *
  812. * @static
  813. * @memberOf _
  814. * @since 4.0.0
  815. * @category Lang
  816. * @param {*} value The value to check.
  817. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  818. * @example
  819. *
  820. * _.isObjectLike({});
  821. * // => true
  822. *
  823. * _.isObjectLike([1, 2, 3]);
  824. * // => true
  825. *
  826. * _.isObjectLike(_.noop);
  827. * // => false
  828. *
  829. * _.isObjectLike(null);
  830. * // => false
  831. */
  832. function isObjectLike(value) {
  833. return !!value && typeof value == 'object';
  834. }
  835. /**
  836. * Creates an array of the own enumerable property names of `object`.
  837. *
  838. * **Note:** Non-object values are coerced to objects. See the
  839. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  840. * for more details.
  841. *
  842. * @static
  843. * @since 0.1.0
  844. * @memberOf _
  845. * @category Object
  846. * @param {Object} object The object to query.
  847. * @returns {Array} Returns the array of property names.
  848. * @example
  849. *
  850. * function Foo() {
  851. * this.a = 1;
  852. * this.b = 2;
  853. * }
  854. *
  855. * Foo.prototype.c = 3;
  856. *
  857. * _.keys(new Foo);
  858. * // => ['a', 'b'] (iteration order is not guaranteed)
  859. *
  860. * _.keys('hi');
  861. * // => ['0', '1']
  862. */
  863. function keys(object) {
  864. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  865. }
  866. /**
  867. * Creates an array of own enumerable string keyed-value pairs for `object`
  868. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  869. * entries are returned.
  870. *
  871. * @static
  872. * @memberOf _
  873. * @since 4.0.0
  874. * @alias entries
  875. * @category Object
  876. * @param {Object} object The object to query.
  877. * @returns {Array} Returns the key-value pairs.
  878. * @example
  879. *
  880. * function Foo() {
  881. * this.a = 1;
  882. * this.b = 2;
  883. * }
  884. *
  885. * Foo.prototype.c = 3;
  886. *
  887. * _.toPairs(new Foo);
  888. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  889. */
  890. var toPairs = createToPairs(keys);
  891. module.exports = toPairs;
  892. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3)))
  893. /***/ }),
  894. /* 9 */
  895. /***/ (function(module, exports) {
  896. module.exports = function(){try{return echarts}catch(e){return {}}}();
  897. /***/ }),
  898. /* 10 */
  899. /***/ (function(module, exports) {
  900. module.exports = function(){try{return canvg}catch(e){return {}}}();
  901. /***/ }),
  902. /* 11 */
  903. /***/ (function(module, exports, __webpack_require__) {
  904. __webpack_require__(18);
  905. module.exports = __webpack_require__(17);
  906. /***/ }),
  907. /* 12 */
  908. /***/ (function(module, exports, __webpack_require__) {
  909. /* WEBPACK VAR INJECTION */(function(setImmediate, global) {(function (global, factory) {
  910. true ? factory() :
  911. undefined;
  912. }(this, (function () { 'use strict';
  913. /**
  914. * @this {Promise}
  915. */
  916. function finallyConstructor(callback) {
  917. var constructor = this.constructor;
  918. return this.then(
  919. function(value) {
  920. // @ts-ignore
  921. return constructor.resolve(callback()).then(function() {
  922. return value;
  923. });
  924. },
  925. function(reason) {
  926. // @ts-ignore
  927. return constructor.resolve(callback()).then(function() {
  928. // @ts-ignore
  929. return constructor.reject(reason);
  930. });
  931. }
  932. );
  933. }
  934. // Store setTimeout reference so promise-polyfill will be unaffected by
  935. // other code modifying setTimeout (like sinon.useFakeTimers())
  936. var setTimeoutFunc = setTimeout;
  937. function isArray(x) {
  938. return Boolean(x && typeof x.length !== 'undefined');
  939. }
  940. function noop() {}
  941. // Polyfill for Function.prototype.bind
  942. function bind(fn, thisArg) {
  943. return function() {
  944. fn.apply(thisArg, arguments);
  945. };
  946. }
  947. /**
  948. * @constructor
  949. * @param {Function} fn
  950. */
  951. function Promise(fn) {
  952. if (!(this instanceof Promise))
  953. throw new TypeError('Promises must be constructed via new');
  954. if (typeof fn !== 'function') throw new TypeError('not a function');
  955. /** @type {!number} */
  956. this._state = 0;
  957. /** @type {!boolean} */
  958. this._handled = false;
  959. /** @type {Promise|undefined} */
  960. this._value = undefined;
  961. /** @type {!Array<!Function>} */
  962. this._deferreds = [];
  963. doResolve(fn, this);
  964. }
  965. function handle(self, deferred) {
  966. while (self._state === 3) {
  967. self = self._value;
  968. }
  969. if (self._state === 0) {
  970. self._deferreds.push(deferred);
  971. return;
  972. }
  973. self._handled = true;
  974. Promise._immediateFn(function() {
  975. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  976. if (cb === null) {
  977. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  978. return;
  979. }
  980. var ret;
  981. try {
  982. ret = cb(self._value);
  983. } catch (e) {
  984. reject(deferred.promise, e);
  985. return;
  986. }
  987. resolve(deferred.promise, ret);
  988. });
  989. }
  990. function resolve(self, newValue) {
  991. try {
  992. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  993. if (newValue === self)
  994. throw new TypeError('A promise cannot be resolved with itself.');
  995. if (
  996. newValue &&
  997. (typeof newValue === 'object' || typeof newValue === 'function')
  998. ) {
  999. var then = newValue.then;
  1000. if (newValue instanceof Promise) {
  1001. self._state = 3;
  1002. self._value = newValue;
  1003. finale(self);
  1004. return;
  1005. } else if (typeof then === 'function') {
  1006. doResolve(bind(then, newValue), self);
  1007. return;
  1008. }
  1009. }
  1010. self._state = 1;
  1011. self._value = newValue;
  1012. finale(self);
  1013. } catch (e) {
  1014. reject(self, e);
  1015. }
  1016. }
  1017. function reject(self, newValue) {
  1018. self._state = 2;
  1019. self._value = newValue;
  1020. finale(self);
  1021. }
  1022. function finale(self) {
  1023. if (self._state === 2 && self._deferreds.length === 0) {
  1024. Promise._immediateFn(function() {
  1025. if (!self._handled) {
  1026. Promise._unhandledRejectionFn(self._value);
  1027. }
  1028. });
  1029. }
  1030. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  1031. handle(self, self._deferreds[i]);
  1032. }
  1033. self._deferreds = null;
  1034. }
  1035. /**
  1036. * @constructor
  1037. */
  1038. function Handler(onFulfilled, onRejected, promise) {
  1039. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  1040. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  1041. this.promise = promise;
  1042. }
  1043. /**
  1044. * Take a potentially misbehaving resolver function and make sure
  1045. * onFulfilled and onRejected are only called once.
  1046. *
  1047. * Makes no guarantees about asynchrony.
  1048. */
  1049. function doResolve(fn, self) {
  1050. var done = false;
  1051. try {
  1052. fn(
  1053. function(value) {
  1054. if (done) return;
  1055. done = true;
  1056. resolve(self, value);
  1057. },
  1058. function(reason) {
  1059. if (done) return;
  1060. done = true;
  1061. reject(self, reason);
  1062. }
  1063. );
  1064. } catch (ex) {
  1065. if (done) return;
  1066. done = true;
  1067. reject(self, ex);
  1068. }
  1069. }
  1070. Promise.prototype['catch'] = function(onRejected) {
  1071. return this.then(null, onRejected);
  1072. };
  1073. Promise.prototype.then = function(onFulfilled, onRejected) {
  1074. // @ts-ignore
  1075. var prom = new this.constructor(noop);
  1076. handle(this, new Handler(onFulfilled, onRejected, prom));
  1077. return prom;
  1078. };
  1079. Promise.prototype['finally'] = finallyConstructor;
  1080. Promise.all = function(arr) {
  1081. return new Promise(function(resolve, reject) {
  1082. if (!isArray(arr)) {
  1083. return reject(new TypeError('Promise.all accepts an array'));
  1084. }
  1085. var args = Array.prototype.slice.call(arr);
  1086. if (args.length === 0) return resolve([]);
  1087. var remaining = args.length;
  1088. function res(i, val) {
  1089. try {
  1090. if (val && (typeof val === 'object' || typeof val === 'function')) {
  1091. var then = val.then;
  1092. if (typeof then === 'function') {
  1093. then.call(
  1094. val,
  1095. function(val) {
  1096. res(i, val);
  1097. },
  1098. reject
  1099. );
  1100. return;
  1101. }
  1102. }
  1103. args[i] = val;
  1104. if (--remaining === 0) {
  1105. resolve(args);
  1106. }
  1107. } catch (ex) {
  1108. reject(ex);
  1109. }
  1110. }
  1111. for (var i = 0; i < args.length; i++) {
  1112. res(i, args[i]);
  1113. }
  1114. });
  1115. };
  1116. Promise.resolve = function(value) {
  1117. if (value && typeof value === 'object' && value.constructor === Promise) {
  1118. return value;
  1119. }
  1120. return new Promise(function(resolve) {
  1121. resolve(value);
  1122. });
  1123. };
  1124. Promise.reject = function(value) {
  1125. return new Promise(function(resolve, reject) {
  1126. reject(value);
  1127. });
  1128. };
  1129. Promise.race = function(arr) {
  1130. return new Promise(function(resolve, reject) {
  1131. if (!isArray(arr)) {
  1132. return reject(new TypeError('Promise.race accepts an array'));
  1133. }
  1134. for (var i = 0, len = arr.length; i < len; i++) {
  1135. Promise.resolve(arr[i]).then(resolve, reject);
  1136. }
  1137. });
  1138. };
  1139. // Use polyfill for setImmediate for performance gains
  1140. Promise._immediateFn =
  1141. // @ts-ignore
  1142. (typeof setImmediate === 'function' &&
  1143. function(fn) {
  1144. // @ts-ignore
  1145. setImmediate(fn);
  1146. }) ||
  1147. function(fn) {
  1148. setTimeoutFunc(fn, 0);
  1149. };
  1150. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  1151. if (typeof console !== 'undefined' && console) {
  1152. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  1153. }
  1154. };
  1155. /** @suppress {undefinedVars} */
  1156. var globalNS = (function() {
  1157. // the only reliable means to get the global object is
  1158. // `Function('return this')()`
  1159. // However, this causes CSP violations in Chrome apps.
  1160. if (typeof self !== 'undefined') {
  1161. return self;
  1162. }
  1163. if (typeof window !== 'undefined') {
  1164. return window;
  1165. }
  1166. if (typeof global !== 'undefined') {
  1167. return global;
  1168. }
  1169. throw new Error('unable to locate global object');
  1170. })();
  1171. if (!('Promise' in globalNS)) {
  1172. globalNS['Promise'] = Promise;
  1173. } else if (!globalNS.Promise.prototype['finally']) {
  1174. globalNS.Promise.prototype['finally'] = finallyConstructor;
  1175. }
  1176. })));
  1177. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13).setImmediate, __webpack_require__(3)))
  1178. /***/ }),
  1179. /* 13 */
  1180. /***/ (function(module, exports, __webpack_require__) {
  1181. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  1182. (typeof self !== "undefined" && self) ||
  1183. window;
  1184. var apply = Function.prototype.apply;
  1185. // DOM APIs, for completeness
  1186. exports.setTimeout = function() {
  1187. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  1188. };
  1189. exports.setInterval = function() {
  1190. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  1191. };
  1192. exports.clearTimeout =
  1193. exports.clearInterval = function(timeout) {
  1194. if (timeout) {
  1195. timeout.close();
  1196. }
  1197. };
  1198. function Timeout(id, clearFn) {
  1199. this._id = id;
  1200. this._clearFn = clearFn;
  1201. }
  1202. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  1203. Timeout.prototype.close = function() {
  1204. this._clearFn.call(scope, this._id);
  1205. };
  1206. // Does not start the time, just sets up the members needed.
  1207. exports.enroll = function(item, msecs) {
  1208. clearTimeout(item._idleTimeoutId);
  1209. item._idleTimeout = msecs;
  1210. };
  1211. exports.unenroll = function(item) {
  1212. clearTimeout(item._idleTimeoutId);
  1213. item._idleTimeout = -1;
  1214. };
  1215. exports._unrefActive = exports.active = function(item) {
  1216. clearTimeout(item._idleTimeoutId);
  1217. var msecs = item._idleTimeout;
  1218. if (msecs >= 0) {
  1219. item._idleTimeoutId = setTimeout(function onTimeout() {
  1220. if (item._onTimeout)
  1221. item._onTimeout();
  1222. }, msecs);
  1223. }
  1224. };
  1225. // setimmediate attaches itself to the global object
  1226. __webpack_require__(14);
  1227. // On some exotic environments, it's not clear which object `setimmediate` was
  1228. // able to install onto. Search each possibility in the same order as the
  1229. // `setimmediate` library.
  1230. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  1231. (typeof global !== "undefined" && global.setImmediate) ||
  1232. (this && this.setImmediate);
  1233. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  1234. (typeof global !== "undefined" && global.clearImmediate) ||
  1235. (this && this.clearImmediate);
  1236. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3)))
  1237. /***/ }),
  1238. /* 14 */
  1239. /***/ (function(module, exports, __webpack_require__) {
  1240. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  1241. "use strict";
  1242. if (global.setImmediate) {
  1243. return;
  1244. }
  1245. var nextHandle = 1; // Spec says greater than zero
  1246. var tasksByHandle = {};
  1247. var currentlyRunningATask = false;
  1248. var doc = global.document;
  1249. var registerImmediate;
  1250. function setImmediate(callback) {
  1251. // Callback can either be a function or a string
  1252. if (typeof callback !== "function") {
  1253. callback = new Function("" + callback);
  1254. }
  1255. // Copy function arguments
  1256. var args = new Array(arguments.length - 1);
  1257. for (var i = 0; i < args.length; i++) {
  1258. args[i] = arguments[i + 1];
  1259. }
  1260. // Store and register the task
  1261. var task = { callback: callback, args: args };
  1262. tasksByHandle[nextHandle] = task;
  1263. registerImmediate(nextHandle);
  1264. return nextHandle++;
  1265. }
  1266. function clearImmediate(handle) {
  1267. delete tasksByHandle[handle];
  1268. }
  1269. function run(task) {
  1270. var callback = task.callback;
  1271. var args = task.args;
  1272. switch (args.length) {
  1273. case 0:
  1274. callback();
  1275. break;
  1276. case 1:
  1277. callback(args[0]);
  1278. break;
  1279. case 2:
  1280. callback(args[0], args[1]);
  1281. break;
  1282. case 3:
  1283. callback(args[0], args[1], args[2]);
  1284. break;
  1285. default:
  1286. callback.apply(undefined, args);
  1287. break;
  1288. }
  1289. }
  1290. function runIfPresent(handle) {
  1291. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  1292. // So if we're currently running a task, we'll need to delay this invocation.
  1293. if (currentlyRunningATask) {
  1294. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  1295. // "too much recursion" error.
  1296. setTimeout(runIfPresent, 0, handle);
  1297. } else {
  1298. var task = tasksByHandle[handle];
  1299. if (task) {
  1300. currentlyRunningATask = true;
  1301. try {
  1302. run(task);
  1303. } finally {
  1304. clearImmediate(handle);
  1305. currentlyRunningATask = false;
  1306. }
  1307. }
  1308. }
  1309. }
  1310. function installNextTickImplementation() {
  1311. registerImmediate = function(handle) {
  1312. process.nextTick(function () { runIfPresent(handle); });
  1313. };
  1314. }
  1315. function canUsePostMessage() {
  1316. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  1317. // where `global.postMessage` means something completely different and can't be used for this purpose.
  1318. if (global.postMessage && !global.importScripts) {
  1319. var postMessageIsAsynchronous = true;
  1320. var oldOnMessage = global.onmessage;
  1321. global.onmessage = function() {
  1322. postMessageIsAsynchronous = false;
  1323. };
  1324. global.postMessage("", "*");
  1325. global.onmessage = oldOnMessage;
  1326. return postMessageIsAsynchronous;
  1327. }
  1328. }
  1329. function installPostMessageImplementation() {
  1330. // Installs an event handler on `global` for the `message` event: see
  1331. // * https://developer.mozilla.org/en/DOM/window.postMessage
  1332. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  1333. var messagePrefix = "setImmediate$" + Math.random() + "$";
  1334. var onGlobalMessage = function(event) {
  1335. if (event.source === global &&
  1336. typeof event.data === "string" &&
  1337. event.data.indexOf(messagePrefix) === 0) {
  1338. runIfPresent(+event.data.slice(messagePrefix.length));
  1339. }
  1340. };
  1341. if (global.addEventListener) {
  1342. global.addEventListener("message", onGlobalMessage, false);
  1343. } else {
  1344. global.attachEvent("onmessage", onGlobalMessage);
  1345. }
  1346. registerImmediate = function(handle) {
  1347. global.postMessage(messagePrefix + handle, "*");
  1348. };
  1349. }
  1350. function installMessageChannelImplementation() {
  1351. var channel = new MessageChannel();
  1352. channel.port1.onmessage = function(event) {
  1353. var handle = event.data;
  1354. runIfPresent(handle);
  1355. };
  1356. registerImmediate = function(handle) {
  1357. channel.port2.postMessage(handle);
  1358. };
  1359. }
  1360. function installReadyStateChangeImplementation() {
  1361. var html = doc.documentElement;
  1362. registerImmediate = function(handle) {
  1363. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  1364. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  1365. var script = doc.createElement("script");
  1366. script.onreadystatechange = function () {
  1367. runIfPresent(handle);
  1368. script.onreadystatechange = null;
  1369. html.removeChild(script);
  1370. script = null;
  1371. };
  1372. html.appendChild(script);
  1373. };
  1374. }
  1375. function installSetTimeoutImplementation() {
  1376. registerImmediate = function(handle) {
  1377. setTimeout(runIfPresent, 0, handle);
  1378. };
  1379. }
  1380. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  1381. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  1382. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  1383. // Don't get fooled by e.g. browserify environments.
  1384. if ({}.toString.call(global.process) === "[object process]") {
  1385. // For Node.js before 0.9
  1386. installNextTickImplementation();
  1387. } else if (canUsePostMessage()) {
  1388. // For non-IE10 modern browsers
  1389. installPostMessageImplementation();
  1390. } else if (global.MessageChannel) {
  1391. // For web workers, where supported
  1392. installMessageChannelImplementation();
  1393. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  1394. // For IE 6–8
  1395. installReadyStateChangeImplementation();
  1396. } else {
  1397. // For older browsers
  1398. installSetTimeoutImplementation();
  1399. }
  1400. attachTo.setImmediate = setImmediate;
  1401. attachTo.clearImmediate = clearImmediate;
  1402. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  1403. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3), __webpack_require__(15)))
  1404. /***/ }),
  1405. /* 15 */
  1406. /***/ (function(module, exports) {
  1407. // shim for using process in browser
  1408. var process = module.exports = {};
  1409. // cached from whatever global is present so that test runners that stub it
  1410. // don't break things. But we need to wrap it in a try catch in case it is
  1411. // wrapped in strict mode code which doesn't define any globals. It's inside a
  1412. // function because try/catches deoptimize in certain engines.
  1413. var cachedSetTimeout;
  1414. var cachedClearTimeout;
  1415. function defaultSetTimout() {
  1416. throw new Error('setTimeout has not been defined');
  1417. }
  1418. function defaultClearTimeout () {
  1419. throw new Error('clearTimeout has not been defined');
  1420. }
  1421. (function () {
  1422. try {
  1423. if (typeof setTimeout === 'function') {
  1424. cachedSetTimeout = setTimeout;
  1425. } else {
  1426. cachedSetTimeout = defaultSetTimout;
  1427. }
  1428. } catch (e) {
  1429. cachedSetTimeout = defaultSetTimout;
  1430. }
  1431. try {
  1432. if (typeof clearTimeout === 'function') {
  1433. cachedClearTimeout = clearTimeout;
  1434. } else {
  1435. cachedClearTimeout = defaultClearTimeout;
  1436. }
  1437. } catch (e) {
  1438. cachedClearTimeout = defaultClearTimeout;
  1439. }
  1440. } ())
  1441. function runTimeout(fun) {
  1442. if (cachedSetTimeout === setTimeout) {
  1443. //normal enviroments in sane situations
  1444. return setTimeout(fun, 0);
  1445. }
  1446. // if setTimeout wasn't available but was latter defined
  1447. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  1448. cachedSetTimeout = setTimeout;
  1449. return setTimeout(fun, 0);
  1450. }
  1451. try {
  1452. // when when somebody has screwed with setTimeout but no I.E. maddness
  1453. return cachedSetTimeout(fun, 0);
  1454. } catch(e){
  1455. try {
  1456. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1457. return cachedSetTimeout.call(null, fun, 0);
  1458. } catch(e){
  1459. // 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
  1460. return cachedSetTimeout.call(this, fun, 0);
  1461. }
  1462. }
  1463. }
  1464. function runClearTimeout(marker) {
  1465. if (cachedClearTimeout === clearTimeout) {
  1466. //normal enviroments in sane situations
  1467. return clearTimeout(marker);
  1468. }
  1469. // if clearTimeout wasn't available but was latter defined
  1470. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  1471. cachedClearTimeout = clearTimeout;
  1472. return clearTimeout(marker);
  1473. }
  1474. try {
  1475. // when when somebody has screwed with setTimeout but no I.E. maddness
  1476. return cachedClearTimeout(marker);
  1477. } catch (e){
  1478. try {
  1479. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1480. return cachedClearTimeout.call(null, marker);
  1481. } catch (e){
  1482. // 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.
  1483. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  1484. return cachedClearTimeout.call(this, marker);
  1485. }
  1486. }
  1487. }
  1488. var queue = [];
  1489. var draining = false;
  1490. var currentQueue;
  1491. var queueIndex = -1;
  1492. function cleanUpNextTick() {
  1493. if (!draining || !currentQueue) {
  1494. return;
  1495. }
  1496. draining = false;
  1497. if (currentQueue.length) {
  1498. queue = currentQueue.concat(queue);
  1499. } else {
  1500. queueIndex = -1;
  1501. }
  1502. if (queue.length) {
  1503. drainQueue();
  1504. }
  1505. }
  1506. function drainQueue() {
  1507. if (draining) {
  1508. return;
  1509. }
  1510. var timeout = runTimeout(cleanUpNextTick);
  1511. draining = true;
  1512. var len = queue.length;
  1513. while(len) {
  1514. currentQueue = queue;
  1515. queue = [];
  1516. while (++queueIndex < len) {
  1517. if (currentQueue) {
  1518. currentQueue[queueIndex].run();
  1519. }
  1520. }
  1521. queueIndex = -1;
  1522. len = queue.length;
  1523. }
  1524. currentQueue = null;
  1525. draining = false;
  1526. runClearTimeout(timeout);
  1527. }
  1528. process.nextTick = function (fun) {
  1529. var args = new Array(arguments.length - 1);
  1530. if (arguments.length > 1) {
  1531. for (var i = 1; i < arguments.length; i++) {
  1532. args[i - 1] = arguments[i];
  1533. }
  1534. }
  1535. queue.push(new Item(fun, args));
  1536. if (queue.length === 1 && !draining) {
  1537. runTimeout(drainQueue);
  1538. }
  1539. };
  1540. // v8 likes predictible objects
  1541. function Item(fun, array) {
  1542. this.fun = fun;
  1543. this.array = array;
  1544. }
  1545. Item.prototype.run = function () {
  1546. this.fun.apply(null, this.array);
  1547. };
  1548. process.title = 'browser';
  1549. process.browser = true;
  1550. process.env = {};
  1551. process.argv = [];
  1552. process.version = ''; // empty string to avoid regexp issues
  1553. process.versions = {};
  1554. function noop() {}
  1555. process.on = noop;
  1556. process.addListener = noop;
  1557. process.once = noop;
  1558. process.off = noop;
  1559. process.removeListener = noop;
  1560. process.removeAllListeners = noop;
  1561. process.emit = noop;
  1562. process.prependListener = noop;
  1563. process.prependOnceListener = noop;
  1564. process.listeners = function (name) { return [] }
  1565. process.binding = function (name) {
  1566. throw new Error('process.binding is not supported');
  1567. };
  1568. process.cwd = function () { return '/' };
  1569. process.chdir = function (dir) {
  1570. throw new Error('process.chdir is not supported');
  1571. };
  1572. process.umask = function() { return 0; };
  1573. /***/ }),
  1574. /* 16 */
  1575. /***/ (function(module, exports, __webpack_require__) {
  1576. (function(self) {
  1577. 'use strict';
  1578. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  1579. // with Ajax.
  1580. if (!self.__disableNativeFetch && self.fetch) {
  1581. return
  1582. }
  1583. function normalizeName(name) {
  1584. if (typeof name !== 'string') {
  1585. name = String(name)
  1586. }
  1587. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  1588. throw new TypeError('Invalid character in header field name')
  1589. }
  1590. return name.toLowerCase()
  1591. }
  1592. function normalizeValue(value) {
  1593. if (typeof value !== 'string') {
  1594. value = String(value)
  1595. }
  1596. return value
  1597. }
  1598. function Headers(headers) {
  1599. this.map = {}
  1600. if (headers instanceof Headers) {
  1601. headers.forEach(function(value, name) {
  1602. this.append(name, value)
  1603. }, this)
  1604. } else if (headers) {
  1605. Object.getOwnPropertyNames(headers).forEach(function(name) {
  1606. this.append(name, headers[name])
  1607. }, this)
  1608. }
  1609. }
  1610. Headers.prototype.append = function(name, value) {
  1611. name = normalizeName(name)
  1612. value = normalizeValue(value)
  1613. var list = this.map[name]
  1614. if (!list) {
  1615. list = []
  1616. this.map[name] = list
  1617. }
  1618. list.push(value)
  1619. }
  1620. Headers.prototype['delete'] = function(name) {
  1621. delete this.map[normalizeName(name)]
  1622. }
  1623. Headers.prototype.get = function(name) {
  1624. var values = this.map[normalizeName(name)]
  1625. return values ? values[0] : null
  1626. }
  1627. Headers.prototype.getAll = function(name) {
  1628. return this.map[normalizeName(name)] || []
  1629. }
  1630. Headers.prototype.has = function(name) {
  1631. return this.map.hasOwnProperty(normalizeName(name))
  1632. }
  1633. Headers.prototype.set = function(name, value) {
  1634. this.map[normalizeName(name)] = [normalizeValue(value)]
  1635. }
  1636. Headers.prototype.forEach = function(callback, thisArg) {
  1637. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  1638. this.map[name].forEach(function(value) {
  1639. callback.call(thisArg, value, name, this)
  1640. }, this)
  1641. }, this)
  1642. }
  1643. function consumed(body) {
  1644. if (body.bodyUsed) {
  1645. return Promise.reject(new TypeError('Already read'))
  1646. }
  1647. body.bodyUsed = true
  1648. }
  1649. function fileReaderReady(reader) {
  1650. return new Promise(function(resolve, reject) {
  1651. reader.onload = function() {
  1652. resolve(reader.result)
  1653. }
  1654. reader.onerror = function() {
  1655. reject(reader.error)
  1656. }
  1657. })
  1658. }
  1659. function readBlobAsArrayBuffer(blob) {
  1660. var reader = new FileReader()
  1661. reader.readAsArrayBuffer(blob)
  1662. return fileReaderReady(reader)
  1663. }
  1664. function readBlobAsText(blob, options) {
  1665. var reader = new FileReader()
  1666. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  1667. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  1668. var _charset = blob.type.match(regex) || contentType.match(regex)
  1669. var args = [blob]
  1670. if(_charset) {
  1671. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  1672. }
  1673. reader.readAsText.apply(reader, args)
  1674. return fileReaderReady(reader)
  1675. }
  1676. var support = {
  1677. blob: 'FileReader' in self && 'Blob' in self && (function() {
  1678. try {
  1679. new Blob();
  1680. return true
  1681. } catch(e) {
  1682. return false
  1683. }
  1684. })(),
  1685. formData: 'FormData' in self,
  1686. arrayBuffer: 'ArrayBuffer' in self
  1687. }
  1688. function Body() {
  1689. this.bodyUsed = false
  1690. this._initBody = function(body, options) {
  1691. this._bodyInit = body
  1692. if (typeof body === 'string') {
  1693. this._bodyText = body
  1694. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  1695. this._bodyBlob = body
  1696. this._options = options
  1697. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  1698. this._bodyFormData = body
  1699. } else if (!body) {
  1700. this._bodyText = ''
  1701. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  1702. // Only support ArrayBuffers for POST method.
  1703. // Receiving ArrayBuffers happens via Blobs, instead.
  1704. } else {
  1705. throw new Error('unsupported BodyInit type')
  1706. }
  1707. }
  1708. if (support.blob) {
  1709. this.blob = function() {
  1710. var rejected = consumed(this)
  1711. if (rejected) {
  1712. return rejected
  1713. }
  1714. if (this._bodyBlob) {
  1715. return Promise.resolve(this._bodyBlob)
  1716. } else if (this._bodyFormData) {
  1717. throw new Error('could not read FormData body as blob')
  1718. } else {
  1719. return Promise.resolve(new Blob([this._bodyText]))
  1720. }
  1721. }
  1722. this.arrayBuffer = function() {
  1723. return this.blob().then(readBlobAsArrayBuffer)
  1724. }
  1725. this.text = function() {
  1726. var rejected = consumed(this)
  1727. if (rejected) {
  1728. return rejected
  1729. }
  1730. if (this._bodyBlob) {
  1731. return readBlobAsText(this._bodyBlob, this._options)
  1732. } else if (this._bodyFormData) {
  1733. throw new Error('could not read FormData body as text')
  1734. } else {
  1735. return Promise.resolve(this._bodyText)
  1736. }
  1737. }
  1738. } else {
  1739. this.text = function() {
  1740. var rejected = consumed(this)
  1741. return rejected ? rejected : Promise.resolve(this._bodyText)
  1742. }
  1743. }
  1744. if (support.formData) {
  1745. this.formData = function() {
  1746. return this.text().then(decode)
  1747. }
  1748. }
  1749. this.json = function() {
  1750. return this.text().then(JSON.parse)
  1751. }
  1752. return this
  1753. }
  1754. // HTTP methods whose capitalization should be normalized
  1755. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  1756. function normalizeMethod(method) {
  1757. var upcased = method.toUpperCase()
  1758. return (methods.indexOf(upcased) > -1) ? upcased : method
  1759. }
  1760. function Request(input, options) {
  1761. options = options || {}
  1762. var body = options.body
  1763. if (Request.prototype.isPrototypeOf(input)) {
  1764. if (input.bodyUsed) {
  1765. throw new TypeError('Already read')
  1766. }
  1767. this.url = input.url
  1768. this.credentials = input.credentials
  1769. if (!options.headers) {
  1770. this.headers = new Headers(input.headers)
  1771. }
  1772. this.method = input.method
  1773. this.mode = input.mode
  1774. if (!body) {
  1775. body = input._bodyInit
  1776. input.bodyUsed = true
  1777. }
  1778. } else {
  1779. this.url = input
  1780. }
  1781. this.credentials = options.credentials || this.credentials || 'omit'
  1782. if (options.headers || !this.headers) {
  1783. this.headers = new Headers(options.headers)
  1784. }
  1785. this.method = normalizeMethod(options.method || this.method || 'GET')
  1786. this.mode = options.mode || this.mode || null
  1787. this.referrer = null
  1788. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  1789. throw new TypeError('Body not allowed for GET or HEAD requests')
  1790. }
  1791. this._initBody(body, options)
  1792. }
  1793. Request.prototype.clone = function() {
  1794. return new Request(this)
  1795. }
  1796. function decode(body) {
  1797. var form = new FormData()
  1798. body.trim().split('&').forEach(function(bytes) {
  1799. if (bytes) {
  1800. var split = bytes.split('=')
  1801. var name = split.shift().replace(/\+/g, ' ')
  1802. var value = split.join('=').replace(/\+/g, ' ')
  1803. form.append(decodeURIComponent(name), decodeURIComponent(value))
  1804. }
  1805. })
  1806. return form
  1807. }
  1808. function headers(xhr) {
  1809. var head = new Headers()
  1810. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  1811. pairs.forEach(function(header) {
  1812. var split = header.trim().split(':')
  1813. var key = split.shift().trim()
  1814. var value = split.join(':').trim()
  1815. head.append(key, value)
  1816. })
  1817. return head
  1818. }
  1819. Body.call(Request.prototype)
  1820. function Response(bodyInit, options) {
  1821. if (!options) {
  1822. options = {}
  1823. }
  1824. this._initBody(bodyInit, options)
  1825. this.type = 'default'
  1826. this.status = options.status
  1827. this.ok = this.status >= 200 && this.status < 300
  1828. this.statusText = options.statusText
  1829. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  1830. this.url = options.url || ''
  1831. }
  1832. Body.call(Response.prototype)
  1833. Response.prototype.clone = function() {
  1834. return new Response(this._bodyInit, {
  1835. status: this.status,
  1836. statusText: this.statusText,
  1837. headers: new Headers(this.headers),
  1838. url: this.url
  1839. })
  1840. }
  1841. Response.error = function() {
  1842. var response = new Response(null, {status: 0, statusText: ''})
  1843. response.type = 'error'
  1844. return response
  1845. }
  1846. var redirectStatuses = [301, 302, 303, 307, 308]
  1847. Response.redirect = function(url, status) {
  1848. if (redirectStatuses.indexOf(status) === -1) {
  1849. throw new RangeError('Invalid status code')
  1850. }
  1851. return new Response(null, {status: status, headers: {location: url}})
  1852. }
  1853. self.Headers = Headers;
  1854. self.Request = Request;
  1855. self.Response = Response;
  1856. self.fetch = function(input, init) {
  1857. return new Promise(function(resolve, reject) {
  1858. var request
  1859. if (Request.prototype.isPrototypeOf(input) && !init) {
  1860. request = input
  1861. } else {
  1862. request = new Request(input, init)
  1863. }
  1864. var xhr = new XMLHttpRequest()
  1865. function responseURL() {
  1866. if ('responseURL' in xhr) {
  1867. return xhr.responseURL
  1868. }
  1869. // Avoid security warnings on getResponseHeader when not allowed by CORS
  1870. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  1871. return xhr.getResponseHeader('X-Request-URL')
  1872. }
  1873. return;
  1874. }
  1875. var __onLoadHandled = false;
  1876. function onload() {
  1877. if (xhr.readyState !== 4) {
  1878. return
  1879. }
  1880. var status = (xhr.status === 1223) ? 204 : xhr.status
  1881. if (status < 100 || status > 599) {
  1882. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  1883. reject(new TypeError('Network request failed'))
  1884. return
  1885. }
  1886. var options = {
  1887. status: status,
  1888. statusText: xhr.statusText,
  1889. headers: headers(xhr),
  1890. url: responseURL()
  1891. }
  1892. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  1893. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  1894. resolve(new Response(body, options))
  1895. }
  1896. xhr.onreadystatechange = onload;
  1897. xhr.onload = onload;
  1898. xhr.onerror = function() {
  1899. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  1900. reject(new TypeError('Network request failed'))
  1901. }
  1902. xhr.open(request.method, request.url, true)
  1903. // `withCredentials` should be setted after calling `.open` in IE10
  1904. // http://stackoverflow.com/a/19667959/1219343
  1905. try {
  1906. if (request.credentials === 'include') {
  1907. if ('withCredentials' in xhr) {
  1908. xhr.withCredentials = true;
  1909. } else {
  1910. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  1911. }
  1912. }
  1913. } catch (e) {
  1914. console && console.warn && console.warn('set withCredentials error:' + e);
  1915. }
  1916. if ('responseType' in xhr && support.blob) {
  1917. xhr.responseType = 'blob'
  1918. }
  1919. request.headers.forEach(function(value, name) {
  1920. xhr.setRequestHeader(name, value)
  1921. })
  1922. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  1923. })
  1924. }
  1925. self.fetch.polyfill = true
  1926. // Support CommonJS
  1927. if ( true && module.exports) {
  1928. module.exports = self.fetch;
  1929. }
  1930. })(typeof self !== 'undefined' ? self : this);
  1931. /***/ }),
  1932. /* 17 */
  1933. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1934. "use strict";
  1935. __webpack_require__.r(__webpack_exports__);
  1936. /* harmony import */ var _supermap_iclient_common_css_webmapfont_iconfont_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19);
  1937. /* harmony import */ var _supermap_iclient_common_css_webmapfont_iconfont_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_supermap_iclient_common_css_webmapfont_iconfont_css__WEBPACK_IMPORTED_MODULE_0__);
  1938. /* harmony import */ var _supermap_iclient_common_components_css_MessageBox_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25);
  1939. /* harmony import */ var _supermap_iclient_common_components_css_MessageBox_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_supermap_iclient_common_components_css_MessageBox_css__WEBPACK_IMPORTED_MODULE_1__);
  1940. /***/ }),
  1941. /* 18 */
  1942. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1943. "use strict";
  1944. // ESM COMPAT FLAG
  1945. __webpack_require__.r(__webpack_exports__);
  1946. // EXPORTS
  1947. __webpack_require__.d(__webpack_exports__, "SuperMap", function() { return /* reexport */ SuperMap; });
  1948. __webpack_require__.d(__webpack_exports__, "DataFormat", function() { return /* reexport */ DataFormat; });
  1949. __webpack_require__.d(__webpack_exports__, "ServerType", function() { return /* reexport */ ServerType; });
  1950. __webpack_require__.d(__webpack_exports__, "GeometryType", function() { return /* reexport */ GeometryType; });
  1951. __webpack_require__.d(__webpack_exports__, "QueryOption", function() { return /* reexport */ QueryOption; });
  1952. __webpack_require__.d(__webpack_exports__, "JoinType", function() { return /* reexport */ JoinType; });
  1953. __webpack_require__.d(__webpack_exports__, "EngineType", function() { return /* reexport */ EngineType; });
  1954. __webpack_require__.d(__webpack_exports__, "MeasureMode", function() { return /* reexport */ MeasureMode; });
  1955. __webpack_require__.d(__webpack_exports__, "SpatialRelationType", function() { return /* reexport */ SpatialRelationType; });
  1956. __webpack_require__.d(__webpack_exports__, "DataReturnMode", function() { return /* reexport */ DataReturnMode; });
  1957. __webpack_require__.d(__webpack_exports__, "Unit", function() { return /* reexport */ Unit; });
  1958. __webpack_require__.d(__webpack_exports__, "BufferRadiusUnit", function() { return /* reexport */ BufferRadiusUnit; });
  1959. __webpack_require__.d(__webpack_exports__, "SpatialQueryMode", function() { return /* reexport */ SpatialQueryMode; });
  1960. __webpack_require__.d(__webpack_exports__, "ThemeGraphTextFormat", function() { return /* reexport */ ThemeGraphTextFormat; });
  1961. __webpack_require__.d(__webpack_exports__, "ThemeGraphType", function() { return /* reexport */ ThemeGraphType; });
  1962. __webpack_require__.d(__webpack_exports__, "GraphAxesTextDisplayMode", function() { return /* reexport */ GraphAxesTextDisplayMode; });
  1963. __webpack_require__.d(__webpack_exports__, "GraduatedMode", function() { return /* reexport */ GraduatedMode; });
  1964. __webpack_require__.d(__webpack_exports__, "RangeMode", function() { return /* reexport */ RangeMode; });
  1965. __webpack_require__.d(__webpack_exports__, "ThemeType", function() { return /* reexport */ ThemeType; });
  1966. __webpack_require__.d(__webpack_exports__, "ColorGradientType", function() { return /* reexport */ ColorGradientType; });
  1967. __webpack_require__.d(__webpack_exports__, "TextAlignment", function() { return /* reexport */ TextAlignment; });
  1968. __webpack_require__.d(__webpack_exports__, "FillGradientMode", function() { return /* reexport */ FillGradientMode; });
  1969. __webpack_require__.d(__webpack_exports__, "SideType", function() { return /* reexport */ SideType; });
  1970. __webpack_require__.d(__webpack_exports__, "AlongLineDirection", function() { return /* reexport */ AlongLineDirection; });
  1971. __webpack_require__.d(__webpack_exports__, "LabelBackShape", function() { return /* reexport */ LabelBackShape; });
  1972. __webpack_require__.d(__webpack_exports__, "LabelOverLengthMode", function() { return /* reexport */ LabelOverLengthMode; });
  1973. __webpack_require__.d(__webpack_exports__, "DirectionType", function() { return /* reexport */ DirectionType; });
  1974. __webpack_require__.d(__webpack_exports__, "OverlayOperationType", function() { return /* reexport */ OverlayOperationType; });
  1975. __webpack_require__.d(__webpack_exports__, "SupplyCenterType", function() { return /* reexport */ SupplyCenterType; });
  1976. __webpack_require__.d(__webpack_exports__, "TurnType", function() { return /* reexport */ TurnType; });
  1977. __webpack_require__.d(__webpack_exports__, "BufferEndType", function() { return /* reexport */ BufferEndType; });
  1978. __webpack_require__.d(__webpack_exports__, "SmoothMethod", function() { return /* reexport */ SmoothMethod; });
  1979. __webpack_require__.d(__webpack_exports__, "SurfaceAnalystMethod", function() { return /* reexport */ SurfaceAnalystMethod; });
  1980. __webpack_require__.d(__webpack_exports__, "ColorSpaceType", function() { return /* reexport */ ColorSpaceType; });
  1981. __webpack_require__.d(__webpack_exports__, "ChartType", function() { return /* reexport */ ChartType; });
  1982. __webpack_require__.d(__webpack_exports__, "EditType", function() { return /* reexport */ EditType; });
  1983. __webpack_require__.d(__webpack_exports__, "TransferTactic", function() { return /* reexport */ TransferTactic; });
  1984. __webpack_require__.d(__webpack_exports__, "TransferPreference", function() { return /* reexport */ TransferPreference; });
  1985. __webpack_require__.d(__webpack_exports__, "GridType", function() { return /* reexport */ GridType; });
  1986. __webpack_require__.d(__webpack_exports__, "ClientType", function() { return /* reexport */ ClientType; });
  1987. __webpack_require__.d(__webpack_exports__, "LayerType", function() { return /* reexport */ LayerType; });
  1988. __webpack_require__.d(__webpack_exports__, "UGCLayerType", function() { return /* reexport */ UGCLayerType; });
  1989. __webpack_require__.d(__webpack_exports__, "StatisticMode", function() { return /* reexport */ StatisticMode; });
  1990. __webpack_require__.d(__webpack_exports__, "PixelFormat", function() { return /* reexport */ PixelFormat; });
  1991. __webpack_require__.d(__webpack_exports__, "SearchMode", function() { return /* reexport */ SearchMode; });
  1992. __webpack_require__.d(__webpack_exports__, "SummaryType", function() { return /* reexport */ SummaryType; });
  1993. __webpack_require__.d(__webpack_exports__, "InterpolationAlgorithmType", function() { return /* reexport */ InterpolationAlgorithmType; });
  1994. __webpack_require__.d(__webpack_exports__, "VariogramMode", function() { return /* reexport */ VariogramMode; });
  1995. __webpack_require__.d(__webpack_exports__, "Exponent", function() { return /* reexport */ Exponent; });
  1996. __webpack_require__.d(__webpack_exports__, "ClipAnalystMode", function() { return /* reexport */ ClipAnalystMode; });
  1997. __webpack_require__.d(__webpack_exports__, "AnalystAreaUnit", function() { return /* reexport */ AnalystAreaUnit; });
  1998. __webpack_require__.d(__webpack_exports__, "AnalystSizeUnit", function() { return /* reexport */ AnalystSizeUnit; });
  1999. __webpack_require__.d(__webpack_exports__, "StatisticAnalystMode", function() { return /* reexport */ StatisticAnalystMode; });
  2000. __webpack_require__.d(__webpack_exports__, "TopologyValidatorRule", function() { return /* reexport */ TopologyValidatorRule; });
  2001. __webpack_require__.d(__webpack_exports__, "OutputType", function() { return /* reexport */ OutputType; });
  2002. __webpack_require__.d(__webpack_exports__, "AggregationQueryBuilderType", function() { return /* reexport */ AggregationQueryBuilderType; });
  2003. __webpack_require__.d(__webpack_exports__, "AggregationType", function() { return /* reexport */ AggregationType; });
  2004. __webpack_require__.d(__webpack_exports__, "GetFeatureMode", function() { return /* reexport */ GetFeatureMode; });
  2005. __webpack_require__.d(__webpack_exports__, "TimeFlowControl", function() { return /* reexport */ TimeFlowControl_TimeFlowControl; });
  2006. __webpack_require__.d(__webpack_exports__, "IManager", function() { return /* reexport */ iManager_IManager; });
  2007. __webpack_require__.d(__webpack_exports__, "IManagerServiceBase", function() { return /* reexport */ iManagerServiceBase_IManagerServiceBase; });
  2008. __webpack_require__.d(__webpack_exports__, "IManagerCreateNodeParam", function() { return /* reexport */ iManagerCreateNodeParam_IManagerCreateNodeParam; });
  2009. __webpack_require__.d(__webpack_exports__, "IPortal", function() { return /* reexport */ iPortal_IPortal; });
  2010. __webpack_require__.d(__webpack_exports__, "IPortalQueryParam", function() { return /* reexport */ iPortalQueryParam_IPortalQueryParam; });
  2011. __webpack_require__.d(__webpack_exports__, "IPortalResource", function() { return /* reexport */ iPortalResource_IPortalResource; });
  2012. __webpack_require__.d(__webpack_exports__, "IPortalQueryResult", function() { return /* reexport */ iPortalQueryResult_IPortalQueryResult; });
  2013. __webpack_require__.d(__webpack_exports__, "IPortalShareParam", function() { return /* reexport */ iPortalShareParam_IPortalShareParam; });
  2014. __webpack_require__.d(__webpack_exports__, "IPortalShareEntity", function() { return /* reexport */ iPortalShareEntity_IPortalShareEntity; });
  2015. __webpack_require__.d(__webpack_exports__, "IPortalServiceBase", function() { return /* reexport */ iPortalServiceBase_IPortalServiceBase; });
  2016. __webpack_require__.d(__webpack_exports__, "IPortalUser", function() { return /* reexport */ iPortalUser_IPortalUser; });
  2017. __webpack_require__.d(__webpack_exports__, "IPortalAddResourceParam", function() { return /* reexport */ iPortalAddResourceParam_IPortalAddResourceParam; });
  2018. __webpack_require__.d(__webpack_exports__, "IPortalRegisterServiceParam", function() { return /* reexport */ iPortalRegisterServiceParam_IPortalRegisterServiceParam; });
  2019. __webpack_require__.d(__webpack_exports__, "IPortalAddDataParam", function() { return /* reexport */ iPortalAddDataParam_IPortalAddDataParam; });
  2020. __webpack_require__.d(__webpack_exports__, "IPortalDataMetaInfoParam", function() { return /* reexport */ iPortalDataMetaInfoParam_IPortalDataMetaInfoParam; });
  2021. __webpack_require__.d(__webpack_exports__, "IPortalDataStoreInfoParam", function() { return /* reexport */ iPortalDataStoreInfoParam_IPortalDataStoreInfoParam; });
  2022. __webpack_require__.d(__webpack_exports__, "IPortalDataConnectionInfoParam", function() { return /* reexport */ iPortalDataConnectionInfoParam_IPortalDataConnectionInfoParam; });
  2023. __webpack_require__.d(__webpack_exports__, "Online", function() { return /* reexport */ Online_Online; });
  2024. __webpack_require__.d(__webpack_exports__, "OnlineData", function() { return /* reexport */ OnlineData_OnlineData; });
  2025. __webpack_require__.d(__webpack_exports__, "OnlineQueryDatasParameter", function() { return /* reexport */ OnlineQueryDatasParameter_OnlineQueryDatasParameter; });
  2026. __webpack_require__.d(__webpack_exports__, "ServiceStatus", function() { return /* reexport */ ServiceStatus; });
  2027. __webpack_require__.d(__webpack_exports__, "DataItemType", function() { return /* reexport */ OnlineResources_DataItemType; });
  2028. __webpack_require__.d(__webpack_exports__, "DataItemOrderBy", function() { return /* reexport */ DataItemOrderBy; });
  2029. __webpack_require__.d(__webpack_exports__, "FilterField", function() { return /* reexport */ FilterField; });
  2030. __webpack_require__.d(__webpack_exports__, "OnlineServiceBase", function() { return /* reexport */ OnlineServiceBase_OnlineServiceBase; });
  2031. __webpack_require__.d(__webpack_exports__, "KeyServiceParameter", function() { return /* reexport */ KeyServiceParameter_KeyServiceParameter; });
  2032. __webpack_require__.d(__webpack_exports__, "SecurityManager", function() { return /* reexport */ SecurityManager_SecurityManager; });
  2033. __webpack_require__.d(__webpack_exports__, "ServerInfo", function() { return /* reexport */ ServerInfo_ServerInfo; });
  2034. __webpack_require__.d(__webpack_exports__, "TokenServiceParameter", function() { return /* reexport */ TokenServiceParameter_TokenServiceParameter; });
  2035. __webpack_require__.d(__webpack_exports__, "ElasticSearch", function() { return /* reexport */ ElasticSearch_ElasticSearch; });
  2036. __webpack_require__.d(__webpack_exports__, "FetchRequest", function() { return /* reexport */ FetchRequest; });
  2037. __webpack_require__.d(__webpack_exports__, "ColorsPickerUtil", function() { return /* reexport */ ColorsPickerUtil; });
  2038. __webpack_require__.d(__webpack_exports__, "ArrayStatistic", function() { return /* reexport */ ArrayStatistic; });
  2039. __webpack_require__.d(__webpack_exports__, "AreaSolarRadiationParameters", function() { return /* reexport */ AreaSolarRadiationParameters_AreaSolarRadiationParameters; });
  2040. __webpack_require__.d(__webpack_exports__, "AggregationParameter", function() { return /* reexport */ AggregationParameter_AggregationParameter; });
  2041. __webpack_require__.d(__webpack_exports__, "AggQueryBuilderParameter", function() { return /* reexport */ AggQueryBuilderParameter_AggQueryBuilderParameter; });
  2042. __webpack_require__.d(__webpack_exports__, "BufferAnalystParameters", function() { return /* reexport */ BufferAnalystParameters_BufferAnalystParameters; });
  2043. __webpack_require__.d(__webpack_exports__, "BufferDistance", function() { return /* reexport */ BufferDistance_BufferDistance; });
  2044. __webpack_require__.d(__webpack_exports__, "BuffersAnalystJobsParameter", function() { return /* reexport */ BuffersAnalystJobsParameter_BuffersAnalystJobsParameter; });
  2045. __webpack_require__.d(__webpack_exports__, "BufferSetting", function() { return /* reexport */ BufferSetting_BufferSetting; });
  2046. __webpack_require__.d(__webpack_exports__, "BurstPipelineAnalystParameters", function() { return /* reexport */ BurstPipelineAnalystParameters_BurstPipelineAnalystParameters; });
  2047. __webpack_require__.d(__webpack_exports__, "ChartQueryFilterParameter", function() { return /* reexport */ ChartQueryFilterParameter_ChartQueryFilterParameter; });
  2048. __webpack_require__.d(__webpack_exports__, "ChartQueryParameters", function() { return /* reexport */ ChartQueryParameters_ChartQueryParameters; });
  2049. __webpack_require__.d(__webpack_exports__, "ClipParameter", function() { return /* reexport */ ClipParameter_ClipParameter; });
  2050. __webpack_require__.d(__webpack_exports__, "ColorDictionary", function() { return /* reexport */ ColorDictionary_ColorDictionary; });
  2051. __webpack_require__.d(__webpack_exports__, "ComputeWeightMatrixParameters", function() { return /* reexport */ ComputeWeightMatrixParameters_ComputeWeightMatrixParameters; });
  2052. __webpack_require__.d(__webpack_exports__, "DataReturnOption", function() { return /* reexport */ DataReturnOption_DataReturnOption; });
  2053. __webpack_require__.d(__webpack_exports__, "DatasetBufferAnalystParameters", function() { return /* reexport */ DatasetBufferAnalystParameters_DatasetBufferAnalystParameters; });
  2054. __webpack_require__.d(__webpack_exports__, "DatasetInfo", function() { return /* reexport */ DatasetInfo_DatasetInfo; });
  2055. __webpack_require__.d(__webpack_exports__, "DatasetOverlayAnalystParameters", function() { return /* reexport */ DatasetOverlayAnalystParameters_DatasetOverlayAnalystParameters; });
  2056. __webpack_require__.d(__webpack_exports__, "DatasetSurfaceAnalystParameters", function() { return /* reexport */ DatasetSurfaceAnalystParameters_DatasetSurfaceAnalystParameters; });
  2057. __webpack_require__.d(__webpack_exports__, "DatasetThiessenAnalystParameters", function() { return /* reexport */ DatasetThiessenAnalystParameters_DatasetThiessenAnalystParameters; });
  2058. __webpack_require__.d(__webpack_exports__, "DatasourceConnectionInfo", function() { return /* reexport */ DatasourceConnectionInfo_DatasourceConnectionInfo; });
  2059. __webpack_require__.d(__webpack_exports__, "DensityKernelAnalystParameters", function() { return /* reexport */ DensityKernelAnalystParameters_DensityKernelAnalystParameters; });
  2060. __webpack_require__.d(__webpack_exports__, "EditFeaturesParameters", function() { return /* reexport */ EditFeaturesParameters_EditFeaturesParameters; });
  2061. __webpack_require__.d(__webpack_exports__, "FacilityAnalyst3DParameters", function() { return /* reexport */ FacilityAnalyst3DParameters_FacilityAnalyst3DParameters; });
  2062. __webpack_require__.d(__webpack_exports__, "FacilityAnalystSinks3DParameters", function() { return /* reexport */ FacilityAnalystSinks3DParameters_FacilityAnalystSinks3DParameters; });
  2063. __webpack_require__.d(__webpack_exports__, "FacilityAnalystSources3DParameters", function() { return /* reexport */ FacilityAnalystSources3DParameters_FacilityAnalystSources3DParameters; });
  2064. __webpack_require__.d(__webpack_exports__, "FacilityAnalystStreamParameters", function() { return /* reexport */ FacilityAnalystStreamParameters_FacilityAnalystStreamParameters; });
  2065. __webpack_require__.d(__webpack_exports__, "FacilityAnalystTracedown3DParameters", function() { return /* reexport */ FacilityAnalystTracedown3DParameters_FacilityAnalystTracedown3DParameters; });
  2066. __webpack_require__.d(__webpack_exports__, "FacilityAnalystTraceup3DParameters", function() { return /* reexport */ FacilityAnalystTraceup3DParameters_FacilityAnalystTraceup3DParameters; });
  2067. __webpack_require__.d(__webpack_exports__, "FacilityAnalystUpstream3DParameters", function() { return /* reexport */ FacilityAnalystUpstream3DParameters_FacilityAnalystUpstream3DParameters; });
  2068. __webpack_require__.d(__webpack_exports__, "FieldParameters", function() { return /* reexport */ FieldParameters_FieldParameters; });
  2069. __webpack_require__.d(__webpack_exports__, "FieldStatisticsParameters", function() { return /* reexport */ FieldStatisticsParameters_FieldStatisticsParameters; });
  2070. __webpack_require__.d(__webpack_exports__, "FilterParameter", function() { return /* reexport */ FilterParameter_FilterParameter; });
  2071. __webpack_require__.d(__webpack_exports__, "FilterAggParameter", function() { return /* reexport */ FilterAggParameter_FilterAggParameter; });
  2072. __webpack_require__.d(__webpack_exports__, "FindClosestFacilitiesParameters", function() { return /* reexport */ FindClosestFacilitiesParameters_FindClosestFacilitiesParameters; });
  2073. __webpack_require__.d(__webpack_exports__, "FindLocationParameters", function() { return /* reexport */ FindLocationParameters_FindLocationParameters; });
  2074. __webpack_require__.d(__webpack_exports__, "FindMTSPPathsParameters", function() { return /* reexport */ FindMTSPPathsParameters_FindMTSPPathsParameters; });
  2075. __webpack_require__.d(__webpack_exports__, "FindPathParameters", function() { return /* reexport */ FindPathParameters_FindPathParameters; });
  2076. __webpack_require__.d(__webpack_exports__, "FindServiceAreasParameters", function() { return /* reexport */ FindServiceAreasParameters_FindServiceAreasParameters; });
  2077. __webpack_require__.d(__webpack_exports__, "FindTSPPathsParameters", function() { return /* reexport */ FindTSPPathsParameters_FindTSPPathsParameters; });
  2078. __webpack_require__.d(__webpack_exports__, "GenerateSpatialDataParameters", function() { return /* reexport */ GenerateSpatialDataParameters_GenerateSpatialDataParameters; });
  2079. __webpack_require__.d(__webpack_exports__, "GeoBoundingBoxQueryBuilderParameter", function() { return /* reexport */ GeoBoundingBoxQueryBuilderParameter_GeoBoundingBoxQueryBuilderParameter; });
  2080. __webpack_require__.d(__webpack_exports__, "GeoCodingParameter", function() { return /* reexport */ GeoCodingParameter_GeoCodingParameter; });
  2081. __webpack_require__.d(__webpack_exports__, "GeoDecodingParameter", function() { return /* reexport */ GeoDecodingParameter_GeoDecodingParameter; });
  2082. __webpack_require__.d(__webpack_exports__, "GeoHashGridAggParameter", function() { return /* reexport */ GeoHashGridAggParameter_GeoHashGridAggParameter; });
  2083. __webpack_require__.d(__webpack_exports__, "GeometryBufferAnalystParameters", function() { return /* reexport */ GeometryBufferAnalystParameters_GeometryBufferAnalystParameters; });
  2084. __webpack_require__.d(__webpack_exports__, "GeometryOverlayAnalystParameters", function() { return /* reexport */ GeometryOverlayAnalystParameters_GeometryOverlayAnalystParameters; });
  2085. __webpack_require__.d(__webpack_exports__, "GeometrySurfaceAnalystParameters", function() { return /* reexport */ GeometrySurfaceAnalystParameters_GeometrySurfaceAnalystParameters; });
  2086. __webpack_require__.d(__webpack_exports__, "GeometryThiessenAnalystParameters", function() { return /* reexport */ GeometryThiessenAnalystParameters_GeometryThiessenAnalystParameters; });
  2087. __webpack_require__.d(__webpack_exports__, "GeoRelationAnalystParameters", function() { return /* reexport */ GeoRelationAnalystParameters_GeoRelationAnalystParameters; });
  2088. __webpack_require__.d(__webpack_exports__, "GetFeaturesByBoundsParameters", function() { return /* reexport */ GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters; });
  2089. __webpack_require__.d(__webpack_exports__, "GetFeaturesByBufferParameters", function() { return /* reexport */ GetFeaturesByBufferParameters_GetFeaturesByBufferParameters; });
  2090. __webpack_require__.d(__webpack_exports__, "GetFeaturesByGeometryParameters", function() { return /* reexport */ GetFeaturesByGeometryParameters_GetFeaturesByGeometryParameters; });
  2091. __webpack_require__.d(__webpack_exports__, "GetFeaturesByIDsParameters", function() { return /* reexport */ GetFeaturesByIDsParameters_GetFeaturesByIDsParameters; });
  2092. __webpack_require__.d(__webpack_exports__, "GetFeaturesBySQLParameters", function() { return /* reexport */ GetFeaturesBySQLParameters_GetFeaturesBySQLParameters; });
  2093. __webpack_require__.d(__webpack_exports__, "GetGridCellInfosParameters", function() { return /* reexport */ GetGridCellInfosParameters_GetGridCellInfosParameters; });
  2094. __webpack_require__.d(__webpack_exports__, "Grid", function() { return /* reexport */ Grid_Grid; });
  2095. __webpack_require__.d(__webpack_exports__, "Image", function() { return /* reexport */ Image_Image; });
  2096. __webpack_require__.d(__webpack_exports__, "InterpolationAnalystParameters", function() { return /* reexport */ InterpolationAnalystParameters_InterpolationAnalystParameters; });
  2097. __webpack_require__.d(__webpack_exports__, "InterpolationIDWAnalystParameters", function() { return /* reexport */ InterpolationIDWAnalystParameters_InterpolationIDWAnalystParameters; });
  2098. __webpack_require__.d(__webpack_exports__, "InterpolationKrigingAnalystParameters", function() { return /* reexport */ InterpolationKrigingAnalystParameters_InterpolationKrigingAnalystParameters; });
  2099. __webpack_require__.d(__webpack_exports__, "InterpolationRBFAnalystParameters", function() { return /* reexport */ InterpolationRBFAnalystParameters_InterpolationRBFAnalystParameters; });
  2100. __webpack_require__.d(__webpack_exports__, "JoinItem", function() { return /* reexport */ JoinItem_JoinItem; });
  2101. __webpack_require__.d(__webpack_exports__, "KernelDensityJobParameter", function() { return /* reexport */ KernelDensityJobParameter_KernelDensityJobParameter; });
  2102. __webpack_require__.d(__webpack_exports__, "LabelImageCell", function() { return /* reexport */ LabelImageCell_LabelImageCell; });
  2103. __webpack_require__.d(__webpack_exports__, "LabelMatrixCell", function() { return /* reexport */ LabelMatrixCell; });
  2104. __webpack_require__.d(__webpack_exports__, "LabelMixedTextStyle", function() { return /* reexport */ LabelMixedTextStyle_LabelMixedTextStyle; });
  2105. __webpack_require__.d(__webpack_exports__, "LabelSymbolCell", function() { return /* reexport */ LabelSymbolCell_LabelSymbolCell; });
  2106. __webpack_require__.d(__webpack_exports__, "LabelThemeCell", function() { return /* reexport */ LabelThemeCell_LabelThemeCell; });
  2107. __webpack_require__.d(__webpack_exports__, "LayerStatus", function() { return /* reexport */ LayerStatus_LayerStatus; });
  2108. __webpack_require__.d(__webpack_exports__, "LinkItem", function() { return /* reexport */ LinkItem_LinkItem; });
  2109. __webpack_require__.d(__webpack_exports__, "MathExpressionAnalysisParameters", function() { return /* reexport */ MathExpressionAnalysisParameters_MathExpressionAnalysisParameters; });
  2110. __webpack_require__.d(__webpack_exports__, "MeasureParameters", function() { return /* reexport */ MeasureParameters_MeasureParameters; });
  2111. __webpack_require__.d(__webpack_exports__, "OutputSetting", function() { return /* reexport */ OutputSetting_OutputSetting; });
  2112. __webpack_require__.d(__webpack_exports__, "MappingParameters", function() { return /* reexport */ MappingParameters_MappingParameters; });
  2113. __webpack_require__.d(__webpack_exports__, "OverlapDisplayedOptions", function() { return /* reexport */ OverlapDisplayedOptions_OverlapDisplayedOptions; });
  2114. __webpack_require__.d(__webpack_exports__, "OverlayAnalystParameters", function() { return /* reexport */ OverlayAnalystParameters_OverlayAnalystParameters; });
  2115. __webpack_require__.d(__webpack_exports__, "OverlayGeoJobParameter", function() { return /* reexport */ OverlayGeoJobParameter_OverlayGeoJobParameter; });
  2116. __webpack_require__.d(__webpack_exports__, "PointWithMeasure", function() { return /* reexport */ PointWithMeasure_PointWithMeasure; });
  2117. __webpack_require__.d(__webpack_exports__, "QueryByBoundsParameters", function() { return /* reexport */ QueryByBoundsParameters_QueryByBoundsParameters; });
  2118. __webpack_require__.d(__webpack_exports__, "QueryByDistanceParameters", function() { return /* reexport */ QueryByDistanceParameters_QueryByDistanceParameters; });
  2119. __webpack_require__.d(__webpack_exports__, "QueryByGeometryParameters", function() { return /* reexport */ QueryByGeometryParameters_QueryByGeometryParameters; });
  2120. __webpack_require__.d(__webpack_exports__, "QueryBySQLParameters", function() { return /* reexport */ QueryBySQLParameters_QueryBySQLParameters; });
  2121. __webpack_require__.d(__webpack_exports__, "QueryParameters", function() { return /* reexport */ QueryParameters_QueryParameters; });
  2122. __webpack_require__.d(__webpack_exports__, "Route", function() { return /* reexport */ Route_Route; });
  2123. __webpack_require__.d(__webpack_exports__, "RouteCalculateMeasureParameters", function() { return /* reexport */ RouteCalculateMeasureParameters_RouteCalculateMeasureParameters; });
  2124. __webpack_require__.d(__webpack_exports__, "RouteLocatorParameters", function() { return /* reexport */ RouteLocatorParameters_RouteLocatorParameters; });
  2125. __webpack_require__.d(__webpack_exports__, "ServerColor", function() { return /* reexport */ ServerColor; });
  2126. __webpack_require__.d(__webpack_exports__, "ServerFeature", function() { return /* reexport */ ServerFeature_ServerFeature; });
  2127. __webpack_require__.d(__webpack_exports__, "ServerGeometry", function() { return /* reexport */ ServerGeometry_ServerGeometry; });
  2128. __webpack_require__.d(__webpack_exports__, "ServerStyle", function() { return /* reexport */ ServerStyle_ServerStyle; });
  2129. __webpack_require__.d(__webpack_exports__, "ServerTextStyle", function() { return /* reexport */ ServerTextStyle_ServerTextStyle; });
  2130. __webpack_require__.d(__webpack_exports__, "ServerTheme", function() { return /* reexport */ ServerTheme_ServerTheme; });
  2131. __webpack_require__.d(__webpack_exports__, "SetLayerInfoParameters", function() { return /* reexport */ SetLayerInfoParameters_SetLayerInfoParameters; });
  2132. __webpack_require__.d(__webpack_exports__, "SetLayersInfoParameters", function() { return /* reexport */ SetLayersInfoParameters_SetLayersInfoParameters; });
  2133. __webpack_require__.d(__webpack_exports__, "SetLayerStatusParameters", function() { return /* reexport */ SetLayerStatusParameters_SetLayerStatusParameters; });
  2134. __webpack_require__.d(__webpack_exports__, "SingleObjectQueryJobsParameter", function() { return /* reexport */ SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter; });
  2135. __webpack_require__.d(__webpack_exports__, "StopQueryParameters", function() { return /* reexport */ StopQueryParameters_StopQueryParameters; });
  2136. __webpack_require__.d(__webpack_exports__, "SummaryAttributesJobsParameter", function() { return /* reexport */ SummaryAttributesJobsParameter_SummaryAttributesJobsParameter; });
  2137. __webpack_require__.d(__webpack_exports__, "SummaryMeshJobParameter", function() { return /* reexport */ SummaryMeshJobParameter_SummaryMeshJobParameter; });
  2138. __webpack_require__.d(__webpack_exports__, "SummaryRegionJobParameter", function() { return /* reexport */ SummaryRegionJobParameter_SummaryRegionJobParameter; });
  2139. __webpack_require__.d(__webpack_exports__, "SupplyCenter", function() { return /* reexport */ SupplyCenter_SupplyCenter; });
  2140. __webpack_require__.d(__webpack_exports__, "SurfaceAnalystParameters", function() { return /* reexport */ SurfaceAnalystParameters_SurfaceAnalystParameters; });
  2141. __webpack_require__.d(__webpack_exports__, "SurfaceAnalystParametersSetting", function() { return /* reexport */ SurfaceAnalystParametersSetting_SurfaceAnalystParametersSetting; });
  2142. __webpack_require__.d(__webpack_exports__, "TerrainCurvatureCalculationParameters", function() { return /* reexport */ TerrainCurvatureCalculationParameters_TerrainCurvatureCalculationParameters; });
  2143. __webpack_require__.d(__webpack_exports__, "Theme", function() { return /* reexport */ Theme_Theme; });
  2144. __webpack_require__.d(__webpack_exports__, "ThemeDotDensity", function() { return /* reexport */ ThemeDotDensity_ThemeDotDensity; });
  2145. __webpack_require__.d(__webpack_exports__, "ThemeFlow", function() { return /* reexport */ ThemeFlow_ThemeFlow; });
  2146. __webpack_require__.d(__webpack_exports__, "ThemeGraduatedSymbol", function() { return /* reexport */ ThemeGraduatedSymbol_ThemeGraduatedSymbol; });
  2147. __webpack_require__.d(__webpack_exports__, "ThemeGraduatedSymbolStyle", function() { return /* reexport */ ThemeGraduatedSymbolStyle_ThemeGraduatedSymbolStyle; });
  2148. __webpack_require__.d(__webpack_exports__, "ThemeGraph", function() { return /* reexport */ ThemeGraph_ThemeGraph; });
  2149. __webpack_require__.d(__webpack_exports__, "ThemeGraphAxes", function() { return /* reexport */ ThemeGraphAxes_ThemeGraphAxes; });
  2150. __webpack_require__.d(__webpack_exports__, "ThemeGraphItem", function() { return /* reexport */ ThemeGraphItem_ThemeGraphItem; });
  2151. __webpack_require__.d(__webpack_exports__, "ThemeGraphSize", function() { return /* reexport */ ThemeGraphSize_ThemeGraphSize; });
  2152. __webpack_require__.d(__webpack_exports__, "ThemeGraphText", function() { return /* reexport */ ThemeGraphText_ThemeGraphText; });
  2153. __webpack_require__.d(__webpack_exports__, "ThemeGridRange", function() { return /* reexport */ ThemeGridRange_ThemeGridRange; });
  2154. __webpack_require__.d(__webpack_exports__, "ThemeGridRangeItem", function() { return /* reexport */ ThemeGridRangeItem_ThemeGridRangeItem; });
  2155. __webpack_require__.d(__webpack_exports__, "ThemeGridUnique", function() { return /* reexport */ ThemeGridUnique_ThemeGridUnique; });
  2156. __webpack_require__.d(__webpack_exports__, "ThemeGridUniqueItem", function() { return /* reexport */ ThemeGridUniqueItem_ThemeGridUniqueItem; });
  2157. __webpack_require__.d(__webpack_exports__, "ThemeLabel", function() { return /* reexport */ ThemeLabel_ThemeLabel; });
  2158. __webpack_require__.d(__webpack_exports__, "ThemeLabelAlongLine", function() { return /* reexport */ ThemeLabelAlongLine_ThemeLabelAlongLine; });
  2159. __webpack_require__.d(__webpack_exports__, "ThemeLabelBackground", function() { return /* reexport */ ThemeLabelBackground_ThemeLabelBackground; });
  2160. __webpack_require__.d(__webpack_exports__, "ThemeLabelItem", function() { return /* reexport */ ThemeLabelItem_ThemeLabelItem; });
  2161. __webpack_require__.d(__webpack_exports__, "ThemeLabelText", function() { return /* reexport */ ThemeLabelText_ThemeLabelText; });
  2162. __webpack_require__.d(__webpack_exports__, "ThemeLabelUniqueItem", function() { return /* reexport */ ThemeLabelUniqueItem_ThemeLabelUniqueItem; });
  2163. __webpack_require__.d(__webpack_exports__, "ThemeMemoryData", function() { return /* reexport */ ThemeMemoryData; });
  2164. __webpack_require__.d(__webpack_exports__, "ThemeOffset", function() { return /* reexport */ ThemeOffset_ThemeOffset; });
  2165. __webpack_require__.d(__webpack_exports__, "ThemeParameters", function() { return /* reexport */ ThemeParameters_ThemeParameters; });
  2166. __webpack_require__.d(__webpack_exports__, "ThemeRange", function() { return /* reexport */ ThemeRange_ThemeRange; });
  2167. __webpack_require__.d(__webpack_exports__, "ThemeRangeItem", function() { return /* reexport */ ThemeRangeItem_ThemeRangeItem; });
  2168. __webpack_require__.d(__webpack_exports__, "ThemeUnique", function() { return /* reexport */ ThemeUnique_ThemeUnique; });
  2169. __webpack_require__.d(__webpack_exports__, "ThemeUniqueItem", function() { return /* reexport */ ThemeUniqueItem_ThemeUniqueItem; });
  2170. __webpack_require__.d(__webpack_exports__, "ThiessenAnalystParameters", function() { return /* reexport */ ThiessenAnalystParameters_ThiessenAnalystParameters; });
  2171. __webpack_require__.d(__webpack_exports__, "TopologyValidatorJobsParameter", function() { return /* reexport */ TopologyValidatorJobsParameter_TopologyValidatorJobsParameter; });
  2172. __webpack_require__.d(__webpack_exports__, "TransferLine", function() { return /* reexport */ TransferLine_TransferLine; });
  2173. __webpack_require__.d(__webpack_exports__, "TransferPathParameters", function() { return /* reexport */ TransferPathParameters_TransferPathParameters; });
  2174. __webpack_require__.d(__webpack_exports__, "TransferSolutionParameters", function() { return /* reexport */ TransferSolutionParameters_TransferSolutionParameters; });
  2175. __webpack_require__.d(__webpack_exports__, "TransportationAnalystParameter", function() { return /* reexport */ TransportationAnalystParameter_TransportationAnalystParameter; });
  2176. __webpack_require__.d(__webpack_exports__, "TransportationAnalystResultSetting", function() { return /* reexport */ TransportationAnalystResultSetting_TransportationAnalystResultSetting; });
  2177. __webpack_require__.d(__webpack_exports__, "UGCLayer", function() { return /* reexport */ UGCLayer_UGCLayer; });
  2178. __webpack_require__.d(__webpack_exports__, "UGCMapLayer", function() { return /* reexport */ UGCMapLayer_UGCMapLayer; });
  2179. __webpack_require__.d(__webpack_exports__, "UGCSubLayer", function() { return /* reexport */ UGCSubLayer_UGCSubLayer; });
  2180. __webpack_require__.d(__webpack_exports__, "UpdateEdgeWeightParameters", function() { return /* reexport */ UpdateEdgeWeightParameters_UpdateEdgeWeightParameters; });
  2181. __webpack_require__.d(__webpack_exports__, "UpdateTurnNodeWeightParameters", function() { return /* reexport */ UpdateTurnNodeWeightParameters_UpdateTurnNodeWeightParameters; });
  2182. __webpack_require__.d(__webpack_exports__, "Vector", function() { return /* reexport */ iServer_Vector_Vector; });
  2183. __webpack_require__.d(__webpack_exports__, "VectorClipJobsParameter", function() { return /* reexport */ VectorClipJobsParameter_VectorClipJobsParameter; });
  2184. __webpack_require__.d(__webpack_exports__, "WebPrintingJobCustomItems", function() { return /* reexport */ WebPrintingJobCustomItems_WebPrintingJobCustomItems; });
  2185. __webpack_require__.d(__webpack_exports__, "WebPrintingJobImage", function() { return /* reexport */ WebPrintingJobImage_WebPrintingJobImage; });
  2186. __webpack_require__.d(__webpack_exports__, "WebPrintingJobLayers", function() { return /* reexport */ WebPrintingJobLayers_WebPrintingJobLayers; });
  2187. __webpack_require__.d(__webpack_exports__, "WebPrintingJobLegendOptions", function() { return /* reexport */ WebPrintingJobLegendOptions_WebPrintingJobLegendOptions; });
  2188. __webpack_require__.d(__webpack_exports__, "WebPrintingJobLittleMapOptions", function() { return /* reexport */ WebPrintingJobLittleMapOptions_WebPrintingJobLittleMapOptions; });
  2189. __webpack_require__.d(__webpack_exports__, "WebPrintingJobNorthArrowOptions", function() { return /* reexport */ WebPrintingJobNorthArrowOptions_WebPrintingJobNorthArrowOptions; });
  2190. __webpack_require__.d(__webpack_exports__, "WebPrintingJobScaleBarOptions", function() { return /* reexport */ WebPrintingJobScaleBarOptions_WebPrintingJobScaleBarOptions; });
  2191. __webpack_require__.d(__webpack_exports__, "WebPrintingJobContent", function() { return /* reexport */ WebPrintingJobContent_WebPrintingJobContent; });
  2192. __webpack_require__.d(__webpack_exports__, "WebPrintingJobLayoutOptions", function() { return /* reexport */ WebPrintingJobLayoutOptions_WebPrintingJobLayoutOptions; });
  2193. __webpack_require__.d(__webpack_exports__, "WebPrintingJobExportOptions", function() { return /* reexport */ WebPrintingJobExportOptions_WebPrintingJobExportOptions; });
  2194. __webpack_require__.d(__webpack_exports__, "WebPrintingJobParameters", function() { return /* reexport */ WebPrintingJobParameters_WebPrintingJobParameters; });
  2195. __webpack_require__.d(__webpack_exports__, "WebPrintingService", function() { return /* reexport */ WebPrintingService_WebPrintingService; });
  2196. __webpack_require__.d(__webpack_exports__, "FileTypes", function() { return /* reexport */ FileTypes; });
  2197. __webpack_require__.d(__webpack_exports__, "FileConfig", function() { return /* reexport */ FileConfig; });
  2198. __webpack_require__.d(__webpack_exports__, "FileModel", function() { return /* reexport */ FileModel_FileModel; });
  2199. __webpack_require__.d(__webpack_exports__, "MessageBox", function() { return /* reexport */ MessageBox; });
  2200. __webpack_require__.d(__webpack_exports__, "CommonContainer", function() { return /* reexport */ CommonContainer_CommonContainer; });
  2201. __webpack_require__.d(__webpack_exports__, "DropDownBox", function() { return /* reexport */ DropDownBox_DropDownBox; });
  2202. __webpack_require__.d(__webpack_exports__, "Select", function() { return /* reexport */ Select_Select; });
  2203. __webpack_require__.d(__webpack_exports__, "AttributesPopContainer", function() { return /* reexport */ AttributesPopContainer_AttributesPopContainer; });
  2204. __webpack_require__.d(__webpack_exports__, "PopContainer", function() { return /* reexport */ PopContainer_PopContainer; });
  2205. __webpack_require__.d(__webpack_exports__, "IndexTabsPageContainer", function() { return /* reexport */ IndexTabsPageContainer_IndexTabsPageContainer; });
  2206. __webpack_require__.d(__webpack_exports__, "CityTabsPage", function() { return /* reexport */ CityTabsPage_CityTabsPage; });
  2207. __webpack_require__.d(__webpack_exports__, "NavTabsPage", function() { return /* reexport */ NavTabsPage_NavTabsPage; });
  2208. __webpack_require__.d(__webpack_exports__, "PaginationContainer", function() { return /* reexport */ PaginationContainer_PaginationContainer; });
  2209. __webpack_require__.d(__webpack_exports__, "ComponentsUtil", function() { return /* reexport */ ComponentsUtil; });
  2210. __webpack_require__.d(__webpack_exports__, "FileReaderUtil", function() { return /* reexport */ FileReaderUtil; });
  2211. __webpack_require__.d(__webpack_exports__, "ChartView", function() { return /* reexport */ ChartView_ChartView; });
  2212. __webpack_require__.d(__webpack_exports__, "ChartViewModel", function() { return /* reexport */ ChartViewModel_ChartViewModel; });
  2213. __webpack_require__.d(__webpack_exports__, "Logo", function() { return /* reexport */ Logo_Logo; });
  2214. __webpack_require__.d(__webpack_exports__, "Util", function() { return /* reexport */ core_Util_Util; });
  2215. __webpack_require__.d(__webpack_exports__, "MapExtend", function() { return /* reexport */ MapExtend; });
  2216. __webpack_require__.d(__webpack_exports__, "Graph", function() { return /* reexport */ GraphThemeLayer_Graph; });
  2217. __webpack_require__.d(__webpack_exports__, "Label", function() { return /* reexport */ LabelThemeLayer_Label; });
  2218. __webpack_require__.d(__webpack_exports__, "MapvLayer", function() { return /* reexport */ MapvLayer_MapvLayer; });
  2219. __webpack_require__.d(__webpack_exports__, "RangeTheme3DLayer", function() { return /* reexport */ RangeTheme3DLayer_RangeTheme3DLayer; });
  2220. __webpack_require__.d(__webpack_exports__, "Range", function() { return /* reexport */ RangeThemeLayer_Range; });
  2221. __webpack_require__.d(__webpack_exports__, "RankSymbol", function() { return /* reexport */ RankSymbolThemeLayer_RankSymbol; });
  2222. __webpack_require__.d(__webpack_exports__, "UniqueTheme3DLayer", function() { return /* reexport */ UniqueTheme3DLayer_UniqueTheme3DLayer; });
  2223. __webpack_require__.d(__webpack_exports__, "Unique", function() { return /* reexport */ UniqueThemeLayer_Unique; });
  2224. __webpack_require__.d(__webpack_exports__, "GraphicLayer", function() { return /* reexport */ GraphicLayer_GraphicLayer; });
  2225. __webpack_require__.d(__webpack_exports__, "ThreeLayer", function() { return /* reexport */ ThreeLayer_ThreeLayer; });
  2226. __webpack_require__.d(__webpack_exports__, "HeatMapLayer", function() { return /* reexport */ HeatMapLayer_HeatMapLayer; });
  2227. __webpack_require__.d(__webpack_exports__, "DeckglLayer", function() { return /* reexport */ DeckglLayer_DeckglLayer; });
  2228. __webpack_require__.d(__webpack_exports__, "Graphic", function() { return /* reexport */ Graphic_Graphic; });
  2229. __webpack_require__.d(__webpack_exports__, "MapvDataSet", function() { return /* reexport */ MapvDataSet; });
  2230. __webpack_require__.d(__webpack_exports__, "MapvRenderer", function() { return /* reexport */ MapvRenderer_MapvRenderer; });
  2231. __webpack_require__.d(__webpack_exports__, "getDefaultVectorTileStyle", function() { return /* reexport */ getDefaultVectorTileStyle; });
  2232. __webpack_require__.d(__webpack_exports__, "setBackground", function() { return /* reexport */ setBackground; });
  2233. __webpack_require__.d(__webpack_exports__, "setPaintProperty", function() { return /* reexport */ setPaintProperty; });
  2234. __webpack_require__.d(__webpack_exports__, "GeoFeature", function() { return /* reexport */ GeoFeatureThemeLayer_GeoFeature; });
  2235. __webpack_require__.d(__webpack_exports__, "Theme3DLayer", function() { return /* reexport */ Theme3DLayer; });
  2236. __webpack_require__.d(__webpack_exports__, "ThemeFeature", function() { return /* reexport */ ThemeFeature_ThemeFeature; });
  2237. __webpack_require__.d(__webpack_exports__, "ThemeLayer", function() { return /* reexport */ ThemeLayer_Theme; });
  2238. __webpack_require__.d(__webpack_exports__, "ThreeLayerRenderer", function() { return /* reexport */ ThreeLayerRenderer_ThreeLayerRenderer; });
  2239. __webpack_require__.d(__webpack_exports__, "Transform", function() { return /* reexport */ Transform; });
  2240. __webpack_require__.d(__webpack_exports__, "AddressMatchService", function() { return /* reexport */ services_AddressMatchService_AddressMatchService; });
  2241. __webpack_require__.d(__webpack_exports__, "ChartService", function() { return /* reexport */ ChartService_ChartService; });
  2242. __webpack_require__.d(__webpack_exports__, "DataFlowService", function() { return /* reexport */ services_DataFlowService_DataFlowService; });
  2243. __webpack_require__.d(__webpack_exports__, "FeatureService", function() { return /* reexport */ FeatureService_FeatureService; });
  2244. __webpack_require__.d(__webpack_exports__, "FieldService", function() { return /* reexport */ FieldService_FieldService; });
  2245. __webpack_require__.d(__webpack_exports__, "GridCellInfosService", function() { return /* reexport */ GridCellInfosService_GridCellInfosService; });
  2246. __webpack_require__.d(__webpack_exports__, "GeoprocessingService", function() { return /* reexport */ services_GeoprocessingService_GeoprocessingService; });
  2247. __webpack_require__.d(__webpack_exports__, "LayerInfoService", function() { return /* reexport */ LayerInfoService_LayerInfoService; });
  2248. __webpack_require__.d(__webpack_exports__, "MapService", function() { return /* reexport */ services_MapService_MapService; });
  2249. __webpack_require__.d(__webpack_exports__, "MeasureService", function() { return /* reexport */ services_MeasureService_MeasureService; });
  2250. __webpack_require__.d(__webpack_exports__, "NetworkAnalystService", function() { return /* reexport */ NetworkAnalystService_NetworkAnalystService; });
  2251. __webpack_require__.d(__webpack_exports__, "NetworkAnalyst3DService", function() { return /* reexport */ NetworkAnalyst3DService_NetworkAnalyst3DService; });
  2252. __webpack_require__.d(__webpack_exports__, "ProcessingService", function() { return /* reexport */ ProcessingService_ProcessingService; });
  2253. __webpack_require__.d(__webpack_exports__, "QueryService", function() { return /* reexport */ services_QueryService_QueryService; });
  2254. __webpack_require__.d(__webpack_exports__, "ServiceBase", function() { return /* reexport */ ServiceBase_ServiceBase; });
  2255. __webpack_require__.d(__webpack_exports__, "SpatialAnalystService", function() { return /* reexport */ SpatialAnalystService_SpatialAnalystService; });
  2256. __webpack_require__.d(__webpack_exports__, "ThemeService", function() { return /* reexport */ services_ThemeService_ThemeService; });
  2257. __webpack_require__.d(__webpack_exports__, "TrafficTransferAnalystService", function() { return /* reexport */ TrafficTransferAnalystService_TrafficTransferAnalystService; });
  2258. __webpack_require__.d(__webpack_exports__, "WebPrintingJobService", function() { return /* reexport */ WebPrintingJobService_WebPrintingJobService; });
  2259. __webpack_require__.d(__webpack_exports__, "WebMap", function() { return /* reexport */ WebMap_WebMap; });
  2260. // CONCATENATED MODULE: ./src/common/SuperMap.js
  2261. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  2262. * This program are made available under the terms of the Apache License, Version 2.0
  2263. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2264. var SuperMap = window.SuperMap = window.SuperMap || {};
  2265. SuperMap.Components = window.SuperMap.Components || {};
  2266. // CONCATENATED MODULE: ./src/common/REST.js
  2267. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  2268. * This program are made available under the terms of the Apache License, Version 2.0
  2269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2270. /**
  2271. * @enum DataFormat
  2272. * @memberOf SuperMap
  2273. * @description 服务请求返回结果数据类型
  2274. * @type {string}
  2275. */
  2276. var DataFormat = SuperMap.DataFormat = {
  2277. /** GEOJSON */
  2278. GEOJSON: "GEOJSON",
  2279. /** ISERVER */
  2280. ISERVER: "ISERVER"
  2281. };
  2282. /**
  2283. * @enum ServerType
  2284. * @memberOf SuperMap
  2285. * @description 服务器类型
  2286. * @type {string}
  2287. */
  2288. var ServerType = SuperMap.ServerType = {
  2289. /** ISERVER */
  2290. ISERVER: "ISERVER",
  2291. /** IPORTAL */
  2292. IPORTAL: "IPORTAL",
  2293. /** ONLINE */
  2294. ONLINE: "ONLINE"
  2295. };
  2296. /**
  2297. * @enum GeometryType
  2298. * @memberOf SuperMap
  2299. * @description 几何对象枚举,定义了一系列几何对象类型。
  2300. * @type {string}
  2301. */
  2302. var GeometryType = SuperMap.GeometryType = {
  2303. /** LINE */
  2304. LINE: "LINE",
  2305. /** LINEM */
  2306. LINEM: "LINEM",
  2307. /** POINT */
  2308. POINT: "POINT",
  2309. /** REGION */
  2310. REGION: "REGION",
  2311. /** POINTEPS */
  2312. POINTEPS: "POINTEPS",
  2313. /** LINEEPS */
  2314. LINEEPS: "LINEEPS",
  2315. /** REGIONEPS */
  2316. REGIONEPS: "REGIONEPS",
  2317. /** ELLIPSE */
  2318. ELLIPSE: "ELLIPSE",
  2319. /** CIRCLE */
  2320. CIRCLE: "CIRCLE",
  2321. /** TEXT */
  2322. TEXT: "TEXT",
  2323. /** RECTANGLE */
  2324. RECTANGLE: "RECTANGLE",
  2325. /** UNKNOWN */
  2326. UNKNOWN: "UNKNOWN",
  2327. /** GEOCOMPOUND */
  2328. GEOCOMPOUND:"GEOCOMPOUND"
  2329. };
  2330. /**
  2331. * @enum QueryOption
  2332. * @memberOf SuperMap
  2333. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  2334. * @type {string}
  2335. */
  2336. var QueryOption = SuperMap.QueryOption = {
  2337. /** 属性 */
  2338. ATTRIBUTE: "ATTRIBUTE",
  2339. /** 属性和几何对象 */
  2340. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  2341. /** 几何对象 */
  2342. GEOMETRY: "GEOMETRY"
  2343. };
  2344. /**
  2345. * @enum JoinType
  2346. * @memberOf SuperMap
  2347. * @description 关联查询时的关联类型常量。
  2348. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  2349. * @type {string}
  2350. */
  2351. var JoinType = SuperMap.JoinType = {
  2352. /** INNERJOIN */
  2353. INNERJOIN: "INNERJOIN",
  2354. /** LEFTJOIN */
  2355. LEFTJOIN: "LEFTJOIN"
  2356. };
  2357. /**
  2358. * @enum SpatialQueryMode
  2359. * @memberOf SuperMap
  2360. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  2361. * @type {string}
  2362. */
  2363. var SpatialQueryMode = SuperMap.SpatialQueryMode = {
  2364. /** 包含空间查询模式 */
  2365. CONTAIN: "CONTAIN",
  2366. /** 交叉空间查询模式 */
  2367. CROSS: "CROSS",
  2368. /** 分离空间查询模式 */
  2369. DISJOINT: "DISJOINT",
  2370. /** 重合空间查询模式 */
  2371. IDENTITY: "IDENTITY",
  2372. /** 相交空间查询模式 */
  2373. INTERSECT: "INTERSECT",
  2374. /** 无空间查询 */
  2375. NONE: "NONE",
  2376. /** 叠加空间查询模式 */
  2377. OVERLAP: "OVERLAP",
  2378. /** 邻接空间查询模式 */
  2379. TOUCH: "TOUCH",
  2380. /** 被包含空间查询模式 */
  2381. WITHIN: "WITHIN"
  2382. };
  2383. /**
  2384. * @enum SpatialRelationType
  2385. * @memberOf SuperMap
  2386. * @description 数据集对象间的空间关系枚举。
  2387. * 该类定义了数据集对象间的空间关系类型常量。
  2388. * @type {string}
  2389. */
  2390. var SpatialRelationType = SuperMap.SpatialRelationType = {
  2391. /** 包含关系 */
  2392. CONTAIN: "CONTAIN",
  2393. /** 相交关系 */
  2394. INTERSECT: "INTERSECT",
  2395. /** 被包含关系 */
  2396. WITHIN: "WITHIN"
  2397. };
  2398. /**
  2399. * @enum MeasureMode
  2400. * @memberOf SuperMap
  2401. * @type {string}
  2402. * @description 量算模式枚举。
  2403. * 该类定义了两种测量模式:距离测量和面积测量。
  2404. */
  2405. var MeasureMode = SuperMap.MeasureMode = {
  2406. /** 距离测量 */
  2407. DISTANCE: "DISTANCE",
  2408. /** 面积测量 */
  2409. AREA: "AREA"
  2410. };
  2411. /**
  2412. * @enum Unit
  2413. * @memberOf SuperMap
  2414. * @description 距离单位枚举。
  2415. * 该类定义了一系列距离单位类型。
  2416. * @type {string}
  2417. */
  2418. var Unit = SuperMap.Unit = {
  2419. /** 米 */
  2420. METER: "METER",
  2421. /** 千米 */
  2422. KILOMETER: "KILOMETER",
  2423. /** 英里 */
  2424. MILE: "MILE",
  2425. /** 码 */
  2426. YARD: "YARD",
  2427. /** 度 */
  2428. DEGREE: "DEGREE",
  2429. /** 毫米 */
  2430. MILLIMETER: "MILLIMETER",
  2431. /** 厘米 */
  2432. CENTIMETER: "CENTIMETER",
  2433. /** 英寸 */
  2434. INCH: "INCH",
  2435. /** 分米 */
  2436. DECIMETER: "DECIMETER",
  2437. /** 英尺 */
  2438. FOOT: "FOOT",
  2439. /** 秒 */
  2440. SECOND: "SECOND",
  2441. /** 分 */
  2442. MINUTE: "MINUTE",
  2443. /** 弧度 */
  2444. RADIAN: "RADIAN"
  2445. };
  2446. /**
  2447. * @enum BufferRadiusUnit
  2448. * @memberOf SuperMap
  2449. * @description 缓冲区距离单位枚举。
  2450. * 该类定义了一系列缓冲距离单位类型。
  2451. * @type {string}
  2452. */
  2453. var BufferRadiusUnit = SuperMap.BufferRadiusUnit = {
  2454. /** 厘米 */
  2455. CENTIMETER: "CENTIMETER",
  2456. /** 分米 */
  2457. DECIMETER: "DECIMETER",
  2458. /** 英尺 */
  2459. FOOT: "FOOT",
  2460. /** 英寸 */
  2461. INCH: "INCH",
  2462. /** 千米 */
  2463. KILOMETER: "KILOMETER",
  2464. /** 米 */
  2465. METER: "METER",
  2466. /** 英里 */
  2467. MILE: "MILE",
  2468. /** 毫米 */
  2469. MILLIMETER: "MILLIMETER",
  2470. /** 码 */
  2471. YARD: "YARD"
  2472. }
  2473. /**
  2474. * @enum EngineType
  2475. * @memberOf SuperMap
  2476. * @description 数据源引擎类型枚举。
  2477. * @type {string}
  2478. */
  2479. var EngineType = SuperMap.EngineType = {
  2480. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  2481. IMAGEPLUGINS: "IMAGEPLUGINS",
  2482. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  2483. OGC: "OGC",
  2484. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  2485. ORACLEPLUS: "ORACLEPLUS",
  2486. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  2487. SDBPLUS: "SDBPLUS",
  2488. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
  2489. SQLPLUS: "SQLPLUS",
  2490. /** UDB 引擎类型,文件引擎。 */
  2491. UDB: "UDB"
  2492. };
  2493. /**
  2494. * @enum ThemeGraphTextFormat
  2495. * @memberOf SuperMap
  2496. * @description 统计专题图文本显示格式枚举。
  2497. * @type {string}
  2498. */
  2499. var ThemeGraphTextFormat = SuperMap.ThemeGraphTextFormat = {
  2500. /** 标题。以各子项的标题来进行标注。 */
  2501. CAPTION: "CAPTION",
  2502. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  2503. CAPTION_PERCENT: "CAPTION_PERCENT",
  2504. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  2505. CAPTION_VALUE: "CAPTION_VALUE",
  2506. /** 百分数。以各子项所占的百分比来进行标注。 */
  2507. PERCENT: "PERCENT",
  2508. /** 实际数值。以各子项的真实数值来进行标注。 */
  2509. VALUE: "VALUE"
  2510. };
  2511. /**
  2512. * @enum ThemeGraphType
  2513. * @memberOf SuperMap
  2514. * @description 统计专题图类型枚举。
  2515. * @type {string}
  2516. */
  2517. var ThemeGraphType = SuperMap.ThemeGraphType = {
  2518. /** 面积图。 */
  2519. AREA: "AREA",
  2520. /** 柱状图。 */
  2521. BAR: "BAR",
  2522. /** 三维柱状图。 */
  2523. BAR3D: "BAR3D",
  2524. /** 折线图。 */
  2525. LINE: "LINE",
  2526. /** 饼图。 */
  2527. PIE: "PIE",
  2528. /** 三维饼图。 */
  2529. PIE3D: "PIE3D",
  2530. /** 点状图。 */
  2531. POINT: "POINT",
  2532. /** 环状图。 */
  2533. RING: "RING",
  2534. /** 玫瑰图。 */
  2535. ROSE: "ROSE",
  2536. /** 三维玫瑰图。 */
  2537. ROSE3D: "ROSE3D",
  2538. /** 堆叠柱状图。 */
  2539. STACK_BAR: "STACK_BAR",
  2540. /** 三维堆叠柱状图。 */
  2541. STACK_BAR3D: "STACK_BAR3D",
  2542. /** 阶梯图。 */
  2543. STEP: "STEP"
  2544. };
  2545. /**
  2546. * @enum GraphAxesTextDisplayMode
  2547. * @memberOf SuperMap
  2548. * @description 统计专题图坐标轴文本显示模式。
  2549. * @type {string}
  2550. */
  2551. var GraphAxesTextDisplayMode = SuperMap.GraphAxesTextDisplayMode = {
  2552. /** 显示全部文本。 */
  2553. ALL: "ALL",
  2554. /** 不显示。 */
  2555. NONE: "NONE",
  2556. /** 显示Y轴的文本。 */
  2557. YAXES: "YAXES"
  2558. };
  2559. /**
  2560. * @enum GraduatedMode
  2561. * @memberOf SuperMap
  2562. * @description 专题图分级模式枚举。
  2563. *
  2564. * @type {string}
  2565. */
  2566. var GraduatedMode = SuperMap.GraduatedMode = {
  2567. /** 常量分级模式。 */
  2568. CONSTANT: "CONSTANT",
  2569. /** 对数分级模式。 */
  2570. LOGARITHM: "LOGARITHM",
  2571. /** 平方根分级模式。 */
  2572. SQUAREROOT: "SQUAREROOT"
  2573. };
  2574. /**
  2575. * @enum RangeMode
  2576. * @memberOf SuperMap
  2577. * @description 范围分段专题图分段方式枚举。
  2578. * @type {string}
  2579. */
  2580. var RangeMode = SuperMap.RangeMode = {
  2581. /** 自定义分段法。 */
  2582. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  2583. /** 等距离分段法。 */
  2584. EQUALINTERVAL: "EQUALINTERVAL",
  2585. /** 对数分段法。 */
  2586. LOGARITHM: "LOGARITHM",
  2587. /** 等计数分段法。 */
  2588. QUANTILE: "QUANTILE",
  2589. /** 平方根分段法。 */
  2590. SQUAREROOT: "SQUAREROOT",
  2591. /** 标准差分段法。 */
  2592. STDDEVIATION: "STDDEVIATION"
  2593. };
  2594. /**
  2595. * @enum ThemeType
  2596. * @memberOf SuperMap
  2597. * @description 专题图类型枚举。
  2598. * @type {string}
  2599. */
  2600. var ThemeType = SuperMap.ThemeType = {
  2601. /** 点密度专题图。 */
  2602. DOTDENSITY: "DOTDENSITY",
  2603. /** 等级符号专题图。 */
  2604. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  2605. /** 统计专题图。 */
  2606. GRAPH: "GRAPH",
  2607. /** 标签专题图。 */
  2608. LABEL: "LABEL",
  2609. /** 分段专题图。 */
  2610. RANGE: "RANGE",
  2611. /** 単值专题图。 */
  2612. UNIQUE: "UNIQUE"
  2613. };
  2614. /**
  2615. * @enum ColorGradientType
  2616. * @memberOf SuperMap
  2617. * @description 渐变颜色枚举。
  2618. * @type {string}
  2619. */
  2620. var ColorGradientType = SuperMap.ColorGradientType = {
  2621. /** 黑白渐变色。 */
  2622. BLACK_WHITE: "BLACKWHITE",
  2623. /** 蓝黑渐变色。 */
  2624. BLUE_BLACK: "BLUEBLACK",
  2625. /** 蓝红渐变色。 */
  2626. BLUE_RED: "BLUERED",
  2627. /** 蓝白渐变色。 */
  2628. BLUE_WHITE: "BLUEWHITE",
  2629. /** 青黑渐变色。 */
  2630. CYAN_BLACK: "CYANBLACK",
  2631. /** 青蓝渐变色。 */
  2632. CYAN_BLUE: "CYANBLUE",
  2633. /** 青绿渐变色。 */
  2634. CYAN_GREEN: "CYANGREEN",
  2635. /** 青白渐变色。 */
  2636. CYAN_WHITE: "CYANWHITE",
  2637. /** 绿黑渐变色。 */
  2638. GREEN_BLACK: "GREENBLACK",
  2639. /** 绿蓝渐变色。 */
  2640. GREEN_BLUE: "GREENBLUE",
  2641. /** 绿橙紫渐变色。 */
  2642. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  2643. /** 绿红渐变色。 */
  2644. GREEN_RED: "GREENRED",
  2645. /** 蓝红渐变色。 */
  2646. GREEN_WHITE: "GREENWHITE",
  2647. /** 粉黑渐变色。 */
  2648. PINK_BLACK: "PINKBLACK",
  2649. /** 粉蓝渐变色。 */
  2650. PINK_BLUE: "PINKBLUE",
  2651. /** 粉红渐变色。 */
  2652. PINK_RED: "PINKRED",
  2653. /** 粉白渐变色。 */
  2654. PINK_WHITE: "PINKWHITE",
  2655. /** 彩虹色。 */
  2656. RAIN_BOW: "RAINBOW",
  2657. /** 红黑渐变色。 */
  2658. RED_BLACK: "REDBLACK",
  2659. /** 红白渐变色。 */
  2660. RED_WHITE: "REDWHITE",
  2661. /** 光谱渐变。 */
  2662. SPECTRUM: "SPECTRUM",
  2663. /** 地形渐变,用于三维显示效果较好。 */
  2664. TERRAIN: "TERRAIN",
  2665. /** 黄黑渐变色。 */
  2666. YELLOW_BLACK: "YELLOWBLACK",
  2667. /** 黄蓝渐变色。 */
  2668. YELLOW_BLUE: "YELLOWBLUE",
  2669. /** 黄绿渐变色。 */
  2670. YELLOW_GREEN: "YELLOWGREEN",
  2671. /** 黄红渐变色。 */
  2672. YELLOW_RED: "YELLOWRED",
  2673. /** 黄白渐变色。 */
  2674. YELLOW_WHITE: "YELLOWWHITE"
  2675. };
  2676. /**
  2677. * @enum TextAlignment
  2678. * @memberOf SuperMap
  2679. * @description 文本对齐枚举。
  2680. * @type {string}
  2681. */
  2682. var TextAlignment = SuperMap.TextAlignment = {
  2683. /** 左上角对齐。 */
  2684. TOPLEFT: "TOPLEFT",
  2685. /** 顶部居中对齐。 */
  2686. TOPCENTER: "TOPCENTER",
  2687. /** 右上角对齐。 */
  2688. TOPRIGHT: "TOPRIGHT",
  2689. /** 基准线左对齐。 */
  2690. BASELINELEFT: "BASELINELEFT",
  2691. /** 基准线居中对齐。 */
  2692. BASELINECENTER: "BASELINECENTER",
  2693. /** 基准线右对齐。 */
  2694. BASELINERIGHT: "BASELINERIGHT",
  2695. /** 左下角对齐。 */
  2696. BOTTOMLEFT: "BOTTOMLEFT",
  2697. /** 底部居中对齐。 */
  2698. BOTTOMCENTER: "BOTTOMCENTER",
  2699. /** 右下角对齐。 */
  2700. BOTTOMRIGHT: "BOTTOMRIGHT",
  2701. /** 左中对齐。 */
  2702. MIDDLELEFT: "MIDDLELEFT",
  2703. /** 中心对齐。 */
  2704. MIDDLECENTER: "MIDDLECENTER",
  2705. /** 右中对齐。 */
  2706. MIDDLERIGHT: "MIDDLERIGHT"
  2707. };
  2708. /**
  2709. * @enum FillGradientMode
  2710. * @memberOf SuperMap
  2711. * @description 渐变填充风格的渐变类型枚举。
  2712. * @type {string}
  2713. */
  2714. var FillGradientMode = SuperMap.FillGradientMode = {
  2715. /** 无渐变。 */
  2716. NONE: "NONE",
  2717. /** 线性渐变填充。 */
  2718. LINEAR: "LINEAR",
  2719. /** 辐射渐变填充。 */
  2720. RADIAL: "RADIAL",
  2721. /** 圆锥渐变填充。 */
  2722. CONICAL: "CONICAL",
  2723. /** 四角渐变填充。 */
  2724. SQUARE: "SQUARE"
  2725. };
  2726. /**
  2727. * @enum AlongLineDirection
  2728. * @memberOf SuperMap
  2729. * @description 标签沿线标注方向枚举。
  2730. * @type {string}
  2731. */
  2732. var AlongLineDirection = SuperMap.AlongLineDirection = {
  2733. /** 沿线的法线方向放置标签。 */
  2734. NORMAL: "ALONG_LINE_NORMAL",
  2735. /** 从下到上,从左到右放置。 */
  2736. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  2737. /** 从上到下,从左到右放置。 */
  2738. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  2739. /** 从下到上,从右到左放置。 */
  2740. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  2741. /** 从上到下,从右到左放置。 */
  2742. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  2743. };
  2744. /**
  2745. * @enum LabelBackShape
  2746. * @memberOf SuperMap
  2747. * @description 标签专题图中标签背景的形状枚举。
  2748. * @type {string}
  2749. */
  2750. var LabelBackShape = SuperMap.LabelBackShape = {
  2751. /** 菱形背景,即标签背景的形状为菱形。 */
  2752. DIAMOND: "DIAMOND",
  2753. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  2754. ELLIPSE: "ELLIPSE",
  2755. /** 符号背景,即标签背景的形状为设定的符号。 */
  2756. MARKER: "MARKER",
  2757. /** 空背景,即不使用任何形状作为标签的背景。 */
  2758. NONE: "NONE",
  2759. /** 矩形背景,即标签背景的形状为矩形。 */
  2760. RECT: "RECT",
  2761. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  2762. ROUNDRECT: "ROUNDRECT",
  2763. /** 三角形背景,即标签背景的形状为三角形。 */
  2764. TRIANGLE: "TRIANGLE"
  2765. };
  2766. /**
  2767. * @enum LabelOverLengthMode
  2768. * @memberOf SuperMap
  2769. * @description 标签专题图中超长标签的处理模式枚举。
  2770. * @type {string}
  2771. */
  2772. var LabelOverLengthMode = SuperMap.LabelOverLengthMode = {
  2773. /** 换行显示。 */
  2774. NEWLINE: "NEWLINE",
  2775. /** 对超长标签不进行处理。 */
  2776. NONE: "NONE",
  2777. /** 省略超出部分。 */
  2778. OMIT: "OMIT"
  2779. };
  2780. /**
  2781. * @enum DirectionType
  2782. * @memberOf SuperMap
  2783. * @description 网络分析中方向枚举。
  2784. * 在行驶引导子项中使用。
  2785. * @type {string}
  2786. */
  2787. var DirectionType = SuperMap.DirectionType = {
  2788. /** 东。 */
  2789. EAST: "EAST",
  2790. /** 无方向。 */
  2791. NONE: "NONE",
  2792. /** 北。 */
  2793. NORTH: "NORTH",
  2794. /** 南。 */
  2795. SOURTH: "SOURTH",
  2796. /** 西。 */
  2797. WEST: "WEST"
  2798. };
  2799. /**
  2800. * @enum SideType
  2801. * @memberOf SuperMap
  2802. * @description 行驶位置枚举。
  2803. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  2804. * @type {string}
  2805. */
  2806. var SideType = SuperMap.SideType = {
  2807. /** 路的左侧。 */
  2808. LEFT: "LEFT",
  2809. /** 在路上(即路的中间)。 */
  2810. MIDDLE: "MIDDLE",
  2811. /** 无效值。 */
  2812. NONE: "NONE",
  2813. /** 路的右侧。 */
  2814. RIGHT: "RIGHT"
  2815. };
  2816. /**
  2817. * @enum SupplyCenterType
  2818. * @memberOf SuperMap
  2819. * @description 资源供给中心类型枚举。
  2820. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  2821. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  2822. * @type {string}
  2823. */
  2824. var SupplyCenterType = SuperMap.SupplyCenterType = {
  2825. /** 固定中心点。 */
  2826. FIXEDCENTER: "FIXEDCENTER",
  2827. /** 非中心点。 */
  2828. NULL: "NULL",
  2829. /** 可选中心点。 */
  2830. OPTIONALCENTER: "OPTIONALCENTER"
  2831. };
  2832. /**
  2833. * @enum TurnType
  2834. * @memberOf SuperMap
  2835. * @description 转弯方向枚举。
  2836. * 用在行驶引导子项类中,表示转弯的方向。
  2837. * @type {string}
  2838. */
  2839. var TurnType = SuperMap.TurnType = {
  2840. /** 向前直行。 */
  2841. AHEAD: "AHEAD",
  2842. /** 掉头。 */
  2843. BACK: "BACK",
  2844. /** 终点,不拐弯。 */
  2845. END: "END",
  2846. /** 左转弯。 */
  2847. LEFT: "LEFT",
  2848. /** 无效值。 */
  2849. NONE: "NONE",
  2850. /** 右转弯。 */
  2851. RIGHT: "RIGHT"
  2852. };
  2853. /**
  2854. * @enum BufferEndType
  2855. * @memberOf SuperMap
  2856. * @description 缓冲区分析BufferEnd类型。
  2857. * @type {string}
  2858. */
  2859. var BufferEndType = SuperMap.BufferEndType = {
  2860. /** FLAT */
  2861. FLAT: "FLAT",
  2862. /** ROUND */
  2863. ROUND: "ROUND"
  2864. };
  2865. /**
  2866. * @enum OverlayOperationType
  2867. * @memberOf SuperMap
  2868. * @description 叠加分析类型枚举。
  2869. * @type {string}
  2870. */
  2871. var OverlayOperationType = SuperMap.OverlayOperationType = {
  2872. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  2873. CLIP: "CLIP",
  2874. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  2875. ERASE: "ERASE",
  2876. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  2877. IDENTITY: "IDENTITY",
  2878. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  2879. INTERSECT: "INTERSECT",
  2880. /** 对两个面数据集(几何对象)进行合并操作。 */
  2881. UNION: "UNION",
  2882. /** 对两个面数据集(几何对象)进行更新操作。 */
  2883. UPDATE: "UPDATE",
  2884. /** 对两个面数据集(几何对象)进行对称差操作。 */
  2885. XOR: "XOR"
  2886. };
  2887. /**
  2888. * @enum OutputType
  2889. * @memberOf SuperMap
  2890. * @description 分布式分析输出类型枚举。
  2891. * @type {string}
  2892. */
  2893. var OutputType = SuperMap.OutputType = {
  2894. /** INDEXEDHDFS */
  2895. INDEXEDHDFS: "INDEXEDHDFS",
  2896. /** UDB */
  2897. UDB: "UDB",
  2898. /** MONGODB */
  2899. MONGODB: "MONGODB",
  2900. /** PG */
  2901. PG: "PG"
  2902. };
  2903. /**
  2904. * @enum SmoothMethod
  2905. * @memberOf SuperMap
  2906. * @description 光滑方法枚举。
  2907. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  2908. * @type {string}
  2909. */
  2910. var SmoothMethod = SuperMap.SmoothMethod = {
  2911. /** B 样条法。 */
  2912. BSPLINE: "BSPLINE",
  2913. /** 磨角法。 */
  2914. POLISH: "POLISH"
  2915. };
  2916. /**
  2917. * @enum SurfaceAnalystMethod
  2918. * @memberOf SuperMap
  2919. * @description 表面分析方法枚举。
  2920. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  2921. * @type {string}
  2922. */
  2923. var SurfaceAnalystMethod = SuperMap.SurfaceAnalystMethod = {
  2924. /** 等值线提取。 */
  2925. ISOLINE: "ISOLINE",
  2926. /** 等值面提取。 */
  2927. ISOREGION: "ISOREGION"
  2928. };
  2929. /**
  2930. * @enum DataReturnMode
  2931. * @memberOf SuperMap
  2932. * @description 数据返回模式枚举。
  2933. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  2934. * @type {string}
  2935. */
  2936. var DataReturnMode = SuperMap.DataReturnMode = {
  2937. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  2938. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  2939. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  2940. DATASET_ONLY: "DATASET_ONLY",
  2941. /** 只返回记录集(RecordSet)。 */
  2942. RECORDSET_ONLY: "RECORDSET_ONLY"
  2943. };
  2944. /**
  2945. * @enum EditType
  2946. * @memberOf SuperMap
  2947. * @description 要素集更新模式枚举。
  2948. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  2949. * @type {string}
  2950. */
  2951. var EditType = SuperMap.EditType = {
  2952. /** 增加操作。 */
  2953. ADD: "add",
  2954. /** 修改操作。 */
  2955. UPDATE: "update",
  2956. /** 删除操作。 */
  2957. DELETE: "delete"
  2958. };
  2959. /**
  2960. * @enum TransferTactic
  2961. * @memberOf SuperMap
  2962. * @description 公交换乘策略枚举。
  2963. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  2964. * @type {string}
  2965. */
  2966. var TransferTactic = SuperMap.TransferTactic = {
  2967. /** 时间短。 */
  2968. LESS_TIME: "LESS_TIME",
  2969. /** 少换乘。 */
  2970. LESS_TRANSFER: "LESS_TRANSFER",
  2971. /** 少步行。 */
  2972. LESS_WALK: "LESS_WALK",
  2973. /** 距离最短。 */
  2974. MIN_DISTANCE: "MIN_DISTANCE"
  2975. };
  2976. /**
  2977. * @enum TransferPreference
  2978. * @memberOf SuperMap
  2979. * @description 公交换乘策略枚举。
  2980. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  2981. * @type {string}
  2982. */
  2983. var TransferPreference = SuperMap.TransferPreference = {
  2984. /** 公交汽车优先。 */
  2985. BUS: "BUS",
  2986. /** 地铁优先。 */
  2987. SUBWAY: "SUBWAY",
  2988. /** 不乘坐地铁。 */
  2989. NO_SUBWAY: "NO_SUBWAY",
  2990. /** 无乘车偏好。 */
  2991. NONE: "NONE"
  2992. };
  2993. /**
  2994. * @enum GridType
  2995. * @memberOf SuperMap
  2996. * @description 地图背景格网类型枚举。
  2997. * @type {string}
  2998. */
  2999. var GridType = SuperMap.GridType = {
  3000. /** 十字叉丝。 */
  3001. CROSS: "CROSS",
  3002. /** 网格线。 */
  3003. GRID: "GRID",
  3004. /** 点。 */
  3005. POINT: "POINT"
  3006. };
  3007. /**
  3008. * @enum ColorSpaceType
  3009. * @memberOf SuperMap
  3010. * @description 色彩空间枚举。
  3011. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  3012. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  3013. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  3014. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  3015. * @type {string}
  3016. */
  3017. var ColorSpaceType = SuperMap.ColorSpaceType = {
  3018. /** 该类型主要在印刷系统使用。 */
  3019. CMYK: "CMYK",
  3020. /** 该类型主要在显示系统中使用。 */
  3021. RGB: "RGB"
  3022. };
  3023. /**
  3024. * @enum LayerType
  3025. * @memberOf SuperMap
  3026. * @description 图层类型。
  3027. * @type {string}
  3028. */
  3029. var LayerType = SuperMap.LayerType = {
  3030. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  3031. UGC: "UGC",
  3032. /** WMS 图层。 */
  3033. WMS: "WMS",
  3034. /** WFS 图层。 */
  3035. WFS: "WFS",
  3036. /** 自定义图层。 */
  3037. CUSTOM: "CUSTOM"
  3038. };
  3039. /**
  3040. * @enum UGCLayerType
  3041. * @memberOf SuperMap
  3042. * @description UGC图层类型。
  3043. * @type {string}
  3044. */
  3045. var UGCLayerType = SuperMap.UGCLayerType = {
  3046. /** 专题图层。 */
  3047. THEME: "THEME",
  3048. /** 矢量图层。 */
  3049. VECTOR: "VECTOR",
  3050. /** 栅格图层。。 */
  3051. GRID: "GRID",
  3052. /** 影像图层。 */
  3053. IMAGE: "IMAGE"
  3054. };
  3055. /**
  3056. * @enum StatisticMode
  3057. * @memberOf SuperMap
  3058. * @description 字段统计方法类型。
  3059. * @type {string}
  3060. */
  3061. var StatisticMode = SuperMap.StatisticMode = {
  3062. /** 统计所选字段的平均值。 */
  3063. AVERAGE: "AVERAGE",
  3064. /** 统计所选字段的最大值。 */
  3065. MAX: "MAX",
  3066. /** 统计所选字段的最小值。 */
  3067. MIN: "MIN",
  3068. /** 统计所选字段的标准差 */
  3069. STDDEVIATION: "STDDEVIATION",
  3070. /** 统计所选字段的总和。 */
  3071. SUM: "SUM",
  3072. /** 统计所选字段的方差。 */
  3073. VARIANCE: "VARIANCE"
  3074. };
  3075. /**
  3076. * @enum PixelFormat
  3077. * @memberOf SuperMap
  3078. * @description 栅格与影像数据存储的像素格式枚举。
  3079. * @type {string}
  3080. */
  3081. var PixelFormat = SuperMap.PixelFormat = {
  3082. /** 每个像元用16个比特(即2个字节)表示。 */
  3083. BIT16: "BIT16",
  3084. /** 每个像元用32个比特(即4个字节)表示。 */
  3085. BIT32: "BIT32",
  3086. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  3087. BIT64: "BIT64",
  3088. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  3089. SINGLE: "SINGLE",
  3090. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  3091. DOUBLE: "DOUBLE",
  3092. /** 每个像元用1个比特表示。 */
  3093. UBIT1: "UBIT1",
  3094. /** 每个像元用4个比特来表示。 */
  3095. UBIT4: "UBIT4",
  3096. /** 每个像元用8个比特(即1个字节)来表示。 */
  3097. UBIT8: "UBIT8",
  3098. /** 每个像元用24个比特(即3个字节)来表示。 */
  3099. UBIT24: "UBIT24",
  3100. /** 每个像元用32个比特(即4个字节)来表示。 */
  3101. UBIT32: "UBIT32"
  3102. };
  3103. /**
  3104. * @enum SearchMode
  3105. * @memberOf SuperMap
  3106. * @description 内插时使用的样本点的查找方式枚举
  3107. * @type {string}
  3108. */
  3109. var SearchMode = SuperMap.SearchMode = {
  3110. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  3111. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  3112. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  3113. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  3114. /** 不进行查找,使用所有的输入点进行内插分析。 */
  3115. NONE: "NONE",
  3116. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  3117. QUADTREE: "QUADTREE"
  3118. };
  3119. /**
  3120. * @enum InterpolationAlgorithmType
  3121. * @memberOf SuperMap
  3122. * @description 插值分析的算法的类型
  3123. * @type {string}
  3124. */
  3125. var InterpolationAlgorithmType = SuperMap.InterpolationAlgorithmType = {
  3126. /** 普通克吕金插值法。 */
  3127. KRIGING: "KRIGING",
  3128. /** 简单克吕金插值法。 */
  3129. SimpleKriging: "SimpleKriging",
  3130. /** 泛克吕金插值法。 */
  3131. UniversalKriging: "UniversalKriging"
  3132. };
  3133. /**
  3134. * @enum VariogramMode
  3135. * @memberOf SuperMap
  3136. * @description 克吕金(Kriging)插值时的半变函数类型枚举
  3137. * @type {string}
  3138. */
  3139. var VariogramMode = SuperMap.VariogramMode = {
  3140. /** 指数函数。 */
  3141. EXPONENTIAL: "EXPONENTIAL",
  3142. /** 高斯函数。 */
  3143. GAUSSIAN: "GAUSSIAN",
  3144. /** 球型函数。 */
  3145. SPHERICAL: "SPHERICAL"
  3146. };
  3147. /**
  3148. * @enum Exponent
  3149. * @memberOf SuperMap
  3150. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
  3151. * @type {string}
  3152. */
  3153. var Exponent = SuperMap.Exponent = {
  3154. /** 阶数为1。 */
  3155. EXP1: "EXP1",
  3156. /** 阶数为2。 */
  3157. EXP2: "EXP2"
  3158. };
  3159. /**
  3160. * @enum ClientType
  3161. * @memberOf SuperMap
  3162. * @description token申请的客户端标识类型
  3163. * @type {string}
  3164. */
  3165. var ClientType = SuperMap.ClientType = {
  3166. /** 指定的 IP 地址。 */
  3167. IP: "IP",
  3168. /** 指定的 URL。 */
  3169. REFERER: "Referer",
  3170. /** 发送申请令牌请求的客户端 IP。 */
  3171. REQUESTIP: "RequestIP",
  3172. /** 不做任何验证。 */
  3173. NONE: "NONE",
  3174. /** SERVER。 */
  3175. SERVER: "SERVER",
  3176. /** WEB。 */
  3177. WEB: "WEB"
  3178. };
  3179. /**
  3180. * @enum ChartType
  3181. * @memberOf SuperMap
  3182. * @description 客户端专题图图表类型
  3183. * @type {string}
  3184. */
  3185. var ChartType = SuperMap.ChartType = {
  3186. /** 柱状图。 */
  3187. BAR: "Bar",
  3188. /** 三维柱状图。 */
  3189. BAR3D: "Bar3D",
  3190. /** 圆形图。 */
  3191. CIRCLE: "Circle",
  3192. /** 饼图。 */
  3193. PIE: "Pie",
  3194. /** 散点图。 */
  3195. POINT: "Point",
  3196. /** 折线图。 */
  3197. LINE: "Line",
  3198. /** 环状图。 */
  3199. RING: "Ring"
  3200. };
  3201. /**
  3202. * @enum ClipAnalystMode
  3203. * @memberOf SuperMap
  3204. * @description 裁剪分析模式
  3205. * @type {string}
  3206. */
  3207. var ClipAnalystMode = SuperMap.ClipAnalystMode = {
  3208. /** CLIP。 */
  3209. CLIP: "clip",
  3210. /** INTERSECT。 */
  3211. INTERSECT: "intersect"
  3212. };
  3213. /**
  3214. * @enum AnalystAreaUnit
  3215. * @memberOf SuperMap
  3216. * @description 分布式分析面积单位
  3217. * @type {string}
  3218. */
  3219. var AnalystAreaUnit = SuperMap.AnalystAreaUnit = {
  3220. /** 平方米。 */
  3221. "SQUAREMETER": "SquareMeter",
  3222. /** 平方千米。 */
  3223. "SQUAREKILOMETER": "SquareKiloMeter",
  3224. /** 公顷。 */
  3225. "HECTARE": "Hectare",
  3226. /** 公亩。 */
  3227. "ARE": "Are",
  3228. /** 英亩。 */
  3229. "ACRE": "Acre",
  3230. /** 平方英尺。 */
  3231. "SQUAREFOOT": "SquareFoot",
  3232. /** 平方码。 */
  3233. "SQUAREYARD": "SquareYard",
  3234. /** 平方英里。 */
  3235. "SQUAREMILE": "SquareMile"
  3236. };
  3237. /**
  3238. * @enum AnalystSizeUnit
  3239. * @memberOf SuperMap
  3240. * @description 分布式分析单位
  3241. * @type {string}
  3242. */
  3243. var AnalystSizeUnit = SuperMap.AnalystSizeUnit = {
  3244. /** 米。 */
  3245. "METER": "Meter",
  3246. /** 千米。 */
  3247. "KILOMETER": "Kilometer",
  3248. /** 码。 */
  3249. "YARD": "Yard",
  3250. /** 英尺。 */
  3251. "FOOT": "Foot",
  3252. /** 英里。 */
  3253. "MILE": "Mile"
  3254. };
  3255. /**
  3256. * @enum StatisticAnalystMode
  3257. * @memberOf SuperMap
  3258. * @description 分布式分析统计模式
  3259. * @type {string}
  3260. */
  3261. var StatisticAnalystMode = SuperMap.StatisticAnalystMode = {
  3262. /** 统计所选字段的最大值。 */
  3263. "MAX": "max",
  3264. /** 统计所选字段的最小值。 */
  3265. "MIN": "min",
  3266. /** 统计所选字段的平均值。 */
  3267. "AVERAGE": "average",
  3268. /** 统计所选字段的总和。 */
  3269. "SUM": "sum",
  3270. /** 统计所选字段的方差。 */
  3271. "VARIANCE": "variance",
  3272. /** 统计所选字段的标准差 */
  3273. "STDDEVIATION": "stdDeviation"
  3274. };
  3275. /**
  3276. * @enum SummaryType
  3277. * @memberOf SuperMap
  3278. * @description 分布式分析聚合类型
  3279. * @type {string}
  3280. */
  3281. var SummaryType = SuperMap.SummaryType = {
  3282. /** 格网聚合。 */
  3283. "SUMMARYMESH": "SUMMARYMESH",
  3284. /** 多边形聚合。 */
  3285. "SUMMARYREGION": "SUMMARYREGION"
  3286. };
  3287. /**
  3288. * @enum TopologyValidatorRule
  3289. * @memberOf SuperMap
  3290. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  3291. * @type {string}
  3292. */
  3293. var TopologyValidatorRule = SuperMap.TopologyValidatorRule = {
  3294. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  3295. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  3296. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  3297. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  3298. /** 面被面包含,用于对面数据进行拓扑检查。 */
  3299. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  3300. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  3301. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  3302. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  3303. LINENOOVERLAP: "LINENOOVERLAP",
  3304. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  3305. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  3306. /** 点不相同,用于对点数据进行拓扑检查。 */
  3307. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  3308. };
  3309. /**
  3310. * @enum AggregationType
  3311. * @memberOf SuperMap
  3312. * @description 聚合查询枚举类,该类定义了Es数据服务中聚合查询模式常量
  3313. * @type {string}
  3314. */
  3315. var AggregationType = SuperMap.AggregationType = {
  3316. /** 格网聚合类型。 */
  3317. GEOHASH_GRID: "geohash_grid",
  3318. /** 过滤聚合类型。 */
  3319. FILTER: "filter"
  3320. };
  3321. /**
  3322. * @enum AggregationType
  3323. * @memberOf SuperMap
  3324. * @description 聚合查询中filter查询枚举类
  3325. * @type {string}
  3326. */
  3327. var AggregationQueryBuilderType = SuperMap.AggregationQueryBuilderType = {
  3328. /** 范围查询。 */
  3329. GEO_BOUNDING_BOX: "geo_bounding_box"
  3330. }
  3331. /**
  3332. * @enum GetFeatureMode
  3333. * @memberOf SuperMap
  3334. * @description feature 查询方式。
  3335. * @type {string}
  3336. */
  3337. var GetFeatureMode = SuperMap.GetFeatureMode = {
  3338. /** 通过范围查询来获取要素。 */
  3339. BOUNDS: "BOUNDS",
  3340. /** 通过几何对象的缓冲区来获取要素。 */
  3341. BUFFER: "BUFFER",
  3342. /** 通过 ID 来获取要素。 */
  3343. ID: "ID",
  3344. /** 通过空间查询模式来获取要素。 */
  3345. SPATIAL: "SPATIAL",
  3346. /** 通过 SQL 查询来获取要素。 */
  3347. SQL: 'SQL'
  3348. }
  3349. /**
  3350. * @enum RasterFunctionType
  3351. * @memberOf SuperMap
  3352. * @description 栅格分析方法。
  3353. * @type {string}
  3354. */
  3355. var RasterFunctionType = SuperMap.RasterFunctionType = {
  3356. /** 归一化植被指数。 */
  3357. NDVI: "NDVI",
  3358. /** 阴影面分析。 */
  3359. HILLSHADE: "HILLSHADE"
  3360. }
  3361. /**
  3362. * @enum ResourceType
  3363. * @memberOf SuperMap
  3364. * @description iportal资源类型。
  3365. * @version 10.0.1
  3366. * @type {string}
  3367. */
  3368. var ResourceType = SuperMap.ResourceType = {
  3369. /** 地图。 */
  3370. MAP: "MAP",
  3371. /** 服务。 */
  3372. SERVICE: "SERVICE",
  3373. /** 场景。 */
  3374. SCENE: "SCENE",
  3375. /** 数据。 */
  3376. DATA: "DATA",
  3377. /** 洞察。 */
  3378. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  3379. /** 大屏。 */
  3380. MAP_DASHBOARD: "MAP_DASHBOARD"
  3381. }
  3382. /**
  3383. * @enum OrderBy
  3384. * @memberOf SuperMap
  3385. * @description iportal资源排序字段。
  3386. * @version 10.0.1
  3387. * @type {string}
  3388. */
  3389. var OrderBy = SuperMap.OrderBy = {
  3390. /** 按更新时间排序 */
  3391. UPDATETIME: "UPDATETIME",
  3392. /** 按热度(可能是访问量、下载量)排序 */
  3393. HEATLEVEL: "HEATLEVEL",
  3394. /** 按相关性排序 */
  3395. RELEVANCE: "RELEVANCE"
  3396. }
  3397. /**
  3398. * @enum OrderType
  3399. * @memberOf SuperMap
  3400. * @description iportal资源升序还是降序过滤
  3401. * @version 10.0.1
  3402. * @type {string}
  3403. */
  3404. var OrderType = SuperMap.OrderType = {
  3405. /** 升序 */
  3406. ASC: "ASC",
  3407. /** 降序 */
  3408. DESC: "DESC"
  3409. }
  3410. /**
  3411. * @enum SearchType
  3412. * @memberOf SuperMap
  3413. * @description iportal资源查询的范围进行过滤
  3414. * @version 10.0.1
  3415. * @type {string}
  3416. */
  3417. var SearchType = SuperMap.SearchType = {
  3418. /** 公开资源。 */
  3419. PUBLIC: "PUBLIC",
  3420. /** 我的资源。 */
  3421. MY_RES: "MY_RES",
  3422. /** 我的群组资源。 */
  3423. MYGROUP_RES: "MYGROUP_RES",
  3424. /** 我的部门资源。 */
  3425. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  3426. /** 分享给我的资源。 */
  3427. SHARETOME_RES: "SHARETOME_RES"
  3428. }
  3429. /**
  3430. * @enum AggregationTypes
  3431. * @memberOf SuperMap
  3432. * @description iportal资源聚合查询的类型
  3433. * @version 10.0.1
  3434. * @type {string}
  3435. */
  3436. var AggregationTypes = SuperMap.AggregationTypes = {
  3437. /** 标签 */
  3438. TAG: "TAG",
  3439. /** 资源类型 */
  3440. TYPE: "TYPE"
  3441. }
  3442. /**
  3443. * @enum PermissionType
  3444. * @memberOf SuperMap
  3445. * @description iportal资源权限类型。
  3446. * @version 10.0.1
  3447. * @type {string}
  3448. */
  3449. var PermissionType = SuperMap.PermissionType = {
  3450. /** 可检索 */
  3451. SEARCH:"SEARCH",
  3452. /** 可查看 */
  3453. READ: "READ",
  3454. /** 可编辑 */
  3455. READWRITE: "READWRITE",
  3456. /** 可删除 */
  3457. DELETE: "DELETE",
  3458. /** 可下载,包括可读、可检索 */
  3459. DOWNLOAD:"DOWNLOAD"
  3460. }
  3461. /**
  3462. * @enum EntityType
  3463. * @memberOf SuperMap
  3464. * @description iportal资源实体类型。
  3465. * @version 10.0.1
  3466. * @type {string}
  3467. */
  3468. var EntityType = SuperMap.EntityType = {
  3469. /** 部门 */
  3470. DEPARTMENT: "DEPARTMENT",
  3471. /** 用户组 */
  3472. GROUP: "GROUP",
  3473. /** 群组 */
  3474. IPORTALGROUP: "IPORTALGROUP",
  3475. /** 角色 */
  3476. ROLE: "ROLE",
  3477. /** 用户 */
  3478. USER: "USER"
  3479. }
  3480. /**
  3481. * @enum DataItemType
  3482. * @memberOf SuperMap
  3483. * @description iportal数据类型。
  3484. * @version 10.0.1
  3485. * @type {string}
  3486. */
  3487. var DataItemType = SuperMap.DataItemType = {
  3488. /** 工作空间 sxwu, smwu, sxw, smw */
  3489. WORKSPACE: "WORKSPACE",
  3490. /** udb 数据源 */
  3491. UDB: "UDB",
  3492. /** shp空间数据 */
  3493. SHP: "SHP",
  3494. /** excel数据 */
  3495. EXCEL: "EXCEL",
  3496. /** csv数据 */
  3497. CSV: "CSV",
  3498. /** geojson数据。 */
  3499. GEOJSON: "GEOJSON",
  3500. /** smtiles */
  3501. SMTILES: "SMTILES",
  3502. /** svtiles */
  3503. SVTILES: "SVTILES",
  3504. /** mbtiles */
  3505. MBTILES: "MBTILES",
  3506. /** tpk */
  3507. TPK: "TPK",
  3508. /** ugc v5 */
  3509. UGCV5: "UGCV5",
  3510. /** UGCV5_MVT */
  3511. UGCV5_MVT: "UGCV5_MVT",
  3512. /** json数据 */
  3513. JSON: "JSON"
  3514. }
  3515. /**
  3516. * @enum WebExportFormatType
  3517. * @memberOf SuperMap
  3518. * @description Web 打印输出的格式。
  3519. * @version 10.0.1
  3520. * @type {string}
  3521. */
  3522. var WebExportFormatType = SuperMap.WebExportFormatType = {
  3523. /** png */
  3524. PNG: "PNG",
  3525. /** pdf */
  3526. PDF: "PDF"
  3527. }
  3528. /**
  3529. * @enum WebScaleOrientationType
  3530. * @memberOf SuperMap
  3531. * @description Web 比例尺的方位样式。
  3532. * @version 10.0.1
  3533. * @type {string}
  3534. */
  3535. var WebScaleOrientationType = SuperMap.WebScaleOrientationType = {
  3536. /** horizontal labels below */
  3537. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  3538. /** horizontal labels above */
  3539. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  3540. /** vertical labels left */
  3541. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  3542. /** vertical labels right */
  3543. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  3544. }
  3545. /**
  3546. * @enum WebScaleType
  3547. * @memberOf SuperMap
  3548. * @description Web 比例尺的样式。
  3549. * @version 10.0.1
  3550. * @type {string}
  3551. */
  3552. var WebScaleType = SuperMap.WebScaleType = {
  3553. /** line */
  3554. LINE: "LINE",
  3555. /** bar */
  3556. BAR: "BAR",
  3557. /** bar sub */
  3558. BAR_SUB: "BAR_SUB"
  3559. }
  3560. /**
  3561. * @enum WebScaleUnit
  3562. * @memberOf SuperMap
  3563. * @description Web 比例尺的单位制。
  3564. * @version 10.0.1
  3565. * @type {string}
  3566. */
  3567. var WebScaleUnit = SuperMap.WebScaleUnit = {
  3568. /** meter */
  3569. METER: "METER",
  3570. /** foot */
  3571. FOOT: "FOOT",
  3572. /** degrees */
  3573. DEGREES: "DEGREES"
  3574. }
  3575. // CONCATENATED MODULE: ./src/common/commontypes/Size.js
  3576. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  3577. * This program are made available under the terms of the Apache License, Version 2.0
  3578. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3579. /**
  3580. * @class SuperMap.Size
  3581. * @category BaseTypes Style
  3582. * @classdesc 此类描绘一对高宽值的实例。
  3583. * @param {number} [w=0.0] - 宽度。
  3584. * @param {number} [h=0.0] - 高度。
  3585. *
  3586. * @example
  3587. * var size = new SuperMap.Size(31,46);
  3588. */
  3589. class Size {
  3590. constructor(w, h) {
  3591. /**
  3592. * @member {number} [SuperMap.Size.prototype.w=0.0]
  3593. * @description 宽度。
  3594. */
  3595. this.w = w ? parseFloat(w) : 0.0;
  3596. /**
  3597. * @member {number} [SuperMap.Size.prototype.h=0.0]
  3598. * @description 高度。
  3599. */
  3600. this.h = w ? parseFloat(h) : 0.0;
  3601. this.CLASS_NAME = "SuperMap.Size";
  3602. }
  3603. /**
  3604. * @function SuperMap.Size.prototype.toString
  3605. * @description 返回此对象的字符串形式。
  3606. * @example
  3607. * var size = new SuperMap.Size(10,5);
  3608. * var str = size.toString();
  3609. * @returns {string} 例如:"w=10,h=5"。
  3610. */
  3611. toString() {
  3612. return ("w=" + this.w + ",h=" + this.h);
  3613. }
  3614. /**
  3615. * @function SuperMap.Size.prototype.clone
  3616. * @description 克隆当前size对象。
  3617. * @example
  3618. * var size = new SuperMap.Size(31,46);
  3619. * var size2 = size.clone();
  3620. * @returns {SuperMap.Size} 返回一个新的与当前 size 对象有相同宽、高的 Size 对象。
  3621. */
  3622. clone() {
  3623. return new Size(this.w, this.h);
  3624. }
  3625. /**
  3626. *
  3627. * @function SuperMap.Size.prototype.equals
  3628. * @description 比较两个 size 对象是否相等。
  3629. * @example
  3630. * var size = new SuperMap.Size(31,46);
  3631. * var size2 = new SuperMap.Size(31,46);
  3632. * var isEquals = size.equals(size2);
  3633. *
  3634. * @param {SuperMap.Size} sz - 用于比较相等的 Size 对象。
  3635. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  3636. *
  3637. */
  3638. equals(sz) {
  3639. var equals = false;
  3640. if (sz != null) {
  3641. equals = ((this.w === sz.w && this.h === sz.h) ||
  3642. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  3643. }
  3644. return equals;
  3645. }
  3646. /**
  3647. *
  3648. * @function SuperMap.Size.prototype.destroy
  3649. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  3650. * @example
  3651. * var size = new SuperMap.Size(31,46);
  3652. * size.destroy();
  3653. */
  3654. destroy() {
  3655. this.w = null;
  3656. this.h = null;
  3657. }
  3658. }
  3659. SuperMap.Size = Size;
  3660. // CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  3661. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  3662. * This program are made available under the terms of the Apache License, Version 2.0
  3663. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3664. /**
  3665. * @class SuperMap.Pixel
  3666. * @category BaseTypes Geometry
  3667. * @classdesc 此类用 x,y 坐标描绘屏幕坐标(像素点)。
  3668. * @param {number} [x=0.0] - x 坐标。
  3669. * @param {number} [y=0.0] - y 坐标。
  3670. * @param {SuperMap.Pixel.Mode} [mode=SuperMap.Pixel.Mode.LeftTop] - 坐标模式。
  3671. *
  3672. * @example
  3673. * //单独创建一个对象
  3674. * var pixcel = new SuperMap.Pixel(100,50);
  3675. *
  3676. * //依据 size 创建
  3677. * var size = new SuperMap.Size(21,25);
  3678. * var offset = new SuperMap.Pixel(-(size.w/2), -size.h);
  3679. */
  3680. class Pixel_Pixel {
  3681. constructor(x, y, mode) {
  3682. /**
  3683. * @member {number} [SuperMap.Pixel.prototype.x=0.0]
  3684. * @description x 坐标。
  3685. */
  3686. this.x = x ? parseFloat(x) : 0.0;
  3687. /**
  3688. * @member {number} [SuperMap.Pixel.prototype.y=0.0]
  3689. * @description y 坐标。
  3690. */
  3691. this.y = y ? parseFloat(y) : 0.0;
  3692. /**
  3693. * @member {SuperMap.Pixel.Mode} [SuperMap.Pixel.prototype.mode=SuperMap.Pixel.Mode.LeftTop]
  3694. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  3695. */
  3696. this.mode = mode;
  3697. this.CLASS_NAME = "SuperMap.Pixel";
  3698. /**
  3699. * @enum SuperMap.Pixel.Mode
  3700. * @readonly
  3701. * @description 模式。
  3702. * @type {string}
  3703. */
  3704. SuperMap.Pixel.Mode = {
  3705. /** 左上模式。*/
  3706. LeftTop: "lefttop",
  3707. /** 右上模式。 */
  3708. RightTop: "righttop",
  3709. /** 右下模式。 */
  3710. RightBottom: "rightbottom",
  3711. /** 左下模式。 */
  3712. LeftBottom: "leftbottom"
  3713. };
  3714. }
  3715. /**
  3716. * @function SuperMap.Pixel.prototype.toString
  3717. * @description 返回此对象的字符串形式。
  3718. * @example
  3719. *
  3720. * var pixcel = new SuperMap.Pixel(100,50);
  3721. * var str = pixcel.toString();
  3722. *
  3723. * @returns {string} 例如: "x=200.4,y=242.2"
  3724. */
  3725. toString() {
  3726. return ("x=" + this.x + ",y=" + this.y);
  3727. }
  3728. /**
  3729. * @function SuperMap.Pixel.prototype.clone
  3730. * @description 克隆当前的 pixel 对象。
  3731. * @example
  3732. * var pixcel = new SuperMap.Pixel(100,50);
  3733. * var pixcel2 = pixcel.clone();
  3734. * @returns {SuperMap.Pixel} 返回一个新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  3735. */
  3736. clone() {
  3737. return new Pixel_Pixel(this.x, this.y, this.mode);
  3738. }
  3739. /**
  3740. * @function SuperMap.Pixel.prototype.equals
  3741. * @description 比较两 pixel 是否相等。
  3742. * @example
  3743. * var pixcel = new SuperMap.Pixel(100,50);
  3744. * var pixcel2 = new SuperMap.Pixel(100,50);
  3745. * var isEquals = pixcel.equals(pixcel2);
  3746. *
  3747. * @param {SuperMap.Pixel} px - 用于比较相等的 pixel 对象。
  3748. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  3749. */
  3750. equals(px) {
  3751. var equals = false;
  3752. if (px != null) {
  3753. equals = ((this.x == px.x && this.y == px.y) ||
  3754. (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));
  3755. }
  3756. return equals;
  3757. }
  3758. /**
  3759. * @function SuperMap.Pixel.prototype.distanceTo
  3760. * @description 返回两个 pixel 的距离。
  3761. * @example
  3762. * var pixcel = new SuperMap.Pixel(100,50);
  3763. * var pixcel2 = new SuperMap.Pixel(110,30);
  3764. * var distance = pixcel.distanceTo(pixcel2);
  3765. *
  3766. * @param {SuperMap.Pixel} px - 用于计算的一个 pixel。
  3767. * @returns {float} 作为参数传入的像素与当前像素点的距离。
  3768. */
  3769. distanceTo(px) {
  3770. return Math.sqrt(
  3771. Math.pow(this.x - px.x, 2) +
  3772. Math.pow(this.y - px.y, 2)
  3773. );
  3774. }
  3775. /**
  3776. * @function SuperMap.Pixel.prototype.add
  3777. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  3778. * @example
  3779. * var pixcel = new SuperMap.Pixel(100,50);
  3780. * //pixcel2是新的对象
  3781. * var pixcel2 = pixcel.add(20,30);
  3782. *
  3783. * @param {number} x - 传入的 x 值。
  3784. * @param {number} y - 传入的 y 值。
  3785. * @returns {SuperMap.Pixel} 返回一个新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  3786. */
  3787. add(x, y) {
  3788. if ((x == null) || (y == null)) {
  3789. throw new TypeError('Pixel.add cannot receive null values');
  3790. }
  3791. return new Pixel_Pixel(this.x + x, this.y + y);
  3792. }
  3793. /**
  3794. * @function SuperMap.Pixel.prototype.offset
  3795. * @description 通过传入的 {@link SuperMap.Pixel} 参数对原屏幕坐标进行偏移。
  3796. * @example
  3797. * var pixcel = new SuperMap.Pixel(100,50);
  3798. * var pixcel2 = new SuperMap.Pixel(130,20);
  3799. * //pixcel3 是新的对象
  3800. * var pixcel3 = pixcel.offset(pixcel2);
  3801. *
  3802. * @param {SuperMap.Pixel} px - 传入的 <SuperMap.Pixel> 对象。
  3803. * @returns {SuperMap.Pixel} 返回一个新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  3804. */
  3805. offset(px) {
  3806. var newPx = this.clone();
  3807. if (px) {
  3808. newPx = this.add(px.x, px.y);
  3809. }
  3810. return newPx;
  3811. }
  3812. /**
  3813. *
  3814. * @function SuperMap.Pixel.prototype.destroy
  3815. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  3816. * @example
  3817. * var pixcel = new SuperMap.Pixel(100,50);
  3818. * pixcel.destroy();
  3819. */
  3820. destroy() {
  3821. this.x = null;
  3822. this.y = null;
  3823. this.mode = null;
  3824. }
  3825. }
  3826. SuperMap.Pixel = Pixel_Pixel;
  3827. // CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  3828. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  3829. * This program are made available under the terms of the Apache License, Version 2.0
  3830. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3831. /**
  3832. *@namespace SuperMap
  3833. *@category BaseTypes Namespace
  3834. */
  3835. /**
  3836. * @function SuperMap.inherit
  3837. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  3838. * @memberOf SuperMap
  3839. * @param {Object} C - 继承的类。
  3840. * @param {Object} P - 被继承的父类。
  3841. */
  3842. SuperMap.inherit = function (C, P) {
  3843. var F = function () {
  3844. };
  3845. F.prototype = P.prototype;
  3846. C.prototype = new F;
  3847. var i, l, o;
  3848. for (i = 2, l = arguments.length; i < l; i++) {
  3849. o = arguments[i];
  3850. if (typeof o === "function") {
  3851. o = o.prototype;
  3852. }
  3853. SuperMap.Util.extend(C.prototype, o);
  3854. }
  3855. };
  3856. /**
  3857. * @function SuperMap.mixin
  3858. * @description 实现多重继承。
  3859. * @memberOf SuperMap
  3860. * @param {Class|Object} ...mixins - 继承的类。
  3861. */
  3862. SuperMap.mixin = function (...mixins) {
  3863. class Mix {
  3864. constructor(options) {
  3865. for (var index = 0; index < mixins.length; index++) {
  3866. copyProperties(this, new mixins[index](options));
  3867. }
  3868. }
  3869. }
  3870. for (var index = 0; index < mixins.length; index++) {
  3871. var mixin = mixins[index];
  3872. copyProperties(Mix, mixin);
  3873. copyProperties(Mix.prototype, mixin.prototype);
  3874. copyProperties(Mix.prototype, new mixin());
  3875. }
  3876. return Mix;
  3877. function copyProperties(target, source) {
  3878. var ownKeys = Object.getOwnPropertyNames(source);
  3879. if (Object.getOwnPropertySymbols) {
  3880. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  3881. }
  3882. for (var index = 0; index < ownKeys.length; index++) {
  3883. var key = ownKeys[index];
  3884. if (key !== "constructor"
  3885. && key !== "prototype"
  3886. && key !== "name" && key !== "length") {
  3887. let desc = Object.getOwnPropertyDescriptor(source, key);
  3888. if (window["ActiveXObject"]) {
  3889. Object.defineProperty(target, key, desc || {});
  3890. } else {
  3891. Object.defineProperty(target, key, desc);
  3892. }
  3893. }
  3894. }
  3895. }
  3896. };
  3897. /**
  3898. * @name String
  3899. * @namespace
  3900. * @memberOf SuperMap
  3901. * @category BaseTypes Util
  3902. * @description 字符串操作的一系列常用扩展函数。
  3903. */
  3904. var StringExt = SuperMap.String = {
  3905. /**
  3906. * @function SuperMap.String.startsWith
  3907. * @description 判断目标字符串是否以指定的子字符串开头。
  3908. * @param {string} str - 目标字符串。
  3909. * @param {string} sub - 查找的子字符串。
  3910. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  3911. */
  3912. startsWith: function (str, sub) {
  3913. return (str.indexOf(sub) == 0);
  3914. },
  3915. /**
  3916. * @function SuperMap.String.contains
  3917. * @description 判断目标字符串是否包含指定的子字符串。
  3918. * @param {string} str - 目标字符串。
  3919. * @param {string} sub - 查找的子字符串。
  3920. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  3921. */
  3922. contains: function (str, sub) {
  3923. return (str.indexOf(sub) != -1);
  3924. },
  3925. /**
  3926. * @function SuperMap.String.trim
  3927. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  3928. * @param {string} str - (可能)存在空白字符填塞的字符串。
  3929. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  3930. */
  3931. trim: function (str) {
  3932. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  3933. },
  3934. /**
  3935. * @function SuperMap.String.camelize
  3936. * @description 骆驼式("-")连字符的字符串处理。
  3937. * 例如:"chicken-head" becomes "chickenHead",
  3938. * "-chicken-head" becomes "ChickenHead"。
  3939. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  3940. * @returns {string}
  3941. */
  3942. camelize: function (str) {
  3943. var oStringList = str.split('-');
  3944. var camelizedString = oStringList[0];
  3945. for (var i = 1, len = oStringList.length; i < len; i++) {
  3946. var s = oStringList[i];
  3947. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  3948. }
  3949. return camelizedString;
  3950. },
  3951. /**
  3952. * @function SuperMap.String.format
  3953. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  3954. * @example
  3955. * 示例:
  3956. * (code)
  3957. * 1、template = "${value,getValue}";
  3958. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  3959. * args = [2,23,12,36,21];
  3960. * 返回值:36
  3961. * (end)
  3962. * 示例:
  3963. * (code)
  3964. * 2、template = "$${{value,getValue}}";
  3965. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  3966. * args = [2,23,12,36,21];
  3967. * 返回值:"${36}"
  3968. * (end)
  3969. * 示例:
  3970. * (code)
  3971. * 3、template = "${a,b}";
  3972. * context = {a: {b:"format"}};
  3973. * args = null;
  3974. * 返回值:"format"
  3975. * (end)
  3976. * 示例:
  3977. * (code)
  3978. * 3、template = "${a,b}";
  3979. * context = null;
  3980. * args = null;
  3981. * 返回值:"${a.b}"
  3982. * (end)
  3983. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  3984. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  3985. * @param {Array} [args] - 可选参数传递给在 context 对象上找到的函数。
  3986. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  3987. */
  3988. format: function (template, context, args) {
  3989. if (!context) {
  3990. context = window;
  3991. }
  3992. // Example matching:
  3993. // str = ${foo.bar}
  3994. // match = foo.bar
  3995. var replacer = function (str, match) {
  3996. var replacement;
  3997. // Loop through all subs. Example: ${a.b.c}
  3998. // 0 -> replacement = context[a];
  3999. // 1 -> replacement = context[a][b];
  4000. // 2 -> replacement = context[a][b][c];
  4001. var subs = match.split(/\.+/);
  4002. for (var i = 0; i < subs.length; i++) {
  4003. if (i == 0) {
  4004. replacement = context;
  4005. }
  4006. replacement = replacement[subs[i]];
  4007. }
  4008. if (typeof replacement === "function") {
  4009. replacement = args ?
  4010. replacement.apply(null, args) :
  4011. replacement();
  4012. }
  4013. // If replacement is undefined, return the string 'undefined'.
  4014. // This is a workaround for a bugs in browsers not properly
  4015. // dealing with non-participating groups in regular expressions:
  4016. // http://blog.stevenlevithan.com/archives/npcg-javascript
  4017. if (typeof replacement == 'undefined') {
  4018. return 'undefined';
  4019. } else {
  4020. return replacement;
  4021. }
  4022. };
  4023. return template.replace(SuperMap.String.tokenRegEx, replacer);
  4024. },
  4025. /**
  4026. * @member {RegExp} [SuperMap.String.tokenRegEx]
  4027. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  4028. * @example
  4029. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  4030. */
  4031. tokenRegEx: /\$\{([\w.]+?)\}/g,
  4032. /**
  4033. * @member {RegExp} [SuperMap.String.numberRegEx]
  4034. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  4035. */
  4036. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  4037. /**
  4038. * @function SuperMap.String.isNumeric
  4039. * @description 判断一个字符串是否只包含一个数值。
  4040. * @example
  4041. * (code)
  4042. * SuperMap.String.isNumeric("6.02e23") // true
  4043. * SuperMap.String.isNumeric("12 dozen") // false
  4044. * SuperMap.String.isNumeric("4") // true
  4045. * SuperMap.String.isNumeric(" 4 ") // false
  4046. * (end)
  4047. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  4048. */
  4049. isNumeric: function (value) {
  4050. return SuperMap.String.numberRegEx.test(value);
  4051. },
  4052. /**
  4053. * @function SuperMap.String.numericIf
  4054. * @description 把一个看似数值型的字符串转化为一个数值。
  4055. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  4056. */
  4057. numericIf: function (value) {
  4058. return SuperMap.String.isNumeric(value) ? parseFloat(value) : value;
  4059. }
  4060. };
  4061. /**
  4062. * @name Number
  4063. * @memberOf SuperMap
  4064. * @namespace
  4065. * @category BaseTypes Util
  4066. * @description 数值操作的一系列常用扩展函数。
  4067. */
  4068. var NumberExt = SuperMap.Number = {
  4069. /**
  4070. * @member {string} [SuperMap.Number.decimalSeparator='.']
  4071. * @description 格式化数字时默认的小数点分隔符。
  4072. * @constant
  4073. */
  4074. decimalSeparator: ".",
  4075. /**
  4076. * @member {string} [SuperMap.Number.thousandsSeparator=',']
  4077. * @description 格式化数字时默认的千位分隔符。
  4078. * @constant
  4079. */
  4080. thousandsSeparator: ",",
  4081. /**
  4082. * @function SuperMap.Number.limitSigDigs
  4083. * @description 限制浮点数的有效数字位数。
  4084. * @param {number} num - 浮点数。
  4085. * @param {integer} sig - 有效位数。
  4086. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  4087. */
  4088. limitSigDigs: function (num, sig) {
  4089. var fig = 0;
  4090. if (sig > 0) {
  4091. fig = parseFloat(num.toPrecision(sig));
  4092. }
  4093. return fig;
  4094. },
  4095. /**
  4096. * @function SuperMap.Number.format
  4097. * @description 数字格式化输出。
  4098. * @param {number} num - 数字。
  4099. * @param {integer} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  4100. * @param {string} [tsep=','] - 千位分隔符。
  4101. * @param {string} [dsep='.'] - 小数点分隔符。
  4102. * @returns {string} 数字格式化后的字符串。
  4103. */
  4104. format: function (num, dec, tsep, dsep) {
  4105. dec = (typeof dec != "undefined") ? dec : 0;
  4106. tsep = (typeof tsep != "undefined") ? tsep :
  4107. SuperMap.Number.thousandsSeparator;
  4108. dsep = (typeof dsep != "undefined") ? dsep :
  4109. SuperMap.Number.decimalSeparator;
  4110. if (dec != null) {
  4111. num = parseFloat(num.toFixed(dec));
  4112. }
  4113. var parts = num.toString().split(".");
  4114. if (parts.length === 1 && dec == null) {
  4115. // integer where we do not want to touch the decimals
  4116. dec = 0;
  4117. }
  4118. var integer = parts[0];
  4119. if (tsep) {
  4120. var thousands = /(-?[0-9]+)([0-9]{3})/;
  4121. while (thousands.test(integer)) {
  4122. integer = integer.replace(thousands, "$1" + tsep + "$2");
  4123. }
  4124. }
  4125. var str;
  4126. if (dec == 0) {
  4127. str = integer;
  4128. } else {
  4129. var rem = parts.length > 1 ? parts[1] : "0";
  4130. if (dec != null) {
  4131. rem = rem + new Array(dec - rem.length + 1).join("0");
  4132. }
  4133. str = integer + dsep + rem;
  4134. }
  4135. return str;
  4136. }
  4137. };
  4138. if (!Number.prototype.limitSigDigs) {
  4139. /**
  4140. * APIMethod: Number.limitSigDigs
  4141. * 限制浮点数的有效数字位数.
  4142. * @param {integer} sig -有效位数。
  4143. * @returns {integer} 将数字四舍五入到指定数量的有效位数。
  4144. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  4145. */
  4146. Number.prototype.limitSigDigs = function (sig) {
  4147. return NumberExt.limitSigDigs(this, sig);
  4148. };
  4149. }
  4150. /**
  4151. * @name Function
  4152. * @memberOf SuperMap
  4153. * @namespace
  4154. * @category BaseTypes Util
  4155. * @description 函数操作的一系列常用扩展函数。
  4156. */
  4157. var FunctionExt = SuperMap.Function = {
  4158. /**
  4159. * @function SuperMap.Function.bind
  4160. * @description 绑定函数到对象。方便创建 this 的作用域。
  4161. * @param {function} func - 输入函数。
  4162. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  4163. * @returns {function} object 参数作为 func 函数的 this 对象。
  4164. */
  4165. bind: function (func, object) {
  4166. // create a reference to all arguments past the second one
  4167. var args = Array.prototype.slice.apply(arguments, [2]);
  4168. return function () {
  4169. // Push on any additional arguments from the actual function call.
  4170. // These will come after those sent to the bind call.
  4171. var newArgs = args.concat(
  4172. Array.prototype.slice.apply(arguments, [0])
  4173. );
  4174. return func.apply(object, newArgs);
  4175. };
  4176. },
  4177. /**
  4178. * @function SuperMap.Function.bindAsEventListener
  4179. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  4180. * @param {function} func - 用于监听事件的函数。
  4181. * @param {Object} object - this 对象的引用。
  4182. * @returns {function}
  4183. */
  4184. bindAsEventListener: function (func, object) {
  4185. return function (event) {
  4186. return func.call(object, event || window.event);
  4187. };
  4188. },
  4189. /**
  4190. * @function SuperMap.Function.False
  4191. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  4192. * @example
  4193. * document.onclick = SuperMap.Function.False;
  4194. * @returns {boolean}
  4195. */
  4196. False: function () {
  4197. return false;
  4198. },
  4199. /**
  4200. * @function SuperMap.Function.True
  4201. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  4202. * @example
  4203. * document.onclick = SuperMap.Function.True;
  4204. * @returns {boolean}
  4205. */
  4206. True: function () {
  4207. return true;
  4208. },
  4209. /**
  4210. * @function SuperMap.Function.Void
  4211. * @description 可重用函数,仅仅返回 "undefined"。
  4212. * @returns {undefined}
  4213. */
  4214. Void: function () {
  4215. }
  4216. };
  4217. /**
  4218. * @name Array
  4219. * @memberOf SuperMap
  4220. * @namespace
  4221. * @category BaseTypes Util
  4222. * @description 数组操作的一系列常用扩展函数。
  4223. */
  4224. var ArrayExt = SuperMap.Array = {
  4225. /**
  4226. * @function SuperMap.Array.filter
  4227. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  4228. * @param {Array} array - 要过滤的数组。
  4229. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  4230. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  4231. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  4232. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  4233. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  4234. */
  4235. filter: function (array, callback, caller) {
  4236. var selected = [];
  4237. if (Array.prototype.filter) {
  4238. selected = array.filter(callback, caller);
  4239. } else {
  4240. var len = array.length;
  4241. if (typeof callback != "function") {
  4242. throw new TypeError();
  4243. }
  4244. for (var i = 0; i < len; i++) {
  4245. if (i in array) {
  4246. var val = array[i];
  4247. if (callback.call(caller, val, i, array)) {
  4248. selected.push(val);
  4249. }
  4250. }
  4251. }
  4252. }
  4253. return selected;
  4254. }
  4255. };
  4256. // CONCATENATED MODULE: ./src/common/commontypes/Util.js
  4257. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  4258. * This program are made available under the terms of the Apache License, Version 2.0
  4259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4260. var Util_Util = SuperMap.Util = SuperMap.Util || {};
  4261. /**
  4262. * @name Util
  4263. * @memberOf SuperMap
  4264. * @namespace
  4265. * @category BaseTypes Util
  4266. * @description common 工具类。
  4267. */
  4268. /**
  4269. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  4270. * @example
  4271. * 要复制 SuperMap.Size 对象的所有属性到自定义对象上,使用方法如下:
  4272. * var size = new SuperMap.Size(100, 100);
  4273. * var obj = {};
  4274. * SuperMap.Util.extend(obj, size);
  4275. * @param {Object} [destination] - 目标对象。
  4276. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  4277. * @returns {Object} 目标对象。
  4278. */
  4279. SuperMap.Util.extend = function (destination, source) {
  4280. destination = destination || {};
  4281. if (source) {
  4282. for (var property in source) {
  4283. var value = source[property];
  4284. if (value !== undefined) {
  4285. destination[property] = value;
  4286. }
  4287. }
  4288. /**
  4289. * IE doesn't include the toString property when iterating over an object's
  4290. * properties with the for(property in object) syntax. Explicitly check if
  4291. * the source has its own toString property.
  4292. */
  4293. /*
  4294. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  4295. * prototype object" when calling hawOwnProperty if the source object
  4296. * is an instance of window.Event.
  4297. */
  4298. var sourceIsEvt = typeof window.Event === "function"
  4299. && source instanceof window.Event;
  4300. if (!sourceIsEvt
  4301. && source.hasOwnProperty && source.hasOwnProperty("toString")) {
  4302. destination.toString = source.toString;
  4303. }
  4304. }
  4305. return destination;
  4306. };
  4307. /**
  4308. * @description 对象拷贝。
  4309. * @param {Object} [des] - 目标对象。
  4310. * @param {Object} soc - 源对象。
  4311. */
  4312. SuperMap.Util.copy = function (des, soc) {
  4313. des = des || {};
  4314. var v;
  4315. if (soc) {
  4316. for (var p in des) {
  4317. v = soc[p];
  4318. if (typeof v !== 'undefined') {
  4319. des[p] = v;
  4320. }
  4321. }
  4322. }
  4323. };
  4324. /**
  4325. * @description 销毁对象,将其属性置空。
  4326. * @param {Object} [obj] - 目标对象。
  4327. */
  4328. SuperMap.Util.reset = function (obj) {
  4329. obj = obj || {};
  4330. for (var p in obj) {
  4331. if (obj.hasOwnProperty(p)) {
  4332. if (typeof obj[p] === "object" && obj[p] instanceof Array) {
  4333. for (var i in obj[p]) {
  4334. if (obj[p][i].destroy) {
  4335. obj[p][i].destroy();
  4336. }
  4337. }
  4338. obj[p].length = 0;
  4339. } else if (typeof obj[p] === "object" && obj[p] instanceof Object) {
  4340. if (obj[p].destroy) {
  4341. obj[p].destroy();
  4342. }
  4343. }
  4344. obj[p] = null;
  4345. }
  4346. }
  4347. };
  4348. /**
  4349. * @description 获取 HTML 元素数组。
  4350. * @returns {Array.<HTMLElement>} HTML 元素数组。
  4351. */
  4352. SuperMap.Util.getElement = function () {
  4353. var elements = [];
  4354. for (var i = 0, len = arguments.length; i < len; i++) {
  4355. var element = arguments[i];
  4356. if (typeof element === 'string') {
  4357. element = document.getElementById(element);
  4358. }
  4359. if (arguments.length === 1) {
  4360. return element;
  4361. }
  4362. elements.push(element);
  4363. }
  4364. return elements;
  4365. };
  4366. /**
  4367. * @description instance of 的跨浏览器实现。
  4368. * @param {Object} o - 对象。
  4369. * @returns {boolean} 是否是页面元素。
  4370. */
  4371. SuperMap.Util.isElement = function (o) {
  4372. return !!(o && o.nodeType === 1);
  4373. };
  4374. /**
  4375. * @description 判断一个对象是否是数组。
  4376. * @param {Object} a - 对象。
  4377. * @returns {boolean} 是否是数组。
  4378. */
  4379. SuperMap.Util.isArray = function (a) {
  4380. return (Object.prototype.toString.call(a) === '[object Array]');
  4381. };
  4382. /**
  4383. * @description 从数组中删除某一项。
  4384. * @param {Array} array - 数组。
  4385. * @param {Object} item - 数组中要删除的一项。
  4386. * @returns {Array} 执行删除操作后的数组。
  4387. */
  4388. SuperMap.Util.removeItem = function (array, item) {
  4389. for (var i = array.length - 1; i >= 0; i--) {
  4390. if (array[i] === item) {
  4391. array.splice(i, 1);
  4392. //break;more than once??
  4393. }
  4394. }
  4395. return array;
  4396. };
  4397. /**
  4398. * @description 获取某对象再数组中的索引值。
  4399. * @param {Array} array - 数组。
  4400. * @param {Object} obj - 对象。
  4401. * @returns {number} 某对象再数组中的索引值。
  4402. */
  4403. SuperMap.Util.indexOf = function (array, obj) {
  4404. if (array == null) {
  4405. return -1;
  4406. } else {
  4407. // use the build-in function if available.
  4408. if (typeof array.indexOf === "function") {
  4409. return array.indexOf(obj);
  4410. } else {
  4411. for (var i = 0, len = array.length; i < len; i++) {
  4412. if (array[i] === obj) {
  4413. return i;
  4414. }
  4415. }
  4416. return -1;
  4417. }
  4418. }
  4419. };
  4420. /**
  4421. * @description 修改某 DOM 元素的许多属性。
  4422. * @param {HTMLElement} element - 待修改的 DOM 元素。
  4423. * @param {string} [id] - DOM 元素的 ID。
  4424. * @param {SuperMap.Pixel} [px] - 包含 DOM 元素的 style 属性的 left 和 top 属性。
  4425. * @param {SuperMap.Size} [sz] - 包含 DOM 元素的 width 和 height 属性。
  4426. * @param {string} [position] - DOM 元素的 position 属性。
  4427. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  4428. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  4429. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  4430. */
  4431. SuperMap.Util.modifyDOMElement = function (element, id, px, sz, position,
  4432. border, overflow, opacity) {
  4433. if (id) {
  4434. element.id = id;
  4435. }
  4436. if (px) {
  4437. element.style.left = px.x + "px";
  4438. element.style.top = px.y + "px";
  4439. }
  4440. if (sz) {
  4441. element.style.width = sz.w + "px";
  4442. element.style.height = sz.h + "px";
  4443. }
  4444. if (position) {
  4445. element.style.position = position;
  4446. }
  4447. if (border) {
  4448. element.style.border = border;
  4449. }
  4450. if (overflow) {
  4451. element.style.overflow = overflow;
  4452. }
  4453. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  4454. element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
  4455. element.style.opacity = opacity;
  4456. } else if (parseFloat(opacity) === 1.0) {
  4457. element.style.filter = '';
  4458. element.style.opacity = '';
  4459. }
  4460. };
  4461. /**
  4462. * @description Takes an object and copies any properties that don't exist from
  4463. * another properties, by analogy with SuperMap.Util.extend() from
  4464. * Prototype.js.
  4465. *
  4466. * @param {Object} [to] - 目标对象。
  4467. * @param {Object} from - 源对象。Any properties of this object that
  4468. * are undefined in the to object will be set on the to object.
  4469. *
  4470. * @returns {Object} A reference to the to object. Note that the to argument is modified
  4471. * in place and returned by this function.
  4472. */
  4473. SuperMap.Util.applyDefaults = function (to, from) {
  4474. to = to || {};
  4475. /*
  4476. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  4477. * prototype object" when calling hawOwnProperty if the source object is an
  4478. * instance of window.Event.
  4479. */
  4480. var fromIsEvt = typeof window.Event === "function"
  4481. && from instanceof window.Event;
  4482. for (var key in from) {
  4483. if (to[key] === undefined ||
  4484. (!fromIsEvt && from.hasOwnProperty
  4485. && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) {
  4486. to[key] = from[key];
  4487. }
  4488. }
  4489. /**
  4490. * IE doesn't include the toString property when iterating over an object's
  4491. * properties with the for(property in object) syntax. Explicitly check if
  4492. * the source has its own toString property.
  4493. */
  4494. if (!fromIsEvt && from && from.hasOwnProperty
  4495. && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
  4496. to.toString = from.toString;
  4497. }
  4498. return to;
  4499. };
  4500. /**
  4501. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  4502. * @param {Object} params - 参数对象。
  4503. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  4504. */
  4505. SuperMap.Util.getParameterString = function (params) {
  4506. var paramsArray = [];
  4507. for (var key in params) {
  4508. var value = params[key];
  4509. if ((value != null) && (typeof value !== 'function')) {
  4510. var encodedValue;
  4511. if (Array.isArray(value) || value.toString() === '[object Object]') {
  4512. encodedValue = encodeURIComponent(JSON.stringify(value));
  4513. } else {
  4514. /* value is a string; simply encode */
  4515. encodedValue = encodeURIComponent(value);
  4516. }
  4517. paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
  4518. }
  4519. }
  4520. return paramsArray.join("&");
  4521. };
  4522. /**
  4523. * @description 给 URL 追加查询参数。
  4524. * @param {string} url - 待追加参数的 URL 字符串。
  4525. * @param {string} paramStr - 待追加的查询参数。
  4526. * @returns {string} 新的 URL。
  4527. */
  4528. SuperMap.Util.urlAppend = function (url, paramStr) {
  4529. var newUrl = url;
  4530. if (paramStr) {
  4531. if(paramStr.indexOf('?') === 0){
  4532. paramStr = paramStr.substring(1);
  4533. }
  4534. var parts = (url + " ").split(/[?&]/);
  4535. newUrl += (parts.pop() === " " ?
  4536. paramStr :
  4537. parts.length ? "&" + paramStr : "?" + paramStr);
  4538. }
  4539. return newUrl;
  4540. };
  4541. /**
  4542. * @description 给 URL 追加 path 参数。
  4543. * @param {string} url - 待追加参数的 URL 字符串。
  4544. * @param {string} paramStr - 待追加的path参数。
  4545. * @returns {string} 新的 URL。
  4546. */
  4547. SuperMap.Util.urlPathAppend = function (url, pathStr) {
  4548. let newUrl = url;
  4549. if (!pathStr) {
  4550. return newUrl;
  4551. }
  4552. if (pathStr.indexOf('/') === 0) {
  4553. pathStr = pathStr.substring(1);
  4554. }
  4555. const parts = url.split('?');
  4556. if(parts[0].indexOf('/', parts[0].length - 1) < 0){
  4557. parts[0] += '/'
  4558. }
  4559. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  4560. return newUrl;
  4561. };
  4562. /**
  4563. * @description 为了避免浮点精度错误而保留的有效位数。
  4564. * @type {number}
  4565. * @default 14
  4566. */
  4567. SuperMap.Util.DEFAULT_PRECISION = 14;
  4568. /**
  4569. * @description 将字符串以接近的精度转换为数字。
  4570. * @param {string} number - 字符串。
  4571. * @param {number} [precision=14] - 精度。
  4572. * @returns {number} 数字。
  4573. */
  4574. SuperMap.Util.toFloat = function (number, precision) {
  4575. if (precision == null) {
  4576. precision = SuperMap.Util.DEFAULT_PRECISION;
  4577. }
  4578. if (typeof number !== "number") {
  4579. number = parseFloat(number);
  4580. }
  4581. return precision === 0 ? number :
  4582. parseFloat(number.toPrecision(precision));
  4583. };
  4584. /**
  4585. * @description 角度转弧度。
  4586. * @param {number} x - 角度。
  4587. * @returns {number} 弧度。
  4588. */
  4589. SuperMap.Util.rad = function (x) {
  4590. return x * Math.PI / 180;
  4591. };
  4592. /**
  4593. * @description 从 URL 字符串中解析出参数对象。
  4594. * @param {string} url - URL。
  4595. * @returns {Object} 解析出的参数对象。
  4596. */
  4597. SuperMap.Util.getParameters = function (url) {
  4598. // if no url specified, take it from the location bar
  4599. url = (url === null || url === undefined) ? window.location.href : url;
  4600. //parse out parameters portion of url string
  4601. var paramsString = "";
  4602. if (SuperMap.String.contains(url, '?')) {
  4603. var start = url.indexOf('?') + 1;
  4604. var end = SuperMap.String.contains(url, "#") ?
  4605. url.indexOf('#') : url.length;
  4606. paramsString = url.substring(start, end);
  4607. }
  4608. var parameters = {};
  4609. var pairs = paramsString.split(/[&;]/);
  4610. for (var i = 0, len = pairs.length; i < len; ++i) {
  4611. var keyValue = pairs[i].split('=');
  4612. if (keyValue[0]) {
  4613. var key = keyValue[0];
  4614. try {
  4615. key = decodeURIComponent(key);
  4616. } catch (err) {
  4617. key = unescape(key);
  4618. }
  4619. // being liberal by replacing "+" with " "
  4620. var value = (keyValue[1] || '').replace(/\+/g, " ");
  4621. try {
  4622. value = decodeURIComponent(value);
  4623. } catch (err) {
  4624. value = unescape(value);
  4625. }
  4626. // follow OGC convention of comma delimited values
  4627. value = value.split(",");
  4628. //if there's only one value, do not return as array
  4629. if (value.length == 1) {
  4630. value = value[0];
  4631. }
  4632. parameters[key] = value;
  4633. }
  4634. }
  4635. return parameters;
  4636. };
  4637. /**
  4638. * @description 不断递增计数变量,用于生成唯一 ID。
  4639. * @type {number}
  4640. * @default 0
  4641. */
  4642. SuperMap.Util.lastSeqID = 0;
  4643. /**
  4644. * @description 创建唯一 ID 值。
  4645. * @param {string} [prefix] - 前缀。
  4646. * @returns {string} 唯一的 ID 值。
  4647. */
  4648. SuperMap.Util.createUniqueID = function (prefix) {
  4649. if (prefix == null) {
  4650. prefix = "id_";
  4651. }
  4652. SuperMap.Util.lastSeqID += 1;
  4653. return prefix + SuperMap.Util.lastSeqID;
  4654. };
  4655. /**
  4656. * @memberOf SuperMap
  4657. * @description 每单位的英尺数。
  4658. * @type {Object}
  4659. * @constant
  4660. */
  4661. SuperMap.INCHES_PER_UNIT = {
  4662. 'inches': 1.0,
  4663. 'ft': 12.0,
  4664. 'mi': 63360.0,
  4665. 'm': 39.3701,
  4666. 'km': 39370.1,
  4667. 'dd': 4374754,
  4668. 'yd': 36
  4669. };
  4670. SuperMap.INCHES_PER_UNIT["in"] = SuperMap.INCHES_PER_UNIT.inches;
  4671. SuperMap.INCHES_PER_UNIT["degrees"] = SuperMap.INCHES_PER_UNIT.dd;
  4672. SuperMap.INCHES_PER_UNIT["nmi"] = 1852 * SuperMap.INCHES_PER_UNIT.m;
  4673. // Units from CS-Map
  4674. SuperMap.METERS_PER_INCH = 0.02540005080010160020;
  4675. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  4676. "Inch": SuperMap.INCHES_PER_UNIT.inches,
  4677. "Meter": 1.0 / SuperMap.METERS_PER_INCH, //EPSG:9001
  4678. "Foot": 0.30480060960121920243 / SuperMap.METERS_PER_INCH, //EPSG:9003
  4679. "IFoot": 0.30480000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9002
  4680. "ClarkeFoot": 0.3047972651151 / SuperMap.METERS_PER_INCH, //EPSG:9005
  4681. "SearsFoot": 0.30479947153867624624 / SuperMap.METERS_PER_INCH, //EPSG:9041
  4682. "GoldCoastFoot": 0.30479971018150881758 / SuperMap.METERS_PER_INCH, //EPSG:9094
  4683. "IInch": 0.02540000000000000000 / SuperMap.METERS_PER_INCH,
  4684. "MicroInch": 0.00002540000000000000 / SuperMap.METERS_PER_INCH,
  4685. "Mil": 0.00000002540000000000 / SuperMap.METERS_PER_INCH,
  4686. "Centimeter": 0.01000000000000000000 / SuperMap.METERS_PER_INCH,
  4687. "Kilometer": 1000.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9036
  4688. "Yard": 0.91440182880365760731 / SuperMap.METERS_PER_INCH,
  4689. "SearsYard": 0.914398414616029 / SuperMap.METERS_PER_INCH, //EPSG:9040
  4690. "IndianYard": 0.91439853074444079983 / SuperMap.METERS_PER_INCH, //EPSG:9084
  4691. "IndianYd37": 0.91439523 / SuperMap.METERS_PER_INCH, //EPSG:9085
  4692. "IndianYd62": 0.9143988 / SuperMap.METERS_PER_INCH, //EPSG:9086
  4693. "IndianYd75": 0.9143985 / SuperMap.METERS_PER_INCH, //EPSG:9087
  4694. "IndianFoot": 0.30479951 / SuperMap.METERS_PER_INCH, //EPSG:9080
  4695. "IndianFt37": 0.30479841 / SuperMap.METERS_PER_INCH, //EPSG:9081
  4696. "IndianFt62": 0.3047996 / SuperMap.METERS_PER_INCH, //EPSG:9082
  4697. "IndianFt75": 0.3047995 / SuperMap.METERS_PER_INCH, //EPSG:9083
  4698. "Mile": 1609.34721869443738887477 / SuperMap.METERS_PER_INCH,
  4699. "IYard": 0.91440000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9096
  4700. "IMile": 1609.34400000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9093
  4701. "NautM": 1852.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9030
  4702. "Lat-66": 110943.316488932731 / SuperMap.METERS_PER_INCH,
  4703. "Lat-83": 110946.25736872234125 / SuperMap.METERS_PER_INCH,
  4704. "Decimeter": 0.10000000000000000000 / SuperMap.METERS_PER_INCH,
  4705. "Millimeter": 0.00100000000000000000 / SuperMap.METERS_PER_INCH,
  4706. "Dekameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  4707. "Decameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  4708. "Hectometer": 100.00000000000000000000 / SuperMap.METERS_PER_INCH,
  4709. "GermanMeter": 1.0000135965 / SuperMap.METERS_PER_INCH, //EPSG:9031
  4710. "CaGrid": 0.999738 / SuperMap.METERS_PER_INCH,
  4711. "ClarkeChain": 20.1166194976 / SuperMap.METERS_PER_INCH, //EPSG:9038
  4712. "GunterChain": 20.11684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9033
  4713. "BenoitChain": 20.116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9062
  4714. "SearsChain": 20.11676512155 / SuperMap.METERS_PER_INCH, //EPSG:9042
  4715. "ClarkeLink": 0.201166194976 / SuperMap.METERS_PER_INCH, //EPSG:9039
  4716. "GunterLink": 0.2011684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9034
  4717. "BenoitLink": 0.20116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9063
  4718. "SearsLink": 0.2011676512155 / SuperMap.METERS_PER_INCH, //EPSG:9043
  4719. "Rod": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  4720. "IntnlChain": 20.1168 / SuperMap.METERS_PER_INCH, //EPSG:9097
  4721. "IntnlLink": 0.201168 / SuperMap.METERS_PER_INCH, //EPSG:9098
  4722. "Perch": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  4723. "Pole": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  4724. "Furlong": 201.1684023368046 / SuperMap.METERS_PER_INCH,
  4725. "Rood": 3.778266898 / SuperMap.METERS_PER_INCH,
  4726. "CapeFoot": 0.3047972615 / SuperMap.METERS_PER_INCH,
  4727. "Brealey": 375.00000000000000000000 / SuperMap.METERS_PER_INCH,
  4728. "ModAmFt": 0.304812252984505969011938 / SuperMap.METERS_PER_INCH,
  4729. "Fathom": 1.8288 / SuperMap.METERS_PER_INCH,
  4730. "NautM-UK": 1853.184 / SuperMap.METERS_PER_INCH,
  4731. "50kilometers": 50000.0 / SuperMap.METERS_PER_INCH,
  4732. "150kilometers": 150000.0 / SuperMap.METERS_PER_INCH
  4733. });
  4734. //unit abbreviations supported by PROJ.4
  4735. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  4736. "mm": SuperMap.INCHES_PER_UNIT["Meter"] / 1000.0,
  4737. "cm": SuperMap.INCHES_PER_UNIT["Meter"] / 100.0,
  4738. "dm": SuperMap.INCHES_PER_UNIT["Meter"] * 100.0,
  4739. "km": SuperMap.INCHES_PER_UNIT["Meter"] * 1000.0,
  4740. "kmi": SuperMap.INCHES_PER_UNIT["nmi"], //International Nautical Mile
  4741. "fath": SuperMap.INCHES_PER_UNIT["Fathom"], //International Fathom
  4742. "ch": SuperMap.INCHES_PER_UNIT["IntnlChain"], //International Chain
  4743. "link": SuperMap.INCHES_PER_UNIT["IntnlLink"], //International Link
  4744. "us-in": SuperMap.INCHES_PER_UNIT["inches"], //U.S. Surveyor's Inch
  4745. "us-ft": SuperMap.INCHES_PER_UNIT["Foot"], //U.S. Surveyor's Foot
  4746. "us-yd": SuperMap.INCHES_PER_UNIT["Yard"], //U.S. Surveyor's Yard
  4747. "us-ch": SuperMap.INCHES_PER_UNIT["GunterChain"], //U.S. Surveyor's Chain
  4748. "us-mi": SuperMap.INCHES_PER_UNIT["Mile"], //U.S. Surveyor's Statute Mile
  4749. "ind-yd": SuperMap.INCHES_PER_UNIT["IndianYd37"], //Indian Yard
  4750. "ind-ft": SuperMap.INCHES_PER_UNIT["IndianFt37"], //Indian Foot
  4751. "ind-ch": 20.11669506 / SuperMap.METERS_PER_INCH //Indian Chain
  4752. });
  4753. /**
  4754. * @memberOf SuperMap
  4755. * @member [SuperMap.DOTS_PER_INCH=96]
  4756. * @description 分辨率与比例尺之间转换的常量。
  4757. * @type {Object}
  4758. */
  4759. SuperMap.DOTS_PER_INCH = 96;
  4760. /**
  4761. * @param {number} scale - 比例尺。
  4762. * @returns {number} 返回正常的 scale 值。
  4763. */
  4764. SuperMap.Util.normalizeScale = function (scale) {
  4765. var normScale = (scale > 1.0) ? (1.0 / scale) : scale;
  4766. return normScale;
  4767. };
  4768. /**
  4769. * @description 比例尺转分辨率。
  4770. * @param {number} scale - 比例尺。
  4771. * @param {string} [units='degrees'] - 比例尺单位。
  4772. * @returns {number} 分辨率。
  4773. */
  4774. SuperMap.Util.getResolutionFromScale = function (scale, units) {
  4775. var resolution;
  4776. if (scale) {
  4777. if (units == null) {
  4778. units = "degrees";
  4779. }
  4780. var normScale = SuperMap.Util.normalizeScale(scale);
  4781. resolution = 1 / (normScale * SuperMap.INCHES_PER_UNIT[units]
  4782. * SuperMap.DOTS_PER_INCH);
  4783. }
  4784. return resolution;
  4785. };
  4786. /**
  4787. * @description 分辨率转比例尺。
  4788. * @param {number} resolution - 分辨率。
  4789. * @param {string} [units='degrees'] - 分辨率单位。
  4790. * @returns {number} 比例尺。
  4791. */
  4792. SuperMap.Util.getScaleFromResolution = function (resolution, units) {
  4793. if (units == null) {
  4794. units = "degrees";
  4795. }
  4796. var scale = resolution * SuperMap.INCHES_PER_UNIT[units] *
  4797. SuperMap.DOTS_PER_INCH;
  4798. return scale;
  4799. };
  4800. /**
  4801. * @memberOf SuperMap
  4802. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  4803. * @constant
  4804. */
  4805. SuperMap.IS_GECKO = (function () {
  4806. var ua = navigator.userAgent.toLowerCase();
  4807. return ua.indexOf("webkit") === -1 && ua.indexOf("gecko") !== -1;
  4808. })();
  4809. /**
  4810. * @memberOf SuperMap
  4811. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  4812. * * "opera" -- Opera
  4813. * * "msie" -- Internet Explorer
  4814. * * "safari" -- Safari
  4815. * * "firefox" -- Firefox
  4816. * * "mozilla" -- Mozilla
  4817. * @constant
  4818. */
  4819. SuperMap.Browser = (function () {
  4820. var name = '', version = '', device = 'pc', uaMatch;
  4821. //以下进行测试
  4822. var ua = navigator.userAgent.toLowerCase();
  4823. if (ua.indexOf("msie") > -1 || (ua.indexOf("trident") > -1 && ua.indexOf("rv") > -1)) {
  4824. name = 'msie';
  4825. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  4826. } else if (ua.indexOf("chrome") > -1) {
  4827. name = 'chrome';
  4828. uaMatch = ua.match(/chrome\/([\d.]+)/);
  4829. } else if (ua.indexOf("firefox") > -1) {
  4830. name = 'firefox';
  4831. uaMatch = ua.match(/firefox\/([\d.]+)/);
  4832. } else if (ua.indexOf("opera") > -1) {
  4833. name = 'opera';
  4834. uaMatch = ua.match(/version\/([\d.]+)/);
  4835. } else if (ua.indexOf("safari") > -1) {
  4836. name = 'safari';
  4837. uaMatch = ua.match(/version\/([\d.]+)/);
  4838. }
  4839. version = uaMatch ? uaMatch[1] : '';
  4840. if (ua.indexOf("ipad") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("iphone") > -1) {
  4841. device = 'apple';
  4842. } else if (ua.indexOf("android") > -1) {
  4843. uaMatch = ua.match(/version\/([\d.]+)/);
  4844. version = uaMatch ? uaMatch[1] : '';
  4845. device = 'android';
  4846. }
  4847. return {name: name, version: version, device: device};
  4848. })();
  4849. /**
  4850. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  4851. * @returns {Object} 获取浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  4852. */
  4853. SuperMap.Util.getBrowser = function () {
  4854. return SuperMap.Browser;
  4855. };
  4856. /**
  4857. * @description 浏览器是否支持 Canvas。
  4858. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas。
  4859. */
  4860. SuperMap.Util.isSupportCanvas = (function () {
  4861. var checkRes = true, broz = SuperMap.Util.getBrowser();
  4862. if (document.createElement("canvas").getContext) {
  4863. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  4864. checkRes = false;
  4865. }
  4866. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  4867. checkRes = false;
  4868. }
  4869. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  4870. checkRes = false;
  4871. }
  4872. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  4873. checkRes = false;
  4874. }
  4875. } else {
  4876. checkRes = false;
  4877. }
  4878. return checkRes;
  4879. })();
  4880. /**
  4881. * @description 判断;浏览器是否支持 Canvas。
  4882. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas 。
  4883. */
  4884. SuperMap.Util.supportCanvas = function () {
  4885. return SuperMap.Util.isSupportCanvas;
  4886. };
  4887. //将服务端的地图单位转成SuperMap的地图单位
  4888. SuperMap.INCHES_PER_UNIT["degree"] = SuperMap.INCHES_PER_UNIT.dd;
  4889. SuperMap.INCHES_PER_UNIT["meter"] = SuperMap.INCHES_PER_UNIT.m;
  4890. SuperMap.INCHES_PER_UNIT["foot"] = SuperMap.INCHES_PER_UNIT.ft;
  4891. SuperMap.INCHES_PER_UNIT["inch"] = SuperMap.INCHES_PER_UNIT.inches;
  4892. SuperMap.INCHES_PER_UNIT["mile"] = SuperMap.INCHES_PER_UNIT.mi;
  4893. SuperMap.INCHES_PER_UNIT["kilometer"] = SuperMap.INCHES_PER_UNIT.km;
  4894. SuperMap.INCHES_PER_UNIT["yard"] = SuperMap.INCHES_PER_UNIT.yd;
  4895. /**
  4896. * @description 判断一个 URL 请求是否在当前域中。
  4897. * @param {string} url - URL 请求字符串。
  4898. * @returns {boolean} URL 请求是否在当前域中。
  4899. */
  4900. SuperMap.Util.isInTheSameDomain = function (url) {
  4901. if (!url) {
  4902. return true;
  4903. }
  4904. var index = url.indexOf("//");
  4905. var documentUrl = document.location.toString();
  4906. var documentIndex = documentUrl.indexOf("//");
  4907. if (index === -1) {
  4908. return true;
  4909. } else {
  4910. var protocol;
  4911. var substring = protocol = url.substring(0, index);
  4912. var documentSubString = documentUrl.substring(documentIndex + 2);
  4913. documentIndex = documentSubString.indexOf("/");
  4914. var documentPortIndex = documentSubString.indexOf(":");
  4915. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  4916. //var documentPort;
  4917. var documentprotocol = document.location.protocol;
  4918. if (documentPortIndex !== -1) {
  4919. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  4920. } else {
  4921. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  4922. }
  4923. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  4924. return false;
  4925. }
  4926. substring = url.substring(index + 2);
  4927. var portIndex = substring.indexOf(":");
  4928. index = substring.indexOf("/");
  4929. var domainWithPort = substring.substring(0, index);
  4930. var domain;
  4931. if (portIndex !== -1) {
  4932. domain = substring.substring(0, portIndex);
  4933. } else {
  4934. domain = substring.substring(0, index);
  4935. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  4936. }
  4937. var documentDomain = document.domain;
  4938. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  4939. return true;
  4940. }
  4941. }
  4942. return false;
  4943. };
  4944. /**
  4945. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  4946. * @param {SuperMap.Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  4947. * @param {SuperMap.Size} viewer - 地图初始化时默认的地图图片的尺寸。
  4948. * @param {number} scale - 地图初始化时默认的显示比例尺。
  4949. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  4950. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  4951. * @returns {number} 返回图层显示分辨率。
  4952. */
  4953. SuperMap.Util.calculateDpi = function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  4954. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  4955. if (!viewBounds || !viewer || !scale) {
  4956. return;
  4957. }
  4958. var ratio = 10000,
  4959. rvbWidth = viewBounds.getWidth(),
  4960. rvbHeight = viewBounds.getHeight(),
  4961. rvWidth = viewer.w,
  4962. rvHeight = viewer.h;
  4963. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  4964. datumAxis = datumAxis || 6378137;
  4965. coordUnit = coordUnit || "degrees";
  4966. var dpi;
  4967. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  4968. let num1 = rvbWidth / rvWidth,
  4969. num2 = rvbHeight / rvHeight,
  4970. resolution = num1 > num2 ? num1 : num2;
  4971. dpi = 0.0254 * ratio / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  4972. } else {
  4973. let resolution = rvbWidth / rvWidth;
  4974. dpi = 0.0254 * ratio / resolution / scale / ratio;
  4975. }
  4976. return dpi;
  4977. };
  4978. /**
  4979. * @description 将对象转换成 JSON 字符串。
  4980. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  4981. * @returns {string} 返回转换后的 JSON 对象。
  4982. */
  4983. SuperMap.Util.toJSON = function (obj) {
  4984. var objInn = obj;
  4985. if (objInn == null) {
  4986. return null;
  4987. }
  4988. switch (objInn.constructor) {
  4989. case String:
  4990. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  4991. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  4992. objInn = objInn.replace(/\n/g, "\\n");
  4993. objInn = objInn.replace(/\r/g, "\\r");
  4994. objInn = objInn.replace("<", "&lt;");
  4995. objInn = objInn.replace(">", "&gt;");
  4996. objInn = objInn.replace(/%/g, "%25");
  4997. objInn = objInn.replace(/&/g, "%26");
  4998. return objInn;
  4999. case Array:
  5000. var arr = [];
  5001. for (var i = 0, len = objInn.length; i < len; i++) {
  5002. arr.push(SuperMap.Util.toJSON(objInn[i]));
  5003. }
  5004. return "[" + arr.join(",") + "]";
  5005. case Number:
  5006. return isFinite(objInn) ? String(objInn) : null;
  5007. case Boolean:
  5008. return String(objInn);
  5009. case Date:
  5010. var dateStr = "{" + "'__type':\"System.DateTime\"," +
  5011. "'Year':" + objInn.getFullYear() + "," +
  5012. "'Month':" + (objInn.getMonth() + 1) + "," +
  5013. "'Day':" + objInn.getDate() + "," +
  5014. "'Hour':" + objInn.getHours() + "," +
  5015. "'Minute':" + objInn.getMinutes() + "," +
  5016. "'Second':" + objInn.getSeconds() + "," +
  5017. "'Millisecond':" + objInn.getMilliseconds() + "," +
  5018. "'TimezoneOffset':" + objInn.getTimezoneOffset() + "}";
  5019. return dateStr;
  5020. default:
  5021. if (objInn["toJSON"] != null && typeof objInn["toJSON"] === "function") {
  5022. return objInn.toJSON();
  5023. }
  5024. if (typeof objInn === "object") {
  5025. if (objInn.length) {
  5026. let arr = [];
  5027. for (let i = 0, len = objInn.length; i < len; i++) {
  5028. arr.push(SuperMap.Util.toJSON(objInn[i]));
  5029. }
  5030. return "[" + arr.join(",") + "]";
  5031. }
  5032. let arr = [];
  5033. for (let attr in objInn) {
  5034. //为解决SuperMap.Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  5035. if (typeof objInn[attr] !== "function" && attr !== "CLASS_NAME" && attr !== "parent") {
  5036. arr.push("'" + attr + "':" + SuperMap.Util.toJSON(objInn[attr]));
  5037. }
  5038. }
  5039. if (arr.length > 0) {
  5040. return "{" + arr.join(",") + "}";
  5041. } else {
  5042. return "{}";
  5043. }
  5044. }
  5045. return objInn.toString();
  5046. }
  5047. };
  5048. /**
  5049. * @description 根据比例尺和 dpi 计算屏幕分辨率。
  5050. * @param {number} scale - 比例尺。
  5051. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  5052. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  5053. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  5054. * @returns {number} 返回当前比例尺下的屏幕分辨率。
  5055. */
  5056. SuperMap.Util.getResolutionFromScaleDpi = function (scale, dpi, coordUnit, datumAxis) {
  5057. var resolution = null,
  5058. ratio = 10000;
  5059. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  5060. datumAxis = datumAxis || 6378137;
  5061. coordUnit = coordUnit || "";
  5062. if (scale > 0 && dpi > 0) {
  5063. scale = SuperMap.Util.normalizeScale(scale);
  5064. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  5065. //scale = SuperMap.Util.normalizeScale(scale);
  5066. resolution = 0.0254 * ratio / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  5067. return resolution;
  5068. } else {
  5069. resolution = 0.0254 * ratio / dpi / scale / ratio;
  5070. return resolution;
  5071. }
  5072. }
  5073. return -1;
  5074. };
  5075. /**
  5076. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  5077. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  5078. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  5079. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  5080. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  5081. * @returns {number} 返回当前屏幕分辨率下的比例尺。
  5082. */
  5083. SuperMap.Util.getScaleFromResolutionDpi = function (resolution, dpi, coordUnit, datumAxis) {
  5084. var scale = null,
  5085. ratio = 10000;
  5086. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  5087. datumAxis = datumAxis || 6378137;
  5088. coordUnit = coordUnit || "";
  5089. if (resolution > 0 && dpi > 0) {
  5090. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  5091. scale = 0.0254 * ratio / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  5092. return scale;
  5093. } else {
  5094. scale = 0.0254 * ratio / dpi / resolution / ratio;
  5095. return scale;
  5096. }
  5097. }
  5098. return -1;
  5099. };
  5100. /**
  5101. * @description 转换查询结果。
  5102. * @param {Object} result - 查询结果。
  5103. * @returns {Object} 转换后的查询结果。
  5104. */
  5105. SuperMap.Util.transformResult = function (result) {
  5106. if (result.responseText && typeof result.responseText === "string") {
  5107. result = JSON.parse(result.responseText);
  5108. }
  5109. return result;
  5110. };
  5111. /**
  5112. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  5113. * @param {Object} [destination] - 拷贝目标。
  5114. * @param {Object} source - 源对象。
  5115. *
  5116. */
  5117. SuperMap.Util.copyAttributes = function (destination, source) {
  5118. destination = destination || {};
  5119. if (source) {
  5120. for (var property in source) {
  5121. var value = source[property];
  5122. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  5123. destination[property] = value;
  5124. }
  5125. }
  5126. }
  5127. return destination;
  5128. };
  5129. /**
  5130. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  5131. * @param {Object} [destination] - 目标对象。
  5132. * @param {Object} source - 源对象。
  5133. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  5134. *
  5135. */
  5136. SuperMap.Util.copyAttributesWithClip = function (destination, source, clip) {
  5137. destination = destination || {};
  5138. if (source) {
  5139. for (var property in source) {
  5140. //去掉禁止拷贝的属性
  5141. var isInClip = false;
  5142. if (clip && clip.length) {
  5143. for (var i = 0, len = clip.length; i < len; i++) {
  5144. if (property === clip[i]) {
  5145. isInClip = true;
  5146. break;
  5147. }
  5148. }
  5149. }
  5150. if (isInClip === true) {
  5151. continue;
  5152. }
  5153. var value = source[property];
  5154. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  5155. destination[property] = value;
  5156. }
  5157. }
  5158. }
  5159. return destination;
  5160. };
  5161. /**
  5162. * @description 克隆一个 Object 对象
  5163. * @param {Object} obj - 需要克隆的对象。
  5164. * @returns {Object} 返回对象的拷贝对象,注意是新的对象,不是指向。
  5165. */
  5166. SuperMap.Util.cloneObject = function (obj) {
  5167. // Handle the 3 simple types, and null or undefined
  5168. if (null === obj || "object" !== typeof obj) {
  5169. return obj;
  5170. }
  5171. // Handle Date
  5172. if (obj instanceof Date) {
  5173. let copy = new Date();
  5174. copy.setTime(obj.getTime());
  5175. return copy;
  5176. }
  5177. // Handle Array
  5178. if (obj instanceof Array) {
  5179. let copy = obj.slice(0);
  5180. return copy;
  5181. }
  5182. // Handle Object
  5183. if (obj instanceof Object) {
  5184. let copy = {};
  5185. for (var attr in obj) {
  5186. if (obj.hasOwnProperty(attr)) {
  5187. copy[attr] = SuperMap.Util.cloneObject(obj[attr]);
  5188. }
  5189. }
  5190. return copy;
  5191. }
  5192. throw new Error("Unable to copy obj! Its type isn't supported.");
  5193. };
  5194. /**
  5195. * @description 判断两条线段是不是有交点。
  5196. * @param {SuperMap.Geometry.Point} a1 - 第一条线段的起始节点。
  5197. * @param {SuperMap.Geometry.Point} a2 - 第一条线段的结束节点。
  5198. * @param {SuperMap.Geometry.Point} b1 - 第二条线段的起始节点。
  5199. * @param {SuperMap.Geometry.Point} b2 - 第二条线段的结束节点。
  5200. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  5201. */
  5202. SuperMap.Util.lineIntersection = function (a1, a2, b1, b2) {
  5203. var intersectValue = null;
  5204. var k1;
  5205. var k2;
  5206. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  5207. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  5208. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  5209. //ab==0代表两条线断的斜率一样
  5210. if (ab != 0) {
  5211. k1 = b / ab;
  5212. k2 = a / ab;
  5213. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  5214. intersectValue = new SuperMap.Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  5215. } else {
  5216. intersectValue = "No Intersection";
  5217. }
  5218. } else {
  5219. if (b == 0 && a == 0) {
  5220. var maxy = Math.max(a1.y, a2.y);
  5221. var miny = Math.min(a1.y, a2.y);
  5222. var maxx = Math.max(a1.x, a2.x);
  5223. var minx = Math.min(a1.x, a2.x);
  5224. if (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) &&
  5225. (b1.x >= minx && b1.x <= maxx) || (b2.x >= minx && b2.x <= maxx)) {
  5226. intersectValue = "Coincident";//重合
  5227. } else {
  5228. intersectValue = "Parallel";//平行
  5229. }
  5230. } else {
  5231. intersectValue = "Parallel";//平行
  5232. }
  5233. }
  5234. return intersectValue;
  5235. };
  5236. /**
  5237. * @description 获取文本外接矩形宽度与高度。
  5238. * @param {SuperMap.ThemeStyle} style - 文本样式。
  5239. * @param {string} text - 文本内容。
  5240. * @param {Object} element - DOM 元素。
  5241. * @returns {Object} 返回裁剪后的宽度,高度信息。
  5242. */
  5243. SuperMap.Util.getTextBounds = function (style, text, element) {
  5244. document.body.appendChild(element);
  5245. element.style.width = 'auto';
  5246. element.style.height = 'auto';
  5247. if (style.fontSize) {
  5248. element.style.fontSize = style.fontSize;
  5249. }
  5250. if (style.fontFamily) {
  5251. element.style.fontFamily = style.fontFamily;
  5252. }
  5253. if (style.fontWeight) {
  5254. element.style.fontWeight = style.fontWeight;
  5255. }
  5256. element.style.position = 'relative';
  5257. element.style.visibility = 'hidden';
  5258. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  5259. element.style.display = 'inline-block';
  5260. element.innerHTML = text;
  5261. var textWidth = element.clientWidth;
  5262. var textHeight = element.clientHeight;
  5263. document.body.removeChild(element);
  5264. return {
  5265. textWidth: textWidth,
  5266. textHeight: textHeight
  5267. };
  5268. };
  5269. // CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  5270. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  5271. * This program are made available under the terms of the Apache License, Version 2.0
  5272. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5273. /**
  5274. * @class SuperMap.LonLat
  5275. * @category BaseTypes Geometry
  5276. * @classdesc 这个类用来表示经度和纬度对。
  5277. * @param {number} [lon=0.0] - 地图单位上的 X 轴坐标,如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  5278. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  5279. * @param {Array.<float>} [location] - 如果要同时设置,则使用传入横纵坐标组成的数组。
  5280. * @example
  5281. * var lonLat = new SuperMap.LonLat(30,45);
  5282. */
  5283. class LonLat_LonLat {
  5284. constructor(lon, lat) {
  5285. if (Util_Util.isArray(lon)) {
  5286. lat = lon[1];
  5287. lon = lon[0];
  5288. }
  5289. /**
  5290. * @member {float} [SuperMap.LonLat.prototype.lon=0.0]
  5291. * @description 地图的单位的 X 轴(横轴)坐标。
  5292. */
  5293. this.lon = lon ? Util_Util.toFloat(lon) : 0.0;
  5294. /**
  5295. * @member {float} [SuperMap.LonLat.prototype.lat=0.0]
  5296. * @description 地图的单位的 Y 轴(纵轴)坐标。
  5297. */
  5298. this.lat = lat ? Util_Util.toFloat(lat) : 0.0;
  5299. this.CLASS_NAME = "SuperMap.LonLat";
  5300. }
  5301. /**
  5302. * @function SuperMap.LonLat.prototype.toString
  5303. * @description 返回此对象的字符串形式
  5304. * @example
  5305. * var lonLat = new SuperMap.LonLat(100,50);
  5306. * var str = lonLat.toString();
  5307. * @returns {string} 例如: "lon=100,lat=50"
  5308. */
  5309. toString() {
  5310. return ("lon=" + this.lon + ",lat=" + this.lat);
  5311. }
  5312. /**
  5313. * @function SuperMap.LonLat.prototype.toShortString
  5314. * @description 将经度纬度转换成简单字符串。
  5315. * @example
  5316. * var lonLat = new SuperMap.LonLat(100,50);
  5317. * var str = lonLat.toShortString();
  5318. * @returns {string} 返回处理后的经纬度字符串。例如:"100,50"
  5319. */
  5320. toShortString() {
  5321. return (this.lon + "," + this.lat);
  5322. }
  5323. /**
  5324. * @function SuperMap.LonLat.prototype.clone
  5325. * @description 复制坐标对象,并返回复制后的新对象。
  5326. * @example
  5327. * var lonLat1 = new SuperMap.LonLat(100,50);
  5328. * var lonLat2 = lonLat1.clone();
  5329. * @returns {SuperMap.LonLat} 返回相同坐标值的新的坐标对象。
  5330. */
  5331. clone() {
  5332. return new LonLat_LonLat(this.lon, this.lat);
  5333. }
  5334. /**
  5335. * @function SuperMap.LonLat.prototype.add
  5336. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  5337. * @example
  5338. * var lonLat1 = new SuperMap.LonLat(100,50);
  5339. * //lonLat2 是新的对象
  5340. * var lonLat2 = lonLat1.add(100,50);
  5341. * @param {float} lon - 传入的经度参数。
  5342. * @param {float} lat - 传入的纬度参数。
  5343. * @returns {SuperMap.LonLat} 返回一个新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  5344. */
  5345. add(lon, lat) {
  5346. if ((lon == null) || (lat == null)) {
  5347. throw new TypeError('LonLat.add cannot receive null values');
  5348. }
  5349. return new LonLat_LonLat(this.lon + Util_Util.toFloat(lon),
  5350. this.lat + Util_Util.toFloat(lat));
  5351. }
  5352. /**
  5353. * @function SuperMap.LonLat.prototype.equals
  5354. * @description 判断两个坐标对象是否相等。
  5355. * @example
  5356. * var lonLat1 = new SuperMap.LonLat(100,50);
  5357. * var lonLat2 = new SuperMap.LonLat(100,50);
  5358. * var isEquals = lonLat1.equals(lonLat2);
  5359. * @param {SuperMap.LonLat} ll - 需要进行比较的坐标对象。
  5360. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  5361. * 致或传入的ll参数为NULL则返回false。
  5362. */
  5363. equals(ll) {
  5364. var equals = false;
  5365. if (ll != null) {
  5366. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  5367. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  5368. }
  5369. return equals;
  5370. }
  5371. /**
  5372. * @function SuperMap.LonLat.prototype.wrapDateLine
  5373. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  5374. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  5375. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  5376. * @example
  5377. * var lonLat1 = new SuperMap.LonLat(420,50);
  5378. * var lonLat2 = lonLat1.wrapDateLine(
  5379. * new SuperMap.Bounds(-180,-90,180,90)
  5380. * );
  5381. * @param {SuperMap.Bounds} maxExtent - 最大边界的范围。
  5382. * @returns {SuperMap.LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  5383. */
  5384. wrapDateLine(maxExtent) {
  5385. var newLonLat = this.clone();
  5386. if (maxExtent) {
  5387. //shift right?
  5388. while (newLonLat.lon < maxExtent.left) {
  5389. newLonLat.lon += maxExtent.getWidth();
  5390. }
  5391. //shift left?
  5392. while (newLonLat.lon > maxExtent.right) {
  5393. newLonLat.lon -= maxExtent.getWidth();
  5394. }
  5395. }
  5396. return newLonLat;
  5397. }
  5398. /**
  5399. *
  5400. * @function SuperMap.LonLat.prototype.destroy
  5401. * @description 销毁此对象。
  5402. * 销毁后此对象的所有属性为 null,而不是初始值。
  5403. * @example
  5404. * var lonLat = new SuperMap.LonLat(100,50);
  5405. * lonLat.destroy();
  5406. */
  5407. destroy() {
  5408. this.lon = null;
  5409. this.lat = null;
  5410. }
  5411. /**
  5412. * @function SuperMap.LonLat.fromString
  5413. * @description 通过字符串生成一个 {@link SuperMap.LonLat} 对象。
  5414. * @example
  5415. * var str = "100,50";
  5416. * var lonLat = SuperMap.LonLat.fromString(str);
  5417. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  5418. * @returns {SuperMap.LonLat} 返回一个 {@link SuperMap.LonLat} 对象。
  5419. */
  5420. static fromString(str) {
  5421. var pair = str.split(",");
  5422. return new LonLat_LonLat(pair[0], pair[1]);
  5423. }
  5424. /**
  5425. * @function SuperMap.LonLat.fromArray
  5426. * @description 通过数组生成一个 <SuperMap.LonLat> 对象。
  5427. * @param {Array.<float>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  5428. * @returns {SuperMap.LonLat} 返回一个 <SuperMap.LonLat> 对象。
  5429. */
  5430. static fromArray(arr) {
  5431. var gotArr = Util_Util.isArray(arr),
  5432. lon = gotArr && arr[0],
  5433. lat = gotArr && arr[1];
  5434. return new LonLat_LonLat(lon, lat);
  5435. }
  5436. }
  5437. // CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  5438. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  5439. * This program are made available under the terms of the Apache License, Version 2.0
  5440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5441. /**
  5442. * @class SuperMap.Bounds
  5443. * @category BaseTypes Geometry
  5444. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  5445. * @param {number} [left] - 左边界,注意考虑宽度,理论上小于 right 值。
  5446. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  5447. * @param {number} [right] - 右边界。
  5448. * @param {number} [top] - 上边界。
  5449. * @param {Array.<number>} [array] - [left, bottom, right, top],如果同时传多个参数,则使用左下右上组成的数组。
  5450. * @example
  5451. * var bounds = new SuperMap.Bounds();
  5452. * bounds.extend(new SuperMap.LonLat(4,5));
  5453. * bounds.extend(new SuperMap.LonLat(5,6));
  5454. * bounds.toBBOX(); // returns 4,5,5,6
  5455. */
  5456. class Bounds_Bounds {
  5457. constructor(left, bottom, right, top) {
  5458. if (Util_Util.isArray(left)) {
  5459. top = left[3];
  5460. right = left[2];
  5461. bottom = left[1];
  5462. left = left[0];
  5463. }
  5464. /**
  5465. * @member {number} SuperMap.Bounds.prototype.left
  5466. * @description 最小的水平坐标系。
  5467. */
  5468. this.left = left != null ? Util_Util.toFloat(left) : this.left;
  5469. /**
  5470. * @member {number} SuperMap.Bounds.prototype.bottom
  5471. * @description 最小的垂直坐标系。
  5472. */
  5473. this.bottom = bottom != null ? Util_Util.toFloat(bottom) : this.bottom;
  5474. /**
  5475. * @member {number} SuperMap.Bounds.prototype.right
  5476. * @description 最大的水平坐标系。
  5477. */
  5478. this.right = right != null ? Util_Util.toFloat(right) : this.right;
  5479. /**
  5480. * @member {number} SuperMap.Bounds.prototype.top
  5481. * @description 最大的垂直坐标系。
  5482. */
  5483. this.top = top != null ? Util_Util.toFloat(top) : this.top;
  5484. /**
  5485. * @member {SuperMap.LonLat} SuperMap.Bounds.prototype.centerLonLat
  5486. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  5487. */
  5488. this.centerLonLat = null;
  5489. this.CLASS_NAME = "SuperMap.Bounds";
  5490. }
  5491. /**
  5492. * @function SuperMap.Bounds.prototype.clone
  5493. * @description 复制当前 bounds 对象。
  5494. * @example
  5495. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  5496. * var bounds2 = bounds1.clone();
  5497. * @returns {SuperMap.Bounds} 返回一个克隆的 bounds。
  5498. */
  5499. clone() {
  5500. return new Bounds_Bounds(this.left, this.bottom,
  5501. this.right, this.top);
  5502. }
  5503. /**
  5504. * @function SuperMap.Bounds.prototype.equals
  5505. * @description 判断两个 bounds 对象是否相等。
  5506. * @example
  5507. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  5508. * var bounds2 = new SuperMap.Bounds(-180,-90,180,90);
  5509. * var isEquals = bounds1.equals(bounds2);
  5510. * @param {SuperMap.Bounds} bounds - 需要进行计较的 bounds。
  5511. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  5512. */
  5513. equals(bounds) {
  5514. var equals = false;
  5515. if (bounds != null) {
  5516. equals = ((this.left === bounds.left) &&
  5517. (this.right === bounds.right) &&
  5518. (this.top === bounds.top) &&
  5519. (this.bottom === bounds.bottom));
  5520. }
  5521. return equals;
  5522. }
  5523. /**
  5524. * @function SuperMap.Bounds.prototype.toString
  5525. * @description 返回此对象的字符串形式。
  5526. * @example
  5527. * var bounds = new SuperMap.Bounds(-180,-90,180,90);
  5528. * var str = bounds.toString();
  5529. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  5530. */
  5531. toString() {
  5532. return [this.left, this.bottom, this.right, this.top].join(",");
  5533. }
  5534. /**
  5535. * @function SuperMap.Bounds.prototype.toArray
  5536. * @description 边界对象的数组表示形式。
  5537. * @example
  5538. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5539. * //array1 = [-180,-90,100,80];
  5540. * var array1 = bounds.toArray();
  5541. * //array1 = [-90,-180,80,100];
  5542. * var array2 = bounds.toArray(true);
  5543. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  5544. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  5545. * @returns {Array.<number>} left, bottom, right, top 数组。
  5546. */
  5547. toArray(reverseAxisOrder) {
  5548. if (reverseAxisOrder === true) {
  5549. return [this.bottom, this.left, this.top, this.right];
  5550. } else {
  5551. return [this.left, this.bottom, this.right, this.top];
  5552. }
  5553. }
  5554. /**
  5555. * @function SuperMap.Bounds.prototype.toBBOX
  5556. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  5557. * @example
  5558. * var bounds = new SuperMap.Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  5559. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  5560. * var str1 = bounds.toBBOX();
  5561. * //str2 = "-1.1,-1.8,1.4,1.6";
  5562. * var str2 = bounds.toBBOX(1);
  5563. * //str2 = "-1.8,-1.1,1.6,1.4";
  5564. * var str2 = bounds.toBBOX(1,true);
  5565. * @param {integer} [decimal=6] - 边界方位坐标的有效数字个数。
  5566. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  5567. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  5568. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  5569. */
  5570. toBBOX(decimal, reverseAxisOrder) {
  5571. if (decimal == null) {
  5572. decimal = 6;
  5573. }
  5574. var mult = Math.pow(10, decimal);
  5575. var xmin = Math.round(this.left * mult) / mult;
  5576. var ymin = Math.round(this.bottom * mult) / mult;
  5577. var xmax = Math.round(this.right * mult) / mult;
  5578. var ymax = Math.round(this.top * mult) / mult;
  5579. if (reverseAxisOrder === true) {
  5580. return ymin + "," + xmin + "," + ymax + "," + xmax;
  5581. } else {
  5582. return xmin + "," + ymin + "," + xmax + "," + ymax;
  5583. }
  5584. }
  5585. /**
  5586. * @function SuperMap.Bounds.prototype.toGeometry
  5587. * @description 基于当前边界范围创建一个新的多边形对象。
  5588. * @example
  5589. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5590. * //SuperMap.Geometry.Polygon对象
  5591. * var geo = bounds.toGeometry();
  5592. * @returns {SuperMap.Geometry.Polygon} 基于当前 bounds 坐标创建的新的多边形。
  5593. */
  5594. // toGeometry() {
  5595. // return new Polygon([
  5596. // new LinearRing([
  5597. // new Point(this.left, this.bottom),
  5598. // new Point(this.right, this.bottom),
  5599. // new Point(this.right, this.top),
  5600. // new Point(this.left, this.top)
  5601. // ])
  5602. // ]);
  5603. // }
  5604. /**
  5605. * @function SuperMap.Bounds.prototype.getWidth
  5606. * @description 获取 bounds 的宽度。
  5607. * @example
  5608. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5609. * //width = 280;
  5610. * var width = bounds.getWidth();
  5611. * @returns {float} 获取当前 bounds 的宽度(right 减去 left)。
  5612. */
  5613. getWidth() {
  5614. return (this.right - this.left);
  5615. }
  5616. /**
  5617. * @function SuperMap.Bounds.prototype.getHeight
  5618. * @description 获取 bounds 的高度。
  5619. * @example
  5620. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5621. * //height = 170;
  5622. * var height = bounds.getHeight();
  5623. * @returns {float} 返回边界高度(top 减去 bottom)。
  5624. */
  5625. getHeight() {
  5626. return (this.top - this.bottom);
  5627. }
  5628. /**
  5629. * @function SuperMap.Bounds.prototype.getSize
  5630. * @description 获取边框大小。
  5631. * @example
  5632. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5633. * var size = bounds.getSize();
  5634. * @returns {SuperMap.Size} 返回边框大小。
  5635. */
  5636. getSize() {
  5637. return new Size(this.getWidth(), this.getHeight());
  5638. }
  5639. /**
  5640. * @function SuperMap.Bounds.prototype.getCenterPixel
  5641. * @description 获取像素格式的范围中心点。
  5642. * @example
  5643. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5644. * var pixel = bounds.getCenterPixel();
  5645. * @returns {SuperMap.Pixel} 返回像素格式的当前范围的中心点。
  5646. */
  5647. getCenterPixel() {
  5648. return new Pixel_Pixel((this.left + this.right) / 2,
  5649. (this.bottom + this.top) / 2);
  5650. }
  5651. /**
  5652. * @function SuperMap.Bounds.prototype.getCenterLonLat
  5653. * @description 获取地理格式的范围中心点。
  5654. * @example
  5655. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5656. * var lonlat = bounds.getCenterLonLat();
  5657. * @returns {SuperMap.LonLat} 返回当前地理范围的中心点。
  5658. */
  5659. getCenterLonLat() {
  5660. if (!this.centerLonLat) {
  5661. this.centerLonLat = new LonLat_LonLat(
  5662. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  5663. );
  5664. }
  5665. return this.centerLonLat;
  5666. }
  5667. /**
  5668. * @function SuperMap.Bounds.prototype.scale
  5669. * @description 按照比例扩大/缩小出一个新的 bounds。
  5670. * @example
  5671. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  5672. * var bounds2 = bounds.scale(2);
  5673. * @param {float} [ratio=1] - 需要扩大的比例。
  5674. * @param {(SuperMap.Pixel|SuperMap.LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  5675. * @returns {SuperMap.Bounds} 返回通过 ratio、origin 计算得到的新的边界范围。
  5676. */
  5677. scale(ratio, origin) {
  5678. ratio = ratio ? ratio : 1;
  5679. if (origin == null) {
  5680. origin = this.getCenterLonLat();
  5681. }
  5682. var origx, origy;
  5683. // get origin coordinates
  5684. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  5685. origx = origin.lon;
  5686. origy = origin.lat;
  5687. } else {
  5688. origx = origin.x;
  5689. origy = origin.y;
  5690. }
  5691. var left = (this.left - origx) * ratio + origx;
  5692. var bottom = (this.bottom - origy) * ratio + origy;
  5693. var right = (this.right - origx) * ratio + origx;
  5694. var top = (this.top - origy) * ratio + origy;
  5695. return new Bounds_Bounds(left, bottom, right, top);
  5696. }
  5697. /**
  5698. * @function SuperMap.Bounds.prototype.add
  5699. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  5700. * @example
  5701. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  5702. * //bounds2 是新的 bounds
  5703. * var bounds2 = bounds.add(20,10);
  5704. * @param {float} x - 传入坐标点的 x 坐标。
  5705. * @param {float} y - 传入坐标点的 y 坐标。
  5706. * @returns {SuperMap.Bounds} 返回一个新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  5707. */
  5708. add(x, y) {
  5709. if ((x == null) || (y == null)) {
  5710. throw new TypeError('Bounds.add cannot receive null values');
  5711. }
  5712. return new Bounds_Bounds(this.left + x, this.bottom + y,
  5713. this.right + x, this.top + y);
  5714. }
  5715. /**
  5716. * @function SuperMap.Bounds.prototype.extend
  5717. * @description 在当前 bounds 上扩展 bounds,支持 point,lanlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  5718. * @example
  5719. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  5720. * //bounds 改变
  5721. * bounds.extend(new SuperMap.LonLat(50,60));
  5722. * @param {(SuperMap.Geometry.Point|SuperMap.LonLat|SuperMap.Bounds)} object - 可以是 point、lonlat 和 bounds。
  5723. */
  5724. extend(object) {
  5725. var bounds = null;
  5726. if (object) {
  5727. // clear cached center location
  5728. switch (object.CLASS_NAME) {
  5729. case "SuperMap.LonLat":
  5730. bounds = new Bounds_Bounds(object.lon, object.lat,
  5731. object.lon, object.lat);
  5732. break;
  5733. case "SuperMap.Geometry.Point":
  5734. bounds = new Bounds_Bounds(object.x, object.y,
  5735. object.x, object.y);
  5736. break;
  5737. case "SuperMap.Bounds":
  5738. bounds = object;
  5739. break;
  5740. }
  5741. if (bounds) {
  5742. this.centerLonLat = null;
  5743. if ((this.left == null) || (bounds.left < this.left)) {
  5744. this.left = bounds.left;
  5745. }
  5746. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  5747. this.bottom = bounds.bottom;
  5748. }
  5749. if ((this.right == null) || (bounds.right > this.right)) {
  5750. this.right = bounds.right;
  5751. }
  5752. if ((this.top == null) || (bounds.top > this.top)) {
  5753. this.top = bounds.top;
  5754. }
  5755. }
  5756. }
  5757. }
  5758. /**
  5759. * @function SuperMap.Bounds.prototype.containsLonLat
  5760. * @description 判断传入的坐标是否在范围内。
  5761. * @example
  5762. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  5763. * //isContains1 = true
  5764. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  5765. * var isContains1 = bounds.containsLonLat(new SuperMap.LonLat(40,40),true);
  5766. *
  5767. * //(40,40)在范围内,同样(40+360,40)也在范围内
  5768. * var bounds2 = new SuperMap.Bounds(-50,-50,40,40);
  5769. * //isContains2 = true;
  5770. * var isContains2 = bounds2.containsLonLat(
  5771. * new SuperMap.LonLat(400,40),
  5772. * {
  5773. * inclusive:true,
  5774. * //全球的范围
  5775. * worldBounds: new SuperMap.Bounds(-180,-90,180,90)
  5776. * }
  5777. * );
  5778. * @param {(SuperMap.LonLat|Object)} ll - <SuperMap.LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  5779. * @param {Object} options - 可选参数。
  5780. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  5781. * @param {SuperMap.Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  5782. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  5783. * @returns {boolean} 传入坐标是否包含在范围内。
  5784. */
  5785. containsLonLat(ll, options) {
  5786. if (typeof options === "boolean") {
  5787. options = {inclusive: options};
  5788. }
  5789. options = options || {};
  5790. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  5791. worldBounds = options.worldBounds;
  5792. //日界线以外的也有可能算包含,
  5793. if (worldBounds && !contains) {
  5794. var worldWidth = worldBounds.getWidth();
  5795. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  5796. //这一步很关键
  5797. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  5798. contains = this.containsLonLat({
  5799. lon: ll.lon - worldsAway * worldWidth,
  5800. lat: ll.lat
  5801. }, {inclusive: options.inclusive});
  5802. }
  5803. return contains;
  5804. }
  5805. /**
  5806. * @function SuperMap.Bounds.prototype.containsPixel
  5807. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  5808. * @example
  5809. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  5810. * //isContains = true
  5811. * var isContains = bounds.containsPixel(new SuperMap.Pixel(40,40),true);
  5812. * @param {SuperMap.Pixel} px - 提供的像素参数。
  5813. * @param {boolean} [inclusive=true] - 是否包含边界。
  5814. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  5815. */
  5816. containsPixel(px, inclusive) {
  5817. return this.contains(px.x, px.y, inclusive);
  5818. }
  5819. /**
  5820. * @function SuperMap.Bounds.prototype.contains
  5821. * @description 判断传入的 x,y 坐标值是否在范围内。
  5822. * @example
  5823. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  5824. * //isContains = true
  5825. * var isContains = bounds.contains(40,40,true);
  5826. * @param {float} x - 传入的 x 坐标值。
  5827. * @param {float} y - 传入的 y 坐标值。
  5828. * @param {boolean} [inclusive=true] - 是否包含边界。
  5829. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  5830. */
  5831. contains(x, y, inclusive) {
  5832. //set default
  5833. if (inclusive == null) {
  5834. inclusive = true;
  5835. }
  5836. if (x == null || y == null) {
  5837. return false;
  5838. }
  5839. //x = Util.toFloat(x);
  5840. //y = Util.toFloat(y);
  5841. var contains = false;
  5842. if (inclusive) {
  5843. contains = ((x >= this.left) && (x <= this.right) &&
  5844. (y >= this.bottom) && (y <= this.top));
  5845. } else {
  5846. contains = ((x > this.left) && (x < this.right) &&
  5847. (y > this.bottom) && (y < this.top));
  5848. }
  5849. return contains;
  5850. }
  5851. /**
  5852. * @function SuperMap.Bounds.prototype.intersectsBounds
  5853. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意
  5854. * 边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  5855. * @example
  5856. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5857. * var isIntersects = bounds.intersectsBounds(
  5858. * new SuperMap.Bounds(-170,-90,120,80)
  5859. * );
  5860. * @param {SuperMap.Bounds} bounds - 目标边界。
  5861. * @param {Object} options - 参数。
  5862. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,
  5863. * 两个边界范围没有重叠部分仅仅是在边缘相接(重合),
  5864. * 这种情况被认为没有相交。
  5865. * @param {SuperMap.Bounds} [options.worldBounds] - 提供了 worldBounds 参数, 如果他们相交时
  5866. * 是在全球范围内, 两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  5867. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  5868. */
  5869. intersectsBounds(bounds, options) {
  5870. if (typeof options === "boolean") {
  5871. options = {inclusive: options};
  5872. }
  5873. options = options || {};
  5874. if (options.worldBounds) {
  5875. var self = this.wrapDateLine(options.worldBounds);
  5876. bounds = bounds.wrapDateLine(options.worldBounds);
  5877. } else {
  5878. self = this;
  5879. }
  5880. if (options.inclusive == null) {
  5881. options.inclusive = true;
  5882. }
  5883. var intersects = false;
  5884. var mightTouch = (
  5885. self.left === bounds.right ||
  5886. self.right === bounds.left ||
  5887. self.top === bounds.bottom ||
  5888. self.bottom === bounds.top
  5889. );
  5890. // if the two bounds only touch at an edge, and inclusive is false,
  5891. // then the bounds don't *really* intersect.
  5892. if (options.inclusive || !mightTouch) {
  5893. // otherwise, if one of the boundaries even partially contains another,
  5894. // inclusive of the edges, then they do intersect.
  5895. var inBottom = (
  5896. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  5897. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  5898. );
  5899. var inTop = (
  5900. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  5901. ((self.top > bounds.bottom) && (self.top < bounds.top))
  5902. );
  5903. var inLeft = (
  5904. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  5905. ((self.left >= bounds.left) && (self.left <= bounds.right))
  5906. );
  5907. var inRight = (
  5908. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  5909. ((self.right >= bounds.left) && (self.right <= bounds.right))
  5910. );
  5911. intersects = ((inBottom || inTop) && (inLeft || inRight));
  5912. }
  5913. // document me
  5914. if (options.worldBounds && !intersects) {
  5915. var world = options.worldBounds;
  5916. var width = world.getWidth();
  5917. var selfCrosses = !world.containsBounds(self);
  5918. var boundsCrosses = !world.containsBounds(bounds);
  5919. if (selfCrosses && !boundsCrosses) {
  5920. bounds = bounds.add(-width, 0);
  5921. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  5922. } else if (boundsCrosses && !selfCrosses) {
  5923. self = self.add(-width, 0);
  5924. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  5925. }
  5926. }
  5927. return intersects;
  5928. }
  5929. /**
  5930. * @function SuperMap.Bounds.prototype.containsBounds
  5931. * @description 判断目标边界是否被当前边界包含在内。
  5932. * @example
  5933. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5934. * var isContains = bounds.containsBounds(
  5935. * new SuperMap.Bounds(-170,-90,100,80),true,true
  5936. * );
  5937. * @param {SuperMap.Bounds} bounds - 目标边界。
  5938. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  5939. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  5940. * @param {boolean} [inclusive=true] - 边缘共享被视为包含。
  5941. * @returns {boolean} 传入的边界被当前边界包含。
  5942. */
  5943. containsBounds(bounds, partial, inclusive) {
  5944. if (partial == null) {
  5945. partial = false;
  5946. }
  5947. if (inclusive == null) {
  5948. inclusive = true;
  5949. }
  5950. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  5951. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  5952. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  5953. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  5954. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  5955. : (bottomLeft && bottomRight && topLeft && topRight);
  5956. }
  5957. /**
  5958. * @function SuperMap.Bounds.prototype.determineQuadrant
  5959. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  5960. * @example
  5961. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5962. * //str = "tr";
  5963. * var str = bounds.determineQuadrant(
  5964. * new SuperMap.LonLat(20,20)
  5965. * );
  5966. * @param {SuperMap.LonLat} lonlat - 传入的坐标对象。
  5967. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  5968. */
  5969. determineQuadrant(lonlat) {
  5970. var quadrant = "";
  5971. var center = this.getCenterLonLat();
  5972. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  5973. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  5974. return quadrant;
  5975. }
  5976. /**
  5977. * @function SuperMap.Bounds.prototype.wrapDateLine
  5978. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  5979. * @example
  5980. * var bounds = new SuperMap.Bounds(380,-40,400,-20);
  5981. * var maxExtent = new SuperMap.Bounds(-180,-90,100,80);
  5982. * //新的bounds
  5983. * var newBounds = bounds.wrapDateLine(maxExtent);
  5984. * @param {SuperMap.Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  5985. * @param {Object} options - 可选选项参数。
  5986. * @param {float} [options.leftTolerance=0] - left 允许的误差。
  5987. * @param {float} [options.rightTolerance=0] - right 允许的误差。
  5988. * @returns {SuperMap.Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  5989. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  5990. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  5991. */
  5992. wrapDateLine(maxExtent, options) {
  5993. options = options || {};
  5994. var leftTolerance = options.leftTolerance || 0;
  5995. var rightTolerance = options.rightTolerance || 0;
  5996. var newBounds = this.clone();
  5997. if (maxExtent) {
  5998. var width = maxExtent.getWidth();
  5999. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  6000. //shift right?
  6001. while (newBounds.left < maxExtent.left &&
  6002. newBounds.right - rightTolerance <= maxExtent.left) {
  6003. newBounds = newBounds.add(width, 0);
  6004. }
  6005. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  6006. //shift left?
  6007. while (newBounds.left + leftTolerance >= maxExtent.right &&
  6008. newBounds.right > maxExtent.right) {
  6009. newBounds = newBounds.add(-width, 0);
  6010. }
  6011. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  6012. // crosses right only? force left
  6013. var newLeft = newBounds.left + leftTolerance;
  6014. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  6015. newBounds.right - rightTolerance > maxExtent.right) {
  6016. newBounds = newBounds.add(-width, 0);
  6017. }
  6018. }
  6019. return newBounds;
  6020. }
  6021. /**
  6022. * @function SuperMap.Bounds.prototype.toServerJSONObject
  6023. * @description 转换成对应的 JSON 格式对象。
  6024. * @example
  6025. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6026. * var obj = bounds.toServerJSONObject();
  6027. * @returns {Object} 返回 JSON 格式的 Object 对象。
  6028. */
  6029. toServerJSONObject() {
  6030. var jsonObject = {
  6031. rightTop: {x: this.right, y: this.top},
  6032. leftBottom: {x: this.left, y: this.bottom},
  6033. left: this.left,
  6034. right: this.right,
  6035. top: this.top,
  6036. bottom: this.bottom
  6037. }
  6038. return jsonObject;
  6039. }
  6040. /**
  6041. *
  6042. * @function SuperMap.Bounds.prototype.destroy
  6043. * @description 销毁此对象。
  6044. * 销毁后此对象的所有属性为 null,而不是初始值。
  6045. * @example
  6046. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6047. * bounds.destroy();
  6048. */
  6049. destroy() {
  6050. this.left = null;
  6051. this.right = null;
  6052. this.top = null;
  6053. this.bottom = null;
  6054. this.centerLonLat = null;
  6055. }
  6056. /**
  6057. * @function SuperMap.Bounds.fromString
  6058. * @description 通过字符串参数创建新的 bounds 的构造函数。
  6059. * @example
  6060. * var bounds = SuperMap.Bounds.fromString("-180,-90,100,80");
  6061. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  6062. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  6063. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6064. * @returns {SuperMap.Bounds} 返回给定的字符串创建的新的边界对象。
  6065. */
  6066. static fromString(str, reverseAxisOrder) {
  6067. var bounds = str.split(",");
  6068. return Bounds_Bounds.fromArray(bounds, reverseAxisOrder);
  6069. }
  6070. /**
  6071. * @function SuperMap.Bounds.fromArray
  6072. * @description 通过边界框数组创建 Bounds。
  6073. * @example
  6074. * var bounds = SuperMap.Bounds.fromArray([-180,-90,100,80]);
  6075. * @param {Array.<float>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  6076. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6077. * @returns {SuperMap.Bounds} 返回根据传入的数组创建的新的边界对象。
  6078. */
  6079. static fromArray(bbox, reverseAxisOrder) {
  6080. return reverseAxisOrder === true ?
  6081. new Bounds_Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  6082. new Bounds_Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  6083. }
  6084. /**
  6085. * @function SuperMap.Bounds.fromSize
  6086. * @description 通过传入的边界大小来创建新的边界。
  6087. * @example
  6088. * var bounds = SuperMap.Bounds.fromSize(new SuperMap.Size(20,10));
  6089. * @param {SuperMap.Size} size - 传入的边界大小。
  6090. * @returns {SuperMap.Bounds} 返回根据传入的边界大小的创建新的边界。
  6091. */
  6092. static fromSize(size) {
  6093. return new Bounds_Bounds(0,
  6094. size.h,
  6095. size.w,
  6096. 0);
  6097. }
  6098. /**
  6099. * @function SuperMap.Bounds.oppositeQuadrant
  6100. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  6101. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  6102. * @returns {string} 反转后的象限。
  6103. */
  6104. static oppositeQuadrant(quadrant) {
  6105. var opp = "";
  6106. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  6107. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  6108. return opp;
  6109. }
  6110. }
  6111. SuperMap.Bounds = Bounds_Bounds;
  6112. // CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  6113. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6114. * This program are made available under the terms of the Apache License, Version 2.0
  6115. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6116. // import {WKT} from '../format/WKT';
  6117. // import {Vector} from './Vector';
  6118. /**
  6119. * @class SuperMap.Geometry
  6120. * @category BaseTypes Geometry
  6121. * @classdesc 几何对象类,描述地理对象的几何图形。
  6122. */
  6123. class Geometry_Geometry {
  6124. constructor() {
  6125. this.CLASS_NAME = "SuperMap.Geometry";
  6126. /**
  6127. * @member {string} SuperMap.Geometry.prototype.id
  6128. * @description 此几何对象的唯一标示符。
  6129. *
  6130. */
  6131. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  6132. /**
  6133. * @member {SuperMap.Geometry} SuperMap.Geometry.prototype.parent
  6134. * @description This is set when a Geometry is added as component
  6135. * of another geometry
  6136. */
  6137. this.parent = null;
  6138. /**
  6139. * @member {SuperMap.Bounds} SuperMap.Geometry.prototype.bounds
  6140. * @description 几何对象的范围。
  6141. *
  6142. */
  6143. this.bounds = null;
  6144. /**
  6145. * @member {interger} SuperMap.Geometry.prototype.SRID
  6146. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  6147. * @example
  6148. * var geometry= new SuperMap.Geometry();
  6149. * geometry. SRID=4326;
  6150. *
  6151. */
  6152. this.SRID = null;
  6153. }
  6154. /**
  6155. * @function SuperMap.Geometry.prototype.destroy
  6156. * @description 解构 Geometry 类,释放资源。
  6157. */
  6158. destroy() {
  6159. this.id = null;
  6160. this.bounds = null;
  6161. this.SRID = null;
  6162. }
  6163. /**
  6164. * @function SuperMap.Geometry.prototype.clone
  6165. * @description 创建克隆的几何图形。克隆的几何图形不设置非标准的属性。
  6166. * @returns {SuperMap.Geometry} 克隆的几何图形。
  6167. */
  6168. clone() {
  6169. return new Geometry_Geometry();
  6170. }
  6171. /**
  6172. * @function SuperMap.Geometry.prototype.setBounds
  6173. * @description 设置此几何对象的 bounds。
  6174. * @param {SuperMap.Bounds} bounds - 范围。
  6175. */
  6176. setBounds(bounds) {
  6177. if (bounds) {
  6178. this.bounds = bounds.clone();
  6179. }
  6180. }
  6181. /**
  6182. * @function SuperMap.Geometry.prototype.clearBounds
  6183. * @description 清除几何对象的 bounds。
  6184. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  6185. */
  6186. clearBounds() {
  6187. this.bounds = null;
  6188. if (this.parent) {
  6189. this.parent.clearBounds();
  6190. }
  6191. }
  6192. /**
  6193. * @function SuperMap.Geometry.prototype.extendBounds
  6194. * @description Extend the existing bounds to include the new bounds.
  6195. * If geometry's bounds is not yet set, then set a new Bounds.
  6196. *
  6197. * @param {SuperMap.Bounds} newBounds - 范围。
  6198. */
  6199. extendBounds(newBounds) {
  6200. var bounds = this.getBounds();
  6201. if (!bounds) {
  6202. this.setBounds(newBounds);
  6203. } else {
  6204. this.bounds.extend(newBounds);
  6205. }
  6206. }
  6207. /**
  6208. * @function SuperMap.Geometry.prototype.getBounds
  6209. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  6210. * @returns {SuperMap.Bounds} 返回的几何对象的边界。
  6211. */
  6212. getBounds() {
  6213. if (this.bounds == null) {
  6214. this.calculateBounds();
  6215. }
  6216. return this.bounds;
  6217. }
  6218. /**
  6219. * @function SuperMap.Geometry.prototype.calculateBounds
  6220. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  6221. */
  6222. calculateBounds() {
  6223. //
  6224. // This should be overridden by subclasses.
  6225. //
  6226. }
  6227. /**
  6228. * @function SuperMap.Geometry.prototype.getVertices
  6229. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  6230. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  6231. * @returns {Array} 几何图形的顶点列表。
  6232. */
  6233. getVertices(nodes) { // eslint-disable-line no-unused-vars
  6234. }
  6235. /**
  6236. * @function SuperMap.Geometry.prototype.getArea
  6237. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  6238. * @returns {float} The area of the collection by summing its parts
  6239. */
  6240. getArea() {
  6241. //to be overridden by geometries that actually have an area
  6242. //
  6243. return 0.0;
  6244. }
  6245. // /**
  6246. // * @function SuperMap.Geometry.prototype.toString
  6247. // * @description 返回geometry对象的字符串表述,需要引入{@link SuperMap.Format.WKT}。此方法只能在子类实现,在父类使用会报错。
  6248. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  6249. // */
  6250. // toString() {
  6251. // var string;
  6252. // if (WKT) {
  6253. // var wkt = new WKT();
  6254. // string = wkt.write(new Vector(this));
  6255. // } else {
  6256. // string = Object.prototype.toString.call(this);
  6257. // }
  6258. // return string;
  6259. // }
  6260. }
  6261. SuperMap.Geometry = Geometry_Geometry;
  6262. // CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  6263. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6264. * This program are made available under the terms of the Apache License, Version 2.0
  6265. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6266. /**
  6267. * @class SuperMap.Geometry.Collection
  6268. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  6269. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  6270. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  6271. * @category BaseTypes Geometry
  6272. * @extends {SuperMap.Geometry}
  6273. * @param {Array.<SuperMap.Geometry>} components - 几何对象数组。
  6274. * @example
  6275. * var point1 = new SuperMap.Geometry.Point(10,20);
  6276. * var point2 = new SuperMap.Geometry.Point(30,40);
  6277. * var col = new SuperMap.Geometry.Collection([point1,point2]);
  6278. */
  6279. class Collection_Collection extends Geometry_Geometry {
  6280. constructor(components) {
  6281. super();
  6282. /**
  6283. * @description 存储几何对象的数组。
  6284. * @member {Array.<SuperMap.Geometry>} SuperMap.Geometry.Collection.prototype.components
  6285. */
  6286. this.components = [];
  6287. /**
  6288. * @member {Array.<string>} SuperMap.Geometry.Collection.prototype.componentTypes
  6289. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  6290. */
  6291. this.componentTypes = null;
  6292. if (components != null) {
  6293. this.addComponents(components);
  6294. }
  6295. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  6296. this.geometryType = "Collection";
  6297. }
  6298. /**
  6299. * @function SuperMap.Geometry.Collection.prototype.destroy
  6300. * @description 销毁几何图形。
  6301. */
  6302. destroy() {
  6303. this.components.length = 0;
  6304. this.components = null;
  6305. super.destroy();
  6306. }
  6307. /**
  6308. * @function SuperMap.Geometry.Collection.prototype.clone
  6309. * @description 克隆当前几何对象。
  6310. * @returns {SuperMap.Geometry.Collection} 克隆的几何对象集合。
  6311. */
  6312. clone() {
  6313. var geometry = new Collection_Collection();
  6314. for (var i = 0, len = this.components.length; i < len; i++) {
  6315. geometry.addComponent(this.components[i].clone());
  6316. }
  6317. // catch any randomly tagged-on properties
  6318. Util_Util.applyDefaults(geometry, this);
  6319. return geometry;
  6320. }
  6321. /**
  6322. * @function SuperMap.Geometry.Collection.prototype.getComponentsString
  6323. * @description 获取 components 字符串。
  6324. * @returns {string} components 字符串。
  6325. */
  6326. getComponentsString() {
  6327. var strings = [];
  6328. for (var i = 0, len = this.components.length; i < len; i++) {
  6329. strings.push(this.components[i].toShortString());
  6330. }
  6331. return strings.join(",");
  6332. }
  6333. /**
  6334. * @function SuperMap.Geometry.Collection.prototype.calculateBounds
  6335. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  6336. */
  6337. calculateBounds() {
  6338. this.bounds = null;
  6339. var bounds = new Bounds_Bounds();
  6340. var components = this.components;
  6341. if (components) {
  6342. for (var i = 0, len = components.length; i < len; i++) {
  6343. bounds.extend(components[i].getBounds());
  6344. }
  6345. }
  6346. // to preserve old behavior, we only set bounds if non-null
  6347. // in the future, we could add bounds.isEmpty()
  6348. if (bounds.left != null && bounds.bottom != null &&
  6349. bounds.right != null && bounds.top != null) {
  6350. this.setBounds(bounds);
  6351. }
  6352. }
  6353. /**
  6354. * @function SuperMap.Geometry.Collection.prototype.addComponents
  6355. * @description 给几何图形对象添加元素。
  6356. * @param {Array.<SuperMap.Geometry>} components - 几何对象组件。
  6357. * @example
  6358. * var collection = new SuperMap.Geometry.Collection();
  6359. * collection.addComponents(new SuerpMap.Geometry.Point(10,10));
  6360. */
  6361. addComponents(components) {
  6362. if (!(Util_Util.isArray(components))) {
  6363. components = [components];
  6364. }
  6365. for (var i = 0, len = components.length; i < len; i++) {
  6366. this.addComponent(components[i]);
  6367. }
  6368. }
  6369. /**
  6370. * @function SuperMap.Geometry.Collection.prototype.addComponent
  6371. * @description 添加一个几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  6372. * @param {SuperMap.Geometry} component - 待添加的几何对象。
  6373. * @param {int} [index] - 几何对象插入的位置。
  6374. * @returns {boolean} 是否添加成功。
  6375. */
  6376. addComponent(component, index) {
  6377. var added = false;
  6378. if (component) {
  6379. if (this.componentTypes == null ||
  6380. (Util_Util.indexOf(this.componentTypes,
  6381. component.CLASS_NAME) > -1)) {
  6382. if (index != null && (index < this.components.length)) {
  6383. var components1 = this.components.slice(0, index);
  6384. var components2 = this.components.slice(index,
  6385. this.components.length);
  6386. components1.push(component);
  6387. this.components = components1.concat(components2);
  6388. } else {
  6389. this.components.push(component);
  6390. }
  6391. component.parent = this;
  6392. this.clearBounds();
  6393. added = true;
  6394. }
  6395. }
  6396. return added;
  6397. }
  6398. /**
  6399. * @function SuperMap.Geometry.Collection.prototype.removeComponents
  6400. * @description 清除几何对象。
  6401. * @param {Array.<SuperMap.Geometry>} components - 需要清除的几何对象。
  6402. * @returns {boolean} 元素是否被删除。
  6403. */
  6404. removeComponents(components) {
  6405. var removed = false;
  6406. if (!(Util_Util.isArray(components))) {
  6407. components = [components];
  6408. }
  6409. for (var i = components.length - 1; i >= 0; --i) {
  6410. removed = this.removeComponent(components[i]) || removed;
  6411. }
  6412. return removed;
  6413. }
  6414. /**
  6415. * @function SuperMap.Geometry.Collection.prototype.removeComponent
  6416. * @description 从集合中移除一个几何对象。
  6417. * @param {SuperMap.Geometry} component - 要移除的几何对象。
  6418. * @returns {boolean} 几何对象是否移除成功。
  6419. */
  6420. removeComponent(component) {
  6421. Util_Util.removeItem(this.components, component);
  6422. // clearBounds() so that it gets recalculated on the next call
  6423. // to this.getBounds();
  6424. this.clearBounds();
  6425. return true;
  6426. }
  6427. /**
  6428. * @function SuperMap.Geometry.Collection.prototype.getArea
  6429. * @description 计算几何对象的面积。注意,这个方法在 {@link SuperMap.Geometry.Polygon} 类中需要重写。
  6430. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  6431. */
  6432. getArea() {
  6433. var area = 0.0;
  6434. for (var i = 0, len = this.components.length; i < len; i++) {
  6435. area += this.components[i].getArea();
  6436. }
  6437. return area;
  6438. }
  6439. /**
  6440. * @function SuperMap.Geometry.Collection.prototype.equals
  6441. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  6442. * @param {SuperMap.Geometry} geometry - 需要判断的几何图形。
  6443. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  6444. */
  6445. equals(geometry) {
  6446. var equivalent = true;
  6447. if (!geometry || !geometry.CLASS_NAME ||
  6448. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  6449. equivalent = false;
  6450. } else if (!(Util_Util.isArray(geometry.components)) ||
  6451. (geometry.components.length !== this.components.length)) {
  6452. equivalent = false;
  6453. } else {
  6454. for (var i = 0, len = this.components.length; i < len; ++i) {
  6455. if (!this.components[i].equals(geometry.components[i])) {
  6456. equivalent = false;
  6457. break;
  6458. }
  6459. }
  6460. }
  6461. return equivalent;
  6462. }
  6463. /**
  6464. * @function SuperMap.Geometry.Collection.prototype.getVertices
  6465. * @description 返回几何对象的所有结点的列表。
  6466. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点如果没有设置此参数,则返回所有顶点。
  6467. * @returns {Array} 几何对象的顶点列表。
  6468. */
  6469. getVertices(nodes) {
  6470. var vertices = [];
  6471. for (var i = 0, len = this.components.length; i < len; ++i) {
  6472. Array.prototype.push.apply(
  6473. vertices, this.components[i].getVertices(nodes)
  6474. );
  6475. }
  6476. return vertices;
  6477. }
  6478. }
  6479. SuperMap.Geometry.Collection = Collection_Collection;
  6480. // CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  6481. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6482. * This program are made available under the terms of the Apache License, Version 2.0
  6483. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6484. /**
  6485. * @class SuperMap.Geometry.MultiPoint
  6486. * @classdesc 几何对象多点类。
  6487. * @category BaseTypes Geometry
  6488. * @extends {SuperMap.Geometry.Collection}
  6489. * @param {Array.<SuperMap.Geometry.Point>} components - 点对象数组。
  6490. * @example
  6491. * var point1 = new SuperMap.Geometry.Point(5,6);
  6492. * var poine2 = new SuperMap.Geometry.Point(7,8);
  6493. * var multiPoint = new SuperMap.Geometry.MultiPoint([point1,point2]);
  6494. */
  6495. class MultiPoint_MultiPoint extends Collection_Collection {
  6496. constructor(components) {
  6497. super(components);
  6498. /**
  6499. * @member {Array.<string>} [SuperMap.Geometry.MultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  6500. * @description components 存储的的几何对象所支持的几何类型数组。
  6501. * @readonly
  6502. */
  6503. this.componentTypes = ["SuperMap.Geometry.Point"];
  6504. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  6505. this.geometryType = "MultiPoint";
  6506. }
  6507. /**
  6508. * @function SuperMap.Geometry.MultiPoint.prototype.addPoint
  6509. * @description 添加点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.addComponent} 方法。
  6510. * @param {SuperMap.Geometry.Point} point - 添加的点。
  6511. * @param {integer} [index] - 下标。
  6512. */
  6513. addPoint(point, index) {
  6514. this.addComponent(point, index);
  6515. }
  6516. /**
  6517. * @function SuperMap.Geometry.MultiPoint.prototype.removePoint
  6518. * @description 移除点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.removeComponent} 方法。
  6519. * @param {SuperMap.Geometry.Point} point - 移除的点对象。
  6520. */
  6521. removePoint(point) {
  6522. this.removeComponent(point);
  6523. }
  6524. }
  6525. SuperMap.Geometry.MultiPoint = MultiPoint_MultiPoint;
  6526. // CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  6527. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6528. * This program are made available under the terms of the Apache License, Version 2.0
  6529. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6530. /**
  6531. * @class SuperMap.Geometry.Curve
  6532. * @classdesc 几何对象曲线类。
  6533. * @category BaseTypes Geometry
  6534. * @extends {SuperMap.Geometry.MultiPoint}
  6535. * @param {Array.<SuperMap.Geometry.Point>} components - 几何对象数组。
  6536. * @example
  6537. * var point1 = new SuperMap.Geometry.Point(10,20);
  6538. * var point2 = new SuperMap.Geometry.Point(30,40);
  6539. * var curve = new SuperMap.Geometry.Curve([point1,point2]);
  6540. */
  6541. class Curve_Curve extends MultiPoint_MultiPoint {
  6542. constructor(components) {
  6543. super(components);
  6544. /**
  6545. * @member {Array.<string>} [SuperMap.Geometry.Curve.prototype.componentType=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  6546. * @description components 存储的的几何对象所支持的几何类型数组。
  6547. * @readonly
  6548. */
  6549. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  6550. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  6551. this.geometryType = "Curve";
  6552. }
  6553. }
  6554. SuperMap.Geometry.Curve = Curve_Curve;
  6555. // CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  6556. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6557. * This program are made available under the terms of the Apache License, Version 2.0
  6558. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6559. /**
  6560. * @class SuperMap.Geometry.Point
  6561. * @classdesc 点几何对象类。
  6562. * @category BaseTypes Geometry
  6563. * @extends {SuperMap.Geometry}
  6564. * @param {float} x - x 坐标。
  6565. * @param {float} y - y 坐标。
  6566. * @param {string} [type = 'Point'] - 用来存储点的类型。
  6567. * @param {float} [tag] - 用来存储额外的属性,比如差值分析中的 Z 值。
  6568. * @example
  6569. * var point = new SuperMap.Geometry.Point(-111.04, 45.68);
  6570. */
  6571. class Point_Point extends Geometry_Geometry {
  6572. constructor(x, y, type, tag) {
  6573. super(x, y, type, tag);
  6574. /**
  6575. * @member {float} SuperMap.Geometry.Point.prototype.x
  6576. * @description 横坐标。
  6577. */
  6578. this.x = parseFloat(x);
  6579. /**
  6580. * @member {float} SuperMap.Geometry.Point.prototype.y
  6581. * @description 纵坐标。
  6582. */
  6583. this.y = parseFloat(y);
  6584. /**
  6585. * @member {string} SuperMap.Geometry.Point.prototype.tag
  6586. * @description 用来存储额外的属性,比如差值分析中的 Z 值。
  6587. */
  6588. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  6589. /**
  6590. * @member {string} SuperMap.Geometry.Point.prototype.tag
  6591. * @description 用来存储点的类型
  6592. */
  6593. this.type = type || "Point";
  6594. this.CLASS_NAME = "SuperMap.Geometry.Point";
  6595. this.geometryType = "Point";
  6596. }
  6597. /**
  6598. * @function SuperMap.Geometry.Point.prototype.clone
  6599. * @description 克隆点对象。
  6600. * @returns {SuperMap.Geometry.Point} 克隆后的点对象。
  6601. */
  6602. clone(obj) {
  6603. if (obj == null) {
  6604. obj = new Point_Point(this.x, this.y);
  6605. }
  6606. // catch any randomly tagged-on properties
  6607. Util_Util.applyDefaults(obj, this);
  6608. return obj;
  6609. }
  6610. /**
  6611. * @function SuperMap.Geometry.Point.prototype.calculateBounds
  6612. * @description 计算点对象的范围。
  6613. */
  6614. calculateBounds() {
  6615. this.bounds = new Bounds_Bounds(this.x, this.y,
  6616. this.x, this.y);
  6617. }
  6618. /**
  6619. * @function SuperMap.Geometry.Point.prototype.equals
  6620. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  6621. * @example
  6622. * var point= new SuperMap.Geometry.Point(0,0);
  6623. * var point1={x:0,y:0};
  6624. * var result= point.equals(point1);
  6625. * @param {SuperMap.Geometry.Point} geom - 需要判断的点对象。
  6626. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  6627. */
  6628. equals(geom) {
  6629. var equals = false;
  6630. if (geom != null) {
  6631. equals = ((this.x === geom.x && this.y === geom.y) ||
  6632. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  6633. }
  6634. return equals;
  6635. }
  6636. /**
  6637. * @function SuperMap.Geometry.Point.prototype.move
  6638. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  6639. * @param {float} x - x 轴正方向上的偏移量。
  6640. * @param {float} y - y 轴正方向上偏移量。
  6641. */
  6642. move(x, y) {
  6643. this.x = this.x + x;
  6644. this.y = this.y + y;
  6645. this.clearBounds();
  6646. }
  6647. /**
  6648. * @function SuperMap.Geometry.Point.prototype.toShortString
  6649. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  6650. */
  6651. toShortString() {
  6652. return (this.x + ", " + this.y);
  6653. }
  6654. /**
  6655. * @function SuperMap.Geometry.Point.prototype.destroy
  6656. * @description 释放点对象的资源。
  6657. */
  6658. destroy() {
  6659. this.x = null;
  6660. this.y = null;
  6661. this.tag = null;
  6662. super.destroy();
  6663. }
  6664. /**
  6665. * @function SuperMap.Geometry.Point.prototype.getVertices
  6666. * @description 返回点对象的所有顶点的列表。
  6667. * @param {boolean} [nodes] - 对于点对象此参数不起作用,直接返回点。
  6668. * @returns {Array} 几何图形的顶点列表。
  6669. */
  6670. getVertices(nodes) { // eslint-disable-line no-unused-vars
  6671. return [this];
  6672. }
  6673. }
  6674. SuperMap.Geometry.Point = Point_Point;
  6675. // CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  6676. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6677. * This program are made available under the terms of the Apache License, Version 2.0
  6678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6679. /**
  6680. * @class SuperMap.Geometry.LineString
  6681. * @classdesc 几何对象线串类。
  6682. * @category BaseTypes Geometry
  6683. * @param {Array.<SuperMap.Geometry.Point>} points - 用来生成线串的点数组。
  6684. * @extends {SuperMap.Geometry.Curve}
  6685. * @example
  6686. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  6687. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  6688. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  6689. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  6690. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  6691. * var roadLine = new SuperMap.Geometry.LineString(points);
  6692. */
  6693. class LineString_LineString extends Curve_Curve {
  6694. constructor(points) {
  6695. super(points);
  6696. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  6697. this.geometryType = "LineString";
  6698. }
  6699. /**
  6700. * @function SuperMap.Geometry.LineString.prototype.removeComponent
  6701. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  6702. * @param {SuperMap.Geometry.Point} point - 将被删除的点。
  6703. * @returns {boolean} 删除的点。
  6704. */
  6705. removeComponent(point) { // eslint-disable-line no-unused-vars
  6706. var removed = this.components && (this.components.length > 2);
  6707. if (removed) {
  6708. super.removeComponent.apply(this, arguments);
  6709. }
  6710. return removed;
  6711. }
  6712. /**
  6713. * @function SuperMap.Geometry.LineString.prototype.getSortedSegments
  6714. * @returns {Array} An array of segment objects. Segment objects have properties
  6715. * x1, y1, x2, and y2. The start point is represented by x1 and y1.
  6716. * The end point is represented by x2 and y2. Start and end are
  6717. * ordered so that x1 < x2.
  6718. */
  6719. getSortedSegments() {
  6720. var numSeg = this.components.length - 1;
  6721. var segments = new Array(numSeg), point1, point2;
  6722. for (var i = 0; i < numSeg; ++i) {
  6723. point1 = this.components[i];
  6724. point2 = this.components[i + 1];
  6725. if (point1.x < point2.x) {
  6726. segments[i] = {
  6727. x1: point1.x,
  6728. y1: point1.y,
  6729. x2: point2.x,
  6730. y2: point2.y
  6731. };
  6732. } else {
  6733. segments[i] = {
  6734. x1: point2.x,
  6735. y1: point2.y,
  6736. x2: point1.x,
  6737. y2: point1.y
  6738. };
  6739. }
  6740. }
  6741. // more efficient to define this somewhere static
  6742. function byX1(seg1, seg2) {
  6743. return seg1.x1 - seg2.x1;
  6744. }
  6745. return segments.sort(byX1);
  6746. }
  6747. /**
  6748. * @function SuperMap.Geometry.LineString.prototype.getVertices
  6749. * @description 返回几何图形的所有顶点的列表。
  6750. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点。如果没有设置此参数,则返回所有顶点。
  6751. * @returns {Array} 几何图形的顶点列表。
  6752. */
  6753. getVertices(nodes) {
  6754. var vertices;
  6755. if (nodes === true) {
  6756. vertices = [
  6757. this.components[0],
  6758. this.components[this.components.length - 1]
  6759. ];
  6760. } else if (nodes === false) {
  6761. vertices = this.components.slice(1, this.components.length - 1);
  6762. } else {
  6763. vertices = this.components.slice();
  6764. }
  6765. return vertices;
  6766. }
  6767. /**
  6768. * @function SuperMap.Geometry.LineString.calculateCircle
  6769. * @description 三点画圆弧。
  6770. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  6771. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的圆弧控制点。
  6772. * @example
  6773. * var points = [];
  6774. * points.push(new SuperMap.Geometry.Point(-50,30));
  6775. * points.push(new SuperMap.Geometry.Point(-30,50));
  6776. * points.push(new SuperMap.Geometry.Point(2,60));
  6777. * var circle = SuperMap.Geometry.LineString.calculateCircle(points);
  6778. */
  6779. static calculateCircle(points) {
  6780. if (points.length < 3) {
  6781. return points
  6782. }
  6783. var centerPoint = {},
  6784. p1 = points[0],
  6785. p2 = points[1],
  6786. p3 = points[2];
  6787. var R = 0,
  6788. dStep = 0,
  6789. direc = true,
  6790. dRotation = 0,
  6791. dRotationBegin = 0,
  6792. dRotationAngle = 0,
  6793. nSegmentCount = 72,
  6794. circlePoints = [];
  6795. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  6796. var B13 = p3.y - KTan13 * p3.x;
  6797. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  6798. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  6799. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  6800. circlePoints.push(p1);
  6801. circlePoints.push(p2);
  6802. circlePoints.push(p3);
  6803. } else {
  6804. var D = ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y)) * (2 * (p3.y - p1.y)) - ((p3.x * p3.x + p3.y * p3.y) -
  6805. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  6806. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  6807. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  6808. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  6809. centerPoint.x = D / F;
  6810. centerPoint.y = E / F;
  6811. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  6812. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  6813. var cons = (2 * R * R - dis) / (2 * R * R);
  6814. cons = cons >= 1 ? 1 : cons;
  6815. cons = cons <= -1 ? -1 : cons;
  6816. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  6817. if (p3.x == p1.x) {
  6818. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  6819. } else {
  6820. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  6821. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  6822. }
  6823. dStep = dRotationAngle / 72;
  6824. if (p3.y != p1.y) {
  6825. if (p3.x == p1.x) {
  6826. if (p3.y > p1.y) {
  6827. if (p2.x < p1.x) {
  6828. direc = false;
  6829. }
  6830. } else {
  6831. if (p2.x > p1.x) {
  6832. direc = false;
  6833. }
  6834. }
  6835. } else if (p3.x < p1.x) {
  6836. if (p2.y < KTan13 * p2.x + B13) {
  6837. direc = false;
  6838. }
  6839. } else {
  6840. if (p2.y > KTan13 * p2.x + B13) {
  6841. direc = false;
  6842. }
  6843. }
  6844. } else {
  6845. if (p3.x > p1.x) {
  6846. if (p2.y > p1.y) {
  6847. direc = false;
  6848. }
  6849. } else {
  6850. if (p2.y < p1.y) {
  6851. direc = false;
  6852. }
  6853. }
  6854. }
  6855. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  6856. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  6857. var CY = Math.abs(centerPoint.y);
  6858. if ((p1.y == CY) && (CY == p3.y)) {
  6859. if (p1.x < p3.x) {
  6860. atan10 = atan10 + 180;
  6861. }
  6862. }
  6863. var newPY = p1.y - centerPoint.y;
  6864. circlePoints.push(p1);
  6865. for (var i = 1; i < nSegmentCount; i++) {
  6866. dRotation = dStep * i;
  6867. dRotationBegin = atan10;
  6868. if (direc) {
  6869. if (newPY >= 0) {
  6870. if (K10 >= 0) {
  6871. dRotationBegin = dRotationBegin + dRotation;
  6872. } else {
  6873. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  6874. }
  6875. } else {
  6876. if (K10 > 0) {
  6877. dRotationBegin = (dRotationBegin - 180) + dRotation;
  6878. } else {
  6879. dRotationBegin = (90 - dRotationBegin) + dRotation;
  6880. }
  6881. }
  6882. } else {
  6883. if (newPY >= 0) {
  6884. if (K10 >= 0) {
  6885. dRotationBegin = dRotationBegin - dRotation;
  6886. } else {
  6887. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  6888. }
  6889. } else {
  6890. if (K10 >= 0) {
  6891. dRotationBegin = (dRotationBegin - 180) - dRotation;
  6892. } else {
  6893. dRotationBegin = (90 - dRotationBegin) - dRotation;
  6894. }
  6895. }
  6896. }
  6897. dRotationBegin = dRotationBegin * Math.PI / 180;
  6898. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  6899. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  6900. circlePoints.push(new Point_Point(x, y));
  6901. }
  6902. circlePoints.push(p3);
  6903. }
  6904. return circlePoints;
  6905. }
  6906. /**
  6907. * @function SuperMap.Geometry.LineString.createLineEPS
  6908. * @description 根据点的类型画出不同类型的曲线。
  6909. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  6910. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  6911. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的 lineEPS 控制点。
  6912. * @example
  6913. * var points = [];
  6914. * points.push(new SuperMap.Geometry.Point(-50,30));
  6915. * points.push(new SuperMap.Geometry.Point(-30,50,"LTypeArc"));
  6916. * points.push(new SuperMap.Geometry.Point(2,60));
  6917. * points.push(new SuperMap.Geometry.Point(8,20));
  6918. * var lineEPS = SuperMap.Geometry.LineString.createLineEPS(points);
  6919. */
  6920. static createLineEPS(points) {
  6921. var list = [],
  6922. len = points.length;
  6923. if (len < 2) {
  6924. return points;
  6925. }
  6926. for (var i = 0; i < len;) {
  6927. var type = points[i].type;
  6928. if (type == 'LTypeArc') {
  6929. var listObj = LineString_LineString.createLineArc(list, i, len, points);
  6930. list = listObj[0];
  6931. i = listObj[1];
  6932. } else {
  6933. list.push(points[i]);
  6934. i++;
  6935. }
  6936. }
  6937. return list;
  6938. }
  6939. static createLineArc(list, i, len, points) {
  6940. if (i == 0) {
  6941. let bezierPtsObj = LineString_LineString.addPointEPS(points, i, len, 'LTypeArc');
  6942. Array.prototype.push.apply(list, bezierPtsObj[0]);
  6943. i = bezierPtsObj[1] + 1;
  6944. } else if (i == len - 1) {
  6945. var bezierP = [points[i - 1], points[i]],
  6946. bezierPts = LineString_LineString.calculateCircle(bezierP);
  6947. Array.prototype.push.apply(list, bezierPts);
  6948. i++;
  6949. } else {
  6950. let bezierPtsObj = LineString_LineString.addPointEPS(points, i, len, 'LTypeArc');
  6951. list.pop();
  6952. Array.prototype.push.apply(list, bezierPtsObj[0]);
  6953. i = bezierPtsObj[1] + 1;
  6954. }
  6955. return [list, i];
  6956. }
  6957. static addPointEPS(points, i, len, type) {
  6958. var bezierP = [], j = i + 1;
  6959. if (i == 0) {
  6960. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  6961. } else if (i == len - 1) {
  6962. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  6963. } else {
  6964. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  6965. }
  6966. var bezierPts;
  6967. if (type == 'LTypeCurve') {
  6968. bezierPts = LineString_LineString.calculatePointsFBZN(bezierP);
  6969. } else if (type == 'LTypeArc') {
  6970. bezierPts = LineString_LineString.calculateCircle(bezierP);
  6971. }
  6972. return [bezierPts, j];
  6973. }
  6974. }
  6975. SuperMap.Geometry.LineString = LineString_LineString;
  6976. // CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  6977. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6978. * This program are made available under the terms of the Apache License, Version 2.0
  6979. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6980. /**
  6981. * @class SuperMap.Geometry.GeoText
  6982. * @classdesc 文本标签类。
  6983. * @category BaseTypes Geometry
  6984. * @extends {SuperMap.Geometry}
  6985. * @param {float} x - x 坐标。
  6986. * @param {float} y - y 坐标。
  6987. * @param {string} text - 标签中的文本内容。
  6988. */
  6989. class GeoText_GeoText extends Geometry_Geometry {
  6990. constructor(x, y, text) {
  6991. super(x, y, text);
  6992. /**
  6993. * @member {float} SuperMap.Geometry.GeoText.prototype.x
  6994. * @description 横坐标。
  6995. */
  6996. this.x = parseFloat(x);
  6997. /**
  6998. * @member {float} SuperMap.Geometry.GeoText.prototype.y
  6999. * @description 纵坐标。
  7000. */
  7001. this.y = parseFloat(y);
  7002. /**
  7003. * @member {string} SuperMap.Geometry.GeoText.prototype.text
  7004. * @description 标签中的文本内容。
  7005. */
  7006. this.text = text.toString();
  7007. /**
  7008. * @member {Object} SuperMap.Geometry.GeoText.prototype.bsInfo
  7009. * @description 标签范围的基础信息。
  7010. * @property {number} w - bounds 的宽。
  7011. * @property {number} h - bounds 的高度。
  7012. */
  7013. this.bsInfo = {
  7014. "h": null,
  7015. "w": null
  7016. };
  7017. this.element = document.createElement('span');
  7018. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  7019. this.geometryType = "GeoText";
  7020. }
  7021. /**
  7022. * @function SuperMap.Geometry.GeoText.prototype.destroy
  7023. * @description 销毁文本标签类。
  7024. */
  7025. destroy() {
  7026. super.destroy();
  7027. this.x = null;
  7028. this.y = null;
  7029. this.text = null;
  7030. }
  7031. /**
  7032. * @function SuperMap.Geometry.GeoText.prototype.getCentroid
  7033. * @description 获取标签对象的质心。
  7034. * @returns {SuperMap.Geometry.Point} 标签对象的质心。
  7035. */
  7036. getCentroid() {
  7037. return new Point_Point(this.x, this.y);
  7038. }
  7039. /**
  7040. * @function SuperMap.Geometry.GeoText.prototype.clone
  7041. * @description 克隆标签对象。
  7042. * @returns {SuperMap.Geometry.GeoText} 克隆后的标签对象。
  7043. */
  7044. clone(obj) {
  7045. if (obj == null) {
  7046. obj = new GeoText_GeoText(this.x, this.y, this.text);
  7047. }
  7048. Util_Util.applyDefaults(obj, this);
  7049. return obj;
  7050. }
  7051. /**
  7052. * @function SuperMap.Geometry.GeoText.prototype.calculateBounds
  7053. * @description 计算标签对象的范围。
  7054. */
  7055. calculateBounds() {
  7056. this.bounds = new Bounds_Bounds(this.x, this.y,
  7057. this.x, this.y);
  7058. }
  7059. /**
  7060. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByLabel
  7061. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  7062. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  7063. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  7064. * @param {string} labelHeight - 标签的高度。
  7065. * @param {Object} style - 标签的 style。
  7066. * @returns {SuperMap.Bounds} 标签的像素范围。
  7067. */
  7068. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  7069. var labelPxBounds, left, bottom, top, right;
  7070. var locationPx = Util_Util.cloneObject(locationPixel);
  7071. //计算文本行数
  7072. var theText = style.label || this.text;
  7073. var textRows = theText.split('\n');
  7074. var laberRows = textRows.length;
  7075. //处理文字对齐
  7076. labelWidth = parseFloat(labelWidth);
  7077. labelHeight = parseFloat(labelHeight);
  7078. if (laberRows > 1) {
  7079. labelHeight = parseFloat(labelHeight) * laberRows;
  7080. }
  7081. if (style.labelAlign && style.labelAlign !== "cm") {
  7082. switch (style.labelAlign) {
  7083. case "lt":
  7084. locationPx.x += labelWidth / 2;
  7085. locationPx.y += labelHeight / 2;
  7086. break;
  7087. case "lm":
  7088. locationPx.x += labelWidth / 2;
  7089. break;
  7090. case "lb":
  7091. locationPx.x += labelWidth / 2;
  7092. locationPx.y -= labelHeight / 2;
  7093. break;
  7094. case "ct":
  7095. locationPx.y += labelHeight / 2;
  7096. break;
  7097. case "cb":
  7098. locationPx.y -= labelHeight / 2;
  7099. break;
  7100. case "rt":
  7101. locationPx.x -= labelWidth / 2;
  7102. locationPx.y += labelHeight / 2;
  7103. break;
  7104. case "rm":
  7105. locationPx.x -= labelWidth / 2;
  7106. break;
  7107. case "rb":
  7108. locationPx.x -= labelWidth / 2;
  7109. locationPx.y -= labelHeight / 2;
  7110. break;
  7111. default:
  7112. break;
  7113. }
  7114. }
  7115. this.bsInfo.h = labelHeight;
  7116. this.bsInfo.w = labelWidth;
  7117. //bounds的四边
  7118. left = locationPx.x - parseFloat(labelWidth) / 2;
  7119. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  7120. right = locationPx.x + parseFloat(labelWidth) / 2;
  7121. top = locationPx.y - parseFloat(labelHeight) / 2;
  7122. labelPxBounds = new Bounds_Bounds(left, bottom, right, top);
  7123. return labelPxBounds;
  7124. }
  7125. /**
  7126. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByText
  7127. * @description 根据文本内容获取文字标签的像素范围。
  7128. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  7129. * @param {Object} style - 标签的样式。
  7130. * @returns {SuperMap.Bounds} 标签的像素范围。
  7131. */
  7132. getLabelPxBoundsByText(locationPixel, style) {
  7133. var labelPxBounds, left, bottom, top, right;
  7134. var labelSize = this.getLabelPxSize(style);
  7135. var locationPx = Util_Util.cloneObject(locationPixel);
  7136. //处理文字对齐
  7137. if (style.labelAlign && style.labelAlign !== "cm") {
  7138. switch (style.labelAlign) {
  7139. case "lt":
  7140. locationPx.x += labelSize.w / 2;
  7141. locationPx.y += labelSize.h / 2;
  7142. break;
  7143. case "lm":
  7144. locationPx.x += labelSize.w / 2;
  7145. break;
  7146. case "lb":
  7147. locationPx.x += labelSize.w / 2;
  7148. locationPx.y -= labelSize.h / 2;
  7149. break;
  7150. case "ct":
  7151. locationPx.y += labelSize.h / 2;
  7152. break;
  7153. case "cb":
  7154. locationPx.y -= labelSize.h / 2;
  7155. break;
  7156. case "rt":
  7157. locationPx.x -= labelSize.w / 2;
  7158. locationPx.y += labelSize.h / 2;
  7159. break;
  7160. case "rm":
  7161. locationPx.x -= labelSize.w / 2;
  7162. break;
  7163. case "rb":
  7164. locationPx.x -= labelSize.w / 2;
  7165. locationPx.y -= labelSize.h / 2;
  7166. break;
  7167. default:
  7168. break;
  7169. }
  7170. }
  7171. this.bsInfo.h = labelSize.h;
  7172. this.bsInfo.w = labelSize.w;
  7173. left = locationPx.x - labelSize.w / 2;
  7174. bottom = locationPx.y + labelSize.h / 2;
  7175. //处理斜体字
  7176. if (style.fontStyle && style.fontStyle === "italic") {
  7177. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  7178. } else {
  7179. right = locationPx.x + labelSize.w / 2;
  7180. }
  7181. top = locationPx.y - labelSize.h / 2;
  7182. labelPxBounds = new Bounds_Bounds(left, bottom, right, top);
  7183. return labelPxBounds;
  7184. }
  7185. /**
  7186. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxSize
  7187. * @description 获取 label 的像素大小。
  7188. * @param {Object} style - 标签样式。
  7189. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  7190. */
  7191. getLabelPxSize(style) {
  7192. var text,//文本内容
  7193. fontSize,//字体大小
  7194. spacing = 1,//两个字符间的间距(单位:px)
  7195. lineSpacing = 0.2,
  7196. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  7197. text = style.label || this.text;
  7198. if (style.fontSize) {
  7199. fontSize = parseFloat(style.fontSize);
  7200. } else {
  7201. fontSize = parseFloat("12px");
  7202. }
  7203. //标签宽高
  7204. var labelW, labelH;
  7205. var textRows = text.split('\n');
  7206. var numRows = textRows.length;
  7207. if (numRows > 1) {
  7208. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  7209. } else {
  7210. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  7211. }
  7212. //取最大宽度
  7213. labelW = 0;
  7214. if (this.labelWTmp && labelW < this.labelWTmp) {
  7215. labelW = this.labelWTmp;
  7216. }
  7217. for (var i = 0; i < numRows; i++) {
  7218. var textCharC = this.getTextCount(textRows[i]);
  7219. var labelWTmp = this.labelWTmp = Util_Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  7220. if (labelW < labelWTmp) {
  7221. labelW = labelWTmp;
  7222. }
  7223. }
  7224. var labelSize = new Object(); //标签大小
  7225. labelSize.h = labelH;
  7226. labelSize.w = labelW;
  7227. return labelSize;
  7228. }
  7229. /**
  7230. * @function SuperMap.Geometry.GeoText.prototype.getTextCount
  7231. * @description 获取 text 中的字符个数。
  7232. * @param {string} text - 字符串。
  7233. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  7234. */
  7235. getTextCount(text) {
  7236. var textCharCount = {};
  7237. var cnCount = 0;
  7238. var enCount = 0;
  7239. for (var i = 0; i < text.length; i++) {
  7240. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  7241. cnCount++;
  7242. } else {
  7243. enCount++;
  7244. }
  7245. }
  7246. //中午字符个数
  7247. textCharCount.cnC = cnCount;
  7248. //英文字符个数
  7249. textCharCount.enC = enCount;
  7250. //字符总个数
  7251. textCharCount.textC = text.length;
  7252. return textCharCount;
  7253. }
  7254. }
  7255. SuperMap.Geometry.GeoText = GeoText_GeoText;
  7256. // CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  7257. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7258. * This program are made available under the terms of the Apache License, Version 2.0
  7259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7260. /**
  7261. * @class SuperMap.Geometry.LinearRing
  7262. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  7263. * 作为最后的一个点来自动关闭线环。
  7264. * @category BaseTypes Geometry
  7265. * @extends {SuperMap.Geometry.LineString}
  7266. * @param {Array.<SuperMap.Geometry.Point>} points - 组成线性环的点。
  7267. * @example
  7268. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  7269. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  7270. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  7271. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  7272. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  7273. * var linearRing = new SuperMap.Geometry.LinearRing(points);
  7274. */
  7275. class LinearRing_LinearRing extends LineString_LineString {
  7276. constructor(points) {
  7277. super(points);
  7278. /**
  7279. * @member {Array.<string>} [SuperMap.Geometry.LinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  7280. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  7281. * @readonly
  7282. */
  7283. this.componentTypes = ["SuperMap.Geometry.Point"];
  7284. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  7285. this.geometryType = "LinearRing";
  7286. }
  7287. /**
  7288. * @function SuperMap.Geometry.LinearRing.prototype.addComponent
  7289. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  7290. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  7291. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  7292. * @param {SuperMap.Geometry.Point} point - 点对象。
  7293. * @param {integer} [index] - 插入组件数组的下标。
  7294. * @returns {boolean} 点对象是否添加成功。
  7295. */
  7296. addComponent(point, index) {
  7297. var added = false;
  7298. //remove last point
  7299. var lastPoint = this.components.pop();
  7300. // given an index, add the point
  7301. // without an index only add non-duplicate points
  7302. if (index != null || !point.equals(lastPoint)) {
  7303. added = super.addComponent.apply(this, arguments);
  7304. }
  7305. //append copy of first point
  7306. var firstPoint = this.components[0];
  7307. super.addComponent.apply(this, [firstPoint]);
  7308. return added;
  7309. }
  7310. /**
  7311. * @function SuperMap.Geometry.LinearRing.prototype.removeComponent
  7312. * @description 从几何组件中删除一个点。
  7313. * @param {SuperMap.Geometry.Point} point - 点对象。
  7314. * @returns {boolean} 点对象是否删除。
  7315. */
  7316. removeComponent(point) { // eslint-disable-line no-unused-vars
  7317. var removed = this.components && (this.components.length > 3);
  7318. if (removed) {
  7319. //remove last point
  7320. this.components.pop();
  7321. //remove our point
  7322. super.removeComponent.apply(this, arguments);
  7323. //append copy of first point
  7324. var firstPoint = this.components[0];
  7325. super.addComponent.apply(this, [firstPoint]);
  7326. }
  7327. return removed;
  7328. }
  7329. /**
  7330. * @function SuperMap.Geometry.LinearRing.prototype.getArea
  7331. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  7332. * @returns {float} 环的面积。
  7333. */
  7334. getArea() {
  7335. var area = 0.0;
  7336. if (this.components && (this.components.length > 2)) {
  7337. var sum = 0.0;
  7338. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  7339. var b = this.components[i];
  7340. var c = this.components[i + 1];
  7341. sum += (b.x + c.x) * (c.y - b.y);
  7342. }
  7343. area = -sum / 2.0;
  7344. }
  7345. return area;
  7346. }
  7347. /**
  7348. * @function SuperMap.Geometry.LinearRing.prototype.getVertices
  7349. * @description 返回几何图形的所有点的列表。
  7350. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  7351. * @returns {Array} 几何对象所有点的列表。
  7352. */
  7353. getVertices(nodes) {
  7354. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  7355. }
  7356. }
  7357. SuperMap.Geometry.LinearRing = LinearRing_LinearRing;
  7358. // CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  7359. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7360. * This program are made available under the terms of the Apache License, Version 2.0
  7361. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7362. /**
  7363. * @class SuperMap.Geometry.MultiLineString
  7364. * @classdesc 几何对象多线类。
  7365. * @category BaseTypes Geometry
  7366. * @extends {SuperMap.Geometry.Collection}
  7367. * @param {Array.<SuperMap.Geometry.LineString>} components - LineString 数组。
  7368. * @example
  7369. * var multi = new SuperMap.Geometry.MultiLineString([
  7370. * new SuperMap.Geometry.LineString([
  7371. * new SuperMap.Geometry.Point(1, 0),
  7372. * new SuperMap.Geometry.Point(0, 1)
  7373. * ])
  7374. * ]);
  7375. */
  7376. class MultiLineString_MultiLineString extends Collection_Collection {
  7377. constructor(components) {
  7378. super(components);
  7379. /**
  7380. * @member {Array.<string>} [SuperMap.Geometry.MultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  7381. * @description components 存储的的几何对象所支持的几何类型数组。
  7382. * @readonly
  7383. */
  7384. this.componentTypes = ["SuperMap.Geometry.LineString"];
  7385. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  7386. this.geometryType = "MultiLineString";
  7387. }
  7388. }
  7389. SuperMap.Geometry.MultiLineString = MultiLineString_MultiLineString;
  7390. // CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  7391. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7392. * This program are made available under the terms of the Apache License, Version 2.0
  7393. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7394. /**
  7395. * @class SuperMap.Geometry.MultiPolygon
  7396. * @classdesc 几何对象多多边形类。
  7397. * @category BaseTypes Geometry
  7398. * @extends {SuperMap.Geometry.Collection}
  7399. * @param {Array.<SuperMap.Geometry.Polygon>} components - 形成 MultiPolygon 的多边形数组。
  7400. * @example
  7401. * var points1 = [new SuperMap.Geometry.Point(10,10),new SuperMap.Geometry.Point(0,0)];
  7402. * var points2 = [new SuperMap.Geometry.Point(10,10),new SuperMap.Geometry.Point(0,0),new SuperMap.Geometry.Point(3,3),new SuperMap.Geometry.Point(10,10)];
  7403. *
  7404. * var linearRing1 = new SuperMap.Geometry.LinearRing(points1);
  7405. * var linearRing2 = new SuperMap.Geometry.LinearRing(points2);
  7406. *
  7407. * var polygon1 = new SuperMap.Geometry.Polygon([linearRing1]);
  7408. * var polygon2 = new SuperMap.Geometry.Polygon([linearRing2]);
  7409. *
  7410. * var multiPolygon1 = new SuperMap.Geometry.MultiPolygon([polygon1,polygon2]);
  7411. */
  7412. class MultiPolygon_MultiPolygon extends Collection_Collection {
  7413. constructor(components) {
  7414. super(components);
  7415. /**
  7416. * @member {Array.<string>} [SuperMap.Geometry.MultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  7417. * @description components 存储的的几何对象所支持的几何类型数组。
  7418. * @readonly
  7419. */
  7420. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  7421. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  7422. this.geometryType = "MultiPolygon";
  7423. }
  7424. }
  7425. SuperMap.Geometry.MultiPolygon = MultiPolygon_MultiPolygon;
  7426. // CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  7427. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7428. * This program are made available under the terms of the Apache License, Version 2.0
  7429. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7430. /**
  7431. * @class SuperMap.Geometry.Polygon
  7432. * @classdesc 多边形几何对象类。
  7433. * @category BaseTypes Geometry
  7434. * @extends {SuperMap.Geometry.Collection}
  7435. * @param {Array.<SuperMap.Geometry.LinearRing>} components - 用来生成多边形的线环数组。
  7436. * @example
  7437. * var points =[new SuperMap.Geometry.Point(0,4010338),
  7438. * new SuperMap.Geometry.Point(1063524,4010338),
  7439. * new SuperMap.Geometry.Point(1063524,3150322),
  7440. * new SuperMap.Geometry.Point(0,3150322)
  7441. * ],
  7442. * var linearRings = new SuperMap.Geometry.LinearRing(points),
  7443. * var region = new SuperMap.Geometry.Polygon([linearRings]);
  7444. */
  7445. class Polygon_Polygon extends Collection_Collection {
  7446. constructor(components) {
  7447. super(components);
  7448. /**
  7449. * @member {Array.<string>} [SuperMap.Geometry.Polygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  7450. * @description components 存储的的几何对象所支持的几何类型数组。
  7451. * @readonly
  7452. */
  7453. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  7454. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  7455. this.geometryType = "Polygon";
  7456. }
  7457. /**
  7458. * @function SuperMap.Geometry.Polygon.prototype.getArea
  7459. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  7460. * @returns {float} 几何对象的面积。
  7461. */
  7462. getArea() {
  7463. var area = 0.0;
  7464. if (this.components && (this.components.length > 0)) {
  7465. area += Math.abs(this.components[0].getArea());
  7466. for (var i = 1, len = this.components.length; i < len; i++) {
  7467. area -= Math.abs(this.components[i].getArea());
  7468. }
  7469. }
  7470. return area;
  7471. }
  7472. }
  7473. SuperMap.Geometry.Polygon = Polygon_Polygon;
  7474. // CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  7475. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7476. * This program are made available under the terms of the Apache License, Version 2.0
  7477. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7478. /**
  7479. * @class SuperMap.Geometry.Rectangle
  7480. * @classdesc 矩形几何对象类。
  7481. * @category BaseTypes Geometry
  7482. * @param {float} x - 矩形左下角点的横坐标。
  7483. * @param {float} y - 矩形左下角点的纵坐标。
  7484. * @param {float} width - 矩形的宽度。
  7485. * @param {float} height - 矩形的高度。
  7486. * @extends {SuperMap.Geometry}
  7487. * @example
  7488. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  7489. * var x = 1;
  7490. * var y = 2;
  7491. * var w = 10;
  7492. * var h = 20;
  7493. * var recttangle = new SuperMap.Geometry.Rectangle(x, y, w, h);
  7494. */
  7495. class Rectangle_Rectangle extends Geometry_Geometry {
  7496. constructor(x, y, width, height) {
  7497. super(x, y, width, height);
  7498. /**
  7499. * @member {float} SuperMap.Geometry.Rectangle.prototype.x
  7500. * @description 矩形左下角点的横坐标。
  7501. */
  7502. this.x = x;
  7503. /**
  7504. * @member {float} SuperMap.Geometry.Rectangle.prototype.y
  7505. * @description 矩形左下角点的纵坐标。
  7506. */
  7507. this.y = y;
  7508. /**
  7509. * @member {float} SuperMap.Geometry.Rectangle.prototype.width
  7510. * @description 矩形的宽度。
  7511. */
  7512. this.width = width;
  7513. /**
  7514. * @member {float} SuperMap.Geometry.Rectangle.prototype.height
  7515. * @description 矩形的高度。
  7516. */
  7517. this.height = height;
  7518. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  7519. this.geometryType = "Rectangle";
  7520. }
  7521. /**
  7522. * @function SuperMap.Geometry.Rectangle.prototype.calculateBounds
  7523. * @description 计算出此矩形对象的 bounds。
  7524. */
  7525. calculateBounds() {
  7526. this.bounds = new Bounds_Bounds(this.x, this.y,
  7527. this.x + this.width,
  7528. this.y + this.height);
  7529. }
  7530. /**
  7531. * @function SuperMap.Geometry.Rectangle.prototype.getArea
  7532. * @description 获取矩形对象的面积。
  7533. * @returns {float} 矩形对象面积。
  7534. */
  7535. getArea() {
  7536. var area = this.width * this.height;
  7537. return area;
  7538. }
  7539. }
  7540. SuperMap.Geometry.Rectangle = Rectangle_Rectangle;
  7541. // CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  7542. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7543. * This program are made available under the terms of the Apache License, Version 2.0
  7544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7545. // CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  7546. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7547. * This program are made available under the terms of the Apache License, Version 2.0
  7548. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7549. /**
  7550. * @class SuperMap.Credential
  7551. * @category Security
  7552. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  7553. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  7554. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  7555. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  7556. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  7557. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  7558. * @example
  7559. * var pixcel = new SuperMap.Credential("valueString","token");
  7560. * pixcel.destroy();
  7561. */
  7562. class Credential {
  7563. constructor(value, name) {
  7564. /**
  7565. * @member {string} SuperMap.Bounds.prototype.value
  7566. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  7567. */
  7568. this.value = value ? value : "";
  7569. /**
  7570. * @member {string} [SuperMap.Bounds.prototype.name='token']
  7571. * @description 验证信息前缀,name=value 部分的 name 部分。
  7572. */
  7573. this.name = name ? name : "token";
  7574. this.CLASS_NAME = "SuperMap.Credential";
  7575. }
  7576. /**
  7577. * @function SuperMap.Credential.prototype.getUrlParameters
  7578. * @example
  7579. * var credential = new SuperMap.Credential("valueString","token");
  7580. * //这里 str = "token=valueString";
  7581. * var str = credential.getUrlParameters();
  7582. * @returns {string} 返回安全信息组成的 url 片段。
  7583. */
  7584. getUrlParameters() {
  7585. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  7586. return this.name + "=" + this.value;
  7587. }
  7588. /**
  7589. * @function SuperMap.Bounds.prototype.getValue
  7590. * @description 获取 value。
  7591. * @example
  7592. * var credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  7593. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  7594. * var str = credential.getValue();
  7595. * @returns {string} 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。
  7596. */
  7597. getValue() {
  7598. return this.value;
  7599. }
  7600. /**
  7601. *
  7602. * @function SuperMap.Credential.prototype.destroy
  7603. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  7604. * @example
  7605. * var credential = new SuperMap.Credential("valueString","token");
  7606. * credential.destroy();
  7607. */
  7608. destroy() {
  7609. this.value = null;
  7610. this.name = null;
  7611. }
  7612. }
  7613. /**
  7614. * @member {SuperMap.Credential} SuperMap.Credential.CREDENTIAL
  7615. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  7616. * @constant
  7617. * @example
  7618. * 代码实例:
  7619. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  7620. * var value = "(以iServer为例,这里是申请的token值)";
  7621. * var name = "token";
  7622. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  7623. * SuperMap.Credential.CREDENTIAL = new SuperMap.Credential(value, name);
  7624. *
  7625. */
  7626. Credential.CREDENTIAL = null;
  7627. SuperMap.Credential = Credential;
  7628. // CONCATENATED MODULE: ./src/common/commontypes/Date.js
  7629. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7630. * This program are made available under the terms of the Apache License, Version 2.0
  7631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7632. /**
  7633. * @name Date
  7634. * @memberOf SuperMap
  7635. * @namespace
  7636. * @category BaseTypes Util
  7637. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  7638. */
  7639. var DateExt = SuperMap.Date = {
  7640. /**
  7641. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  7642. * @example
  7643. * var dateString = SuperMap.Date.toISOString(new Date());
  7644. * @param {Date} date - 日期对象。
  7645. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  7646. */
  7647. toISOString: (function () {
  7648. //标准的Date会存在toISOString方法,可以直接调用
  7649. if ("toISOString" in Date.prototype) {
  7650. return function (date) {
  7651. return date.toISOString();
  7652. };
  7653. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  7654. function pad(num, len) {
  7655. var str = num + "";
  7656. while (str.length < len) {
  7657. str = "0" + str;
  7658. }
  7659. return str;
  7660. }
  7661. return function (date) {
  7662. var str;
  7663. if (isNaN(date.getTime())) {
  7664. // ECMA-262 says throw RangeError, Firefox returns
  7665. // "Invalid Date"
  7666. str = "Invalid Date";
  7667. } else {
  7668. str =
  7669. date.getUTCFullYear() + "-" +
  7670. pad(date.getUTCMonth() + 1, 2) + "-" +
  7671. pad(date.getUTCDate(), 2) + "T" +
  7672. pad(date.getUTCHours(), 2) + ":" +
  7673. pad(date.getUTCMinutes(), 2) + ":" +
  7674. pad(date.getUTCSeconds(), 2) + "." +
  7675. pad(date.getUTCMilliseconds(), 3) + "Z";
  7676. }
  7677. return str;
  7678. };
  7679. }
  7680. })(),
  7681. /**
  7682. * @description 从一个字符串生成一个日期对象。
  7683. * @example
  7684. * var date = SuperMap.Date.parse("2010-08-07");
  7685. * @param {string} str - 代表日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  7686. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  7687. */
  7688. parse: function (str) {
  7689. var date;
  7690. var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/);
  7691. if (match && (match[1] || match[7])) { // must have at least year or time
  7692. var year = parseInt(match[1], 10) || 0;
  7693. var month = (parseInt(match[2], 10) - 1) || 0;
  7694. var day = parseInt(match[3], 10) || 1;
  7695. date = new Date(Date.UTC(year, month, day));
  7696. // optional time
  7697. var type = match[7];
  7698. if (type) {
  7699. var hours = parseInt(match[4], 10);
  7700. var minutes = parseInt(match[5], 10);
  7701. var secFrac = parseFloat(match[6]);
  7702. var seconds = secFrac | 0;
  7703. var milliseconds = Math.round(1000 * (secFrac - seconds));
  7704. date.setUTCHours(hours, minutes, seconds, milliseconds);
  7705. // check offset
  7706. if (type !== "Z") {
  7707. var hoursOffset = parseInt(type, 10);
  7708. var minutesOffset = parseInt(match[8], 10) || 0;
  7709. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  7710. date = new Date(date.getTime() + offset);
  7711. }
  7712. }
  7713. } else {
  7714. date = new Date("invalid");
  7715. }
  7716. return date;
  7717. }
  7718. };
  7719. // CONCATENATED MODULE: ./src/common/commontypes/Event.js
  7720. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7721. * This program are made available under the terms of the Apache License, Version 2.0
  7722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7723. /**
  7724. * @name Event
  7725. * @memberOf SuperMap
  7726. * @namespace
  7727. * @description 事件处理函数.
  7728. */
  7729. var Event = SuperMap.Event = {
  7730. /**
  7731. * @description A hash table cache of the event observers. Keyed by element._eventCacheID
  7732. * @type {boolean}
  7733. * @default false
  7734. */
  7735. observers: false,
  7736. /**
  7737. * @description KEY_SPACE
  7738. * @type {number}
  7739. * @default 32
  7740. */
  7741. KEY_SPACE: 32,
  7742. /**
  7743. * @description KEY_BACKSPACE
  7744. * @type {number}
  7745. * @default 8
  7746. */
  7747. KEY_BACKSPACE: 8,
  7748. /**
  7749. * @description KEY_TAB
  7750. * @type {number}
  7751. * @default 9
  7752. */
  7753. KEY_TAB: 9,
  7754. /**
  7755. * @description KEY_RETURN
  7756. * @type {number}
  7757. * @default 13
  7758. */
  7759. KEY_RETURN: 13,
  7760. /**
  7761. * @description KEY_ESC
  7762. * @type {number}
  7763. * @default 27
  7764. */
  7765. KEY_ESC: 27,
  7766. /**
  7767. * @description KEY_LEFT
  7768. * @type {number}
  7769. * @default 37
  7770. */
  7771. KEY_LEFT: 37,
  7772. /**
  7773. * @description KEY_UP
  7774. * @type {number}
  7775. * @default 38
  7776. */
  7777. KEY_UP: 38,
  7778. /**
  7779. * @description KEY_RIGHT
  7780. * @type {number}
  7781. * @default 39
  7782. */
  7783. KEY_RIGHT: 39,
  7784. /**
  7785. * @description KEY_DOWN
  7786. * @type {number}
  7787. * @default 40
  7788. */
  7789. KEY_DOWN: 40,
  7790. /**
  7791. * @description KEY_DELETE
  7792. * @type {number}
  7793. * @default 46
  7794. */
  7795. KEY_DELETE: 46,
  7796. /**
  7797. * @description Cross browser event element detection.
  7798. * @param {Event} event - The event
  7799. * @returns {HTMLElement} The element that caused the event
  7800. */
  7801. element: function (event) {
  7802. return event.target || event.srcElement;
  7803. },
  7804. /**
  7805. * @description Determine whether event was caused by a single touch
  7806. * @param {Event} event - The event
  7807. * @returns {boolean}
  7808. */
  7809. isSingleTouch: function (event) {
  7810. return event.touches && event.touches.length === 1;
  7811. },
  7812. /**
  7813. * @description Determine whether event was caused by a multi touch
  7814. * @param {Event} event - The event
  7815. * @returns {boolean}
  7816. */
  7817. isMultiTouch: function (event) {
  7818. return event.touches && event.touches.length > 1;
  7819. },
  7820. /**
  7821. * @description Determine whether event was caused by a left click.
  7822. * @param {Event} event - The event
  7823. * @returns {boolean}
  7824. */
  7825. isLeftClick: function (event) {
  7826. return (((event.which) && (event.which === 1)) ||
  7827. ((event.button) && (event.button === 1)));
  7828. },
  7829. /**
  7830. * @description Determine whether event was caused by a right mouse click.
  7831. * @param {Event} event - The event
  7832. * @returns {boolean}
  7833. */
  7834. isRightClick: function (event) {
  7835. return (((event.which) && (event.which === 3)) ||
  7836. ((event.button) && (event.button === 2)));
  7837. },
  7838. /**
  7839. * @description Stops an event from propagating.
  7840. * @param {Event} event - The event
  7841. * @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
  7842. */
  7843. stop: function (event, allowDefault) {
  7844. if (!allowDefault) {
  7845. if (event.preventDefault) {
  7846. event.preventDefault();
  7847. } else {
  7848. event.returnValue = false;
  7849. }
  7850. }
  7851. if (event.stopPropagation) {
  7852. event.stopPropagation();
  7853. } else {
  7854. event.cancelBubble = true;
  7855. }
  7856. },
  7857. /**
  7858. * @param {Event} event - The event。
  7859. * @param {string} tagName - html 标签名。
  7860. * @returns {HTMLElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
  7861. */
  7862. findElement: function (event, tagName) {
  7863. var element = SuperMap.Event.element(event);
  7864. while (element.parentNode && (!element.tagName ||
  7865. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  7866. element = element.parentNode;
  7867. }
  7868. return element;
  7869. },
  7870. /**
  7871. * @description 监听事件,注册事件处理方法。
  7872. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  7873. * @param {string} name - 监听事件的类别名称。
  7874. * @param {function} observer - 注册的事件处理方法。
  7875. * @param {boolean} [useCapture=false] - 是否捕获。
  7876. */
  7877. observe: function (elementParam, name, observer, useCapture) {
  7878. var element = Util_Util.getElement(elementParam);
  7879. useCapture = useCapture || false;
  7880. if (name === 'keypress' &&
  7881. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  7882. || element.attachEvent)) {
  7883. name = 'keydown';
  7884. }
  7885. //if observers cache has not yet been created, create it
  7886. if (!this.observers) {
  7887. this.observers = {};
  7888. }
  7889. //if not already assigned, make a new unique cache ID
  7890. if (!element._eventCacheID) {
  7891. var idPrefix = "eventCacheID_";
  7892. if (element.id) {
  7893. idPrefix = element.id + "_" + idPrefix;
  7894. }
  7895. element._eventCacheID = Util_Util.createUniqueID(idPrefix);
  7896. }
  7897. var cacheID = element._eventCacheID;
  7898. //if there is not yet a hash entry for this element, add one
  7899. if (!this.observers[cacheID]) {
  7900. this.observers[cacheID] = [];
  7901. }
  7902. //add a new observer to this element's list
  7903. this.observers[cacheID].push({
  7904. 'element': element,
  7905. 'name': name,
  7906. 'observer': observer,
  7907. 'useCapture': useCapture
  7908. });
  7909. //add the actual browser event listener
  7910. if (element.addEventListener) {
  7911. if(name === 'mousewheel'){
  7912. // https://www.chromestatus.com/features/6662647093133312
  7913. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  7914. } else {
  7915. element.addEventListener(name, observer, useCapture);
  7916. }
  7917. } else if (element.attachEvent) {
  7918. element.attachEvent('on' + name, observer);
  7919. }
  7920. },
  7921. /**
  7922. * @description Given the id of an element to stop observing, cycle through the
  7923. * element's cached observers, calling stopObserving on each one,
  7924. * skipping those entries which can no longer be removed.
  7925. *
  7926. * @param {(HTMLElement|string)} elementParam -
  7927. */
  7928. stopObservingElement: function (elementParam) {
  7929. var element = Util_Util.getElement(elementParam);
  7930. var cacheID = element._eventCacheID;
  7931. this._removeElementObservers(SuperMap.Event.observers[cacheID]);
  7932. },
  7933. /**
  7934. * @param {Array.<Object>} elementObservers - Array of (element, name,
  7935. * observer, usecapture) objects,
  7936. * taken directly from hashtable
  7937. */
  7938. _removeElementObservers: function (elementObservers) {
  7939. if (elementObservers) {
  7940. for (var i = elementObservers.length - 1; i >= 0; i--) {
  7941. var entry = elementObservers[i];
  7942. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  7943. SuperMap.Event.stopObserving.apply(this, args);
  7944. }
  7945. }
  7946. },
  7947. /**
  7948. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
  7949. * 保持一致才能确保事件移除成功。
  7950. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  7951. * @param {string} name - 需要移除的被监听事件名称。
  7952. * @param {function} observer - 需要移除的事件处理方法。
  7953. * @param {boolean} [useCapture=false] - 是否捕获。
  7954. * @returns {boolean} Whether or not the event observer was removed
  7955. */
  7956. stopObserving: function (elementParam, name, observer, useCapture) {
  7957. useCapture = useCapture || false;
  7958. var element = Util_Util.getElement(elementParam);
  7959. var cacheID = element._eventCacheID;
  7960. if (name === 'keypress') {
  7961. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  7962. element.detachEvent) {
  7963. name = 'keydown';
  7964. }
  7965. }
  7966. // find element's entry in this.observers cache and remove it
  7967. var foundEntry = false;
  7968. var elementObservers = SuperMap.Event.observers[cacheID];
  7969. if (elementObservers) {
  7970. // find the specific event type in the element's list
  7971. var i = 0;
  7972. while (!foundEntry && i < elementObservers.length) {
  7973. var cacheEntry = elementObservers[i];
  7974. if ((cacheEntry.name === name) &&
  7975. (cacheEntry.observer === observer) &&
  7976. (cacheEntry.useCapture === useCapture)) {
  7977. elementObservers.splice(i, 1);
  7978. if (elementObservers.length == 0) {
  7979. delete SuperMap.Event.observers[cacheID];
  7980. }
  7981. foundEntry = true;
  7982. break;
  7983. }
  7984. i++;
  7985. }
  7986. }
  7987. //actually remove the event listener from browser
  7988. if (foundEntry) {
  7989. if (element.removeEventListener) {
  7990. element.removeEventListener(name, observer, useCapture);
  7991. } else if (element && element.detachEvent) {
  7992. element.detachEvent('on' + name, observer);
  7993. }
  7994. }
  7995. return foundEntry;
  7996. },
  7997. /**
  7998. * @description Cycle through all the element entries in the events cache and call
  7999. * stopObservingElement on each.
  8000. */
  8001. unloadCache: function () {
  8002. // check for SuperMap.Event before checking for observers, because
  8003. // SuperMap.Event may be undefined in IE if no map instance was
  8004. // created
  8005. if (SuperMap.Event && SuperMap.Event.observers) {
  8006. for (var cacheID in SuperMap.Event.observers) {
  8007. var elementObservers = SuperMap.Event.observers[cacheID];
  8008. SuperMap.Event._removeElementObservers.apply(this,
  8009. [elementObservers]);
  8010. }
  8011. SuperMap.Event.observers = false;
  8012. }
  8013. },
  8014. CLASS_NAME: "SuperMap.Event"
  8015. };
  8016. SuperMap.Event = Event;
  8017. /* prevent memory leaks in IE */
  8018. SuperMap.Event.observe(window, 'unload', SuperMap.Event.unloadCache, false);
  8019. // CONCATENATED MODULE: ./src/common/commontypes/Events.js
  8020. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8021. * This program are made available under the terms of the Apache License, Version 2.0
  8022. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8023. /**
  8024. * @class SuperMap.Events
  8025. * @classdesc 事件类。
  8026. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  8027. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  8028. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  8029. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  8030. * @param {Object} options - 事件对象选项。
  8031. */
  8032. class Events_Events {
  8033. constructor(object, element, eventTypes, fallThrough, options) {
  8034. /**
  8035. * @member {Array.<string>} SuperMap.Events.prototype.BROWSER_EVENTS
  8036. * @description 支持的事件。
  8037. * @constant
  8038. * @default [
  8039. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  8040. "click", "dblclick", "rightclick", "dblrightclick","resize",
  8041. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  8042. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  8043. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  8044. ]
  8045. */
  8046. this.BROWSER_EVENTS = [
  8047. "mouseover", "mouseout",
  8048. "mousedown", "mouseup", "mousemove",
  8049. "click", "dblclick", "rightclick", "dblrightclick",
  8050. "resize", "focus", "blur",
  8051. "touchstart", "touchmove", "touchend",
  8052. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  8053. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  8054. "contextmenu"
  8055. ];
  8056. /**
  8057. * @member {Object} SuperMap.Events.prototype.listeners
  8058. * @description Hashtable of Array(function): events listener functions
  8059. */
  8060. this.listeners = {};
  8061. /**
  8062. * @member {Object} SuperMap.Events.prototype.object
  8063. * @description 发布应用程序事件的对象。
  8064. */
  8065. this.object = object;
  8066. /**
  8067. * @member {HTMLElement} SuperMap.Events.prototype.element
  8068. * @description 接受浏览器事件的 DOM 节点。
  8069. */
  8070. this.element = null;
  8071. /**
  8072. * @member {Array.<string>} SuperMap.Events.prototype.eventTypes
  8073. * @description 支持的事件类型列表。
  8074. */
  8075. this.eventTypes = [];
  8076. /**
  8077. * @member {function} SuperMap.Events.prototype.eventHandler
  8078. * @description 绑定在元素上的事件处理器对象。
  8079. */
  8080. this.eventHandler = null;
  8081. /**
  8082. * @member {boolean} [SuperMap.Events.prototype.fallThrough=false]
  8083. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  8084. */
  8085. this.fallThrough = fallThrough;
  8086. /**
  8087. * @member {boolean} [SuperMap.Events.prototype.includeXY=false]
  8088. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
  8089. * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
  8090. * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
  8091. * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  8092. * @example
  8093. * function named(evt) {
  8094. * this.xy = this.object.events.getMousePosition(evt);
  8095. * }
  8096. */
  8097. this.includeXY = false;
  8098. /**
  8099. * @member {Object} SuperMap.Events.prototype.extensions
  8100. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  8101. * @example
  8102. * 以扩展 "foostart" 和 "fooend" 事件为例。展示替换 css 属性为 foo 的元素的 click 事件。
  8103. *
  8104. * SuperMap.Events.foostart = SuperMap.Class({
  8105. * initialize: function(target) {
  8106. * this.target = target;
  8107. * this.target.register("click", this, this.doStuff, {extension: true});
  8108. * // only required if extension provides more than one event type
  8109. * this.target.extensions["foostart"] = true;
  8110. * this.target.extensions["fooend"] = true;
  8111. * },
  8112. * destroy: function() {
  8113. * var target = this.target;
  8114. * target.unregister("click", this, this.doStuff);
  8115. * delete this.target;
  8116. * // only required if extension provides more than one event type
  8117. * delete target.extensions["foostart"];
  8118. * delete target.extensions["fooend"];
  8119. * },
  8120. * doStuff: function(evt) {
  8121. * var propagate = true;
  8122. * if (SuperMap.Event.element(evt).className === "foo") {
  8123. * propagate = false;
  8124. * var target = this.target;
  8125. * target.triggerEvent("foostart");
  8126. * window.setTimeout(function() {
  8127. * target.triggerEvent("fooend");
  8128. * }, 1000);
  8129. * }
  8130. * return propagate;
  8131. * }
  8132. * });
  8133. * // only required if extension provides more than one event type
  8134. * SuperMap.Events.fooend = SuperMap.Events.foostart;
  8135. */
  8136. this.extensions = {};
  8137. /**
  8138. * @member {Object} SuperMap.Events.prototype.extensionCount
  8139. */
  8140. this.extensionCount = {};
  8141. /**
  8142. * @member {Object} SuperMap.Events.prototype.clearMouseListener
  8143. */
  8144. this.clearMouseListener = null;
  8145. Util_Util.extend(this, options);
  8146. if (eventTypes != null) {
  8147. for (var i = 0, len = eventTypes.length; i < len; i++) {
  8148. this.addEventType(eventTypes[i]);
  8149. }
  8150. }
  8151. if (element != null) {
  8152. this.attachToElement(element);
  8153. }
  8154. this.CLASS_NAME = "SuperMap.Events";
  8155. }
  8156. /**
  8157. * @function SuperMap.Events.prototype.destroy
  8158. * @description 移除当前要素 element 上的所有事件监听和处理。
  8159. */
  8160. destroy() {
  8161. for (var e in this.extensions) {
  8162. if (typeof this.extensions[e] !== "boolean") {
  8163. this.extensions[e].destroy();
  8164. }
  8165. }
  8166. this.extensions = null;
  8167. if (this.element) {
  8168. Event.stopObservingElement(this.element);
  8169. if (this.element.hasScrollEvent) {
  8170. Event.stopObserving(
  8171. window, "scroll", this.clearMouseListener
  8172. );
  8173. }
  8174. }
  8175. this.element = null;
  8176. this.listeners = null;
  8177. this.object = null;
  8178. this.eventTypes = null;
  8179. this.fallThrough = null;
  8180. this.eventHandler = null;
  8181. }
  8182. /**
  8183. * @function SuperMap.Events.prototype.addEventType
  8184. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  8185. * @param {string} eventName - 事件名。
  8186. */
  8187. addEventType(eventName) {
  8188. if (!this.listeners[eventName]) {
  8189. this.eventTypes.push(eventName);
  8190. this.listeners[eventName] = [];
  8191. }
  8192. }
  8193. /**
  8194. * @function SuperMap.Events.prototype.attachToElement
  8195. * @description 给 DOM 元素绑定浏览器事件。
  8196. * @param {HTMLDOMElement} element - 绑定浏览器事件的 DOM 元素。
  8197. */
  8198. attachToElement(element) {
  8199. if (this.element) {
  8200. Event.stopObservingElement(this.element);
  8201. } else {
  8202. // keep a bound copy of handleBrowserEvent() so that we can
  8203. // pass the same function to both Event.observe() and .stopObserving()
  8204. this.eventHandler = FunctionExt.bindAsEventListener(
  8205. this.handleBrowserEvent, this
  8206. );
  8207. // to be used with observe and stopObserving
  8208. this.clearMouseListener = FunctionExt.bind(
  8209. this.clearMouseCache, this
  8210. );
  8211. }
  8212. this.element = element;
  8213. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  8214. var eventType = this.BROWSER_EVENTS[i];
  8215. // every browser event has a corresponding application event
  8216. // (whether it's listened for or not).
  8217. this.addEventType(eventType);
  8218. // use Prototype to register the event cross-browser
  8219. Event.observe(element, eventType, this.eventHandler);
  8220. }
  8221. // disable dragstart in IE so that mousedown/move/up works normally
  8222. Event.observe(element, "dragstart", Event.stop);
  8223. }
  8224. /**
  8225. * @function SuperMap.Events.prototype.on
  8226. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  8227. * @example
  8228. * // 注册一个 "loadstart" 监听事件
  8229. * events.on({"loadstart": loadStartListener});
  8230. *
  8231. * // 同样注册一个 "loadstart" 监听事件
  8232. * events.register("loadstart", undefined, loadStartListener);
  8233. *
  8234. * // 同时为对象注册多个监听事件
  8235. * events.on({
  8236. * "loadstart": loadStartListener,
  8237. * "loadend": loadEndListener,
  8238. * scope: object
  8239. * });
  8240. *
  8241. * // 同时为对象注册多个监听事件,多次调用 register 方法
  8242. * events.register("loadstart", object, loadStartListener);
  8243. * events.register("loadend", object, loadEndListener);
  8244. *
  8245. *
  8246. * @param {Object} object - 添加监听的对象。
  8247. */
  8248. on(object) {
  8249. for (var type in object) {
  8250. if (type !== "scope" && object.hasOwnProperty(type)) {
  8251. this.register(type, object.scope, object[type]);
  8252. }
  8253. }
  8254. }
  8255. /**
  8256. * @function SuperMap.Events.prototype.register
  8257. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  8258. * 指定 SuperMap.Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  8259. * @param {string} type - 事件注册者的名字。
  8260. * @param {Object} [obj=this.object] - 对象绑定的回调。
  8261. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  8262. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  8263. */
  8264. register(type, obj, func, priority) {
  8265. if (type in Events_Events && !this.extensions[type]) {
  8266. this.extensions[type] = new Events_Events[type](this);
  8267. }
  8268. if ((func != null) &&
  8269. (Util_Util.indexOf(this.eventTypes, type) !== -1)) {
  8270. if (obj == null) {
  8271. obj = this.object;
  8272. }
  8273. var listeners = this.listeners[type];
  8274. if (!listeners) {
  8275. listeners = [];
  8276. this.listeners[type] = listeners;
  8277. this.extensionCount[type] = 0;
  8278. }
  8279. var listener = {obj: obj, func: func};
  8280. if (priority) {
  8281. listeners.splice(this.extensionCount[type], 0, listener);
  8282. if (typeof priority === "object" && priority.extension) {
  8283. this.extensionCount[type]++;
  8284. }
  8285. } else {
  8286. listeners.push(listener);
  8287. }
  8288. }
  8289. }
  8290. /**
  8291. * @function SuperMap.Events.prototype.registerPriority
  8292. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  8293. * @param {string} type - 事件注册者的名字。
  8294. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  8295. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  8296. */
  8297. registerPriority(type, obj, func) {
  8298. this.register(type, obj, func, true);
  8299. }
  8300. /**
  8301. * @function SuperMap.Events.prototype.un
  8302. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  8303. * @example
  8304. * // 移除 "loadstart" 事件监听
  8305. * events.un({"loadstart": loadStartListener});
  8306. *
  8307. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  8308. * events.unregister("loadstart", undefined, loadStartListener);
  8309. *
  8310. * // 取消对象多个事件监听
  8311. * events.un({
  8312. * "loadstart": loadStartListener,
  8313. * "loadend": loadEndListener,
  8314. * scope: object
  8315. * });
  8316. *
  8317. * // 取消对象多个事件监听,多次调用unregister方法。
  8318. * events.unregister("loadstart", object, loadStartListener);
  8319. * events.unregister("loadend", object, loadEndListener);
  8320. *
  8321. * @param {Object} object - 移除监听的对象。
  8322. */
  8323. un(object) {
  8324. for (var type in object) {
  8325. if (type !== "scope" && object.hasOwnProperty(type)) {
  8326. this.unregister(type, object.scope, object[type]);
  8327. }
  8328. }
  8329. }
  8330. /**
  8331. * @function SuperMap.Events.prototype.unregister
  8332. * @description 取消注册。
  8333. * @param {string} type - 事件类型。
  8334. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  8335. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  8336. */
  8337. unregister(type, obj, func) {
  8338. if (obj == null) {
  8339. obj = this.object;
  8340. }
  8341. var listeners = this.listeners[type];
  8342. if (listeners != null) {
  8343. for (var i = 0, len = listeners.length; i < len; i++) {
  8344. if (listeners[i].obj === obj && listeners[i].func === func) {
  8345. listeners.splice(i, 1);
  8346. break;
  8347. }
  8348. }
  8349. }
  8350. }
  8351. /**
  8352. * @function SuperMap.Events.prototype.remove
  8353. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  8354. * @param {string} type - 事件类型。
  8355. */
  8356. remove(type) {
  8357. if (this.listeners[type] != null) {
  8358. this.listeners[type] = [];
  8359. }
  8360. }
  8361. /**
  8362. * @function SuperMap.Events.prototype.triggerEvent
  8363. * @description 触发一个特定的注册事件。
  8364. * @param {string} type - 触发事件类型。
  8365. * @param {Event} evt - 事件对象。
  8366. * @returns {boolean} 返回监听对象,如果返回是 false,则停止监听。
  8367. */
  8368. triggerEvent(type, evt) {
  8369. var listeners = this.listeners[type];
  8370. // fast path
  8371. if (!listeners || listeners.length == 0) {
  8372. return undefined;
  8373. }
  8374. // prep evt object with object & div references
  8375. if (evt == null) {
  8376. evt = {};
  8377. }
  8378. evt.object = this.object;
  8379. evt.element = this.element;
  8380. if (!evt.type) {
  8381. evt.type = type;
  8382. }
  8383. // execute all callbacks registered for specified type
  8384. // get a clone of the listeners array to
  8385. // allow for splicing during callbacks
  8386. listeners = listeners.slice();
  8387. var continueChain;
  8388. for (var i = 0, len = listeners.length; i < len; i++) {
  8389. var callback = listeners[i];
  8390. // bind the context to callback.obj
  8391. continueChain = callback.func.apply(callback.obj, [evt]);
  8392. if ((continueChain != undefined) && (continueChain === false)) {
  8393. // if callback returns false, execute no more callbacks.
  8394. break;
  8395. }
  8396. }
  8397. // don't fall through to other DOM elements
  8398. if (!this.fallThrough) {
  8399. Event.stop(evt, true);
  8400. }
  8401. return continueChain;
  8402. }
  8403. /**
  8404. * @function SuperMap.Events.prototype.handleBrowserEvent
  8405. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  8406. * @param {Event} evt - 事件对象。
  8407. */
  8408. handleBrowserEvent(evt) {
  8409. var type = evt.type, listeners = this.listeners[type];
  8410. if (!listeners || listeners.length == 0) {
  8411. // noone's listening, bail out
  8412. return;
  8413. }
  8414. // add clientX & clientY to all events - corresponds to average x, y
  8415. var touches = evt.touches;
  8416. if (touches && touches[0]) {
  8417. var x = 0;
  8418. var y = 0;
  8419. var num = touches.length;
  8420. var touch;
  8421. for (var i = 0; i < num; ++i) {
  8422. touch = touches[i];
  8423. x += touch.clientX;
  8424. y += touch.clientY;
  8425. }
  8426. evt.clientX = x / num;
  8427. evt.clientY = y / num;
  8428. }
  8429. if (this.includeXY) {
  8430. evt.xy = this.getMousePosition(evt);
  8431. }
  8432. this.triggerEvent(type, evt);
  8433. }
  8434. /**
  8435. * @function SuperMap.Events.prototype.clearMouseCache
  8436. * @description 清除鼠标缓存。
  8437. */
  8438. clearMouseCache() {
  8439. this.element.scrolls = null;
  8440. this.element.lefttop = null;
  8441. var body = document.body;
  8442. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  8443. navigator.userAgent.match(/iPhone/i))) {
  8444. this.element.offsets = null;
  8445. }
  8446. }
  8447. /**
  8448. * @function SuperMap.Events.prototype.getMousePosition
  8449. * @param {Event} evt - 事件对象。
  8450. * @returns {SuperMap.Pixel} 当前的鼠标的 xy 坐标点。
  8451. */
  8452. getMousePosition(evt) {
  8453. if (!this.includeXY) {
  8454. this.clearMouseCache();
  8455. } else if (!this.element.hasScrollEvent) {
  8456. Event.observe(window, "scroll", this.clearMouseListener);
  8457. this.element.hasScrollEvent = true;
  8458. }
  8459. if (!this.element.scrolls) {
  8460. var viewportElement = Util_Util.getViewportElement();
  8461. this.element.scrolls = [
  8462. viewportElement.scrollLeft,
  8463. viewportElement.scrollTop
  8464. ];
  8465. }
  8466. if (!this.element.lefttop) {
  8467. this.element.lefttop = [
  8468. (document.documentElement.clientLeft || 0),
  8469. (document.documentElement.clientTop || 0)
  8470. ];
  8471. }
  8472. if (!this.element.offsets) {
  8473. this.element.offsets = Util_Util.pagePosition(this.element);
  8474. }
  8475. return new Pixel_Pixel(
  8476. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  8477. - this.element.lefttop[0],
  8478. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  8479. - this.element.lefttop[1]
  8480. );
  8481. }
  8482. }
  8483. SuperMap.Events = Events_Events;
  8484. SuperMap.Events.prototype.BROWSER_EVENTS = [
  8485. "mouseover", "mouseout",
  8486. "mousedown", "mouseup", "mousemove",
  8487. "click", "dblclick", "rightclick", "dblrightclick",
  8488. "resize", "focus", "blur",
  8489. "touchstart", "touchmove", "touchend",
  8490. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  8491. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  8492. "contextmenu"
  8493. ];
  8494. // CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  8495. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8496. * This program are made available under the terms of the Apache License, Version 2.0
  8497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8498. /**
  8499. * @class SuperMap.Feature
  8500. * @category BaseTypes Geometry
  8501. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  8502. * @param {SuperMap.Layer} layer - 图层。
  8503. * @param {SuperMap.LonLat} lonlat - 经纬度。
  8504. * @param {Object} data - 数据对象。
  8505. */
  8506. class Feature_Feature {
  8507. constructor(layer, lonlat, data) {
  8508. this.CLASS_NAME = "SuperMap.Feature";
  8509. /**
  8510. * @deprecated
  8511. * @member {SuperMap.Layer} SuperMap.Feature.prototype.layer
  8512. * @description 图层。
  8513. */
  8514. this.layer = layer;
  8515. /**
  8516. * @member {string} SuperMap.Feature.prototype.id
  8517. * @description 要素 ID。
  8518. */
  8519. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  8520. /**
  8521. * @member {SuperMap.LonLat} SuperMap.Feature.prototype.lonlat
  8522. * @description 经纬度。
  8523. *
  8524. */
  8525. this.lonlat = lonlat;
  8526. /**
  8527. * @member {Object} SuperMap.Feature.prototype.data
  8528. * @description 数据对象。
  8529. */
  8530. this.data = (data != null) ? data : {};
  8531. }
  8532. /**
  8533. * @function SuperMap.Feature.prototype.destroy
  8534. * @description 释放相关资源。
  8535. */
  8536. destroy() {
  8537. this.id = null;
  8538. this.lonlat = null;
  8539. this.data = null;
  8540. }
  8541. }
  8542. SuperMap.Feature = Feature_Feature;
  8543. // CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  8544. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8545. * This program are made available under the terms of the Apache License, Version 2.0
  8546. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8547. /**
  8548. * @class SuperMap.Feature.Vector
  8549. * @category BaseTypes Geometry
  8550. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  8551. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  8552. * 其中,默认的样式在 {@link SuperMap.Feature.Vector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  8553. * @extends {SuperMap.Feature}
  8554. * @param {SuperMap.Geometry} geometry - 代表要素的几何形状。
  8555. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  8556. * @param {Object} [style] - 样式对象。
  8557. * @example
  8558. * var geometry = new SuperMap.Geometry.Point(-115,10);
  8559. * var style = {
  8560. * strokeColor:"#339933",
  8561. * strokeOpacity:1,
  8562. * strokeWidth:3,
  8563. * pointRadius:6
  8564. * }
  8565. * var pointFeature = new SuperMap.Feature.Vector(geometry,null,style);
  8566. * vectorLayer.addFeatures(pointFeature);
  8567. */
  8568. class Vector_Vector extends Feature_Feature {
  8569. constructor(geometry, attributes, style) {
  8570. super(null, null, attributes);
  8571. /**
  8572. * @member {string} SuperMap.Feature.Vector.prototype.fid
  8573. * @description fid
  8574. */
  8575. this.fid = null;
  8576. /**
  8577. * @member {SuperMap.Geometry} SuperMap.Feature.Vector.prototype.geometry
  8578. * @description 该属性用于存放几何信息。
  8579. */
  8580. this.geometry = geometry ? geometry : null;
  8581. /**
  8582. * @member {Object} SuperMap.Feature.Vector.prototype.attributes
  8583. * @description 描述要素的任意的可序列化属性。
  8584. */
  8585. this.attributes = {};
  8586. if (attributes) {
  8587. this.attributes = Util_Util.extend(this.attributes, attributes);
  8588. }
  8589. /**
  8590. * @member {SuperMap.Bounds} SuperMap.Feature.Vector.prototype.bounds
  8591. * @description The box bounding that feature's geometry, that
  8592. * property can be set by an <SuperMap.Format> object when
  8593. * deserializing the feature, so in most cases it represents an
  8594. * information set by the server.
  8595. */
  8596. this.bounds = null;
  8597. /**
  8598. * @member {string} SuperMap.Feature.Vector.prototype.state
  8599. * @description state
  8600. */
  8601. this.state = null;
  8602. /**
  8603. * @member {Object} SuperMap.Feature.Vector.prototype.style
  8604. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  8605. */
  8606. this.style = style ? style : null;
  8607. /**
  8608. * @member {string} SuperMap.Feature.Vector.prototype.url
  8609. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link SuperMap.HTTP} 。
  8610. */
  8611. this.url = null;
  8612. this.lonlat = null;
  8613. this.CLASS_NAME = "SuperMap.Feature.Vector";
  8614. // TRASH THIS
  8615. SuperMap.State = {
  8616. /** states */
  8617. UNKNOWN: 'Unknown',
  8618. INSERT: 'Insert',
  8619. UPDATE: 'Update',
  8620. DELETE: 'Delete'
  8621. };
  8622. Vector_Vector.style = {
  8623. 'default': {
  8624. fillColor: "#ee9900",
  8625. fillOpacity: 0.4,
  8626. hoverFillColor: "white",
  8627. hoverFillOpacity: 0.8,
  8628. strokeColor: "#ee9900",
  8629. strokeOpacity: 1,
  8630. strokeWidth: 1,
  8631. strokeLinecap: "round",
  8632. strokeDashstyle: "solid",
  8633. hoverStrokeColor: "red",
  8634. hoverStrokeOpacity: 1,
  8635. hoverStrokeWidth: 0.2,
  8636. pointRadius: 6,
  8637. hoverPointRadius: 1,
  8638. hoverPointUnit: "%",
  8639. pointerEvents: "visiblePainted",
  8640. cursor: "inherit",
  8641. fontColor: "#000000",
  8642. labelAlign: "cm",
  8643. labelOutlineColor: "white",
  8644. labelOutlineWidth: 3
  8645. },
  8646. 'select': {
  8647. fillColor: "blue",
  8648. fillOpacity: 0.4,
  8649. hoverFillColor: "white",
  8650. hoverFillOpacity: 0.8,
  8651. strokeColor: "blue",
  8652. strokeOpacity: 1,
  8653. strokeWidth: 2,
  8654. strokeLinecap: "round",
  8655. strokeDashstyle: "solid",
  8656. hoverStrokeColor: "red",
  8657. hoverStrokeOpacity: 1,
  8658. hoverStrokeWidth: 0.2,
  8659. pointRadius: 6,
  8660. hoverPointRadius: 1,
  8661. hoverPointUnit: "%",
  8662. pointerEvents: "visiblePainted",
  8663. cursor: "pointer",
  8664. fontColor: "#000000",
  8665. labelAlign: "cm",
  8666. labelOutlineColor: "white",
  8667. labelOutlineWidth: 3
  8668. },
  8669. 'temporary': {
  8670. fillColor: "#66cccc",
  8671. fillOpacity: 0.2,
  8672. hoverFillColor: "white",
  8673. hoverFillOpacity: 0.8,
  8674. strokeColor: "#66cccc",
  8675. strokeOpacity: 1,
  8676. strokeLinecap: "round",
  8677. strokeWidth: 2,
  8678. strokeDashstyle: "solid",
  8679. hoverStrokeColor: "red",
  8680. hoverStrokeOpacity: 1,
  8681. hoverStrokeWidth: 0.2,
  8682. pointRadius: 6,
  8683. hoverPointRadius: 1,
  8684. hoverPointUnit: "%",
  8685. pointerEvents: "visiblePainted",
  8686. //cursor:"inherit",
  8687. cursor: "default",
  8688. fontColor: "#000000",
  8689. labelAlign: "cm",
  8690. labelOutlineColor: "white",
  8691. labelOutlineWidth: 3
  8692. },
  8693. 'delete': {
  8694. display: "none"
  8695. }
  8696. };
  8697. }
  8698. /**
  8699. * @function SuperMap.Feature.Vector.prototype.destroy
  8700. * @description nullify references to prevent circular references and memory leaks
  8701. */
  8702. destroy() {
  8703. if (this.layer) {
  8704. this.layer.removeFeatures(this);
  8705. this.layer = null;
  8706. }
  8707. this.geometry = null;
  8708. super.destroy();
  8709. }
  8710. /**
  8711. * @function SuperMap.Feature.Vector.prototype.clone
  8712. * @description Create a clone of this vector feature. Does not set any non-standard
  8713. * properties.
  8714. * @returns {SuperMap.Feature.Vector} An exact clone of this vector feature.
  8715. */
  8716. clone() {
  8717. return new Vector_Vector(
  8718. this.geometry ? this.geometry.clone() : null,
  8719. this.attributes,
  8720. this.style);
  8721. }
  8722. /**
  8723. * @function SuperMap.Feature.Vector.prototype.toState
  8724. * @description 设置新状态。
  8725. * @param {string} state - 状态。
  8726. */
  8727. toState(state) {
  8728. if (state === SuperMap.State.UPDATE) {
  8729. switch (this.state) {
  8730. case SuperMap.State.UNKNOWN:
  8731. case SuperMap.State.DELETE:
  8732. this.state = state;
  8733. break;
  8734. case SuperMap.State.UPDATE:
  8735. case SuperMap.State.INSERT:
  8736. break;
  8737. }
  8738. } else if (state === SuperMap.State.INSERT) {
  8739. switch (this.state) {
  8740. case SuperMap.State.UNKNOWN:
  8741. break;
  8742. default:
  8743. this.state = state;
  8744. break;
  8745. }
  8746. } else if (state === SuperMap.State.DELETE) {
  8747. switch (this.state) {
  8748. case SuperMap.State.INSERT:
  8749. // the feature should be destroyed
  8750. break;
  8751. case SuperMap.State.DELETE:
  8752. break;
  8753. case SuperMap.State.UNKNOWN:
  8754. case SuperMap.State.UPDATE:
  8755. this.state = state;
  8756. break;
  8757. }
  8758. } else if (state === SuperMap.State.UNKNOWN) {
  8759. this.state = state;
  8760. }
  8761. }
  8762. }
  8763. /**
  8764. *
  8765. * @typedef {Object} SuperMap.Feature.Vector.style
  8766. * @description SuperMap.features 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  8767. * 大部分样式通过 SVG 标准定义属性。
  8768. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  8769. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  8770. * @property {boolean} [fill] - 不需要填充则设置为 false。
  8771. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  8772. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  8773. * @property {boolean} [stroke] - 不需要描边则设为 false。
  8774. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  8775. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  8776. * @property {number} [strokeWidth=1] - 像素描边宽度。
  8777. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  8778. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  8779. * @property {boolean} [graphic] - 不需要则设置为 false。
  8780. * @property {number} [pointRadius=6] - 像素点半径。
  8781. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  8782. * @property {string} [cursor] - cursor。
  8783. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  8784. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  8785. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  8786. * @property {number} [graphicHeight] - 外部图表的高宽度。
  8787. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  8788. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  8789. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量 Pixel。
  8790. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  8791. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  8792. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  8793. * @property {string} [graphicTitle] - 外部图表的提示框。
  8794. * @property {string} [backgroundGraphic] - 外部图表的背景。
  8795. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  8796. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  8797. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  8798. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  8799. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  8800. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  8801. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  8802. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  8803. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  8804. * @property {string} [label] - 可选的标签文本。
  8805. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  8806. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  8807. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  8808. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  8809. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  8810. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  8811. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  8812. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  8813. * @property {string} [fontFamily] - 标签的字体类型。
  8814. * @property {string} [fontSize] - 标签的字体大小。
  8815. * @property {string} [fontStyle] - 标签的字体样式。
  8816. * @property {string} [fontWeight] - 标签的字体粗细。
  8817. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  8818. * @example
  8819. * // label的用法如下:
  8820. * function addGeoTest(){
  8821. * var geometry = new SuperMap.Geometry.Point(105, 35);
  8822. * var pointFeature = new SuperMap.Feature.Vector(geometry);
  8823. * var styleTest = {
  8824. * label:"supermap",
  8825. * fontColor:"#0000ff",
  8826. * fontOpacity:"0.5",
  8827. * fontFamily:"隶书",
  8828. * fontSize:"8em",
  8829. * fontWeight:"bold",
  8830. * fontStyle:"italic",
  8831. * labelSelect:"true",
  8832. * }
  8833. * pointFeature.style = styleTest;
  8834. * vectorLayer.addFeatures([pointFeature]);
  8835. * }
  8836. */
  8837. SuperMap.Feature.Vector = Vector_Vector;
  8838. // CONCATENATED MODULE: ./src/common/commontypes/index.js
  8839. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8840. * This program are made available under the terms of the Apache License, Version 2.0
  8841. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8842. // CONCATENATED MODULE: ./src/common/format/Format.js
  8843. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8844. * This program are made available under the terms of the Apache License, Version 2.0
  8845. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8846. /**
  8847. * @class SuperMap.Format
  8848. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  8849. * @category BaseTypes Format
  8850. * @param {Object} options - 可选参数。
  8851. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  8852. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  8853. */
  8854. class Format_Format {
  8855. constructor(options) {
  8856. /**
  8857. * @member {Object} SuperMap.Format.prototype.data
  8858. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  8859. */
  8860. this.data = null;
  8861. /**
  8862. * APIProperty: keepData
  8863. * @member {Object} [SuperMap.Format.prototype.keepData=false]
  8864. * @description 保持最近读到的数据的引用(通过 <data> 属性)。
  8865. */
  8866. this.keepData = false;
  8867. Util_Util.extend(this, options);
  8868. this.options = options;
  8869. this.CLASS_NAME = "SuperMap.Format";
  8870. }
  8871. /**
  8872. * @function SuperMap.Format.prototype.destroy
  8873. * @description 销毁该格式类,释放相关资源。
  8874. */
  8875. destroy() {
  8876. //用来销毁该格式类,释放相关资源
  8877. }
  8878. /**
  8879. * @function SuperMap.Format.prototype.read
  8880. * @description 来从字符串中读取数据。
  8881. * @param {string} data - 读取的数据。
  8882. */
  8883. read(data) { // eslint-disable-line no-unused-vars
  8884. //用来从字符串中读取数据
  8885. }
  8886. /**
  8887. * @function SuperMap.Format.prototype.write
  8888. * @description 将对象写成字符串。
  8889. * @param {Object} object - 可序列化的对象。
  8890. * @returns {string} 对象被写成字符串。
  8891. */
  8892. write(object) { // eslint-disable-line no-unused-vars
  8893. //用来写字符串
  8894. }
  8895. }
  8896. SuperMap.Format = SuperMap.Format || Format_Format;
  8897. // CONCATENATED MODULE: ./src/common/format/JSON.js
  8898. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8899. * This program are made available under the terms of the Apache License, Version 2.0
  8900. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8901. /**
  8902. * @class SuperMap.Format.JSON
  8903. * @classdesc 安全的读写 JSON 的解析类。使用 {@link SuperMap.Format.JSON} 构造函数创建新实例。
  8904. * @category BaseTypes Format
  8905. * @param {Object} [options] - 参数。
  8906. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  8907. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  8908. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  8909. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  8910. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8911. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  8912. * @extends {SuperMap.Format}
  8913. */
  8914. class JSON_JSONFormat extends Format_Format {
  8915. constructor(options) {
  8916. super(options);
  8917. /**
  8918. * @member {string} [SuperMap.Format.JSON.prototype.indent=" "]
  8919. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  8920. */
  8921. this.indent = " ";
  8922. /**
  8923. * @member {string} [SuperMap.Format.JSON.prototype.space=" "]
  8924. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  8925. */
  8926. this.space = " ";
  8927. /**
  8928. * @member {string} [SuperMap.Format.JSON.prototype.newline="\n"]
  8929. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  8930. */
  8931. this.newline = "\n";
  8932. /**
  8933. * @member {integer} [SuperMap.Format.JSON.prototype.level=0]
  8934. * @description 用于格式化输出, 表示的是缩进级别。
  8935. */
  8936. this.level = 0;
  8937. /**
  8938. * @member {boolean} [SuperMap.Format.JSON.prototype.pretty=false]
  8939. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8940. */
  8941. this.pretty = false;
  8942. /**
  8943. * @member {boolean} SuperMap.Format.JSON.prototype.nativeJSON
  8944. * @description 判断浏览器是否原生支持 JSON 格式数据。
  8945. */
  8946. this.nativeJSON = (function () {
  8947. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  8948. })();
  8949. this.CLASS_NAME = "SuperMap.Format.JSON";
  8950. /**
  8951. * @member SuperMap.Format.JSON.prototype.serialize
  8952. * @description 提供一些类型对象转 JSON 字符串的方法。
  8953. */
  8954. this.serialize = {
  8955. /**
  8956. * @function SuperMap.Format.JSON.serialize.object
  8957. * @description 把对象转换为 JSON 字符串。
  8958. * @param {Object} object - 可序列化的对象。
  8959. * @returns {string} JSON 字符串。
  8960. */
  8961. 'object': function (object) {
  8962. // three special objects that we want to treat differently
  8963. if (object == null) {
  8964. return "null";
  8965. }
  8966. if (object.constructor === Date) {
  8967. return this.serialize.date.apply(this, [object]);
  8968. }
  8969. if (object.constructor === Array) {
  8970. return this.serialize.array.apply(this, [object]);
  8971. }
  8972. var pieces = ['{'];
  8973. this.level += 1;
  8974. var key, keyJSON, valueJSON;
  8975. var addComma = false;
  8976. for (key in object) {
  8977. if (object.hasOwnProperty(key)) {
  8978. // recursive calls need to allow for sub-classing
  8979. keyJSON = this.write.apply(this,
  8980. [key, this.pretty]);
  8981. valueJSON = this.write.apply(this,
  8982. [object[key], this.pretty]);
  8983. if (keyJSON != null && valueJSON != null) {
  8984. if (addComma) {
  8985. pieces.push(',');
  8986. }
  8987. pieces.push(this.writeNewline(), this.writeIndent(),
  8988. keyJSON, ':', this.writeSpace(), valueJSON);
  8989. addComma = true;
  8990. }
  8991. }
  8992. }
  8993. this.level -= 1;
  8994. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  8995. return pieces.join('');
  8996. },
  8997. /**
  8998. * @function SuperMap.Format.JSON.serialize.array
  8999. * @description 把数组转换成 JSON 字符串。
  9000. * @param {Array} array - 可序列化的数组。
  9001. * @returns {string} JSON 字符串。
  9002. */
  9003. 'array': function (array) {
  9004. var json;
  9005. var pieces = ['['];
  9006. this.level += 1;
  9007. for (var i = 0, len = array.length; i < len; ++i) {
  9008. // recursive calls need to allow for sub-classing
  9009. json = this.write.apply(this,
  9010. [array[i], this.pretty]);
  9011. if (json != null) {
  9012. if (i > 0) {
  9013. pieces.push(',');
  9014. }
  9015. pieces.push(this.writeNewline(), this.writeIndent(), json);
  9016. }
  9017. }
  9018. this.level -= 1;
  9019. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  9020. return pieces.join('');
  9021. },
  9022. /**
  9023. * @function SuperMap.Format.JSON.serialize.string
  9024. * @description 把字符串转换成 JSON 字符串。
  9025. * @param {string} string - 可序列化的字符串。
  9026. * @returns {string} JSON 字符串。
  9027. */
  9028. 'string': function (string) {
  9029. // If the string contains no control characters, no quote characters, and no
  9030. // backslash characters, then we can simply slap some quotes around it.
  9031. // Otherwise we must also replace the offending characters with safe
  9032. // sequences.
  9033. var m = {
  9034. '\b': '\\b',
  9035. '\t': '\\t',
  9036. '\n': '\\n',
  9037. '\f': '\\f',
  9038. '\r': '\\r',
  9039. '"': '\\"',
  9040. '\\': '\\\\'
  9041. };
  9042. /*eslint-disable no-control-regex*/
  9043. if (/["\\\x00-\x1f]/.test(string)) {
  9044. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  9045. var c = m[b];
  9046. if (c) {
  9047. return c;
  9048. }
  9049. c = b.charCodeAt();
  9050. return '\\u00' +
  9051. Math.floor(c / 16).toString(16) +
  9052. (c % 16).toString(16);
  9053. }) + '"';
  9054. }
  9055. return '"' + string + '"';
  9056. },
  9057. /**
  9058. * @function SuperMap.Format.JSON.serialize.number
  9059. * @description 把数字转换成 JSON 字符串。
  9060. * @param {number} number - 可序列化的数字。
  9061. * @returns {string} JSON 字符串。
  9062. */
  9063. 'number': function (number) {
  9064. return isFinite(number) ? String(number) : "null";
  9065. },
  9066. /**
  9067. * @function SuperMap.Format.JSON.serialize.boolean
  9068. * @description Transform a boolean into a JSON string.
  9069. * @param {boolean} bool - The boolean to be serialized.
  9070. * @returns {string} A JSON string representing the boolean.
  9071. */
  9072. 'boolean': function (bool) {
  9073. return String(bool);
  9074. },
  9075. /**
  9076. * @function SuperMap.Format.JSON.serialize.object
  9077. * @description 将日期对象转换成 JSON 字符串。
  9078. * @param {Date} date - 可序列化的日期对象。
  9079. * @returns {string} JSON 字符串。
  9080. */
  9081. 'date': function (date) {
  9082. function format(number) {
  9083. // Format integers to have at least two digits.
  9084. return (number < 10) ? '0' + number : number;
  9085. }
  9086. return '"' + date.getFullYear() + '-' +
  9087. format(date.getMonth() + 1) + '-' +
  9088. format(date.getDate()) + 'T' +
  9089. format(date.getHours()) + ':' +
  9090. format(date.getMinutes()) + ':' +
  9091. format(date.getSeconds()) + '"';
  9092. }
  9093. };
  9094. }
  9095. /**
  9096. * @function SuperMap.Format.JSON.prototype.read
  9097. * @description 将一个符合 JSON 结构的字符串进行解析。
  9098. * @param {string} json - 符合 JSON 结构的字符串。
  9099. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  9100. * @returns {Object} 对象,数组,字符串或数字。
  9101. */
  9102. read(json, filter) {
  9103. var object;
  9104. if (this.nativeJSON) {
  9105. try {
  9106. object = JSON.parse(json, filter);
  9107. } catch (e) {
  9108. // Fall through if the regexp test fails.
  9109. }
  9110. }
  9111. if (this.keepData) {
  9112. this.data = object;
  9113. }
  9114. return object;
  9115. }
  9116. /**
  9117. * @function SuperMap.Format.JSON.prototype.write
  9118. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  9119. * @param {(object|string|Array|number|boolean)} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  9120. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  9121. * @returns {string} 符合 JSON 格式的字符串。
  9122. *
  9123. */
  9124. write(value, pretty) {
  9125. this.pretty = !!pretty;
  9126. var json = null;
  9127. var type = typeof value;
  9128. if (this.serialize[type]) {
  9129. try {
  9130. json = (!this.pretty && this.nativeJSON) ?
  9131. JSON.stringify(value) :
  9132. this.serialize[type].apply(this, [value]);
  9133. } catch (err) {
  9134. //SuperMap.Console.error("Trouble serializing: " + err);
  9135. }
  9136. }
  9137. return json;
  9138. }
  9139. /**
  9140. * @function SuperMap.Format.JSON.prototype.writeIndent
  9141. * @description 根据缩进级别输出一个缩进字符串。
  9142. * @private
  9143. * @returns {string} 一个适当的缩进字符串。
  9144. */
  9145. writeIndent() {
  9146. var pieces = [];
  9147. if (this.pretty) {
  9148. for (var i = 0; i < this.level; ++i) {
  9149. pieces.push(this.indent);
  9150. }
  9151. }
  9152. return pieces.join('');
  9153. }
  9154. /**
  9155. * @function SuperMap.Format.JSON.prototype.writeNewline
  9156. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  9157. * @private
  9158. * @returns {string} 代表新的一行的字符串。
  9159. */
  9160. writeNewline() {
  9161. return (this.pretty) ? this.newline : '';
  9162. }
  9163. /**
  9164. * @function SuperMap.Format.JSON.prototype.writeSpace
  9165. * @private
  9166. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  9167. * @returns {string} 一个空格。
  9168. */
  9169. writeSpace() {
  9170. return (this.pretty) ? this.space : '';
  9171. }
  9172. }
  9173. SuperMap.Format.JSON = JSON_JSONFormat;
  9174. // CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  9175. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9176. * This program are made available under the terms of the Apache License, Version 2.0
  9177. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9178. /**
  9179. * @class SuperMap.ServerColor
  9180. * @category iServer Map Theme
  9181. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  9182. * @param {Object} options - 参数。
  9183. * @param {number} [options.red=255] - 获取或设置红色值。
  9184. * @param {number} [options.green=0] - 获取或设置绿色值。
  9185. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  9186. */
  9187. class ServerColor {
  9188. constructor(red, green, blue) {
  9189. /**
  9190. * @member {number} [SuperMap.ServerColor.prototype.red=255]
  9191. * @description 获取或设置红色值。
  9192. */
  9193. this.red = (!red && red != 0)?255:red;
  9194. /**
  9195. * @member {number} [SuperMap.ServerColor.prototype.green=0]
  9196. * @description 获取或设置绿色值。
  9197. */
  9198. this.green = green||0;
  9199. /**
  9200. * @member {number} [SuperMap.ServerColor.prototype.blue=0]
  9201. * @description 获取或设置蓝色值。
  9202. */
  9203. this.blue = blue||0;
  9204. this.CLASS_NAME = "SuperMap.ServerColor";
  9205. }
  9206. /**
  9207. * @function SuperMap.ServerColor.prototype.destroy
  9208. * @description 释放资源,将引用资源的属性置空。
  9209. */
  9210. destroy() {
  9211. var me = this;
  9212. me.red = null;
  9213. me.green = null;
  9214. me.blue = null;
  9215. }
  9216. /**
  9217. * @function SuperMap.ServerColor.formJson
  9218. * @description 将 JSON 对象转化为 ServerColor 对象。
  9219. * @param {Object} jsonObject - 要转换的 JSON 对象。
  9220. * @returns {SuperMap.ServerColor} 转化后的 ServerColor 对象。
  9221. */
  9222. static fromJson(jsonObject) {
  9223. if (!jsonObject) {
  9224. return;
  9225. }
  9226. var color = new ServerColor();
  9227. var red = 255;
  9228. if (jsonObject.red !== null) {
  9229. red = Number(jsonObject.red);
  9230. }
  9231. color.red = red;
  9232. var green = 0;
  9233. if (jsonObject.green !== null) {
  9234. green = Number(jsonObject.green);
  9235. }
  9236. color.green = green;
  9237. var blue = 0;
  9238. if (jsonObject.blue !== null) {
  9239. blue = Number(jsonObject.blue);
  9240. }
  9241. color.blue = blue;
  9242. return color;
  9243. }
  9244. }
  9245. SuperMap.ServerColor = ServerColor;
  9246. // CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  9247. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9248. * This program are made available under the terms of the Apache License, Version 2.0
  9249. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9250. /**
  9251. * @class SuperMap.ServerStyle
  9252. * @category iServer Map Theme
  9253. * @classdesc 服务端矢量要素风格类。
  9254. * @description 该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  9255. * @param {Object} options - 参数。
  9256. * @param {SuperMap.FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  9257. * @param {SuperMap.ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  9258. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  9259. * @param {SuperMap.ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  9260. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  9261. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  9262. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  9263. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  9264. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  9265. * @param {SuperMap.ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  9266. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  9267. * @param {number} [options.lineWidth=1] - 边线的宽度。
  9268. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  9269. * @param {number} [options.markerSize=1] - 点状符号的大小。
  9270. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  9271. */
  9272. class ServerStyle_ServerStyle {
  9273. constructor(options) {
  9274. /**
  9275. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillBackColor
  9276. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  9277. */
  9278. this.fillBackColor = new ServerColor(255, 255, 255);
  9279. /**
  9280. * @member {boolean} [SuperMap.ServerStyle.prototype.fillBackOpaque=false]
  9281. * @description 背景是否不透明。false 表示透明。
  9282. */
  9283. this.fillBackOpaque = false;
  9284. /**
  9285. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillForeColor
  9286. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  9287. */
  9288. this.fillForeColor = new ServerColor(255, 0, 0);
  9289. /**
  9290. * @member {SuperMap.FillGradientMode} SuperMap.ServerStyle.prototype.fillGradientMode
  9291. * @description 渐变填充风格的渐变类型。
  9292. */
  9293. this.fillGradientMode = null;
  9294. /**
  9295. * @member {number} SuperMap.ServerStyle.prototype.fillGradientAngle -
  9296. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  9297. */
  9298. this.fillGradientAngle = 0;
  9299. /**
  9300. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioX
  9301. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  9302. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  9303. */
  9304. this.fillGradientOffsetRatioX = 0;
  9305. /**
  9306. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioY
  9307. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  9308. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  9309. */
  9310. this.fillGradientOffsetRatioY = 0;
  9311. /**
  9312. * @member {number} [SuperMap.ServerStyle.prototype.fillOpaqueRate=100]
  9313. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  9314. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  9315. */
  9316. this.fillOpaqueRate = 100;
  9317. /**
  9318. * @member {number} SuperMap.ServerStyle.prototype.fillSymbolID
  9319. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  9320. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  9321. */
  9322. this.fillSymbolID = 0;
  9323. /**
  9324. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.lineColor
  9325. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  9326. */
  9327. this.lineColor = new ServerColor(0, 0, 0);
  9328. /**
  9329. * @member {number} [SuperMap.ServerStyle.prototype.lineSymbolID=0]
  9330. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  9331. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  9332. */
  9333. this.lineSymbolID = 0;
  9334. /**
  9335. * @member {number} [SuperMap.ServerStyle.prototype.lineWidth=1.0]
  9336. * @description 边线的宽度。单位为毫米,精度到 0.1。
  9337. */
  9338. this.lineWidth = 1;
  9339. /**
  9340. * @member {number} [SuperMap.ServerStyle.prototype.markerAngle=0]
  9341. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  9342. */
  9343. this.markerAngle = 0;
  9344. /**
  9345. * @member {number} [SuperMap.ServerStyle.prototype.markerSize=1.0]
  9346. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  9347. * 当该属性设置为非法值时,交由服务器默认处理。
  9348. */
  9349. this.markerSize = 1;
  9350. /**
  9351. * @member {number} [SuperMap.ServerStyle.prototype.markerSymbolID=-1]
  9352. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  9353. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  9354. */
  9355. this.markerSymbolID = -1;
  9356. if (options) {
  9357. Util_Util.extend(this, options);
  9358. }
  9359. this.CLASS_NAME = "SuperMap.ServerStyle";
  9360. }
  9361. /**
  9362. * @function SuperMap.ServerStyle.prototype.destroy
  9363. * @description 释放资源,将引用资源的属性置空。
  9364. */
  9365. destroy() {
  9366. var me = this;
  9367. if (me.fillBackColor) {
  9368. me.fillBackColor.destroy();
  9369. me.fillBackColor = null;
  9370. }
  9371. me.fillBackOpaque = null;
  9372. if (me.fillForeColor) {
  9373. me.fillForeColor.destroy();
  9374. me.fillForeColor = null;
  9375. }
  9376. me.fillGradientMode = null;
  9377. me.fillGradientAngle = null;
  9378. me.fillGradientOffsetRatioX = null;
  9379. me.fillGradientOffsetRatioY = null;
  9380. me.fillOpaqueRate = null;
  9381. me.fillSymbolID = null;
  9382. if (me.lineColor) {
  9383. me.lineColor.destroy();
  9384. me.lineColor = null;
  9385. }
  9386. me.lineSymbolID = null;
  9387. me.lineWidth = null;
  9388. me.markerAngle = null;
  9389. me.markerSize = null;
  9390. me.markerSymbolID = null;
  9391. }
  9392. /**
  9393. * @function SuperMap.ServerStyle.prototype.toServerJSONObject
  9394. * @description 转换成对应的 JSON 格式对象。
  9395. * @returns {Object} 对应的 JSON 格式对象.
  9396. */
  9397. toServerJSONObject() {
  9398. var styleObj = {};
  9399. styleObj = Util_Util.copyAttributes(styleObj, this);
  9400. //暂时先忽略serverColor往Json的转换
  9401. return styleObj;
  9402. }
  9403. /**
  9404. * @function SuperMap.ServerStyle.fromJson
  9405. * @description 将JSON对象转换为 SuperMap.ServerStyle 对象。
  9406. * @param jsonObject - {Object} 要转换的 JSON 对象。
  9407. * @returns {SuperMap.ServerStyle} 转化后的 SuperMap.ServerStyle 对象。
  9408. */
  9409. static fromJson(jsonObject) {
  9410. if (!jsonObject) {
  9411. return;
  9412. }
  9413. return new ServerStyle_ServerStyle({
  9414. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  9415. fillBackOpaque: jsonObject.fillBackOpaque,
  9416. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  9417. fillGradientMode: jsonObject.fillGradientMode,
  9418. fillGradientAngle: jsonObject.fillGradientAngle,
  9419. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  9420. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  9421. fillOpaqueRate: jsonObject.fillOpaqueRate,
  9422. fillSymbolID: jsonObject.fillSymbolID,
  9423. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  9424. lineSymbolID: jsonObject.lineSymbolID,
  9425. lineWidth: jsonObject.lineWidth,
  9426. markerAngle: jsonObject.markerAngle,
  9427. markerSize: jsonObject.markerSize,
  9428. markerSymbolID: jsonObject.markerSymbolID
  9429. });
  9430. }
  9431. }
  9432. SuperMap.ServerStyle = ServerStyle_ServerStyle;
  9433. // CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  9434. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9435. * This program are made available under the terms of the Apache License, Version 2.0
  9436. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9437. /**
  9438. * @class SuperMap.PointWithMeasure
  9439. * @category iServer SpatialAnalyst
  9440. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  9441. * @param {Object} options - 参数。
  9442. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  9443. * @param {number} options.x - 获取当前点对象在地理坐标系下的 X 坐标值。
  9444. * @param {number} options.y - 获取当前点对象在地理坐标系下的 Y 坐标值。
  9445. * @extends {SuperMap.Geometry.Point}
  9446. */
  9447. class PointWithMeasure_PointWithMeasure extends Point_Point {
  9448. constructor(options) {
  9449. super(options);
  9450. /**
  9451. * @member {number} SuperMap.PointWithMeasure.prototype.measure
  9452. * @description 度量值,即路由对象属性值 M。
  9453. */
  9454. this.measure = null;
  9455. if (options) {
  9456. Util_Util.extend(this, options);
  9457. }
  9458. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  9459. }
  9460. /**
  9461. * @function SuperMap.PointWithMeasure.prototype.equals
  9462. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  9463. * @param {SuperMap.PointWithMeasure} geom - 需要判断的路由点对象。
  9464. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  9465. */
  9466. equals(geom) {
  9467. var equals = false;
  9468. if (geom != null) {
  9469. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  9470. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  9471. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  9472. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  9473. }
  9474. return equals;
  9475. }
  9476. /**
  9477. * @function SuperMap.PointWithMeasure.prototype.toJson
  9478. * @description 转换为 JSON 对象。
  9479. * */
  9480. toJson() {
  9481. var result = "{";
  9482. if (this.measure != null && this.measure != undefined) {
  9483. result += "\"measure\":" + this.measure + ",";
  9484. }
  9485. result += "\"x\":" + this.x + ",";
  9486. result += "\"y\":" + this.y;
  9487. result += "}";
  9488. return result;
  9489. }
  9490. /**
  9491. * @function SuperMap.PointWithMeasure.prototype.destroy
  9492. * @description 释放资源,将引用资源的属性置空。
  9493. */
  9494. destroy() {
  9495. var me = this;
  9496. me.measure = null;
  9497. me.x = null;
  9498. me.y = null;
  9499. }
  9500. /**
  9501. * @function SuperMap.PointWithMeasure.fromJson
  9502. * @description 将 JSON 对象转换为{@link SuperMap.PointWithMeasure} 对象。
  9503. * @param {Object} jsonObject - JSON 对象表示的路由点。
  9504. * @returns {SuperMap.PointWithMeasure} 转化后的 PointWithMeasure 对象。
  9505. */
  9506. static fromJson(jsonObject) {
  9507. if (!jsonObject) {
  9508. return;
  9509. }
  9510. return new PointWithMeasure_PointWithMeasure({
  9511. x: jsonObject.x,
  9512. y: jsonObject.y,
  9513. measure: jsonObject.measure
  9514. });
  9515. }
  9516. }
  9517. SuperMap.PointWithMeasure = PointWithMeasure_PointWithMeasure;
  9518. // CONCATENATED MODULE: ./src/common/iServer/Route.js
  9519. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9520. * This program are made available under the terms of the Apache License, Version 2.0
  9521. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9522. /**
  9523. * @class SuperMap.Route
  9524. * @category iServer SpatialAnalyst
  9525. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  9526. * @param {Array.<SuperMap.Geometry>} points - 形成路由对象的线数组。
  9527. * @param {Object} options - 参数。
  9528. * @param {number} options.id - 路由对象在数据库中的 id。
  9529. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  9530. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  9531. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  9532. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  9533. * @extends {SuperMap.Geometry.Collection}
  9534. */
  9535. class Route_Route extends Collection_Collection {
  9536. constructor(points, options) {
  9537. super(points, options);
  9538. /**
  9539. * @member {number} SuperMap.Route.prototype.id
  9540. * @description 路由对象在数据库中的 ID。
  9541. */
  9542. this.id = null;
  9543. /**
  9544. * @member {number} SuperMap.Route.prototype.center
  9545. * @description 路由对象的中心点。
  9546. */
  9547. this.center = null;
  9548. /**
  9549. * @member {string} SuperMap.Route.prototype.style
  9550. * @description 路由对象的样式。
  9551. */
  9552. this.style = null;
  9553. /**
  9554. * @member {number} SuperMap.Route.prototype.length
  9555. * @description 路由对象的长度。单位与数据集的单位相同。
  9556. */
  9557. this.length = null;
  9558. /**
  9559. * @member {number} SuperMap.Route.prototype.maxM
  9560. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  9561. */
  9562. this.maxM = null;
  9563. /**
  9564. * @member {number} SuperMap.Route.prototype.minM
  9565. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  9566. */
  9567. this.minM = null;
  9568. /**
  9569. * @member {Array.<number>} SuperMap.Route.prototype.parts
  9570. * @description 服务端几何对象中各个子对象所包含的节点个数。
  9571. */
  9572. this.parts = null;
  9573. /**
  9574. * @member {Array.<Object>} SuperMap.Route.prototype.points
  9575. * @description 路由对象的所有路由点。
  9576. * @example
  9577. * (start code)
  9578. * [
  9579. * {
  9580. * "measure": 0,
  9581. * "y": -4377.027184298267,
  9582. * "x": 4020.0045221720466
  9583. * },
  9584. * {
  9585. * "measure": 37.33288381391519,
  9586. * "y": -4381.569363260499,
  9587. * "x": 4057.0600591960642
  9588. * }
  9589. * ]
  9590. * (end)
  9591. */
  9592. this.points = null;
  9593. /**
  9594. * @member {string} SuperMap.Route.prototype.type
  9595. * @description 服务端几何对象类型。
  9596. */
  9597. this.type = null;
  9598. /**
  9599. * @member {Array.<string>} [SuperMap.Route.prototype.componentTypes=SuperMap.Geometry.LineString]
  9600. * @description components 存储的的几何对象所支持的几何类型数组。
  9601. */
  9602. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  9603. if (options) {
  9604. Util_Util.extend(this, options);
  9605. }
  9606. this.CLASS_NAME = "SuperMap.Route";
  9607. this.geometryType = "LINEM";
  9608. }
  9609. /**
  9610. *
  9611. * @function SuperMap.Route.prototype.toJson
  9612. * @description 转换为 JSON 对象。
  9613. * @returns {Object} JSON 对象。
  9614. */
  9615. toJson() {
  9616. var result = "{";
  9617. if (this.id != null && this.id != undefined) {
  9618. result += "\"id\":" + this.id + ",";
  9619. }
  9620. if (this.center != null && this.center != undefined) {
  9621. result += "\"center\":" + this.center + ",";
  9622. }
  9623. if (this.style != null && this.style != undefined) {
  9624. result += "\"style\":" + this.style + ",";
  9625. }
  9626. if (this.length != null && this.length != undefined) {
  9627. result += "\"length\":" + this.length + ",";
  9628. }
  9629. if (this.maxM != null && this.maxM != undefined) {
  9630. result += "\"maxM\":" + this.maxM + ",";
  9631. }
  9632. if (this.minM != null && this.minM != undefined) {
  9633. result += "\"minM\":" + this.minM + ",";
  9634. }
  9635. if (this.type != null && this.type != undefined) {
  9636. result += "\"type\":\"" + this.type + "\",";
  9637. }
  9638. if (this.parts != null && this.parts != undefined) {
  9639. result += "\"parts\":[" + this.parts[0];
  9640. for (var i = 1; i < this.parts.length; i++) {
  9641. result += "," + this.parts[i];
  9642. }
  9643. result += "],";
  9644. }
  9645. if (this.components != null && this.components.length > 0) {
  9646. result += "\"points\":[";
  9647. for (var j = 0, len = this.components.length; j < len; j++) {
  9648. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  9649. result += this.components[j].components[k].toJson() + ",";
  9650. }
  9651. }
  9652. result = result.replace(/,$/g, '');
  9653. result += "]";
  9654. }
  9655. result = result.replace(/,$/g, '');
  9656. result += "}";
  9657. return result;
  9658. }
  9659. /**
  9660. * @function SuperMap.Route.prototype.destroy
  9661. * @override
  9662. */
  9663. destroy() {
  9664. var me = this;
  9665. me.id = null;
  9666. me.center = null;
  9667. me.style = null;
  9668. me.length = null;
  9669. me.maxM = null;
  9670. me.minM = null;
  9671. me.type = null;
  9672. me.parts = null;
  9673. me.components.length = 0;
  9674. me.components = null;
  9675. me.componentTypes = null;
  9676. }
  9677. /**
  9678. * @function SuperMap.Route.fromJson
  9679. * @description 将 JSON 对象转换为 SuperMap.Route 对象。
  9680. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  9681. * @returns {SuperMap.Route} 转化后的 Route 对象。
  9682. */
  9683. static fromJson(jsonObject) {
  9684. if (!jsonObject) {
  9685. return;
  9686. }
  9687. var geoParts = jsonObject.parts || [],
  9688. geoPoints = jsonObject.points || [],
  9689. len = geoParts.length,
  9690. lineList = [];
  9691. if (len > 0) {
  9692. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  9693. for (var j = 0; j < geoParts[i]; j++) {
  9694. pointList.push(PointWithMeasure_PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  9695. }
  9696. pointIndex += geoParts[i];
  9697. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  9698. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  9699. lineList.push(new LinearRing_LinearRing(pointList));
  9700. } else {
  9701. lineList.push(new LineString_LineString(pointList));
  9702. }
  9703. pointList = [];
  9704. }
  9705. } else {
  9706. return null;
  9707. }
  9708. return new Route_Route(lineList, {
  9709. id: jsonObject.id,
  9710. center: jsonObject.center,
  9711. style: jsonObject.style,
  9712. length: jsonObject.length,
  9713. maxM: jsonObject.maxM,
  9714. minM: jsonObject.minM,
  9715. type: jsonObject.type,
  9716. parts: jsonObject.parts
  9717. });
  9718. }
  9719. }
  9720. SuperMap.Route = Route_Route;
  9721. // CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  9722. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9723. * This program are made available under the terms of the Apache License, Version 2.0
  9724. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9725. /**
  9726. * @class SuperMap.ServerGeometry
  9727. * @category iServer
  9728. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  9729. * @param {Object} options - 参数。
  9730. * @param {string} options.id - 服务端几何对象唯一标识符。
  9731. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  9732. * @param {Array.<SuperMap.Geometry.Point>} options.points - 组成几何对象的节点的坐标对数组。
  9733. * @param {SuperMap.GeometryType} options.type - 几何对象的类型。
  9734. * @param {SuperMap.ServerStyle} [options.style] - 服务端几何对象的风格。
  9735. */
  9736. class ServerGeometry_ServerGeometry {
  9737. constructor(options) {
  9738. /**
  9739. * @member {string} SuperMap.ServerGeometry.prototype.id
  9740. * @description 服务端几何对象唯一标识符。
  9741. */
  9742. this.id = 0;
  9743. /**
  9744. * @member {SuperMap.ServerStyle} [SuperMap.ServerGeometry.prototype.style]
  9745. * @description 服务端几何对象的风格(ServerStyle)。
  9746. */
  9747. this.style = null;
  9748. /**
  9749. * @member {Array.<number>} SuperMap.ServerGeometry.prototype.parts
  9750. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  9751. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  9752. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  9753. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  9754. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  9755. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  9756. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  9757. * 该字段的值就是这个简单对象节点的个数。
  9758. * 如果一个几何对象是由几个简单对象组合而成的,
  9759. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  9760. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  9761. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  9762. */
  9763. this.parts = null;
  9764. /**
  9765. * @member {Array.<SuperMap.Geometry.Point>} SuperMap.ServerGeometry.prototype.points
  9766. * @description 组成几何对象的节点的坐标对数组。<br>
  9767. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  9768. * 该字段存放了组成几何对象的点坐标的数组。
  9769. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  9770. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  9771. * 从而确定 Points 字段中坐标对的分配归属问题。
  9772. */
  9773. this.points = null;
  9774. /**
  9775. * @member {SuperMap.GeometryType} SuperMap.ServerGeometry.prototype.type
  9776. * @description 几何对象的类型(GeometryType)。
  9777. */
  9778. this.type = null;
  9779. /**
  9780. * @member {Object} SuperMap.ServerGeometry.prototype.prjCoordSys
  9781. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  9782. */
  9783. this.prjCoordSys = null;
  9784. if (options) {
  9785. Util_Util.extend(this, options);
  9786. }
  9787. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  9788. }
  9789. /**
  9790. * @function SuperMap.ServerGeometry.prototype.destroy
  9791. * @description 释放资源,将引用资源的属性置空。
  9792. */
  9793. destroy() {
  9794. var me = this;
  9795. me.id = null;
  9796. me.style = null;
  9797. me.parts = null;
  9798. me.partTopo = null;
  9799. me.points = null;
  9800. me.type = null;
  9801. me.prjCoordSys = null;
  9802. }
  9803. /**
  9804. * @function SuperMap.ServerGeometry.prototype.toGeometry
  9805. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  9806. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9807. */
  9808. toGeometry() {
  9809. var me = this,
  9810. geoType = me.type;
  9811. switch (geoType.toUpperCase()) {
  9812. case GeometryType.POINT:
  9813. return me.toGeoPoint();
  9814. case GeometryType.LINE:
  9815. return me.toGeoLine();
  9816. case GeometryType.LINEM:
  9817. return me.toGeoLinem();
  9818. case GeometryType.REGION:
  9819. return me.toGeoRegion();
  9820. case GeometryType.POINTEPS:
  9821. return me.toGeoPoint();
  9822. case GeometryType.LINEEPS:
  9823. return me.toGeoLineEPS();
  9824. case GeometryType.REGIONEPS:
  9825. return me.toGeoRegionEPS();
  9826. case GeometryType.GEOCOMPOUND:
  9827. return me.transformGeoCompound();
  9828. }
  9829. }
  9830. /**
  9831. * @function SuperMap.ServerGeometry.prototype.toGeoPoint
  9832. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  9833. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9834. */
  9835. toGeoPoint() {
  9836. var me = this,
  9837. geoParts = me.parts || [],
  9838. geoPoints = me.points || [],
  9839. len = geoParts.length;
  9840. if (len > 0) {
  9841. if (len === 1) {
  9842. return new Point_Point(geoPoints[0].x, geoPoints[0].y);
  9843. } else {
  9844. var pointList = [];
  9845. for (let i = 0; i < len; i++) {
  9846. pointList.push(new Point_Point(geoPoints[i].x, geoPoints[i].y));
  9847. }
  9848. return new MultiPoint_MultiPoint(pointList);
  9849. }
  9850. } else {
  9851. return null;
  9852. }
  9853. }
  9854. /**
  9855. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  9856. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  9857. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9858. */
  9859. toGeoLine() {
  9860. var me = this,
  9861. geoParts = me.parts || [],
  9862. geoPoints = me.points || [],
  9863. len = geoParts.length;
  9864. if (len > 0) {
  9865. if (len === 1) {
  9866. let pointList = [];
  9867. for (let i = 0; i < geoParts[0]; i++) {
  9868. pointList.push(new Point_Point(geoPoints[i].x, geoPoints[i].y));
  9869. }
  9870. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  9871. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  9872. return new LinearRing_LinearRing(pointList);
  9873. } else {
  9874. return new LineString_LineString(pointList);
  9875. }
  9876. } else {
  9877. let lineList = [];
  9878. for (let i = 0; i < len; i++) {
  9879. let pointList = [];
  9880. for (let j = 0; j < geoParts[i]; j++) {
  9881. pointList.push(new Point_Point(geoPoints[j].x, geoPoints[j].y));
  9882. }
  9883. lineList.push(new LineString_LineString(pointList));
  9884. geoPoints.splice(0, geoParts[i]);
  9885. }
  9886. return new MultiLineString_MultiLineString(lineList);
  9887. }
  9888. } else {
  9889. return null;
  9890. }
  9891. }
  9892. /**
  9893. * @function SuperMap.ServerGeometry.prototype.toGeoLineEPS
  9894. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  9895. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9896. */
  9897. toGeoLineEPS() {
  9898. var me = this,
  9899. geoParts = me.parts || [],
  9900. geoPoints = me.points || [],
  9901. i,
  9902. j,
  9903. pointList,
  9904. lineList,
  9905. lineEPS,
  9906. len = geoParts.length;
  9907. if (len > 0) {
  9908. if (len === 1) {
  9909. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  9910. pointList.push(new Point_Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  9911. }
  9912. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  9913. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  9914. lineEPS = LineString_LineString.createLineEPS(pointList);
  9915. return new LinearRing_LinearRing(lineEPS);
  9916. } else {
  9917. lineEPS = LineString_LineString.createLineEPS(pointList);
  9918. return new LineString_LineString(lineEPS);
  9919. }
  9920. } else {
  9921. for (i = 0, lineList = []; i < len; i++) {
  9922. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  9923. pointList.push(new Point_Point(geoPoints[j].x, geoPoints[j].y));
  9924. }
  9925. lineEPS = LineString_LineString.createLineEPS(pointList);
  9926. lineList.push(new LineString_LineString(lineEPS));
  9927. geoPoints.splice(0, geoParts[i]);
  9928. }
  9929. return new MultiLineString_MultiLineString(lineList);
  9930. }
  9931. } else {
  9932. return null;
  9933. }
  9934. }
  9935. /**
  9936. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  9937. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  9938. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9939. */
  9940. toGeoLinem() {
  9941. var me = this;
  9942. return Route_Route.fromJson(me);
  9943. }
  9944. /**
  9945. * @function SuperMap.ServerGeometry.prototype.toGeoRegion
  9946. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  9947. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9948. */
  9949. toGeoRegion() {
  9950. var me = this,
  9951. geoParts = me.parts || [],
  9952. geoTopo = me.partTopo || [],
  9953. geoPoints = me.points || [],
  9954. len = geoParts.length;
  9955. if (len <= 0) {
  9956. return null;
  9957. }
  9958. var polygonArray = [];
  9959. var pointList = [];
  9960. if (len == 1) {
  9961. for (let i = 0; i < geoPoints.length; i++) {
  9962. pointList.push(new Point_Point(geoPoints[i].x, geoPoints[i].y));
  9963. }
  9964. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(pointList)]));
  9965. return new MultiPolygon_MultiPolygon(polygonArray);
  9966. }
  9967. //处理复杂面
  9968. var CCWArray = [];
  9969. var areaArray = [];
  9970. var polygonArrayTemp = [];
  9971. var polygonBounds = [];
  9972. //polyon岛洞标识数组,初始都是岛。
  9973. var CCWIdent = [];
  9974. for (let i = 0, pointIndex = 0; i < len; i++) {
  9975. for (let j = 0; j < geoParts[i]; j++) {
  9976. pointList.push(new Point_Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  9977. }
  9978. pointIndex += geoParts[i];
  9979. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(pointList)]);
  9980. pointList = [];
  9981. polygonArrayTemp.push(polygon);
  9982. if (geoTopo.length === 0) {
  9983. polygonBounds.push(polygon.getBounds());
  9984. }
  9985. CCWIdent.push(1);
  9986. areaArray.push(polygon.getArea());
  9987. }
  9988. //根据面积排序
  9989. ServerGeometry_ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  9990. //iServer 9D新增字段
  9991. if (geoTopo.length === 0) {
  9992. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  9993. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  9994. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  9995. //目标polygon索引列表 -1标示没有被任何polygon包含,
  9996. var targetArray = [];
  9997. for (let i = 1; i < polygonArrayTemp.length; i++) {
  9998. for (let j = i - 1; j >= 0; j--) {
  9999. targetArray[i] = -1;
  10000. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  10001. CCWIdent[i] = CCWIdent[j] * -1;
  10002. if (CCWIdent[i] < 0) {
  10003. targetArray[i] = j;
  10004. }
  10005. break;
  10006. }
  10007. }
  10008. }
  10009. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10010. if (CCWIdent[i] > 0) {
  10011. polygonArray.push(polygonArrayTemp[i]);
  10012. } else {
  10013. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  10014. polygonArrayTemp[i].components
  10015. );
  10016. //占位
  10017. polygonArray.push('');
  10018. }
  10019. }
  10020. } else {
  10021. //根据面积排序
  10022. //ServerGeometry.bubbleSort(areaArray, polygonArrayTemp,geoTopo);
  10023. polygonArray = new Array();
  10024. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10025. if (geoTopo[i] && geoTopo[i] == -1) {
  10026. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  10027. } else {
  10028. if (CCWArray.length > 0 && polygonArray.length > 0) {
  10029. polygonArray[polygonArray.length - 1].components = polygonArray[
  10030. polygonArray.length - 1
  10031. ].components.concat(CCWArray);
  10032. CCWArray = [];
  10033. }
  10034. polygonArray.push(polygonArrayTemp[i]);
  10035. }
  10036. if (i == len - 1) {
  10037. var polyLength = polygonArray.length;
  10038. if (polyLength) {
  10039. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  10040. CCWArray
  10041. );
  10042. } else {
  10043. for (let k = 0, length = CCWArray.length; k < length; k++) {
  10044. polygonArray.push(new Polygon_Polygon(CCWArray));
  10045. }
  10046. }
  10047. }
  10048. }
  10049. }
  10050. return new MultiPolygon_MultiPolygon(polygonArray);
  10051. }
  10052. /**
  10053. * @function SuperMap.ServerGeometry.prototype.toGeoRegionEPS
  10054. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  10055. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10056. */
  10057. toGeoRegionEPS() {
  10058. var me = this,
  10059. geoParts = me.parts || [],
  10060. geoTopo = me.partTopo || [],
  10061. geoPoints = me.points || [],
  10062. len = geoParts.length;
  10063. if (len <= 0) {
  10064. return null;
  10065. }
  10066. var polygonArray = [];
  10067. var pointList = [];
  10068. var lineEPS;
  10069. if (len == 1) {
  10070. for (var i = 0; i < geoPoints.length; i++) {
  10071. pointList.push(new Point_Point(geoPoints[i].x, geoPoints[i].y));
  10072. }
  10073. lineEPS = LineString_LineString.createLineEPS(pointList);
  10074. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]));
  10075. return new MultiPolygon_MultiPolygon(polygonArray);
  10076. }
  10077. //处理复杂面
  10078. var CCWArray = [];
  10079. var areaArray = [];
  10080. var polygonArrayTemp = [];
  10081. var polygonBounds = [];
  10082. //polyon岛洞标识数组,初始都是岛。
  10083. var CCWIdent = [];
  10084. for (let i = 0, pointIndex = 0; i < len; i++) {
  10085. for (let j = 0; j < geoParts[i]; j++) {
  10086. pointList.push(new Point_Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  10087. }
  10088. pointIndex += geoParts[i];
  10089. lineEPS = LineString_LineString.createLineEPS(pointList);
  10090. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]);
  10091. pointList = [];
  10092. polygonArrayTemp.push(polygon);
  10093. if (geoTopo.length === 0) {
  10094. polygonBounds.push(polygon.getBounds());
  10095. }
  10096. CCWIdent.push(1);
  10097. areaArray.push(polygon.getArea());
  10098. }
  10099. //根据面积排序
  10100. ServerGeometry_ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  10101. //iServer 9D新增字段
  10102. if (geoTopo.length === 0) {
  10103. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  10104. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  10105. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  10106. //目标polygon索引列表 -1标示没有被任何polygon包含,
  10107. var targetArray = [];
  10108. for (let i = 1; i < polygonArrayTemp.length; i++) {
  10109. for (let j = i - 1; j >= 0; j--) {
  10110. targetArray[i] = -1;
  10111. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  10112. CCWIdent[i] = CCWIdent[j] * -1;
  10113. if (CCWIdent[i] < 0) {
  10114. targetArray[i] = j;
  10115. }
  10116. break;
  10117. }
  10118. }
  10119. }
  10120. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10121. if (CCWIdent[i] > 0) {
  10122. polygonArray.push(polygonArrayTemp[i]);
  10123. } else {
  10124. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  10125. polygonArrayTemp[i].components
  10126. );
  10127. //占位
  10128. polygonArray.push('');
  10129. }
  10130. }
  10131. } else {
  10132. //根据面积排序
  10133. polygonArray = new Array();
  10134. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10135. if (geoTopo[i] && geoTopo[i] == -1) {
  10136. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  10137. } else {
  10138. if (CCWArray.length > 0 && polygonArray.length > 0) {
  10139. polygonArray[polygonArray.length - 1].components = polygonArray[
  10140. polygonArray.length - 1
  10141. ].components.concat(CCWArray);
  10142. CCWArray = [];
  10143. }
  10144. polygonArray.push(polygonArrayTemp[i]);
  10145. }
  10146. if (i == len - 1) {
  10147. var polyLength = polygonArray.length;
  10148. if (polyLength) {
  10149. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  10150. CCWArray
  10151. );
  10152. } else {
  10153. for (let k = 0, length = CCWArray.length; k < length; k++) {
  10154. polygonArray.push(new Polygon_Polygon(CCWArray));
  10155. }
  10156. }
  10157. }
  10158. }
  10159. }
  10160. return new MultiPolygon_MultiPolygon(polygonArray);
  10161. }
  10162. transformGeoCompound() {
  10163. const me = this,
  10164. geoParts = me.geoParts || [],
  10165. len = geoParts.length;
  10166. if (len <= 0) {
  10167. return null;
  10168. }
  10169. const geometryList = [];
  10170. for (let index = 0; index < len; index++) {
  10171. const geometry = geoParts[index];
  10172. geometryList.push(new ServerGeometry_ServerGeometry(geometry).toGeometry());
  10173. }
  10174. return new Collection_Collection(geometryList);
  10175. }
  10176. /**
  10177. * @function SuperMap.ServerGeometry.prototype.fromJson
  10178. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  10179. * @param {Object} jsonObject - 要转换的 JSON 对象。
  10180. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  10181. */
  10182. static fromJson(jsonObject) {
  10183. if (!jsonObject) {
  10184. return;
  10185. }
  10186. return new ServerGeometry_ServerGeometry({
  10187. id: jsonObject.id,
  10188. style: ServerStyle_ServerStyle.fromJson(jsonObject.style),
  10189. parts: jsonObject.parts,
  10190. partTopo: jsonObject.partTopo,
  10191. points: jsonObject.points,
  10192. center: jsonObject.center,
  10193. length: jsonObject.length,
  10194. maxM: jsonObject.maxM,
  10195. minM: jsonObject.minM,
  10196. type: jsonObject.type
  10197. });
  10198. }
  10199. /**
  10200. * @function SuperMap.ServerGeometry.prototype.fromGeometry
  10201. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  10202. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  10203. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  10204. */
  10205. static fromGeometry(geometry) {
  10206. if (!geometry) {
  10207. return;
  10208. }
  10209. var id = 0,
  10210. parts = [],
  10211. points = [],
  10212. type = null,
  10213. icomponents = geometry.components,
  10214. className = geometry.CLASS_NAME,
  10215. prjCoordSys = { epsgCode: geometry.SRID };
  10216. if (!isNaN(geometry.id)) {
  10217. id = geometry.id;
  10218. }
  10219. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  10220. if (
  10221. className != 'SuperMap.Geometry.LinearRing' &&
  10222. className != 'SuperMap.Geometry.LineString' &&
  10223. (geometry instanceof MultiPoint_MultiPoint || geometry instanceof MultiLineString_MultiLineString)
  10224. ) {
  10225. let ilen = icomponents.length;
  10226. for (let i = 0; i < ilen; i++) {
  10227. let partPointsCount = icomponents[i].getVertices().length;
  10228. parts.push(partPointsCount);
  10229. for (let j = 0; j < partPointsCount; j++) {
  10230. points.push(new Point_Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  10231. }
  10232. }
  10233. //这里className不是多点就全部是算线
  10234. type = className == 'SuperMap.Geometry.MultiPoint' ? GeometryType.POINT : GeometryType.LINE;
  10235. } else if (geometry instanceof MultiPolygon_MultiPolygon) {
  10236. let ilen = icomponents.length;
  10237. for (let i = 0; i < ilen; i++) {
  10238. let polygon = icomponents[i],
  10239. linearRingOfPolygon = polygon.components,
  10240. linearRingOfPolygonLen = linearRingOfPolygon.length;
  10241. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  10242. let partPointsCount = linearRingOfPolygon[j].getVertices().length + 1;
  10243. parts.push(partPointsCount);
  10244. for (let k = 0; k < partPointsCount - 1; k++) {
  10245. points.push(
  10246. new Point_Point(
  10247. linearRingOfPolygon[j].getVertices()[k].x,
  10248. linearRingOfPolygon[j].getVertices()[k].y
  10249. )
  10250. );
  10251. }
  10252. points.push(
  10253. new Point_Point(linearRingOfPolygon[j].getVertices()[0].x, linearRingOfPolygon[j].getVertices()[0].y)
  10254. );
  10255. }
  10256. }
  10257. type = GeometryType.REGION;
  10258. } else if (geometry instanceof Polygon_Polygon) {
  10259. let ilen = icomponents.length;
  10260. for (let i = 0; i < ilen; i++) {
  10261. let partPointsCount = icomponents[i].getVertices().length + 1;
  10262. parts.push(partPointsCount);
  10263. for (let j = 0; j < partPointsCount - 1; j++) {
  10264. points.push(new Point_Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  10265. }
  10266. points.push(new Point_Point(icomponents[i].getVertices()[0].x, icomponents[i].getVertices()[0].y));
  10267. }
  10268. type = GeometryType.REGION;
  10269. } else {
  10270. let geometryVerticesCount = geometry.getVertices().length;
  10271. for (let j = 0; j < geometryVerticesCount; j++) {
  10272. points.push(new Point_Point(geometry.getVertices()[j].x, geometry.getVertices()[j].y));
  10273. }
  10274. if (geometry instanceof LinearRing_LinearRing) {
  10275. points.push(new Point_Point(geometry.getVertices()[0].x, geometry.getVertices()[0].y));
  10276. geometryVerticesCount++;
  10277. }
  10278. parts.push(geometryVerticesCount);
  10279. type = geometry instanceof Point_Point ? GeometryType.POINT : GeometryType.LINE;
  10280. }
  10281. return new ServerGeometry_ServerGeometry({
  10282. id: id,
  10283. style: null,
  10284. parts: parts,
  10285. points: points,
  10286. type: type,
  10287. prjCoordSys: prjCoordSys
  10288. });
  10289. }
  10290. /**
  10291. * @function SuperMap.ServerGeometry.prototype.IsClockWise
  10292. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  10293. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  10294. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  10295. */
  10296. static IsClockWise(points) {
  10297. var length = points.length;
  10298. if (length < 3) {
  10299. return 0.0;
  10300. }
  10301. var s = points[0].y * (points[length - 1].x - points[1].x);
  10302. points.push(points[0]);
  10303. for (var i = 1; i < length; i++) {
  10304. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  10305. }
  10306. return s * 0.5;
  10307. }
  10308. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  10309. for (var i = 0; i < areaArray.length; i++) {
  10310. for (var j = 0; j < areaArray.length; j++) {
  10311. if (areaArray[i] > areaArray[j]) {
  10312. var d = areaArray[j];
  10313. areaArray[j] = areaArray[i];
  10314. areaArray[i] = d;
  10315. var b = pointList[j];
  10316. pointList[j] = pointList[i];
  10317. pointList[i] = b;
  10318. if (geoTopo && geoTopo.length > 0) {
  10319. var c = geoTopo[j];
  10320. geoTopo[j] = geoTopo[i];
  10321. geoTopo[i] = c;
  10322. }
  10323. if (polygonBounds && polygonBounds.length > 0) {
  10324. var f = polygonBounds[j];
  10325. polygonBounds[j] = polygonBounds[i];
  10326. polygonBounds[i] = f;
  10327. }
  10328. }
  10329. }
  10330. }
  10331. }
  10332. }
  10333. SuperMap.ServerGeometry = ServerGeometry_ServerGeometry;
  10334. // CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  10335. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  10336. * This program are made available under the terms of the Apache License, Version 2.0
  10337. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10338. /**
  10339. * @class SuperMap.Format.GeoJSON
  10340. * @classdesc GeoJSON 的读和写。使用 {@link SuperMap.Format.GeoJSON} 构造器创建一个 GeoJSON 解析器。
  10341. * @category BaseTypes Format
  10342. * @param {Object} [options] - 参数。
  10343. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  10344. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  10345. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  10346. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  10347. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  10348. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  10349. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  10350. * @extends {SuperMap.Format.JSON}
  10351. */
  10352. class GeoJSON_GeoJSON extends JSON_JSONFormat {
  10353. constructor(options) {
  10354. super(options);
  10355. /**
  10356. * @member {boolean} [SuperMap.Format.GeoJSON.prototype.ignoreExtraDims=true]
  10357. * @description 忽略维度超过 2 的几何要素。
  10358. */
  10359. this.ignoreExtraDims = true;
  10360. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  10361. /**
  10362. * @member {Object} SuperMap.Format.GeoJSON.prototype.parseCoords
  10363. * @private
  10364. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  10365. */
  10366. this.parseCoords = {
  10367. /**
  10368. * @function SuperMap.Format.GeoJSON.parseCoords.point
  10369. * @description 将一组坐标转成一个 {@link SuperMap.Geometry} 对象。
  10370. * @param {Object} array - GeoJSON 片段中的一组坐标。
  10371. * @returns {SuperMap.Geometry} 一个几何对象。
  10372. */
  10373. "point": function (array) {
  10374. if (this.ignoreExtraDims === false &&
  10375. array.length != 2) {
  10376. throw "Only 2D points are supported: " + array;
  10377. }
  10378. return new Point_Point(array[0], array[1]);
  10379. },
  10380. /**
  10381. * @function SuperMap.Format.GeoJSON.parseCoords.multipoint
  10382. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  10383. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  10384. * @returns {SuperMap.Geometry} 一个几何对象。
  10385. */
  10386. "multipoint": function (array) {
  10387. var points = [];
  10388. var p = null;
  10389. for (var i = 0, len = array.length; i < len; ++i) {
  10390. try {
  10391. p = this.parseCoords["point"].apply(this, [array[i]]);
  10392. } catch (err) {
  10393. throw err;
  10394. }
  10395. points.push(p);
  10396. }
  10397. return new MultiPoint_MultiPoint(points);
  10398. },
  10399. /**
  10400. * @function SuperMap.Format.GeoJSON.parseCoords.linestring
  10401. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  10402. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  10403. * @returns {SuperMap.Geometry} 一个几何对象。
  10404. */
  10405. "linestring": function (array) {
  10406. var points = [];
  10407. var p = null;
  10408. for (var i = 0, len = array.length; i < len; ++i) {
  10409. try {
  10410. p = this.parseCoords["point"].apply(this, [array[i]]);
  10411. } catch (err) {
  10412. throw err;
  10413. }
  10414. points.push(p);
  10415. }
  10416. return new LineString_LineString(points);
  10417. },
  10418. /**
  10419. * @function SuperMap.Format.GeoJSON.parseCoords.multilinestring
  10420. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  10421. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  10422. * @returns {SuperMap.Geometry} 一个几何对象。
  10423. */
  10424. "multilinestring": function (array) {
  10425. var lines = [];
  10426. var l = null;
  10427. for (var i = 0, len = array.length; i < len; ++i) {
  10428. try {
  10429. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  10430. } catch (err) {
  10431. throw err;
  10432. }
  10433. lines.push(l);
  10434. }
  10435. return new MultiLineString_MultiLineString(lines);
  10436. },
  10437. /**
  10438. * @function SuperMap.Format.GeoJSON.parseCoords.polygon
  10439. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  10440. * @returns {SuperMap.Geometry} 一个几何对象。
  10441. */
  10442. "polygon": function (array) {
  10443. var rings = [];
  10444. var r, l;
  10445. for (var i = 0, len = array.length; i < len; ++i) {
  10446. try {
  10447. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  10448. } catch (err) {
  10449. throw err;
  10450. }
  10451. r = new LinearRing_LinearRing(l.components);
  10452. rings.push(r);
  10453. }
  10454. return new Polygon_Polygon(rings);
  10455. },
  10456. /**
  10457. * @function SuperMap.Format.GeoJSON.parseCoords.multipolygon
  10458. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  10459. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  10460. * @returns {SuperMap.Geometry} 一个几何对象。
  10461. */
  10462. "multipolygon": function (array) {
  10463. var polys = [];
  10464. var p = null;
  10465. for (var i = 0, len = array.length; i < len; ++i) {
  10466. try {
  10467. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  10468. } catch (err) {
  10469. throw err;
  10470. }
  10471. polys.push(p);
  10472. }
  10473. return new MultiPolygon_MultiPolygon(polys);
  10474. },
  10475. /**
  10476. * @function SuperMap.Format.GeoJSON.parseCoords.box
  10477. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  10478. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  10479. * @returns {SuperMap.Geometry} 一个几何对象。
  10480. */
  10481. "box": function (array) {
  10482. if (array.length != 2) {
  10483. throw "GeoJSON box coordinates must have 2 elements";
  10484. }
  10485. return new Polygon_Polygon([
  10486. new LinearRing_LinearRing([
  10487. new Point_Point(array[0][0], array[0][1]),
  10488. new Point_Point(array[1][0], array[0][1]),
  10489. new Point_Point(array[1][0], array[1][1]),
  10490. new Point_Point(array[0][0], array[1][1]),
  10491. new Point_Point(array[0][0], array[0][1])
  10492. ])
  10493. ]);
  10494. }
  10495. };
  10496. /**
  10497. * @member {Object} SuperMap.Format.GeoJSON.prototype.extract
  10498. * @private
  10499. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  10500. */
  10501. this.extract = {
  10502. /**
  10503. * @function SuperMap.Format.GeoJSON.extract.feature
  10504. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  10505. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  10506. * @returns {Object} 一个表示点的对象。
  10507. */
  10508. 'feature': function (feature) {
  10509. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  10510. var json = {
  10511. "type": "Feature",
  10512. "properties": this.createAttributes(feature),
  10513. "geometry": geom
  10514. };
  10515. if (feature.geometry && feature.geometry.type === 'TEXT') {
  10516. json.properties.texts = feature.geometry.texts;
  10517. json.properties.textStyle = feature.geometry.textStyle;
  10518. }
  10519. if (feature.fid) {
  10520. json.id = feature.fid;
  10521. }
  10522. if (feature.ID) {
  10523. json.id = feature.ID;
  10524. }
  10525. return json;
  10526. },
  10527. /**
  10528. * @function SuperMap.Format.GeoJSON.extract.geometry
  10529. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  10530. * @param {Object} geometry - iServer 几何对象。
  10531. * @returns {Object} 一个表示几何体的对象。
  10532. */
  10533. 'geometry': function (geometry) {
  10534. if (geometry == null) {
  10535. return null;
  10536. }
  10537. if (!geometry.parts && geometry.points) {
  10538. geometry.parts = [geometry.points.length];
  10539. }
  10540. var geo = geometry.hasOwnProperty('geometryType')
  10541. ? geometry
  10542. : new ServerGeometry_ServerGeometry(geometry).toGeometry() || geometry;
  10543. var geometryType = geo.geometryType || geo.type;
  10544. var data;
  10545. if (geometryType === "LinearRing") {
  10546. geometryType = "LineString";
  10547. }
  10548. if (geometryType === "LINEM") {
  10549. geometryType = "MultiLineString";
  10550. }
  10551. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  10552. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  10553. var json;
  10554. if (geometryType === "Collection") {
  10555. json = {
  10556. "type": "GeometryCollection",
  10557. "geometries": data
  10558. };
  10559. } else {
  10560. json = {
  10561. "type": geometryType,
  10562. "coordinates": data
  10563. };
  10564. }
  10565. return json;
  10566. },
  10567. /**
  10568. * @function SuperMap.Format.GeoJSON.extract.point
  10569. * @description 从一个点对象中返回一个坐标组。
  10570. * @param {SuperMap.Geometry.Point} point - 一个点对象。
  10571. * @returns {Array} 一个表示一个点的坐标组。
  10572. */
  10573. 'point': function (point) {
  10574. var p = [point.x, point.y];
  10575. for (var name in point) {
  10576. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  10577. p.push(point[name]);
  10578. }
  10579. }
  10580. return p;
  10581. },
  10582. /**
  10583. * @function SuperMap.Format.GeoJSON.extract.point
  10584. * @description 从一个文本对象中返回一个坐标组。
  10585. * @param {Object} geo - 一个文本对象。
  10586. * @returns {Array} 一个表示一个点的坐标组。
  10587. */
  10588. 'text': function (geo) {
  10589. return [geo.points[0].x, geo.points[0].y];
  10590. },
  10591. /**
  10592. * @function SuperMap.Format.GeoJSON.extract.multipoint
  10593. * @description 从一个多点对象中返一个坐标组数组。
  10594. * @param {SuperMap.Geometry.MultiPoint} multipoint - 多点对象。
  10595. * @returns {Array} 一个表示多点的坐标组数组。
  10596. */
  10597. 'multipoint': function (multipoint) {
  10598. var array = [];
  10599. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  10600. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  10601. }
  10602. return array;
  10603. },
  10604. /**
  10605. * @function SuperMap.Format.GeoJSON.extract.linestring
  10606. * @description 从一个线对象中返回一个坐标组数组。
  10607. * @param {SuperMap.Geometry.Linestring} linestring - 线对象。
  10608. * @returns {Array} 一个表示线对象的坐标组数组。
  10609. */
  10610. 'linestring': function (linestring) {
  10611. var array = [];
  10612. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  10613. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  10614. }
  10615. return array;
  10616. },
  10617. /**
  10618. * @function SuperMap.Format.GeoJSON.extract.multilinestring
  10619. * @description 从一个多线对象中返回一个线数组。
  10620. * @param {SuperMap.Geometry.MultiLinestring} multilinestring - 多线对象。
  10621. *
  10622. * @returns {Array} 一个表示多线的线数组。
  10623. */
  10624. 'multilinestring': function (multilinestring) {
  10625. var array = [];
  10626. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  10627. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  10628. }
  10629. return array;
  10630. },
  10631. /**
  10632. * @function SuperMap.Format.GeoJSON.extract.polygon
  10633. * @description 从一个面对象中返回一组线环。
  10634. * @param {SuperMap.Geometry.Polygon} polygon - 面对象。
  10635. * @returns {Array} 一组表示面的线环。
  10636. */
  10637. 'polygon': function (polygon) {
  10638. var array = [];
  10639. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  10640. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  10641. }
  10642. return array;
  10643. },
  10644. /**
  10645. * @function SuperMap.Format.GeoJSON.extract.multipolygon
  10646. * @description 从一个多面对象中返回一组面。
  10647. * @param {SuperMap.Geometry.MultiPolygon} multipolygon - 多面对象。
  10648. * @returns {Array} 一组表示多面的面。
  10649. */
  10650. 'multipolygon': function (multipolygon) {
  10651. var array = [];
  10652. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  10653. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  10654. }
  10655. return array;
  10656. },
  10657. /**
  10658. * @function SuperMap.Format.GeoJSON.extract.collection
  10659. * @description 从一个几何要素集合中一组几何要素数组。
  10660. * @param {SuperMap.Geometry.Collection} collection - 几何要素集合。
  10661. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  10662. */
  10663. 'collection': function (collection) {
  10664. var len = collection.components.length;
  10665. var array = new Array(len);
  10666. for (var i = 0; i < len; ++i) {
  10667. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  10668. }
  10669. return array;
  10670. }
  10671. };
  10672. }
  10673. /**
  10674. * @function SuperMap.Format.GeoJSON.prototype.read
  10675. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  10676. * @param {GeoJSONObject} json - GeoJSON 对象。
  10677. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  10678. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  10679. * @returns {Object} 返回值依赖于 type 参数的值。
  10680. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link SuperMap.Feature.Vector} 数组。
  10681. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link SuperMap.Feature.Geometry}。
  10682. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link SuperMap.Feature.Vector}。
  10683. */
  10684. read(json, type, filter) {
  10685. type = (type) ? type : "FeatureCollection";
  10686. var results = null;
  10687. var obj = null;
  10688. if (typeof json == "string") {
  10689. obj = super.read(json, filter);
  10690. } else {
  10691. obj = json;
  10692. }
  10693. if (!obj) {
  10694. //SuperMap.Console.error("Bad JSON: " + json);
  10695. } else if (typeof (obj.type) != "string") {
  10696. //SuperMap.Console.error("Bad GeoJSON - no type: " + json);
  10697. } else if (this.isValidType(obj, type)) {
  10698. switch (type) {
  10699. case "Geometry":
  10700. try {
  10701. results = this.parseGeometry(obj);
  10702. } catch (err) {
  10703. //SuperMap.Console.error(err);
  10704. }
  10705. break;
  10706. case "Feature":
  10707. try {
  10708. results = this.parseFeature(obj);
  10709. results.type = "Feature";
  10710. } catch (err) {
  10711. //SuperMap.Console.error(err);
  10712. }
  10713. break;
  10714. case "FeatureCollection":
  10715. // for type FeatureCollection, we allow input to be any type
  10716. results = [];
  10717. switch (obj.type) {
  10718. case "Feature":
  10719. try {
  10720. results.push(this.parseFeature(obj));
  10721. } catch (err) {
  10722. results = null;
  10723. //SuperMap.Console.error(err);
  10724. }
  10725. break;
  10726. case "FeatureCollection":
  10727. for (var i = 0, len = obj.features.length; i < len; ++i) {
  10728. try {
  10729. results.push(this.parseFeature(obj.features[i]));
  10730. } catch (err) {
  10731. results = null;
  10732. // SuperMap.Console.error(err);
  10733. }
  10734. }
  10735. break;
  10736. default:
  10737. try {
  10738. var geom = this.parseGeometry(obj);
  10739. results.push(new Vector_Vector(geom));
  10740. } catch (err) {
  10741. results = null;
  10742. //SuperMap.Console.error(err);
  10743. }
  10744. }
  10745. break;
  10746. default:
  10747. break;
  10748. }
  10749. }
  10750. return results;
  10751. }
  10752. /**
  10753. * @function SuperMap.Format.GeoJSON.prototype.write
  10754. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  10755. * @param {Object} obj - iServer Geometry JSON 对象。
  10756. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  10757. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  10758. */
  10759. write(obj, pretty) {
  10760. return super.write(this.toGeoJSON(obj), pretty);
  10761. }
  10762. /**
  10763. * @function SuperMap.Format.GeoJSON.prototype.fromGeoJSON
  10764. * @version 9.1.1
  10765. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  10766. * @param {GeoJSONObject} json - GeoJSON 对象。
  10767. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  10768. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  10769. * @returns {Object} iServer Feature JSON。
  10770. */
  10771. fromGeoJSON(json, type, filter) {
  10772. let feature = this.read(json, type, filter);
  10773. if (!Util_Util.isArray(feature)) {
  10774. return this._toiSevrerFeature(feature);
  10775. }
  10776. return feature.map((element) => {
  10777. return this._toiSevrerFeature(element);
  10778. })
  10779. }
  10780. /**
  10781. * @function SuperMap.Format.GeoJSON.prototype.toGeoJSON
  10782. * @version 9.1.1
  10783. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  10784. * @param {Object} obj - iServer Feature JSON。
  10785. * @returns {GeoJSONObject} GeoJSON 对象。
  10786. */
  10787. toGeoJSON(obj) {
  10788. var geojson = {
  10789. "type": null
  10790. };
  10791. if (Util_Util.isArray(obj)) {
  10792. geojson.type = "FeatureCollection";
  10793. var numFeatures = obj.length;
  10794. geojson.features = new Array(numFeatures);
  10795. for (var i = 0; i < numFeatures; ++i) {
  10796. var element = obj[i];
  10797. if (isGeometry(element)) {
  10798. let feature = {};
  10799. feature.geometry = element;
  10800. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  10801. } else {
  10802. geojson.features[i] = this.extract.feature.apply(this, [element]);
  10803. }
  10804. }
  10805. } else if (isGeometry(obj)) {
  10806. let feature = {};
  10807. feature.geometry = obj;
  10808. geojson = this.extract.feature.apply(this, [feature]);
  10809. } else {
  10810. geojson = this.extract.feature.apply(this, [obj]);
  10811. }
  10812. function isGeometry(input) {
  10813. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  10814. }
  10815. return geojson;
  10816. }
  10817. /**
  10818. * @function SuperMap.Format.GeoJSON.prototype.isValidType
  10819. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  10820. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  10821. * @private
  10822. */
  10823. isValidType(obj, type) {
  10824. var valid = false;
  10825. switch (type) {
  10826. case "Geometry":
  10827. if (Util_Util.indexOf(
  10828. ["Point", "MultiPoint", "LineString", "MultiLineString",
  10829. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  10830. ],
  10831. obj.type) == -1) {
  10832. // unsupported geometry type
  10833. //SuperMap.Console.error("Unsupported geometry type: " +
  10834. // obj.type);
  10835. } else {
  10836. valid = true;
  10837. }
  10838. break;
  10839. case "FeatureCollection":
  10840. // allow for any type to be converted to a feature collection
  10841. valid = true;
  10842. break;
  10843. default:
  10844. // for Feature types must match
  10845. if (obj.type == type) {
  10846. valid = true;
  10847. } else {
  10848. //SuperMap.Console.error("Cannot convert types from " +
  10849. //obj.type + " to " + type);
  10850. }
  10851. }
  10852. return valid;
  10853. }
  10854. /**
  10855. * @function SuperMap.Format.GeoJSON.prototype.parseFeature
  10856. * @description 将一个 GeoJSON 中的 feature 转化成 {@link SuperMap.Feature.Vector}> 对象。
  10857. * @private
  10858. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  10859. * @returns {SuperMap.Feature.Vector} 一个要素。
  10860. */
  10861. parseFeature(obj) {
  10862. var feature, geometry, attributes, bbox;
  10863. attributes = (obj.properties) ? obj.properties : {};
  10864. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  10865. try {
  10866. geometry = this.parseGeometry(obj.geometry);
  10867. } catch (err) {
  10868. // deal with bad geometries
  10869. throw err;
  10870. }
  10871. feature = new Vector_Vector(geometry, attributes);
  10872. if (bbox) {
  10873. feature.bounds = Bounds_Bounds.fromArray(bbox);
  10874. }
  10875. if (obj.id) {
  10876. feature.fid = obj.id;
  10877. }
  10878. return feature;
  10879. }
  10880. /**
  10881. * @function SuperMap.Format.GeoJSON.prototype.parseGeometry
  10882. * @description 将一个 GeoJSON 中的几何要素转化成 {@link SuperMap.Geometry} 对象。
  10883. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  10884. * @returns {SuperMap.Geometry} 一个几何要素。
  10885. * @private
  10886. */
  10887. parseGeometry(obj) {
  10888. if (obj == null) {
  10889. return null;
  10890. }
  10891. var geometry;
  10892. if (obj.type == "GeometryCollection") {
  10893. if (!(Util_Util.isArray(obj.geometries))) {
  10894. throw "GeometryCollection must have geometries array: " + obj;
  10895. }
  10896. var numGeom = obj.geometries.length;
  10897. var components = new Array(numGeom);
  10898. for (var i = 0; i < numGeom; ++i) {
  10899. components[i] = this.parseGeometry.apply(
  10900. this, [obj.geometries[i]]
  10901. );
  10902. }
  10903. geometry = new Collection_Collection(components);
  10904. } else {
  10905. if (!(Util_Util.isArray(obj.coordinates))) {
  10906. throw "Geometry must have coordinates array: " + obj;
  10907. }
  10908. if (!this.parseCoords[obj.type.toLowerCase()]) {
  10909. throw "Unsupported geometry type: " + obj.type;
  10910. }
  10911. try {
  10912. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  10913. this, [obj.coordinates]
  10914. );
  10915. } catch (err) {
  10916. // deal with bad coordinates
  10917. throw err;
  10918. }
  10919. }
  10920. return geometry;
  10921. }
  10922. /**
  10923. * @function SuperMap.Format.GeoJSON.prototype.createCRSObject
  10924. * @description 从一个要素对象中创建一个坐标参考系对象。
  10925. * @param {SuperMap.Feature.Vector} object - 要素对象。
  10926. * @private
  10927. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  10928. */
  10929. createCRSObject(object) {
  10930. var proj = object.layer.projection.toString();
  10931. var crs = {};
  10932. if (proj.match(/epsg:/i)) {
  10933. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  10934. if (code == 4326) {
  10935. crs = {
  10936. "type": "name",
  10937. "properties": {
  10938. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  10939. }
  10940. };
  10941. } else {
  10942. crs = {
  10943. "type": "name",
  10944. "properties": {
  10945. "name": "EPSG:" + code
  10946. }
  10947. };
  10948. }
  10949. }
  10950. return crs;
  10951. }
  10952. _toiSevrerFeature(feature) {
  10953. const attributes = feature.attributes;
  10954. const attrNames = [];
  10955. const attrValues = [];
  10956. for (var attr in attributes) {
  10957. attrNames.push(attr);
  10958. attrValues.push(attributes[attr]);
  10959. }
  10960. const newFeature = {
  10961. fieldNames: attrNames,
  10962. fieldValues: attrValues,
  10963. geometry: ServerGeometry_ServerGeometry.fromGeometry(feature.geometry)
  10964. };
  10965. newFeature.geometry.id = feature.fid;
  10966. return newFeature;
  10967. }
  10968. createAttributes(feature) {
  10969. if (!feature) {
  10970. return null;
  10971. }
  10972. var attr = {};
  10973. processFieldsAttributes(feature, attr);
  10974. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  10975. for (var key in feature) {
  10976. if (exceptKeys.indexOf(key) > -1) {
  10977. continue;
  10978. }
  10979. attr[key] = feature[key];
  10980. }
  10981. function processFieldsAttributes(feature, attributes) {
  10982. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  10983. return;
  10984. }
  10985. var names = feature.fieldNames,
  10986. values = feature.fieldValues;
  10987. for (var i in names) {
  10988. attributes[names[i]] = values[i];
  10989. }
  10990. }
  10991. return attr;
  10992. }
  10993. }
  10994. SuperMap.Format.GeoJSON = GeoJSON_GeoJSON;
  10995. // CONCATENATED MODULE: ./src/common/format/WKT.js
  10996. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  10997. * This program are made available under the terms of the Apache License, Version 2.0
  10998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10999. /**
  11000. * @class SuperMap.Format.WKT
  11001. * @classdesc 用于读写常见文本的类。通过 {@link SuperMap.Format.WKT} 构造器来创建一个新的实例。
  11002. * @category BaseTypes Format
  11003. * @extends {SuperMap.Format}
  11004. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link SuperMap.Format}。
  11005. */
  11006. class WKT_WKT extends Format_Format {
  11007. constructor(options) {
  11008. super(options);
  11009. this.regExes = {
  11010. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  11011. 'spaces': /\s+/,
  11012. 'parenComma': /\)\s*,\s*\(/,
  11013. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  11014. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  11015. };
  11016. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  11017. * @private
  11018. * @description Object with properties corresponding to the geometry types.
  11019. * Property values are functions that do the actual data extraction.
  11020. */
  11021. this.extract = {
  11022. /**
  11023. * @description Return a space delimited string of point coordinates.
  11024. * @param {SuperMap.Geometry.Point} point
  11025. * @returns {string} A string of coordinates representing the point
  11026. */
  11027. 'point': function (point) {
  11028. return point.x + ' ' + point.y;
  11029. },
  11030. /**
  11031. * @description Return a comma delimited string of point coordinates from a multipoint.
  11032. * @param {SuperMap.Geometry.MultiPoint} multipoint
  11033. * @returns {string} A string of point coordinate strings representing
  11034. * the multipoint
  11035. */
  11036. 'multipoint'(multipoint) {
  11037. var array = [];
  11038. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  11039. array.push('(' +
  11040. this.extract.point.apply(this, [multipoint.components[i]]) +
  11041. ')');
  11042. }
  11043. return array.join(',');
  11044. },
  11045. /**
  11046. * @description Return a comma delimited string of point coordinates from a line.
  11047. * @param {SuperMap.Geometry.LineString} linestring
  11048. * @returns {string} A string of point coordinate strings representing
  11049. * the linestring
  11050. */
  11051. 'linestring'(linestring) {
  11052. var array = [];
  11053. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  11054. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  11055. }
  11056. return array.join(',');
  11057. },
  11058. /**
  11059. * @description Return a comma delimited string of linestring strings from a multilinestring.
  11060. * @param {SuperMap.Geometry.MultiLineString} multilinestring
  11061. * @returns {string} A string of of linestring strings representing
  11062. * the multilinestring
  11063. */
  11064. 'multilinestring'(multilinestring) {
  11065. var array = [];
  11066. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  11067. array.push('(' +
  11068. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  11069. ')');
  11070. }
  11071. return array.join(',');
  11072. },
  11073. /**
  11074. * @description Return a comma delimited string of linear ring arrays from a polygon.
  11075. * @param {SuperMap.Geometry.Polygon} polygon
  11076. * @returns {string} An array of linear ring arrays representing the polygon
  11077. */
  11078. 'polygon'(polygon) {
  11079. var array = [];
  11080. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  11081. array.push('(' +
  11082. this.extract.linestring.apply(this, [polygon.components[i]]) +
  11083. ')');
  11084. }
  11085. return array.join(',');
  11086. },
  11087. /**
  11088. * @description Return an array of polygon arrays from a multipolygon.
  11089. * @param {SuperMap.Geometry.MultiPolygon} multipolygon
  11090. * @returns {string} An array of polygon arrays representing
  11091. * the multipolygon
  11092. */
  11093. 'multipolygon'(multipolygon) {
  11094. var array = [];
  11095. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  11096. array.push('(' +
  11097. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  11098. ')');
  11099. }
  11100. return array.join(',');
  11101. },
  11102. /**
  11103. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <SuperMap.Geometry.Collection>
  11104. * @param {SuperMap.Geometry.Collection} collection
  11105. * @returns {string} internal WKT representation of the collection
  11106. */
  11107. 'collection'(collection) {
  11108. var array = [];
  11109. for (var i = 0, len = collection.components.length; i < len; ++i) {
  11110. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  11111. }
  11112. return array.join(',');
  11113. }
  11114. };
  11115. /**
  11116. * @private
  11117. * @description Object with properties corresponding to the geometry types.
  11118. * Property values are functions that do the actual parsing.
  11119. */
  11120. this.parse = {
  11121. /**
  11122. * @private
  11123. * @description Return point feature given a point WKT fragment.
  11124. * @param {string} str A WKT fragment representing the point
  11125. * @returns {SuperMap.Feature.Vector} A point feature
  11126. *
  11127. */
  11128. 'point': function (str) {
  11129. var coords = StringExt.trim(str).split(this.regExes.spaces);
  11130. return new Vector_Vector(new Point_Point(coords[0], coords[1])
  11131. );
  11132. },
  11133. /**
  11134. * @description Return a multipoint feature given a multipoint WKT fragment.
  11135. * @param {string} A WKT fragment representing the multipoint
  11136. * @returns {SuperMap.Feature.Vector} A multipoint feature
  11137. * @private
  11138. */
  11139. 'multipoint': function (str) {
  11140. var point;
  11141. var points = StringExt.trim(str).split(',');
  11142. var components = [];
  11143. for (var i = 0, len = points.length; i < len; ++i) {
  11144. point = points[i].replace(this.regExes.trimParens, '$1');
  11145. components.push(this.parse.point.apply(this, [point]).geometry);
  11146. }
  11147. return new Vector_Vector(
  11148. new MultiPoint_MultiPoint(components)
  11149. );
  11150. },
  11151. /**
  11152. * @description Return a linestring feature given a linestring WKT fragment.
  11153. * @param {string} A WKT fragment representing the linestring
  11154. * @returns {SuperMap.Feature.Vector} A linestring feature
  11155. * @private
  11156. */
  11157. 'linestring': function (str) {
  11158. var points = StringExt.trim(str).split(',');
  11159. var components = [];
  11160. for (var i = 0, len = points.length; i < len; ++i) {
  11161. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  11162. }
  11163. return new Vector_Vector(
  11164. new LineString_LineString(components)
  11165. );
  11166. },
  11167. /**
  11168. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  11169. * @param {string} A WKT fragment representing the multilinestring
  11170. * @returns {SuperMap.Feature.Vector} A multilinestring feature
  11171. * @private
  11172. */
  11173. 'multilinestring': function (str) {
  11174. var line;
  11175. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  11176. var components = [];
  11177. for (var i = 0, len = lines.length; i < len; ++i) {
  11178. line = lines[i].replace(this.regExes.trimParens, '$1');
  11179. components.push(this.parse.linestring.apply(this, [line]).geometry);
  11180. }
  11181. return new Vector_Vector(
  11182. new MultiLineString_MultiLineString(components)
  11183. );
  11184. },
  11185. /**
  11186. * @description Return a polygon feature given a polygon WKT fragment.
  11187. * @param {string} A WKT fragment representing the polygon
  11188. * @returns {SuperMap.Feature.Vector} A polygon feature
  11189. * @private
  11190. */
  11191. 'polygon': function (str) {
  11192. var ring, linestring, linearring;
  11193. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  11194. var components = [];
  11195. for (var i = 0, len = rings.length; i < len; ++i) {
  11196. ring = rings[i].replace(this.regExes.trimParens, '$1');
  11197. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  11198. linearring = new LinearRing_LinearRing(linestring.components);
  11199. components.push(linearring);
  11200. }
  11201. return new Vector_Vector(
  11202. new Polygon_Polygon(components)
  11203. );
  11204. },
  11205. /**
  11206. * @private
  11207. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  11208. * @param {string} A WKT fragment representing the multipolygon
  11209. * @returns {SuperMap.Feature.Vector} A multipolygon feature
  11210. *
  11211. */
  11212. 'multipolygon': function (str) {
  11213. var polygon;
  11214. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  11215. var components = [];
  11216. for (var i = 0, len = polygons.length; i < len; ++i) {
  11217. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  11218. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  11219. }
  11220. return new Vector_Vector(
  11221. new MultiPolygon_MultiPolygon(components)
  11222. );
  11223. },
  11224. /**
  11225. * @description Return an array of features given a geometrycollection WKT fragment.
  11226. * @param {string} A WKT fragment representing the geometrycollection
  11227. * @returns {Array} An array of SuperMap.Feature.Vector
  11228. * @private
  11229. */
  11230. 'geometrycollection': function (str) {
  11231. // separate components of the collection with |
  11232. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  11233. var wktArray = StringExt.trim(str).split('|');
  11234. var components = [];
  11235. for (var i = 0, len = wktArray.length; i < len; ++i) {
  11236. components.push(this.read(wktArray[i]));
  11237. }
  11238. return components;
  11239. }
  11240. };
  11241. }
  11242. /**
  11243. * @function SuperMap.Format.WKT.prototype.read
  11244. * @description Deserialize a WKT string and return a vector feature or an
  11245. * array of vector features. Supports WKT for POINT, MULTIPOINT,
  11246. * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
  11247. * GEOMETRYCOLLECTION.
  11248. * @param {string} wkt - A WKT string
  11249. * @returns {SuperMap.Feature.Vector|Array} A feature or array of features for
  11250. * GEOMETRYCOLLECTION WKT.
  11251. */
  11252. read(wkt) {
  11253. var features, type, str;
  11254. wkt = wkt.replace(/[\n\r]/g, " ");
  11255. var matches = this.regExes.typeStr.exec(wkt);
  11256. if (matches) {
  11257. type = matches[1].toLowerCase();
  11258. str = matches[2];
  11259. if (this.parse[type]) {
  11260. features = this.parse[type].apply(this, [str]);
  11261. }
  11262. }
  11263. return features;
  11264. }
  11265. /**
  11266. * @function SuperMap.Format.WKT.prototype.write
  11267. * @description Serialize a feature or array of features into a WKT string.
  11268. * @param {(SuperMap.Feature.Vector|Array)} features - A feature or array of features
  11269. * @returns {string} The WKT string representation of the input geometries
  11270. */
  11271. write(features) {
  11272. var collection, geometry, isCollection;
  11273. if (features.constructor === Array) {
  11274. collection = features;
  11275. isCollection = true;
  11276. } else {
  11277. collection = [features];
  11278. isCollection = false;
  11279. }
  11280. var pieces = [];
  11281. if (isCollection) {
  11282. pieces.push('GEOMETRYCOLLECTION(');
  11283. }
  11284. for (var i = 0, len = collection.length; i < len; ++i) {
  11285. if (isCollection && i > 0) {
  11286. pieces.push(',');
  11287. }
  11288. geometry = collection[i].geometry;
  11289. pieces.push(this.extractGeometry(geometry));
  11290. }
  11291. if (isCollection) {
  11292. pieces.push(')');
  11293. }
  11294. return pieces.join('');
  11295. }
  11296. /**
  11297. * @function SuperMap.Format.WKT.prototype.extractGeometry
  11298. * @description Entry point to construct the WKT for a single Geometry object.
  11299. * @param {SuperMap.Geometry} geometry
  11300. * @returns {string} A WKT string of representing the geometry
  11301. */
  11302. extractGeometry(geometry) {
  11303. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  11304. if (!this.extract[type]) {
  11305. return null;
  11306. }
  11307. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  11308. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  11309. return data;
  11310. }
  11311. }
  11312. SuperMap.Format.WKT = WKT_WKT;
  11313. // CONCATENATED MODULE: ./src/common/format/index.js
  11314. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  11315. * This program are made available under the terms of the Apache License, Version 2.0
  11316. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11317. // CONCATENATED MODULE: ./src/common/control/img/Logo.js
  11318. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  11319. * This program are made available under the terms of the Apache License, Version 2.0
  11320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11321. var LogoBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF4AAAAdCAYAAAAjHtusAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozYWZlOGIwMi01MWE3LTRiZjYtYWVkYS05MGQ2ZTQ4YjZiMmUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODg0NkFBQUE3RjEzMTFFNzhFRjJFQkY4RjcxQjc1NjIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODg0NkFBQTk3RjEzMTFFNzhFRjJFQkY4RjcxQjc1NjIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4MWI3NzdhNC1lZmEyLTQ1MzUtOGQzNi03MmRjNDkyODMzN2UiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpjYTYzODVjMi1jNDQ1LTExN2EtYTc0ZC1lM2I5MzJlMGE4Y2QiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5q1HM0AAAF/ElEQVR42tSabYhUVRjHZ7W01C1uaCRW4F3oi9SXCUnwQ9gsGUFvOEtQH1bLu5VS9sbYh5KicjYt29qiGQwVg2xWWKgocob91AvC+CWsoJqB3qHMSdTMpZyeU/+Df07n3pk7997Z6cBv99z7nHvOvf/z/pxJNZvNVI/jCKXmv6EquAmVkxPSlvtp2GItr0/96fFQForChJAWDiVYTkMYMu4XBFcYjLOwWS3sNwmn8NGzZ0h4Flv/zwIdchAnh/slCGmmKUNIBzYPaXOUr0vPuEjD71JAPh7l61embzinhV3V8nnCGmGT8LwlzSL8/yUh4Tfjo9T/CgnCIYNKycA2Qq21AcHU/VHE80Idoo3Qs0W6p0UtUnkZvEMDeVcCyqxEafF7hL8Qf0oYsIj+lfC9cH1CwhchWAGCtZO+AooQOkdC1Km1VtCb63StW73uFSzgKFUkNwBbmZGGmqowhvg8ZNpH9oXChcIcYRdeNomgxLkaH+S1SGubAxyIpFv+Zp+0DYjrAS00j/dem2VGEl6FJ4Qa4quEu8j2hTCJ+GJhe4JjfQMf6JCYPPbysMPxBlp0BUKOogEF9Rg9/heNvNKYfM0KsZUZaYxX4STGrzJa+zbhPeFH2DcK10KItcI+pI0rVElwXl1ULaKnIJhDw0oRQpTQc1zcbwRU8ATy4DR6yMlTzwkqMziEWHvubJ4Nk4ZtHdnqwvwY17xq3Z4FjrG+z2Kdrdf2ZSGD+xlLPh6t1R0jP9fI22ZzKI92yvQl7EbmBxI4S7Y+vIAOL87QZqsc5uNnssxZIcfYjXT9snCR7jjobidp+FkxA2v+Cq1QervMDmp4P7Xs3YZtE9kOC3P/By6JGaETl8ElwueYTNTDq4UDsKnd7YfCNbT239LF1udS72xYJt1UWxNfN4IIP4bWuTpEja01JtMFZFsm/AHbtHBlDE6yasA4moYTrUbvdBTXHqUrAH4uSadbyzF+vbBM2IsNkS3MNa5305JxqfA02T4TnkX8XOH1mPw8ruVejpxbI9hZD2Cz1U7LdrrUvjP/WfZinNZhr6V27hP+FPZh9aLvLxVO4DllX0G2OcKnlO/DCblxaz6uXBtmi+8mBaP3/SP8IuEIiTRoPPQm2TaEmEyXo0JU+F0YiPFD0hhOsiE/vqeEVwyTgF8L51OilcIZ2I4Ll5NttvAJPfukUeB2sk0ZPSbKIUUJpCII7+DasWy08uhNNazT0wGHI7mAtB7KqMKm38HhDdAUibTVKGicbB8YAqrJ9DRsp43JdB4qUof1HQrPE6XTQWu3Ce/inVzjXhXpMiTwUYugNVQ+p80jrUsV5EH0POKeuXO9QjhFq5GryNYvfEMCDhsftYVsB9ETtG0V9ZjfhCURhbcJFpfwVZ9jvhxsLHwTYtp2svlWQw3vXL8UnqHVSIG8l8ex+tHhBXgjddgqHEZ8ufAA2aaEnYgrF/KrPXrEmMUqZ9THLW06xhoBaVueQpkug+ewOUphE3Qv2Q5gGamXYa+QbVq4O+DQ5FHyZqrjxNt7UHh9uuRa0F7HjCF8o9PCTOGnscM7g2u1Hl9C9oeEnxC/1ajZg8JLiM9Hj9GHJseMShwL2DO0G5yEWn3Zh1QUods5CPkIoqlwAZxhXMsb6HrcEPBxchhdJ6wj29vCW4hfLOzo8J3rltYX50nXQAATSf/K4DEaGlTLvplsk/QCpoD60EQ7gLYZc8H9wq+I3yncEOEcNhuz6HWf3XEiwU/4Y8YEqVp2P10rt+8REvBGw026i4aDcbL9jF8r8Blmf4fCOzhViiscskygXRdehf3CO4hfigmTBXyQrl8TFtD1IzQX3CbcQrY3hPcRv4z8OmHPXwchVNln2MmE7BX6VwIFi/he6uxvb6JM3m0fdqvx/ATidxg2JeC7VDErAw5NzGfvwRJVheEIQ8Mg/pdwIM+UOmi9Q8ivCsrIy0tF+wVbEcLrd3Pb2XisEb4Tdlhsi4WP4RBbaLGrHfC3PrvMIezy9rTpGm5lz9LOMG15xvFxD/j5gjzjjDbMOzk+9zzt3v5bgAEAibzFeFHVgYkAAAAASUVORK5CYII=";
  11322. // CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  11323. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  11324. * This program are made available under the terms of the Apache License, Version 2.0
  11325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11326. /**
  11327. * @class SuperMap.TimeControlBase
  11328. * @classdesc 时间控制基类类。
  11329. * @category Control
  11330. * @param {Object} options - 该类开放的可选属性。
  11331. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  11332. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  11333. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  11334. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  11335. * @param {boolean} [options.repeat=true] - 是否重复循环。
  11336. * @param {boolean} [options.reverse=false] - 是否反向。
  11337. */
  11338. class TimeControlBase_TimeControlBase {
  11339. constructor(options) {
  11340. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  11341. var me = this;
  11342. options = options || {};
  11343. /**
  11344. * @member {number} [SuperMap.TimeControlBase.prototype.speed=1]
  11345. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)
  11346. */
  11347. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  11348. /**
  11349. * @member {number} [SuperMap.TimeControlBase.prototype.frequency=1000]
  11350. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  11351. */
  11352. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  11353. /**
  11354. * @member {number} [SuperMap.TimeControlBase.prototype.startTime=0]
  11355. * @description 记录的起始时间,必须为数字,
  11356. * 如果不设置,初始化时为0,建议设置
  11357. */
  11358. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  11359. /**
  11360. * @member {number} SuperMap.TimeControlBase.prototype.endTime
  11361. * @description 记录的结束时间,必须为数字,
  11362. * 如果不设置,初始化时以当前时间进行设置,建议设置
  11363. */
  11364. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  11365. /**
  11366. * @member {boolean} [SuperMap.TimeControlBase.prototype.repeat=true]
  11367. * @description 是否重复循环。
  11368. */
  11369. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  11370. /**
  11371. * @member {boolean} [SuperMap.TimeControlBase.prototype.reverse=false]
  11372. * @description 是否反向。
  11373. */
  11374. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  11375. /**
  11376. * @member {number} SuperMap.TimeControlBase.prototype.currentTime
  11377. * @description 记录近期的时间,也就是当前帧运行到的时间。
  11378. */
  11379. this.currentTime = null;
  11380. /**
  11381. * @member {number} SuperMap.TimeControlBase.prototype.oldTime
  11382. * @description 记录上一帧的时间,也就是之前运行到的时间。
  11383. */
  11384. this.oldTime = null;
  11385. /**
  11386. * @member {boolean} [SuperMap.TimeControlBase.prototype.running=false]
  11387. * @description 记录当前是否处于运行中。
  11388. */
  11389. this.running = false;
  11390. /**
  11391. * @private
  11392. * @member {Array.<string>} SuperMap.TimeControlBase.prototype.EVENT_TYPES
  11393. * @description 此类支持的事件类型。
  11394. *
  11395. */
  11396. this.EVENT_TYPES = ["start", "pause", "stop"];
  11397. /**
  11398. * @private
  11399. * @member {SuperMap.Events} SuperMap.TimeControlBase.prototype.events
  11400. * @description 事件
  11401. */
  11402. me.events = new Events_Events(this, null, this.EVENT_TYPES);
  11403. me.speed = Number(me.speed);
  11404. me.frequency = Number(me.frequency);
  11405. me.startTime = Number(me.startTime);
  11406. me.endTime = Number(me.endTime);
  11407. me.startTime = Date.parse(new Date(me.startTime));
  11408. me.endTime = Date.parse(new Date(me.endTime));
  11409. //初始化当前时间
  11410. me.currentTime = me.startTime;
  11411. this.CLASS_NAME = "SuperMap.TimeControlBase";
  11412. }
  11413. /**
  11414. * @function SuperMap.TimeControlBase.prototype.updateOptions
  11415. * @param {Object} options - 设置参数得可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  11416. */
  11417. updateOptions(options) {
  11418. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  11419. var me = this;
  11420. options = options || {};
  11421. if (options.speed && options.speed >= 0) {
  11422. me.speed = options.speed;
  11423. me.speed = Number(me.speed);
  11424. }
  11425. if (options.speed && options.frequency >= 0) {
  11426. me.frequency = options.frequency;
  11427. me.frequency = Number(me.frequency);
  11428. }
  11429. if (options.startTime && options.startTime != null) {
  11430. me.startTime = options.startTime;
  11431. me.startTime = Date.parse(new Date(me.startTime));
  11432. }
  11433. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  11434. me.endTime = options.endTime;
  11435. me.endTime = Date.parse(new Date(me.endTime));
  11436. }
  11437. if (options.repeat != null) {
  11438. me.repeat = options.repeat;
  11439. }
  11440. if (options.reverse != null) {
  11441. me.reverse = options.reverse;
  11442. }
  11443. }
  11444. /**
  11445. * @function SuperMap.TimeControlBase.prototype.start
  11446. * @description 开始。
  11447. */
  11448. start() {
  11449. var me = this;
  11450. if (!me.running) {
  11451. me.running = true;
  11452. me.tick();
  11453. me.events.triggerEvent('start', me.currentTime);
  11454. }
  11455. }
  11456. /**
  11457. * @function SuperMap.TimeControlBase.prototype.pause
  11458. * @description 暂停。
  11459. */
  11460. pause() {
  11461. var me = this;
  11462. me.running = false;
  11463. me.events.triggerEvent('pause', me.currentTime);
  11464. }
  11465. /**
  11466. * @function SuperMap.TimeControlBase.prototype.stop
  11467. * @description 停止,停止后返回起始状态。
  11468. */
  11469. stop() {
  11470. var me = this;
  11471. //停止时 时间设置为开始时间
  11472. me.currentTime = me.startTime;
  11473. //如果正在运行,修改为初始时间即可绘制一帧
  11474. if (me.running) {
  11475. me.running = false;
  11476. }
  11477. me.events.triggerEvent('stop', me.currentTime);
  11478. }
  11479. /**
  11480. * @function SuperMap.TimeControlBase.prototype.toggle
  11481. * @description 开关切换,切换的是开始和暂停。
  11482. */
  11483. toggle() {
  11484. var me = this;
  11485. if (me.running) {
  11486. me.pause();
  11487. } else {
  11488. me.start();
  11489. }
  11490. }
  11491. /**
  11492. * @function SuperMap.TimeControlBase.prototype.setSpeed
  11493. * @description 设置步长。
  11494. * @param {number} [speed=1] - 步长,必须为非负数。
  11495. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  11496. */
  11497. setSpeed(speed) {
  11498. var me = this;
  11499. if (speed >= 0) {
  11500. me.speed = speed;
  11501. return true;
  11502. }
  11503. return false;
  11504. }
  11505. /**
  11506. * @function SuperMap.TimeControlBase.prototype.getSpeed
  11507. * @description 获取步长。
  11508. * @returns {number} 返回当前的步长
  11509. */
  11510. getSpeed() {
  11511. return this.speed;
  11512. }
  11513. /**
  11514. * @function SuperMap.TimeControlBase.prototype.setFrequency
  11515. * @description 设置刷新频率。
  11516. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  11517. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  11518. */
  11519. setFrequency(frequency) {
  11520. var me = this;
  11521. if (frequency >= 0) {
  11522. me.frequency = frequency;
  11523. return true;
  11524. }
  11525. return false;
  11526. }
  11527. /**
  11528. * @function SuperMap.TimeControlBase.prototype.getFrequency
  11529. * @description 获取刷新频率。
  11530. * @returns {number} 返回当前的刷新频率。
  11531. */
  11532. getFrequency() {
  11533. return this.frequency;
  11534. }
  11535. /**
  11536. * @function SuperMap.TimeControlBase.prototype.setStartTime
  11537. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  11538. * @param {number} startTime - 需要设置的起始时间。
  11539. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  11540. */
  11541. setStartTime(startTime) {
  11542. var me = this;
  11543. startTime = Date.parse(new Date(startTime));
  11544. //起始时间不得大于结束时间
  11545. if (startTime > me.endTime) {
  11546. return false;
  11547. }
  11548. me.startTime = startTime;
  11549. //如果当前时间小于了起始时间,则从当前起始时间开始
  11550. if (me.currentTime < me.startTime) {
  11551. me.currentTime = me.startTime;
  11552. me.tick();
  11553. }
  11554. return true;
  11555. }
  11556. /**
  11557. * @function SuperMap.TimeControlBase.prototype.getStartTime
  11558. * @description 获取起始时间。
  11559. * @returns {number} 返回当前的起始时间。
  11560. */
  11561. getStartTime() {
  11562. return this.startTime;
  11563. }
  11564. /**
  11565. * @function SuperMap.TimeControlBase.prototype.setEndTime
  11566. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  11567. * @param {number} endTime - 需要设置的结束时间。
  11568. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  11569. */
  11570. setEndTime(endTime) {
  11571. var me = this;
  11572. me.endTime = Date.parse(new Date(me.endTime));
  11573. //结束时间不得小于开始时间
  11574. if (endTime < me.startTime) {
  11575. return false;
  11576. }
  11577. me.endTime = endTime;
  11578. //如果当前时间大于了结束时间,则从起始时间开始
  11579. if (me.currentTime >= me.endTime) {
  11580. me.currentTime = me.startTime;
  11581. me.tick();
  11582. }
  11583. return true;
  11584. }
  11585. /**
  11586. * @function SuperMap.TimeControlBase.prototype.getEndTime
  11587. * @description 获取结束时间。
  11588. * @returns {number} 返回当前的结束时间。
  11589. */
  11590. getEndTime() {
  11591. return this.endTime;
  11592. }
  11593. /**
  11594. * @function SuperMap.TimeControlBase.prototype.setCurrentTime
  11595. * @description 设置当前时间。
  11596. * @param {number} currentTime - 需要设置的当前时间。
  11597. * @returns {boolean} true 代表设置成功,false 设置失败。
  11598. */
  11599. setCurrentTime(currentTime) {
  11600. var me = this;
  11601. me.currentTime = Date.parse(new Date(me.currentTime));
  11602. //结束时间不得小于开始时间
  11603. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  11604. me.currentTime = currentTime;
  11605. me.startTime = me.currentTime;
  11606. me.tick();
  11607. return true;
  11608. }
  11609. return false;
  11610. }
  11611. /**
  11612. * @function SuperMap.TimeControlBase.prototype.getCurrentTime
  11613. * @description 获取当前时间。
  11614. * @returns {number} 返回当前时间。
  11615. */
  11616. getCurrentTime() {
  11617. return this.currentTime;
  11618. }
  11619. /**
  11620. * @function SuperMap.TimeControlBase.prototype.setRepeat
  11621. * @description 设置是否重复循环。
  11622. * @param {boolean} [repeat=true] - 是否重复循环。
  11623. */
  11624. setRepeat(repeat) {
  11625. this.repeat = repeat;
  11626. }
  11627. /**
  11628. * @function SuperMap.TimeControlBase.prototype.getRepeat
  11629. * @description 获取是否重复循环,默认是 true。
  11630. * @returns {boolean} 返回是否重复循环。
  11631. */
  11632. getRepeat() {
  11633. return this.repeat;
  11634. }
  11635. /**
  11636. * @function SuperMap.TimeControlBase.prototype.setReverse
  11637. * @description 设置是否反向。
  11638. * @param {boolean} [reverse=false] - 是否反向。
  11639. */
  11640. setReverse(reverse) {
  11641. this.reverse = reverse;
  11642. }
  11643. /**
  11644. * @function SuperMap.TimeControlBase.prototype.getReverse
  11645. * @description 获取是否反向,默认是false。
  11646. * @returns {boolean} 返回是否反向。
  11647. */
  11648. getReverse() {
  11649. return this.reverse;
  11650. }
  11651. /**
  11652. * @function SuperMap.TimeControlBase.prototype.getRunning
  11653. * @description 获取运行状态。
  11654. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  11655. */
  11656. getRunning() {
  11657. return this.running;
  11658. }
  11659. /**
  11660. * @function SuperMap.TimeControlBase.prototype.destroy
  11661. * @description 销毁 Animator 对象,释放资源。
  11662. */
  11663. destroy() {
  11664. var me = this;
  11665. me.speed = null;
  11666. me.frequency = null;
  11667. me.startTime = null;
  11668. me.endTime = null;
  11669. me.currentTime = null;
  11670. me.repeat = null;
  11671. me.running = false;
  11672. me.reverse = null;
  11673. }
  11674. tick() {
  11675. //TODO 每次刷新执行的操作。子类实现
  11676. }
  11677. }
  11678. SuperMap.TimeControlBase = TimeControlBase_TimeControlBase;
  11679. // CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  11680. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  11681. * This program are made available under the terms of the Apache License, Version 2.0
  11682. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11683. /**
  11684. * @class SuperMap.TimeFlowControl
  11685. * @classdesc 时间管理类。
  11686. * @category Control
  11687. * @description 此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  11688. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  11689. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会 1 次(通过 setFrequency 修改)
  11690. * @extends {SuperMap.TimeControlBase}
  11691. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  11692. * @param {Object} options - 该类开放的可选属性。
  11693. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  11694. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  11695. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  11696. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  11697. * @param {boolean} [options.repeat=true] - 是否重复循环。
  11698. * @param {boolean} [options.reverse=false] - 是否反向。
  11699. */
  11700. class TimeFlowControl_TimeFlowControl extends TimeControlBase_TimeControlBase {
  11701. constructor(callback, options) {
  11702. super(options);
  11703. var me = this;
  11704. /**
  11705. * @member SuperMap.TimeFlowControl.prototype.callback -{function}
  11706. * @description 每次刷新执行的回调函数。
  11707. */
  11708. me.callback = callback;
  11709. //先让IE下支持bind方法
  11710. if (!Function.prototype.bind) {
  11711. Function.prototype.bind = function (oThis) {
  11712. if (typeof this !== "function") {
  11713. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  11714. }
  11715. var aArgs = Array.prototype.slice.call(arguments, 1),
  11716. fToBind = this,
  11717. fNOP = function () {
  11718. //empty Function
  11719. },
  11720. fBound = function () {
  11721. return fToBind.apply(this instanceof fNOP && oThis
  11722. ? this
  11723. : oThis,
  11724. aArgs.concat(Array.prototype.slice.call(arguments)));
  11725. };
  11726. fNOP.prototype = this.prototype;
  11727. fBound.prototype = new fNOP();
  11728. return fBound;
  11729. };
  11730. }
  11731. //保证 this.tick 的上下文还是 TimeControl 这个对象
  11732. me.update = me.update.bind(me);
  11733. me.oldTime = me.currentTime;
  11734. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  11735. }
  11736. /**
  11737. * @function SuperMap.TimeFlowControl.prototype.updateOptions
  11738. * @override
  11739. */
  11740. updateOptions(options) {
  11741. options = options || {};
  11742. super.updateOptions(options);
  11743. }
  11744. /**
  11745. * @function SuperMap.TimeFlowControl.prototype.start
  11746. * @override
  11747. */
  11748. start() {
  11749. var me = this;
  11750. if (me.running) {
  11751. return;
  11752. }
  11753. me.running = true;
  11754. if (me.reverse) {
  11755. if (me.currentTime === me.startTime) {
  11756. me.oldTime = me.endTime;
  11757. me.currentTime = me.oldTime;
  11758. }
  11759. } else {
  11760. if (me.oldTime === me.endTime) {
  11761. me.currentTime = me.startTime;
  11762. me.oldTime = me.currentTime;
  11763. }
  11764. }
  11765. me.tick();
  11766. }
  11767. /**
  11768. * @function SuperMap.TimeFlowControl.prototype.stop
  11769. * @override
  11770. */
  11771. stop() {
  11772. super.stop();
  11773. var me = this;
  11774. me.oldTime = me.currentTime;
  11775. if (me.running) {
  11776. me.running = false;
  11777. }
  11778. //清除定时tick
  11779. me.intervalId && window.clearTimeout(me.intervalId);
  11780. }
  11781. /**
  11782. * @function SuperMap.TimeFlowControl.prototype.destroy
  11783. * @override
  11784. */
  11785. destroy() {
  11786. super.destroy();
  11787. var me = this;
  11788. me.oldTime = null;
  11789. me.callback = null;
  11790. }
  11791. /**
  11792. * @function SuperMap.TimeFlowControl.prototype.tick
  11793. * @description 定时刷新。
  11794. */
  11795. tick() {
  11796. var me = this;
  11797. me.intervalId && window.clearInterval(me.intervalId);
  11798. me.intervalId = null;
  11799. me.update();
  11800. me.intervalId = window.setInterval(me.update, me.frequency);
  11801. }
  11802. /**
  11803. * @function SuperMap.TimeFlowControl.prototype.update
  11804. * @override
  11805. */
  11806. update() {
  11807. var me = this;
  11808. //判定是否还需要继续
  11809. if (!me.running) {
  11810. return;
  11811. }
  11812. //调用回调函数
  11813. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  11814. if (!me.reverse) {
  11815. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  11816. if (me.currentTime === me.endTime) {
  11817. //不循环时
  11818. if (!me.repeat) {
  11819. me.running = false;
  11820. me.stop();
  11821. return null;
  11822. }
  11823. me.stop();
  11824. me.currentTime = me.startTime;
  11825. me.oldTime = me.currentTime;
  11826. me.start();
  11827. } else {//否则时间递增
  11828. me.oldTime = me.currentTime;
  11829. me.currentTime += me.speed;
  11830. }
  11831. if (me.currentTime >= me.endTime) {
  11832. me.currentTime = me.endTime;
  11833. }
  11834. } else {
  11835. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  11836. if (me.currentTime === me.startTime) {
  11837. //不循环时
  11838. if (!me.repeat) {
  11839. me.running = false;
  11840. return null;
  11841. }
  11842. me.oldTime = me.endTime;
  11843. me.currentTime = me.oldTime;
  11844. } else {//否则时间递减
  11845. me.currentTime = me.oldTime;
  11846. me.oldTime -= me.speed;
  11847. }
  11848. if (me.oldTime <= me.startTime) {
  11849. me.oldTime = me.startTime;
  11850. }
  11851. }
  11852. }
  11853. }
  11854. SuperMap.TimeFlowControl = TimeFlowControl_TimeFlowControl;
  11855. // CONCATENATED MODULE: ./src/common/control/index.js
  11856. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  11857. * This program are made available under the terms of the Apache License, Version 2.0
  11858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11859. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  11860. var polyfill = __webpack_require__(12);
  11861. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  11862. var fetch = __webpack_require__(16);
  11863. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  11864. var fetch_jsonp = __webpack_require__(4);
  11865. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  11866. // CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  11867. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  11868. * This program are made available under the terms of the Apache License, Version 2.0
  11869. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11870. let FetchRequest_fetch = window.fetch;
  11871. var setFetch = function (newFetch) {
  11872. FetchRequest_fetch = newFetch;
  11873. }
  11874. /**
  11875. * @function SuperMap.setCORS
  11876. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  11877. * @param {boolean} cors - 是否允许跨域请求。
  11878. */
  11879. var setCORS = SuperMap.setCORS = function (cors) {
  11880. SuperMap.CORS = cors;
  11881. }
  11882. /**
  11883. * @function SuperMap.isCORS
  11884. * @description 是是否允许跨域请求。
  11885. * @returns {boolean} 是否允许跨域请求。
  11886. */
  11887. var isCORS = SuperMap.isCORS = function () {
  11888. if (SuperMap.CORS != undefined) {
  11889. return SuperMap.CORS;
  11890. }
  11891. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  11892. }
  11893. /**
  11894. * @function SuperMap.setRequestTimeout
  11895. * @description 设置请求超时时间。
  11896. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  11897. */
  11898. var setRequestTimeout = SuperMap.setRequestTimeout = function (timeout) {
  11899. return SuperMap.RequestTimeout = timeout;
  11900. }
  11901. /**
  11902. * @function SuperMap.getRequestTimeout
  11903. * @description 获取请求超时时间。
  11904. * @returns {number} 请求超时时间。
  11905. */
  11906. var getRequestTimeout = SuperMap.getRequestTimeout = function () {
  11907. return SuperMap.RequestTimeout || 45000;
  11908. }
  11909. var FetchRequest = SuperMap.FetchRequest = {
  11910. commit: function (method, url, params, options) {
  11911. method = method ? method.toUpperCase() : method;
  11912. switch (method) {
  11913. case 'GET':
  11914. return this.get(url, params, options);
  11915. case 'POST':
  11916. return this.post(url, params, options);
  11917. case 'PUT':
  11918. return this.put(url, params, options);
  11919. case 'DELETE':
  11920. return this.delete(url, params, options);
  11921. default:
  11922. return this.get(url, params, options);
  11923. }
  11924. },
  11925. supportDirectRequest: function (url, options) {
  11926. if (Util_Util.isInTheSameDomain(url)) {
  11927. return true;
  11928. }
  11929. if (options.crossOrigin != undefined) {
  11930. return options.crossOrigin;
  11931. } else {
  11932. return isCORS() || options.proxy;
  11933. }
  11934. },
  11935. get: function (url, params, options) {
  11936. options = options || {};
  11937. var type = 'GET';
  11938. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  11939. url = this._processUrl(url, options);
  11940. if (!this.supportDirectRequest(url, options)) {
  11941. url = url.replace('.json', '.jsonp');
  11942. var config = {
  11943. url: url,
  11944. data: params
  11945. };
  11946. return SuperMap.Util.RequestJSONPPromise.GET(config);
  11947. }
  11948. if (!this.urlIsLong(url)) {
  11949. return this._fetch(url, params, options, type);
  11950. } else {
  11951. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  11952. }
  11953. },
  11954. delete: function (url, params, options) {
  11955. options = options || {};
  11956. var type = 'DELETE';
  11957. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  11958. url = this._processUrl(url, options);
  11959. if (!this.supportDirectRequest(url, options)) {
  11960. url = url.replace('.json', '.jsonp');
  11961. var config = {
  11962. url: url += "&_method=DELETE",
  11963. data: params
  11964. };
  11965. return SuperMap.Util.RequestJSONPPromise.DELETE(config);
  11966. }
  11967. if (this.urlIsLong(url)) {
  11968. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  11969. }
  11970. return this._fetch(url, params, options, type);
  11971. },
  11972. post: function (url, params, options) {
  11973. options = options || {};
  11974. if (!this.supportDirectRequest(url, options)) {
  11975. url = url.replace('.json', '.jsonp');
  11976. var config = {
  11977. url: url += "&_method=POST",
  11978. data: params
  11979. };
  11980. return SuperMap.Util.RequestJSONPPromise.POST(config);
  11981. }
  11982. return this._fetch(this._processUrl(url, options), params, options, 'POST');
  11983. },
  11984. put: function (url, params, options) {
  11985. options = options || {};
  11986. url = this._processUrl(url, options);
  11987. if (!this.supportDirectRequest(url, options)) {
  11988. url = url.replace('.json', '.jsonp');
  11989. var config = {
  11990. url: url += "&_method=PUT",
  11991. data: params
  11992. };
  11993. return SuperMap.Util.RequestJSONPPromise.PUT(config);
  11994. }
  11995. return this._fetch(url, params, options, 'PUT');
  11996. },
  11997. urlIsLong: function (url) {
  11998. //当前url的字节长度。
  11999. var totalLength = 0,
  12000. charCode = null;
  12001. for (var i = 0, len = url.length; i < len; i++) {
  12002. //转化为Unicode编码
  12003. charCode = url.charCodeAt(i);
  12004. if (charCode < 0x007f) {
  12005. totalLength++;
  12006. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  12007. totalLength += 2;
  12008. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  12009. totalLength += 3;
  12010. }
  12011. }
  12012. return totalLength < 2000 ? false : true;
  12013. },
  12014. _postSimulatie: function (type, url, params, options) {
  12015. var separator = url.indexOf('?') > -1 ? '&' : '?';
  12016. url += separator + '_method=' + type;
  12017. if (typeof params !== 'string') {
  12018. params = JSON.stringify(params);
  12019. }
  12020. return this.post(url, params, options);
  12021. },
  12022. _processUrl: function (url, options) {
  12023. if (this._isMVTRequest(url)) {
  12024. return url;
  12025. }
  12026. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  12027. if (url.indexOf('?') < 0) {
  12028. url += '.json';
  12029. } else {
  12030. var urlArrays = url.split('?');
  12031. if (urlArrays.length === 2) {
  12032. url = urlArrays[0] + '.json?' + urlArrays[1];
  12033. }
  12034. }
  12035. }
  12036. if (options && options.proxy) {
  12037. if (typeof options.proxy === 'function') {
  12038. url = options.proxy(url);
  12039. } else {
  12040. url = decodeURIComponent(url);
  12041. url = options.proxy + encodeURIComponent(url);
  12042. }
  12043. }
  12044. return url;
  12045. },
  12046. _fetch: function (url, params, options, type) {
  12047. options = options || {};
  12048. options.headers = options.headers || {};
  12049. if (!options.headers['Content-Type']) {
  12050. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  12051. }
  12052. if (options.timeout) {
  12053. return this._timeout(
  12054. options.timeout,
  12055. FetchRequest_fetch(url, {
  12056. method: type,
  12057. headers: options.headers,
  12058. body: type === 'PUT' || type === 'POST' ? params : undefined,
  12059. credentials: this._getWithCredentials(options),
  12060. mode: 'cors',
  12061. timeout: getRequestTimeout()
  12062. }).then(function (response) {
  12063. return response;
  12064. })
  12065. );
  12066. }
  12067. return FetchRequest_fetch(url, {
  12068. method: type,
  12069. body: type === 'PUT' || type === 'POST' ? params : undefined,
  12070. headers: options.headers,
  12071. credentials: this._getWithCredentials(options),
  12072. mode: 'cors',
  12073. timeout: getRequestTimeout()
  12074. }).then(function (response) {
  12075. return response;
  12076. });
  12077. },
  12078. _getWithCredentials: function (options) {
  12079. if (options.withCredentials === true) {
  12080. return 'include';
  12081. }
  12082. if (options.withCredentials === false) {
  12083. return 'omit';
  12084. }
  12085. return 'same-origin';
  12086. },
  12087. _fetchJsonp: function (url, options) {
  12088. options = options || {};
  12089. return fetch_jsonp_default()(url, {
  12090. method: 'GET',
  12091. timeout: options.timeout
  12092. }).then(function (response) {
  12093. return response;
  12094. });
  12095. },
  12096. _timeout: function (seconds, promise) {
  12097. return new Promise(function (resolve, reject) {
  12098. setTimeout(function () {
  12099. reject(new Error('timeout'));
  12100. }, seconds);
  12101. promise.then(resolve, reject);
  12102. });
  12103. },
  12104. _getParameterString: function (params) {
  12105. var paramsArray = [];
  12106. for (var key in params) {
  12107. var value = params[key];
  12108. if (value != null && typeof value !== 'function') {
  12109. var encodedValue;
  12110. if (Array.isArray(value) || value.toString() === '[object Object]') {
  12111. encodedValue = encodeURIComponent(JSON.stringify(value));
  12112. } else {
  12113. encodedValue = encodeURIComponent(value);
  12114. }
  12115. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  12116. }
  12117. }
  12118. return paramsArray.join('&');
  12119. },
  12120. _isMVTRequest: function (url) {
  12121. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  12122. }
  12123. }
  12124. SuperMap.Util.RequestJSONPPromise = {
  12125. limitLength: 1500,
  12126. queryKeys: [],
  12127. queryValues: [],
  12128. supermap_callbacks: {},
  12129. addQueryStrings: function (values) {
  12130. var me = this;
  12131. for (var key in values) {
  12132. me.queryKeys.push(key);
  12133. if (typeof values[key] !== 'string') {
  12134. values[key] = SuperMap.Util.toJSON(values[key]);
  12135. }
  12136. var tempValue = encodeURIComponent(values[key]);
  12137. me.queryValues.push(tempValue);
  12138. }
  12139. },
  12140. issue: function (config) {
  12141. var me = this,
  12142. uid = me.getUid(),
  12143. url = config.url,
  12144. splitQuestUrl = [];
  12145. var p = new Promise(function (resolve) {
  12146. me.supermap_callbacks[uid] = function (response) {
  12147. delete me.supermap_callbacks[uid];
  12148. resolve(response);
  12149. };
  12150. });
  12151. // me.addQueryStrings({
  12152. // callback: "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  12153. // });
  12154. var sectionURL = url,
  12155. keysCount = 0; //此次sectionURL中有多少个key
  12156. var length = me.queryKeys ? me.queryKeys.length : 0;
  12157. for (var i = 0; i < length; i++) {
  12158. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  12159. //+2 for ("&"or"?")and"="
  12160. if (keysCount == 0) {
  12161. return false;
  12162. }
  12163. splitQuestUrl.push(sectionURL);
  12164. sectionURL = url;
  12165. keysCount = 0;
  12166. i--;
  12167. } else {
  12168. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  12169. var leftValue = me.queryValues[i];
  12170. while (leftValue.length > 0) {
  12171. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  12172. if (sectionURL.indexOf('?') > -1) {
  12173. sectionURL += '&';
  12174. } else {
  12175. sectionURL += '?';
  12176. }
  12177. var tempLeftValue = leftValue.substring(0, leftLength);
  12178. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  12179. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  12180. leftLength -= 1;
  12181. tempLeftValue = leftValue.substring(0, leftLength);
  12182. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  12183. leftLength -= 2;
  12184. tempLeftValue = leftValue.substring(0, leftLength);
  12185. }
  12186. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  12187. leftValue = leftValue.substring(leftLength);
  12188. if (tempLeftValue.length > 0) {
  12189. splitQuestUrl.push(sectionURL);
  12190. sectionURL = url;
  12191. keysCount = 0;
  12192. }
  12193. }
  12194. } else {
  12195. keysCount++;
  12196. if (sectionURL.indexOf('?') > -1) {
  12197. sectionURL += '&';
  12198. } else {
  12199. sectionURL += '?';
  12200. }
  12201. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  12202. }
  12203. }
  12204. }
  12205. splitQuestUrl.push(sectionURL);
  12206. me.send(
  12207. splitQuestUrl,
  12208. 'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
  12209. config && config.proxy
  12210. );
  12211. return p;
  12212. },
  12213. getUid: function () {
  12214. var uid = new Date().getTime(),
  12215. random = Math.floor(Math.random() * 1e17);
  12216. return uid * 1000 + random;
  12217. },
  12218. send: function (splitQuestUrl, callback, proxy) {
  12219. var len = splitQuestUrl.length;
  12220. if (len > 0) {
  12221. var jsonpUserID = new Date().getTime();
  12222. for (var i = 0; i < len; i++) {
  12223. var url = splitQuestUrl[i];
  12224. if (url.indexOf('?') > -1) {
  12225. url += '&';
  12226. } else {
  12227. url += '?';
  12228. }
  12229. url += 'sectionCount=' + len;
  12230. url += '&sectionIndex=' + i;
  12231. url += '&jsonpUserID=' + jsonpUserID;
  12232. if (proxy) {
  12233. url = decodeURIComponent(url);
  12234. url = proxy + encodeURIComponent(url);
  12235. }
  12236. fetch_jsonp_default()(url, {
  12237. jsonpCallbackFunction: callback,
  12238. timeout: 30000
  12239. });
  12240. }
  12241. }
  12242. },
  12243. GET: function (config) {
  12244. var me = this;
  12245. me.queryKeys.length = 0;
  12246. me.queryValues.length = 0;
  12247. me.addQueryStrings(config.params);
  12248. return me.issue(config);
  12249. },
  12250. POST: function (config) {
  12251. var me = this;
  12252. me.queryKeys.length = 0;
  12253. me.queryValues.length = 0;
  12254. me.addQueryStrings({
  12255. requestEntity: config.data
  12256. });
  12257. return me.issue(config);
  12258. },
  12259. PUT: function (config) {
  12260. var me = this;
  12261. me.queryKeys.length = 0;
  12262. me.queryValues.length = 0;
  12263. me.addQueryStrings({
  12264. requestEntity: config.data
  12265. });
  12266. return me.issue(config);
  12267. },
  12268. DELETE: function (config) {
  12269. var me = this;
  12270. me.queryKeys.length = 0;
  12271. me.queryValues.length = 0;
  12272. me.addQueryStrings({
  12273. requestEntity: config.data
  12274. });
  12275. return me.issue(config);
  12276. }
  12277. };
  12278. // CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  12279. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12280. * This program are made available under the terms of the Apache License, Version 2.0
  12281. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12282. /**
  12283. * @name SecurityManager
  12284. * @memberOf SuperMap
  12285. * @namespace
  12286. * @category Security
  12287. * @description 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  12288. * > 使用说明:
  12289. * > 创建任何一个服务之前调用 {@link SuperMap.SecurityManager.registerToken}或
  12290. * > {@link SuperMap.SecurityManager.registerKey}注册凭据。
  12291. * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
  12292. */
  12293. class SecurityManager_SecurityManager {
  12294. /**
  12295. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  12296. * @function SuperMap.SecurityManager.generateToken
  12297. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  12298. * @param {SuperMap.TokenServiceParameter} tokenParam - token 申请参数。
  12299. * @returns {Promise} 返回包含 token 信息的 Promise 对象。
  12300. */
  12301. static generateToken(url, tokenParam) {
  12302. var serverInfo = this.servers[url];
  12303. if (!serverInfo) {
  12304. return;
  12305. }
  12306. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function (response) {
  12307. return response.text();
  12308. });
  12309. }
  12310. /**
  12311. * @description 注册安全服务器相关信息。
  12312. * @function SuperMap.SecurityManager.registerServers
  12313. * @param {SuperMap.ServerInfo} serverInfos - 服务器信息。
  12314. */
  12315. static registerServers(serverInfos) {
  12316. this.servers = this.servers || {};
  12317. if (!Util_Util.isArray(serverInfos)) {
  12318. serverInfos = [serverInfos];
  12319. }
  12320. for (var i = 0; i < serverInfos.length; i++) {
  12321. var serverInfo = serverInfos[i];
  12322. this.servers[serverInfo.server] = serverInfo;
  12323. }
  12324. }
  12325. /**
  12326. * @description 服务请求都会自动带上这个 token。
  12327. * @function SuperMap.SecurityManager.registerToken
  12328. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  12329. * @param {string} token - token
  12330. */
  12331. static registerToken(url, token) {
  12332. this.tokens = this.tokens || {};
  12333. if (!url || !token) {
  12334. return;
  12335. }
  12336. var domain = this._getTokenStorageKey(url);
  12337. this.tokens[domain] = token;
  12338. }
  12339. /**
  12340. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  12341. * @function SuperMap.SecurityManager.registerKey
  12342. * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
  12343. * @param {string} key - key
  12344. */
  12345. static registerKey(ids, key) {
  12346. this.keys = this.keys || {};
  12347. if (!ids || ids.length < 1 || !key) {
  12348. return;
  12349. }
  12350. ids = (Util_Util.isArray(ids)) ? ids : [ids];
  12351. for (var i = 0; i < ids.length; i++) {
  12352. var id = this._getUrlRestString(ids[0]) || ids[0];
  12353. this.keys[id] = key;
  12354. }
  12355. }
  12356. /**
  12357. * @description 获取服务器信息。
  12358. * @function SuperMap.SecurityManager.getServerInfo
  12359. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  12360. * @returns {SuperMap.ServerInfo} 服务器信息。
  12361. */
  12362. static getServerInfo(url) {
  12363. this.servers = this.servers || {};
  12364. return this.servers[url];
  12365. }
  12366. /**
  12367. * @description 根据 Url 获取token。
  12368. * @function SuperMap.SecurityManager.getToken
  12369. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  12370. * @returns {string} token
  12371. */
  12372. static getToken(url) {
  12373. if (!url) {
  12374. return;
  12375. }
  12376. this.tokens = this.tokens || {};
  12377. var domain = this._getTokenStorageKey(url);
  12378. return this.tokens[domain];
  12379. }
  12380. /**
  12381. * @description 根据 Url 获取 key。
  12382. * @function SuperMap.SecurityManager.getKey
  12383. * @param {string} id - id
  12384. * @returns {string} key
  12385. */
  12386. static getKey(id) {
  12387. this.keys = this.keys || {};
  12388. var key = this._getUrlRestString(id) || id;
  12389. return this.keys[key];
  12390. }
  12391. /**
  12392. * @description iServer 登录验证。
  12393. * @function SuperMap.SecurityManager.loginiServer
  12394. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  12395. * @param {string} username - 用户名。
  12396. * @param {string} password - 密码。
  12397. * @param {boolean} [rememberme=false] - 是否记住。
  12398. * @returns {Promise} 返回包含 iServer 登录请求结果的 Promise 对象。
  12399. */
  12400. static loginiServer(url, username, password, rememberme) {
  12401. url = Util_Util.urlPathAppend(url, 'services/security/login');
  12402. var loginInfo = {
  12403. username: username && username.toString(),
  12404. password: password && password.toString(),
  12405. rememberme: rememberme
  12406. };
  12407. loginInfo = JSON.stringify(loginInfo);
  12408. var requestOptions = {
  12409. headers: {
  12410. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  12411. }
  12412. };
  12413. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  12414. return response.json();
  12415. });
  12416. }
  12417. /**
  12418. * @description iServer登出。
  12419. * @function SuperMap.SecurityManager.logoutiServer
  12420. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  12421. * @returns {Promise} 是否登出成功。
  12422. */
  12423. static logoutiServer(url) {
  12424. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  12425. var requestOptions = {
  12426. headers: {
  12427. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  12428. },
  12429. withoutFormatSuffix: true
  12430. };
  12431. return FetchRequest.get(url, "", requestOptions).then(function () {
  12432. return true;
  12433. }).catch(function () {
  12434. return false;
  12435. });
  12436. }
  12437. /**
  12438. * @description Online 登录验证。
  12439. * @function SuperMap.SecurityManager.loginOnline
  12440. * @param {string} callbackLocation - 跳转位置。
  12441. * @param {boolean} [newTab=true] - 是否新窗口打开。
  12442. */
  12443. static loginOnline(callbackLocation, newTab) {
  12444. var loginUrl = SecurityManager_SecurityManager.SSO + "/login?service=" + callbackLocation;
  12445. this._open(loginUrl, newTab);
  12446. }
  12447. /**
  12448. * @description iPortal登录验证。
  12449. * @function SuperMap.SecurityManager.loginiPortal
  12450. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  12451. * @param {string} username - 用户名。
  12452. * @param {string} password - 密码。
  12453. * @returns {Promise} 返回包含 iPortal 登录请求结果的 Promise 对象。
  12454. */
  12455. static loginiPortal(url, username, password) {
  12456. url = Util_Util.urlPathAppend(url, 'web/login');
  12457. var loginInfo = {
  12458. username: username && username.toString(),
  12459. password: password && password.toString()
  12460. };
  12461. loginInfo = JSON.stringify(loginInfo);
  12462. var requestOptions = {
  12463. headers: {
  12464. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  12465. },
  12466. withCredentials: true
  12467. };
  12468. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  12469. return response.json();
  12470. });
  12471. }
  12472. /**
  12473. * @description iPortal 登出。
  12474. * @function SuperMap.SecurityManager.logoutiPortal
  12475. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  12476. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  12477. */
  12478. static logoutiPortal(url) {
  12479. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  12480. var requestOptions = {
  12481. headers: {
  12482. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  12483. },
  12484. withCredentials: true,
  12485. withoutFormatSuffix: true
  12486. };
  12487. return FetchRequest.get(url, "", requestOptions).then(function () {
  12488. return true;
  12489. }).catch(function () {
  12490. return false;
  12491. });
  12492. }
  12493. /**
  12494. * @description iManager 登录验证。
  12495. * @function SuperMap.SecurityManager.loginManager
  12496. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  12497. * @param {Object} [loginInfoParams] - iManager 登录参数。
  12498. * @param {string} loginInfoParams.userName - 用户名。
  12499. * @param {string} loginInfoParams.password - 密码。
  12500. * @param {Object} options
  12501. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  12502. * @returns {Promise} 返回包含 iManager 登录请求结果的 Promise 对象。
  12503. */
  12504. static loginManager(url, loginInfoParams, options) {
  12505. if (!Util_Util.isInTheSameDomain(url)) {
  12506. var isNewTab = options ? options.isNewTab : true;
  12507. this._open(url, isNewTab);
  12508. return;
  12509. }
  12510. var requestUrl = Util_Util.urlPathAppend(url, 'icloud/security/tokens');
  12511. var params = loginInfoParams || {};
  12512. var loginInfo = {
  12513. username: params.userName && params.userName.toString(),
  12514. password: params.password && params.password.toString()
  12515. };
  12516. loginInfo = JSON.stringify(loginInfo);
  12517. var requestOptions = {
  12518. headers: {
  12519. 'Accept': '*/*',
  12520. 'Content-Type': 'application/json'
  12521. }
  12522. };
  12523. var me = this;
  12524. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function (response) {
  12525. response.text().then(function (result) {
  12526. me.imanagerToken = result;
  12527. return result;
  12528. });
  12529. });
  12530. }
  12531. /**
  12532. * @description 清空全部验证信息。
  12533. * @function SuperMap.SecurityManager.destroyAllCredentials
  12534. */
  12535. static destroyAllCredentials() {
  12536. this.keys = null;
  12537. this.tokens = null;
  12538. this.servers = null;
  12539. }
  12540. /**
  12541. * @description 清空令牌信息。
  12542. * @function SuperMap.SecurityManager.destroyToken
  12543. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  12544. */
  12545. static destroyToken(url) {
  12546. if (!url) {
  12547. return;
  12548. }
  12549. var domain = this._getTokenStorageKey(url);
  12550. this.tokens = this.tokens || {};
  12551. if (this.tokens[domain]) {
  12552. delete this.tokens[domain];
  12553. }
  12554. }
  12555. /**
  12556. * @description 清空服务授权码。
  12557. * @function SuperMap.SecurityManager.destroyKey
  12558. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  12559. */
  12560. static destroyKey(url) {
  12561. if (!url) {
  12562. return;
  12563. }
  12564. this.keys = this.keys || {};
  12565. var key = this._getUrlRestString(url) || url;
  12566. if (this.keys[key]) {
  12567. delete this.keys[key];
  12568. }
  12569. }
  12570. static _open(url, newTab) {
  12571. newTab = (newTab != null) ? newTab : true;
  12572. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  12573. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  12574. var options =
  12575. "height=" + this.INNER_WINDOW_HEIGHT + ", width=" + this.INNER_WINDOW_WIDTH +
  12576. ",top=" + offsetY + ", left=" + offsetX +
  12577. ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  12578. if (newTab) {
  12579. window.open(url, 'login');
  12580. } else {
  12581. window.open(url, 'login', options);
  12582. }
  12583. }
  12584. static _getTokenStorageKey(url) {
  12585. var patten = /(.*?):\/\/([^\/]+)/i;
  12586. var result = url.match(patten);
  12587. if (!result) {
  12588. return url;
  12589. }
  12590. return result[0];
  12591. }
  12592. static _getUrlRestString(url) {
  12593. if (!url) {
  12594. return url;
  12595. }
  12596. // var patten = /http:\/\/(.*\/rest)/i;
  12597. var patten = /(http|https):\/\/(.*\/rest)/i;
  12598. var result = url.match(patten);
  12599. if (!result) {
  12600. return url;
  12601. }
  12602. return result[0];
  12603. }
  12604. }
  12605. SecurityManager_SecurityManager.INNER_WINDOW_WIDTH = 600;
  12606. SecurityManager_SecurityManager.INNER_WINDOW_HEIGHT = 600;
  12607. SecurityManager_SecurityManager.SSO = "https://sso.supermap.com";
  12608. SecurityManager_SecurityManager.ONLINE = "https://www.supermapol.com";
  12609. SuperMap.SecurityManager = SecurityManager_SecurityManager;
  12610. // CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  12611. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12612. * This program are made available under the terms of the Apache License, Version 2.0
  12613. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12614. /**
  12615. * @class SuperMap.iManagerServiceBase
  12616. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  12617. * @category iManager
  12618. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  12619. * @param {Object} options - 服务参数。
  12620. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  12621. * @param {Object} [options.headers] - 请求头。
  12622. */
  12623. class iManagerServiceBase_IManagerServiceBase {
  12624. constructor(url,options) {
  12625. if (url) {
  12626. var end = url.substr(url.length - 1, 1);
  12627. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  12628. }
  12629. this.options = options || {};
  12630. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  12631. }
  12632. /**
  12633. * @function SuperMap.iManagerServiceBase.prototype.request
  12634. * @description 子类统一通过该方法发送请求。
  12635. * @param {string} url - 请求 URL。
  12636. * @param {string} [method='GET'] - 请求类型。
  12637. * @param {Object} [requestOptions] - 请求选项。
  12638. * @param {Object} param - 请求参数。
  12639. * @description 发送请求。
  12640. * @returns {Promise} Promise 对象。
  12641. */
  12642. request(method, url, param, requestOptions) {
  12643. requestOptions = requestOptions || {
  12644. headers: {
  12645. 'Accept': '*/*',
  12646. 'Content-Type': 'application/json'
  12647. }
  12648. };
  12649. if (!requestOptions.hasOwnProperty("withCredentials")) {
  12650. requestOptions['withCredentials'] = true;
  12651. }
  12652. requestOptions['crossOrigin'] = this.options.crossOrigin;
  12653. requestOptions['headers'] = this.options.headers;
  12654. var token = SecurityManager_SecurityManager.imanagerToken;
  12655. if (token) {
  12656. if (!requestOptions.headers) {
  12657. requestOptions.headers = [];
  12658. }
  12659. requestOptions.headers['X-Auth-Token'] = token;
  12660. }
  12661. if (param) {
  12662. param = JSON.stringify(param);
  12663. }
  12664. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  12665. return response.json();
  12666. });
  12667. }
  12668. }
  12669. SuperMap.iManagerServiceBase = iManagerServiceBase_IManagerServiceBase;
  12670. // CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  12671. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12672. * This program are made available under the terms of the Apache License, Version 2.0
  12673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12674. /**
  12675. * @class SuperMap.iManagerCreateNodeParam
  12676. * @classdesc iManager 创建节点参数。
  12677. * @category iManager
  12678. * @param {Object} [params] - iManager 创建节点参数。
  12679. *
  12680. */
  12681. class iManagerCreateNodeParam_IManagerCreateNodeParam {
  12682. constructor(params) {
  12683. params = params || {};
  12684. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  12685. this.nodeCount = 1; //要创建vm的个数
  12686. this.nodeName = ''; //vm名称
  12687. this.password = ''; //vm的密码,空表示随机分配
  12688. this.description = ''; //描述信息
  12689. this.physicalMachineName = ''; //vm所属的物理机名称.
  12690. this.ips = []; //vm的ip,空数组表示随机分配
  12691. this.userName = ''; //vm所属用户
  12692. Util_Util.extend(this, params);
  12693. }
  12694. }
  12695. SuperMap.iManagerCreateNodeParam = iManagerCreateNodeParam_IManagerCreateNodeParam;
  12696. // CONCATENATED MODULE: ./src/common/iManager/iManager.js
  12697. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12698. * This program are made available under the terms of the Apache License, Version 2.0
  12699. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12700. /**
  12701. * @class SuperMap.iManager
  12702. * @classdesc iManager 服务类。
  12703. * @category iManager
  12704. * @param {string} serviceUrl - iManager 首页地址。
  12705. *
  12706. */
  12707. class iManager_IManager extends iManagerServiceBase_IManagerServiceBase {
  12708. constructor(iManagerUrl) {
  12709. super(iManagerUrl);
  12710. }
  12711. /**
  12712. * @function SuperMap.iManager.prototype.load
  12713. * @description 获取所有服务接口,验证是否已登录授权。
  12714. * @returns {Promise} Promise 对象。
  12715. */
  12716. load() {
  12717. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  12718. }
  12719. /**
  12720. * @function SuperMap.iManager.prototype.createIServer
  12721. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  12722. * @description 创建 iServer。
  12723. * @returns {Promise} Promise 对象。
  12724. */
  12725. createIServer(createParam) {
  12726. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new iManagerCreateNodeParam_IManagerCreateNodeParam(createParam));
  12727. }
  12728. /**
  12729. * @function SuperMap.iManager.prototype.createIPortal
  12730. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  12731. * @description 创建 iPortal。
  12732. * @returns {Promise} Promise 对象。
  12733. */
  12734. createIPortal(createParam) {
  12735. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new iManagerCreateNodeParam_IManagerCreateNodeParam(createParam));
  12736. }
  12737. /**
  12738. * @function SuperMap.iManager.prototype.iServerList
  12739. * @description 获取所有创建的 iServer。
  12740. * @returns {Promise} Promise 对象。
  12741. */
  12742. iServerList() {
  12743. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  12744. }
  12745. /**
  12746. * @function SuperMap.iManager.prototype.iPortalList
  12747. * @description 获取所有创建的 iPortal。
  12748. * @returns {Promise} Promise 对象。
  12749. */
  12750. iPortalList() {
  12751. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  12752. }
  12753. /**
  12754. * @function SuperMap.iManager.prototype.startNodes
  12755. * @param {Array} ids - 需要启动节点的 ID 数组。e.g:['1']。
  12756. * @description 启动节点。
  12757. * @returns {Promise} Promise 对象。
  12758. */
  12759. startNodes(ids) {
  12760. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  12761. }
  12762. /**
  12763. * @function SuperMap.iManager.prototype.stopNodes
  12764. * @param {Array} ids - 需要停止节点的 ID 数组。e.g:['1']。
  12765. * @description 停止节点。
  12766. * @returns {Promise} Promise 对象。
  12767. */
  12768. stopNodes(ids) {
  12769. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  12770. }
  12771. }
  12772. SuperMap.iManager = iManager_IManager;
  12773. // CONCATENATED MODULE: ./src/common/iManager/index.js
  12774. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12775. * This program are made available under the terms of the Apache License, Version 2.0
  12776. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12777. // CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  12778. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12779. * This program are made available under the terms of the Apache License, Version 2.0
  12780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12781. /**
  12782. * @class SuperMap.iPortalServiceBase
  12783. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  12784. * @category iPortal/Online
  12785. * @param {string} url - iPortal 服务地址。
  12786. * @param {Object} options - 可选参数。
  12787. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  12788. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  12789. * @param {Object} [options.headers] - 请求头。
  12790. */
  12791. class iPortalServiceBase_IPortalServiceBase {
  12792. constructor(url, options) {
  12793. options = options || {};
  12794. this.serviceUrl = url;
  12795. this.serverType = ServerType.iPortal;
  12796. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  12797. this.withCredentials = options.withCredentials || false;
  12798. this.crossOrigin = options.crossOrigin
  12799. this.headers = options.headers
  12800. }
  12801. /**
  12802. * @function SuperMap.iPortalServiceBase.prototype.request
  12803. * @description 子类统一通过该方法发送请求。
  12804. * @param {string} [method='GET'] - 请求类型。
  12805. * @param {string} url - 服务地址。
  12806. * @param {Object} param - 请求参数。
  12807. * @param {Object} [requestOptions] - fetch 请求配置项。
  12808. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  12809. */
  12810. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  12811. url = this.createCredentialUrl(url);
  12812. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  12813. return response.json();
  12814. });
  12815. }
  12816. /**
  12817. * @function SuperMap.iPortalServiceBase.prototype.createCredentialUrl
  12818. * @description 追加授权信息。
  12819. * @param {string} url - 创建证书 URL 地址。
  12820. * @returns {string} 携带 token 或 key 的新地址。
  12821. */
  12822. createCredentialUrl(url) {
  12823. var newUrl = url,
  12824. credential = this.getCredential();
  12825. if (credential) {
  12826. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  12827. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  12828. newUrl += credential.getUrlParameters();
  12829. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  12830. newUrl += "&" + credential.getUrlParameters();
  12831. } else {
  12832. newUrl += "?" + credential.getUrlParameters();
  12833. }
  12834. }
  12835. return newUrl;
  12836. }
  12837. /**
  12838. * @function SuperMap.iPortalServiceBase.prototype.getCredential
  12839. * @description 获取 token。
  12840. * @returns {string} 返回获取的 token。
  12841. *
  12842. */
  12843. getCredential() {
  12844. var credential,
  12845. value = SecurityManager_SecurityManager.getToken(this.serviceUrl);
  12846. credential = value ? new Credential(value, "token") : null;
  12847. if (!credential) {
  12848. value = this.getKey();
  12849. credential = value ? new Credential(value, "key") : null;
  12850. }
  12851. return credential;
  12852. }
  12853. /**
  12854. * @function SuperMap.iPortalServiceBase.prototype.getKey
  12855. * @description 其子类需要重写该方法,修改其中获取 key 的字段,存储 key 可能是服务 ID 字段,可能是 URL。
  12856. */
  12857. getKey() {
  12858. //return SuperMap.SecurityManager.getKey(this.id);
  12859. //或
  12860. //return SuperMap.SecurityManager.getKey(this.serviceUrl);
  12861. }
  12862. }
  12863. SuperMap.iPortalServiceBase = iPortalServiceBase_IPortalServiceBase;
  12864. // CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  12865. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12866. * This program are made available under the terms of the Apache License, Version 2.0
  12867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12868. /**
  12869. * @class SuperMap.iPortalQueryParam
  12870. * @classdesc iPortal 资源查询参数。
  12871. * @version 10.0.1
  12872. * @category iPortal/Online
  12873. * @param {Object} params - iPortal 资源查询具体参数。
  12874. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型
  12875. * @param {number} [params.pageSize] - 分页中每页大小。
  12876. * @param {number} [params.currentPage] - 分页页码。
  12877. * @param {SuperMap.OrderBy} [params.orderBy] - 排序字段。
  12878. * @param {SuperMap.OrderType} [params.orderType] - 根据升序还是降序过滤。
  12879. * @param {SuperMap.SearchType} [params.searchType] - 根据查询的范围进行过滤。
  12880. * @param {Array} [params.tags] - 标签。
  12881. * @param {Array} [params.dirIds] - 目录 id
  12882. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  12883. * @param {SuperMap.AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  12884. * @param {string} [params.text] - 搜索的关键词。
  12885. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  12886. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  12887. */
  12888. class iPortalQueryParam_IPortalQueryParam {
  12889. constructor(params) {
  12890. params = params || {};
  12891. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  12892. this.pageSize = 12; // 每页多少条
  12893. this.currentPage = 1; // 第几页
  12894. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  12895. this.orderType = "DESC"; // DESC ASC
  12896. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  12897. this.tags = []; // 标签
  12898. this.dirIds = []; // 类别
  12899. this.resourceSubTypes = []; // 类型
  12900. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  12901. this.text = ""; // 搜索字段
  12902. this.groupIds = []; // 群组Id过滤
  12903. this.departmentIds = []; // 部门Id过滤
  12904. Util_Util.extend(this, params);
  12905. }
  12906. }
  12907. SuperMap.iPortalQueryParam = iPortalQueryParam_IPortalQueryParam;
  12908. // CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  12909. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12910. * This program are made available under the terms of the Apache License, Version 2.0
  12911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12912. /**
  12913. * @class SuperMap.iPortalQueryResult
  12914. * @classdesc iPortal 资源结果集封装类。
  12915. * @version 10.0.1
  12916. * @category iPortal/Online
  12917. * @param {Object} queryResult - 资源参数。
  12918. * @param {Array} [queryResult.content] - 页面内容。
  12919. * @param {number} [queryResult.total] - 总记录数。
  12920. * @param {number} [queryResult.currentPage] - 当前第几页。
  12921. * @param {number} [queryResult.pageSize] - 每页大小。
  12922. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  12923. */
  12924. class iPortalQueryResult_IPortalQueryResult {
  12925. constructor(queryResult) {
  12926. queryResult = queryResult || {};
  12927. this.content = [];
  12928. this.total = 0;
  12929. this.currentPage = 1;
  12930. this.pageSize = 12;
  12931. this.aggregations = null;
  12932. Util_Util.extend(this, queryResult);
  12933. }
  12934. }
  12935. SuperMap.iPortalQueryResult = iPortalQueryResult_IPortalQueryResult;
  12936. // CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  12937. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  12938. * This program are made available under the terms of the Apache License, Version 2.0
  12939. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12940. /**
  12941. * @class SuperMap.iPortalResource
  12942. * @classdesc iPortal 资源详情类。
  12943. * @version 10.0.1
  12944. * @category iPortal/Online
  12945. * @param {string} portalUrl - 资源地址。
  12946. * @param {Object} resourceInfo - 资源详情参数。
  12947. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息
  12948. * @param {string} [resourceInfo.bounds] - 资源的坐标范围
  12949. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  12950. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED
  12951. * @param {Date} [resourceInfo.createTime] - 资源的创建时间
  12952. * @param {string} [resourceInfo.description] - 资源描述
  12953. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的id
  12954. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  12955. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  12956. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档id
  12957. * @param {string} [resourceInfo.name] - 资源名称
  12958. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的id
  12959. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的id
  12960. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  12961. * @param {SuperMap.ResourceType} [resourceInfo.resourceType] - 资源类型
  12962. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID
  12963. * @param {Array} [resourceInfo.tags] - 资源的标签
  12964. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图
  12965. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间
  12966. * @param {string} [resourceInfo.userName] - 搜索的关键词
  12967. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  12968. * @extends {SuperMap.iPortalServiceBase}
  12969. */
  12970. class iPortalResource_IPortalResource extends iPortalServiceBase_IPortalServiceBase {
  12971. constructor(portalUrl, resourceInfo) {
  12972. super(portalUrl);
  12973. resourceInfo = resourceInfo || {};
  12974. this.authorizeSetting = [];
  12975. this.bounds = "";
  12976. this.bounds4326 = "";
  12977. this.checkStatus = "";
  12978. this.createTime = 0;
  12979. this.description = null;
  12980. this.dirId = null;
  12981. this.epsgCode = 0;
  12982. this.heatLevel = 0;
  12983. this.id = 0;
  12984. this.name = "";
  12985. this.personalDirId = null;
  12986. this.resourceId = 0;
  12987. this.resourceSubType = null;
  12988. this.resourceType = null;
  12989. this.serviceRootUrlId = null;
  12990. this.tags = null;
  12991. this.thumbnail = null;
  12992. this.updateTime = 0;
  12993. this.userName = "";
  12994. this.sourceJSON = {};//返回门户资源详细信息
  12995. Util_Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  12996. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  12997. if (this.withCredentials) {
  12998. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  12999. }
  13000. // if (this.id) {
  13001. // this.mapUrl = mapUrl + "/" + this.id;
  13002. // }
  13003. }
  13004. /**
  13005. * @function SuperMap.iPortalResource.prototype.load
  13006. * @description 加载资源信息。
  13007. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  13008. */
  13009. load() {
  13010. var me = this;
  13011. return me.request("GET", me.resourceUrl + ".json")
  13012. .then(function (resourceInfo) {
  13013. if (resourceInfo.error) {
  13014. return resourceInfo;
  13015. }
  13016. me.sourceJSON = resourceInfo;
  13017. });
  13018. }
  13019. /**
  13020. * @function SuperMap.iPortalResource.prototype.update
  13021. * @description 更新资源属性信息。
  13022. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  13023. */
  13024. update() {
  13025. var resourceName = this.resourceType.replace("_","").toLowerCase();
  13026. var options = {
  13027. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  13028. };
  13029. if( resourceName === 'data') {
  13030. this.resourceUrl = this.resourceUrl + "/attributes.json";
  13031. }
  13032. var entity = JSON.stringify(this.sourceJSON);
  13033. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  13034. if( resourceName === 'service') {
  13035. var serviceInfo = {
  13036. authorizeSetting:this.sourceJSON.authorizeSetting,
  13037. metadata:this.sourceJSON.metadata,
  13038. tags:this.sourceJSON.tags,
  13039. thumbnail:this.sourceJSON.thumbnail,
  13040. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  13041. };
  13042. entity = JSON.stringify(serviceInfo);
  13043. }
  13044. return this.request("PUT", this.resourceUrl, entity, options);
  13045. }
  13046. }
  13047. SuperMap.iPortalResource = iPortalResource_IPortalResource;
  13048. // CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  13049. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13050. * This program are made available under the terms of the Apache License, Version 2.0
  13051. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13052. /**
  13053. * @class SuperMap.iPortalShareParam
  13054. * @classdesc iPortal 资源共享参数。
  13055. * @version 10.0.1
  13056. * @category iPortal/Online
  13057. * @param {Object} params - iPortal 资源共享具体参数。
  13058. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型。
  13059. * @param {Array} [params.ids] - 资源的id数组。
  13060. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  13061. */
  13062. class iPortalShareParam_IPortalShareParam {
  13063. constructor(params) {
  13064. params = params || {};
  13065. this.ids = [];
  13066. this.entities = [];
  13067. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  13068. Util_Util.extend(this, params);
  13069. }
  13070. }
  13071. SuperMap.iPortalShareParam = iPortalShareParam_IPortalShareParam;
  13072. // CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  13073. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13074. * This program are made available under the terms of the Apache License, Version 2.0
  13075. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13076. /**
  13077. * @class SuperMap.iPortal
  13078. * @classdesc 对接 SuperMap iPortal 基础服务。
  13079. * @category iPortal/Online
  13080. * @extends {SuperMap.iPortalServiceBase}
  13081. * @param {string} iportalUrl - 地址。
  13082. * @param {Object} options - 参数。
  13083. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  13084. */
  13085. class iPortal_IPortal extends iPortalServiceBase_IPortalServiceBase {
  13086. constructor(iportalUrl, options) {
  13087. super(iportalUrl, options);
  13088. this.iportalUrl = iportalUrl;
  13089. options = options || {};
  13090. this.withCredentials = options.withCredentials || false;
  13091. }
  13092. /**
  13093. * @function SuperMap.iPortal.prototype.load
  13094. * @description 加载页面。
  13095. * @returns {Promise} 返回包含 iportal web 资源信息的 Promise 对象。
  13096. */
  13097. load() {
  13098. return FetchRequest.get(this.iportalUrl + "/web");
  13099. }
  13100. /**
  13101. * @function SuperMap.iPortal.prototype.queryResources
  13102. * @description 查询资源。
  13103. * @version 10.0.1
  13104. * @param {SuperMap.iPortalQueryParam} queryParams - 查询参数。
  13105. * @returns {Promise} 返回包含所有资源结果的 Promise 对象。
  13106. */
  13107. queryResources(queryParams) {
  13108. if (!(queryParams instanceof iPortalQueryParam_IPortalQueryParam)) {
  13109. return new Promise( function(resolve){
  13110. resolve(
  13111. "queryParams is not instanceof iPortalQueryParam !"
  13112. );
  13113. });
  13114. }
  13115. var me = this;
  13116. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  13117. queryParams.t = new Date().getTime();
  13118. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  13119. var content = [];
  13120. result.content.forEach(function(item) {
  13121. content.push(new iPortalResource_IPortalResource(me.iportalUrl, item));
  13122. });
  13123. let queryResult = new iPortalQueryResult_IPortalQueryResult();
  13124. queryResult.content = content;
  13125. queryResult.total = result.total;
  13126. queryResult.currentPage = result.currentPage;
  13127. queryResult.pageSize = result.pageSize;
  13128. queryResult.aggregations = result.aggregations;
  13129. return queryResult;
  13130. });
  13131. }
  13132. /**
  13133. * @function SuperMap.iPortal.prototype.updateResourcesShareSetting
  13134. * @description 更新共享设置。
  13135. * @version 10.0.1
  13136. * @param {SuperMap.iPortalShareParam} shareParams - 共享的参数。
  13137. * @returns {Promise} 返回包含共享资源结果的 Promise 对象。
  13138. */
  13139. updateResourcesShareSetting(shareParams) {
  13140. if (!(shareParams instanceof iPortalShareParam_IPortalShareParam)) {
  13141. return new Promise( function(resolve){
  13142. resolve(
  13143. "shareParams is not instanceof iPortalShareParam !"
  13144. );
  13145. });
  13146. }
  13147. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  13148. if(resourceUrlName === "datas"){
  13149. resourceUrlName = "mycontent/"+resourceUrlName;
  13150. }
  13151. var cloneShareParams = {
  13152. ids: shareParams.ids,
  13153. entities: shareParams.entities
  13154. }
  13155. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  13156. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  13157. return result;
  13158. });
  13159. }
  13160. }
  13161. SuperMap.iPortal = iPortal_IPortal;
  13162. // CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  13163. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13164. * This program are made available under the terms of the Apache License, Version 2.0
  13165. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13166. /**
  13167. * @class SuperMap.iPortalShareEntity
  13168. * @classdesc iPortal 资源共享实体参数。
  13169. * @version 10.0.1
  13170. * @category iPortal/Online
  13171. * @param {Object} shareEntity - iPortal 资源共享实体具体参数。
  13172. * @param {SuperMap.PermissionType} [shareEntity.permissionType] - 权限类型。
  13173. * @param {SuperMap.EntityType} [shareEntity.entityType] - 实体类型
  13174. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、 ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  13175. * @param {number} [shareEntity.entityId] - 实体的 id。用于群组的授权。
  13176. */
  13177. class iPortalShareEntity_IPortalShareEntity {
  13178. constructor(shareEntity) {
  13179. shareEntity = shareEntity || {};
  13180. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  13181. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  13182. this.entityName = "GUEST"; // GUEST or 具体用户 name
  13183. this.entityId = null;
  13184. Util_Util.extend(this, shareEntity);
  13185. }
  13186. }
  13187. SuperMap.iPortalShareEntity = iPortalShareEntity_IPortalShareEntity;
  13188. // CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  13189. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13190. * This program are made available under the terms of the Apache License, Version 2.0
  13191. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13192. /**
  13193. * @class SuperMap.iPortalAddResourceParam
  13194. * @classdesc iPortal 添加资源参数。
  13195. * @version 10.0.1
  13196. * @category iPortal/Online
  13197. * @param {Object} params - iPortal 添加资源具体参数。
  13198. * @param {String} [params.rootUrl] - 服务地址。
  13199. * @param {Array} [params.tags] - 标签。
  13200. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  13201. */
  13202. class iPortalAddResourceParam_IPortalAddResourceParam {
  13203. constructor(params) {
  13204. params = params || {};
  13205. this.rootUrl = "";
  13206. this.tags = [];
  13207. this.entities = [];
  13208. Util_Util.extend(this, params);
  13209. }
  13210. }
  13211. SuperMap.iPortalAddResourceParam = iPortalAddResourceParam_IPortalAddResourceParam;
  13212. // CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  13213. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13214. * This program are made available under the terms of the Apache License, Version 2.0
  13215. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13216. /**
  13217. * @class SuperMap.iPortalRegisterServiceParam
  13218. * @classdesc iPortal 注册服务参数。
  13219. * @version 10.0.1
  13220. * @category iPortal/Online
  13221. * @param {Object} params - iPortal 注册服务具体参数。
  13222. * @param {String} [params.type] - 服务类型。
  13223. * @param {Array} [params.tags] - 服务标签。
  13224. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  13225. * @param {Object} [params.metadata] - 服务元信息。
  13226. * @param {Array} [params.addedMapNames] - 地图服务列表。
  13227. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  13228. */
  13229. class iPortalRegisterServiceParam_IPortalRegisterServiceParam {
  13230. constructor(params) {
  13231. params = params || {};
  13232. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  13233. this.tags = [];
  13234. this.entities = [];
  13235. this.metadata = {};
  13236. this.addedMapNames = [];
  13237. this.addedSceneNames = [];
  13238. Util_Util.extend(this, params);
  13239. }
  13240. }
  13241. SuperMap.iPortalRegisterServiceParam = iPortalRegisterServiceParam_IPortalRegisterServiceParam;
  13242. // CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  13243. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13244. * This program are made available under the terms of the Apache License, Version 2.0
  13245. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13246. /**
  13247. * @class SuperMap.iPortalAddDataParam
  13248. * @classdesc iPortal 上传/注册数据所需的参数。
  13249. * @version 10.0.1
  13250. * @category iPortal/Online
  13251. * @param {Object} params - iPortal 上传/注册数据所需的具体参数。
  13252. * @param {string} params.fileName - 文件名称
  13253. * @param {SuperMap.DataItemType} params.type - 数据类型。
  13254. * @param {Array} [params.tags] - 数据的标签
  13255. * @param {SuperMap.iPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息
  13256. */
  13257. class iPortalAddDataParam_IPortalAddDataParam {
  13258. constructor(params) {
  13259. params = params || {};
  13260. this.fileName = "";
  13261. this.type = "";
  13262. this.tags = [];
  13263. this.dataMetaInfo = {};
  13264. Util_Util.extend(this, params);
  13265. }
  13266. }
  13267. SuperMap.iPortalAddDataParam = iPortalAddDataParam_IPortalAddDataParam;
  13268. // CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  13269. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13270. * This program are made available under the terms of the Apache License, Version 2.0
  13271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13272. /**
  13273. * @class SuperMap.iPortalDataMetaInfoParam
  13274. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  13275. * @version 10.0.1
  13276. * @category iPortal/Online
  13277. * @param {Object} params - iPortal 获取数据项id excel csv类型的数据所需数据元信息具体参数。
  13278. * @param {string} params.xField - X 坐标字段
  13279. * @param {string} params.yField - Y 坐标字段
  13280. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)
  13281. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)
  13282. * @param {array} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为[a,b,,c]。
  13283. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)
  13284. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)
  13285. * @param {boolean} params.url - HDFS注册目录地址
  13286. * @param {SuperMap.iPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息
  13287. */
  13288. class iPortalDataMetaInfoParam_IPortalDataMetaInfoParam {
  13289. constructor(params) {
  13290. params = params || {};
  13291. this.xField = "";
  13292. this.yField = "";
  13293. this.fileEncoding = "UTF-8";
  13294. this.xIndex = 1;
  13295. this.yIndex = 1;
  13296. this.fieldTypes = [];
  13297. this.separator = "";
  13298. this.firstRowIsHead = true;
  13299. this.url = "";
  13300. this.dataStoreInfo = {};
  13301. Util_Util.extend(this, params);
  13302. }
  13303. }
  13304. SuperMap.iPortalDataMetaInfoParam = iPortalDataMetaInfoParam_IPortalDataMetaInfoParam;
  13305. // CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  13306. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13307. * This program are made available under the terms of the Apache License, Version 2.0
  13308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13309. /**
  13310. * @class SuperMap.iPortalDataStoreInfoParam
  13311. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  13312. * @version 10.0.1
  13313. * @category iPortal/Online
  13314. * @param {Object} params - iPortal 注册一个HBASE HDFS数据存储类具体参数。
  13315. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE
  13316. * @param {string} params.url - HDFS数据存储目录地址
  13317. * @param {SuperMap.iPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息
  13318. */
  13319. class iPortalDataStoreInfoParam_IPortalDataStoreInfoParam {
  13320. constructor(params) {
  13321. params = params || {};
  13322. this.type = "";
  13323. this.url = "";
  13324. this.connectionInfo = {};
  13325. Util_Util.extend(this, params);
  13326. }
  13327. }
  13328. SuperMap.iPortalDataStoreInfoParam = iPortalDataStoreInfoParam_IPortalDataStoreInfoParam;
  13329. // CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  13330. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13331. * This program are made available under the terms of the Apache License, Version 2.0
  13332. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13333. /**
  13334. * @class SuperMap.iPortalDataConnectionInfoParam
  13335. * @classdesc iPortal HBASE数据源连接信息类。
  13336. * @version 10.0.1
  13337. * @category iPortal/Online
  13338. * @param {Object} params - iPortal HBASE数据源连接信息类具体参数。
  13339. * @param {string} params.dataBase - 数据源连接的数据库名。
  13340. * @param {string} params.server - 服务地址。
  13341. */
  13342. class iPortalDataConnectionInfoParam_IPortalDataConnectionInfoParam {
  13343. constructor(params) {
  13344. params = params || {};
  13345. this.dataBase = "";
  13346. this.server = "";
  13347. Util_Util.extend(this, params);
  13348. }
  13349. }
  13350. SuperMap.iPortalDataConnectionInfoParam = iPortalDataConnectionInfoParam_IPortalDataConnectionInfoParam;
  13351. // CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  13352. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13353. * This program are made available under the terms of the Apache License, Version 2.0
  13354. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13355. /**
  13356. * @class SuperMap.iPortalUser
  13357. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  13358. * @version 10.0.1
  13359. * @category iPortal/Online
  13360. * @param {string} iportalUrl - iportal根地址。
  13361. * @extends {SuperMap.iPortalServiceBase}
  13362. *
  13363. */
  13364. class iPortalUser_IPortalUser extends iPortalServiceBase_IPortalServiceBase {
  13365. constructor(iportalUrl) {
  13366. super(iportalUrl);
  13367. this.iportalUrl = iportalUrl;
  13368. }
  13369. /**
  13370. * @function SuperMap.iPortalUser.prototype.deleteResources
  13371. * @description 删除资源。
  13372. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  13373. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  13374. */
  13375. deleteResources(params) {
  13376. var resourceName = params.resourceType.replace("_","").toLowerCase();
  13377. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  13378. if( resourceName === 'data') {
  13379. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  13380. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  13381. }
  13382. return this.request("DELETE", deleteResourceUrl);
  13383. }
  13384. /**
  13385. * @function SuperMap.iPortalUser.prototype.addMap
  13386. * @description 添加地图。
  13387. * @version 10.1.0
  13388. * @param {SuperMap.iPortalAddResourceParam} addMapParams - 添加地图的参数。
  13389. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  13390. */
  13391. addMap(addMapParams) {
  13392. if (!(addMapParams instanceof iPortalAddResourceParam_IPortalAddResourceParam)) {
  13393. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  13394. }
  13395. let cloneAddMapParams = {
  13396. rootUrl: addMapParams.rootUrl,
  13397. tags: addMapParams.tags,
  13398. authorizeSetting: addMapParams.entities
  13399. }
  13400. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  13401. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  13402. return result;
  13403. });
  13404. }
  13405. /**
  13406. * @function SuperMap.iPortalUser.prototype.addScene
  13407. * @description 添加场景。
  13408. * @version 10.1.0
  13409. * @param {SuperMap.iPortalAddResourceParam} addSceneParams - 添加场景的参数。
  13410. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  13411. */
  13412. addScene(addSceneParams) {
  13413. if (!(addSceneParams instanceof iPortalAddResourceParam_IPortalAddResourceParam)) {
  13414. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  13415. }
  13416. let cloneAddSceneParams = {
  13417. rootUrl: addSceneParams.rootUrl,
  13418. tags: addSceneParams.tags,
  13419. authorizeSetting: addSceneParams.entities
  13420. }
  13421. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  13422. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  13423. return result;
  13424. });
  13425. }
  13426. /**
  13427. * @function SuperMap.iPortalUser.prototype.registerService
  13428. * @description 注册服务。
  13429. * @version 10.1.0
  13430. * @param {SuperMap.iPortalRegisterServiceParam} registerParams - 注册服务的参数。
  13431. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  13432. */
  13433. registerService(registerParams) {
  13434. if(!(registerParams instanceof iPortalRegisterServiceParam_IPortalRegisterServiceParam)) {
  13435. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  13436. }
  13437. let cloneRegisterParams = {
  13438. type: registerParams.type,
  13439. tags: registerParams.tags,
  13440. authorizeSetting: registerParams.entities,
  13441. metadata: registerParams.metadata,
  13442. addedMapNames: registerParams.addedMapNames,
  13443. addedSceneNames: registerParams.addedSceneNames
  13444. }
  13445. let registerUrl = this.iportalUrl + "/web/services.json";
  13446. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  13447. return result;
  13448. });
  13449. }
  13450. /**
  13451. * @function SuperMap.iPortalUser.prototype.getErrMsgPromise
  13452. * @description 获取包含错误信息的Promise对象。
  13453. * @version 10.1.0
  13454. * @param {String} errMsg - 传入的错误信息。
  13455. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  13456. */
  13457. getErrMsgPromise(errMsg) {
  13458. return new Promise(resolve => {
  13459. resolve(errMsg);
  13460. })
  13461. }
  13462. /**
  13463. * @function SuperMap.iPortalUser.prototype.uploadDataRequest
  13464. * @description 上传数据。
  13465. * @version 10.1.0
  13466. * @param {number} id - 上传数据的资源id。
  13467. * @param {Object} formData - 请求体为文本数据流。
  13468. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  13469. */
  13470. uploadDataRequest(id,formData) {
  13471. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  13472. return this.request("POST",uploadDataUrl,formData);
  13473. }
  13474. /**
  13475. * @function SuperMap.iPortalUser.prototype.addData
  13476. * @description 上传/注册数据。
  13477. * @version 10.1.0
  13478. * @param {SuperMap.iPortalAddDataParam} params - 上传/注册数据所需的参数。
  13479. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  13480. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  13481. */
  13482. addData(params,formData) {
  13483. if(!(params instanceof iPortalAddDataParam_IPortalAddDataParam)){
  13484. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  13485. }
  13486. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  13487. var entity = {
  13488. fileName:params.fileName,
  13489. tags:params.tags,
  13490. type:params.type
  13491. };
  13492. var type = params.type.toLowerCase();
  13493. var dataMetaInfo;
  13494. if(type === "excel" || type === "csv"){
  13495. if(!(params.dataMetaInfo instanceof iPortalDataMetaInfoParam_IPortalDataMetaInfoParam)){
  13496. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  13497. }
  13498. dataMetaInfo = {
  13499. xField:params.dataMetaInfo.xField,
  13500. yField:params.dataMetaInfo.yField
  13501. }
  13502. if(type === 'csv') {
  13503. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  13504. }
  13505. entity.coordType = "WGS84";
  13506. entity.dataMetaInfo = dataMetaInfo;
  13507. }else if(type === "hdfs" || type === "hbase") {
  13508. if(!(params.dataMetaInfo instanceof iPortalDataMetaInfoParam_IPortalDataMetaInfoParam)){
  13509. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  13510. }
  13511. if(!(params.dataMetaInfo.dataStoreInfo instanceof iPortalDataStoreInfoParam_IPortalDataStoreInfoParam)){
  13512. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  13513. }
  13514. var dataStoreInfo = {
  13515. type:params.dataMetaInfo.dataStoreInfo.type
  13516. }
  13517. switch (type) {
  13518. case "hdfs":
  13519. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  13520. dataMetaInfo = {
  13521. url: params.dataMetaInfo.url,
  13522. dataStoreInfo:dataStoreInfo
  13523. }
  13524. break;
  13525. case "hbase":
  13526. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof iPortalDataConnectionInfoParam_IPortalDataConnectionInfoParam)){
  13527. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  13528. }
  13529. dataStoreInfo.connectionInfo = {
  13530. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  13531. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  13532. engineType:'HBASE'
  13533. }
  13534. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  13535. dataMetaInfo = {
  13536. dataStoreInfo:dataStoreInfo
  13537. }
  13538. break;
  13539. }
  13540. entity.dataMetaInfo = dataMetaInfo;
  13541. }
  13542. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  13543. if(type === "hdfs" || type === "hbase"){
  13544. return res;
  13545. }else {
  13546. if(res.childID) {
  13547. return this.uploadDataRequest(res.childID,formData);
  13548. }else {
  13549. return res.customResult;
  13550. }
  13551. }
  13552. })
  13553. }
  13554. /**
  13555. * @function SuperMap.iPortalUser.prototype.publishOrUnpublish
  13556. * @description 发布/取消发布。
  13557. * @version 10.1.0
  13558. * @param {object} options - 发布/取消发布数据服务所需的参数。
  13559. * @param {object} options.dataId - 数据项id。
  13560. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  13561. * @param {object} [options.dataServiceId] - 发布的服务 id。
  13562. * @param {boolean} forPublish - 是否取消发布。
  13563. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  13564. */
  13565. publishOrUnpublish(option,forPublish){
  13566. if(!option.dataId || !option.serviceType) {
  13567. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  13568. }
  13569. var dataId = option.dataId;
  13570. var dataServiceId = option.dataServiceId;
  13571. var serviceType = option.serviceType;
  13572. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  13573. if (dataServiceId) {
  13574. publishUrl += "&dataServiceId=" + dataServiceId;
  13575. }
  13576. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  13577. // 发起服务状态查询
  13578. if(forPublish) {
  13579. // 发布服务的结果异步处理
  13580. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  13581. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  13582. dataServiceId = res.customResult;
  13583. }
  13584. return dataServiceId;
  13585. }else {
  13586. // 取消发布的结果同步处理
  13587. return res;
  13588. }
  13589. });
  13590. }
  13591. /**
  13592. * @function SuperMap.iPortalUser.prototype.getDataPublishedStatus
  13593. * @description 查询服务状态,发起服务状态查询。
  13594. * @version 10.1.0
  13595. * @param {number} dataId - 查询服务状态的数据项id。
  13596. * @param {string} dataServiceId - 发布的服务id。
  13597. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  13598. */
  13599. getDataPublishedStatus(dataId,dataServiceId){
  13600. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  13601. return this.request("GET",publishStateUrl);
  13602. }
  13603. /**
  13604. * @function SuperMap.iPortalUser.prototype.unPublishedDataService
  13605. * @description 取消发布。
  13606. * @version 10.1.0
  13607. * @param {object} options - 取消发布服务具体参数。
  13608. * @param {object} options.dataId - 数据项id。
  13609. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  13610. * @param {object} [options.dataServiceId] - 发布的服务 id。
  13611. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  13612. */
  13613. unPublishDataService(option){
  13614. return this.publishOrUnpublish(option,false);
  13615. }
  13616. /**
  13617. * @function SuperMap.iPortalUser.prototype.publishedDataService
  13618. * @description 发布数据服务。
  13619. * @version 10.1.0
  13620. * @param {object} options - 发布数据服务具体参数。
  13621. * @param {object} options.dataId - 数据项id。
  13622. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  13623. * @param {object} [options.dataServiceId] - 发布的服务 id。
  13624. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  13625. */
  13626. publishDataService(option){
  13627. return this.publishOrUnpublish(option,true);
  13628. }
  13629. }
  13630. SuperMap.iPortalUser = iPortalUser_IPortalUser;
  13631. // CONCATENATED MODULE: ./src/common/iPortal/index.js
  13632. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13633. * This program are made available under the terms of the Apache License, Version 2.0
  13634. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13635. // CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  13636. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13637. * This program are made available under the terms of the Apache License, Version 2.0
  13638. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13639. /**
  13640. * @class SuperMap.CommonServiceBase
  13641. * @category iServer
  13642. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  13643. * @param {string} url - 服务地址。
  13644. * @param {Object} options - 参数。
  13645. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  13646. * @param {string} [options.proxy] - 服务代理地址。
  13647. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  13648. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  13649. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13650. * @param {Object} [options.headers] - 请求头。
  13651. */
  13652. class CommonServiceBase_CommonServiceBase {
  13653. constructor(url, options) {
  13654. let me = this;
  13655. this.EVENT_TYPES = ["processCompleted", "processFailed"];
  13656. this.events = null;
  13657. this.eventListeners = null;
  13658. this.url = null;
  13659. this.urls = null;
  13660. this.proxy = null;
  13661. this.serverType = null;
  13662. this.index = null;
  13663. this.length = null;
  13664. this.options = null;
  13665. this.totalTimes = null;
  13666. this.POLLING_TIMES = 3;
  13667. this._processSuccess = null;
  13668. this._processFailed = null;
  13669. this.isInTheSameDomain = null;
  13670. this.withCredentials = false;
  13671. if (Util_Util.isArray(url)) {
  13672. me.urls = url;
  13673. me.length = url.length;
  13674. me.totalTimes = me.length;
  13675. if (me.length === 1) {
  13676. me.url = url[0];
  13677. } else {
  13678. me.index = parseInt(Math.random() * me.length);
  13679. me.url = url[me.index];
  13680. }
  13681. } else {
  13682. me.totalTimes = 1;
  13683. me.url = url;
  13684. }
  13685. if (Util_Util.isArray(url) && !me.isServiceSupportPolling()) {
  13686. me.url = url[0];
  13687. me.totalTimes = 1;
  13688. }
  13689. me.serverType = me.serverType || ServerType.ISERVER;
  13690. options = options || {};
  13691. this.crossOrigin = options.crossOrigin;
  13692. this.headers = options.headers;
  13693. Util_Util.extend(this, options);
  13694. me.isInTheSameDomain = Util_Util.isInTheSameDomain(me.url);
  13695. me.events = new Events_Events(me, null, me.EVENT_TYPES, true);
  13696. if (me.eventListeners instanceof Object) {
  13697. me.events.on(me.eventListeners);
  13698. }
  13699. this.CLASS_NAME = "SuperMap.CommonServiceBase";
  13700. }
  13701. /**
  13702. * @function SuperMap.CommonServiceBase.prototype.destroy
  13703. * @description 释放资源,将引用的资源属性置空。
  13704. */
  13705. destroy() {
  13706. let me = this;
  13707. if (Util_Util.isArray(me.urls)) {
  13708. me.urls = null;
  13709. me.index = null;
  13710. me.length = null;
  13711. me.totalTimes = null;
  13712. }
  13713. me.url = null;
  13714. me.options = null;
  13715. me._processSuccess = null;
  13716. me._processFailed = null;
  13717. me.isInTheSameDomain = null;
  13718. me.EVENT_TYPES = null;
  13719. if (me.events) {
  13720. me.events.destroy();
  13721. me.events = null;
  13722. }
  13723. if (me.eventListeners) {
  13724. me.eventListeners = null;
  13725. }
  13726. }
  13727. /**
  13728. * @function SuperMap.CommonServiceBase.prototype.request
  13729. * @description: 该方法用于向服务发送请求。
  13730. * @param {Object} options - 参数。
  13731. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  13732. * @param {string} [options.url] - 发送请求的地址。
  13733. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  13734. * @param {string} [options.data] - 发送到服务器的数据。
  13735. * @param {function} options.success - 请求成功后的回调函数。
  13736. * @param {function} options.failure - 请求失败后的回调函数。
  13737. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  13738. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  13739. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  13740. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13741. * @param {Object} [options.headers] - 请求头。
  13742. */
  13743. request(options) {
  13744. let me = this;
  13745. options.url = options.url || me.url;
  13746. options.proxy = options.proxy || me.proxy;
  13747. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  13748. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  13749. options.headers = options.headers || me.headers;
  13750. options.isInTheSameDomain = me.isInTheSameDomain;
  13751. //为url添加安全认证信息片段
  13752. let credential = this.getCredential(options.url);
  13753. if (credential) {
  13754. options.url = Util_Util.urlAppend(options.url, credential.getUrlParameters());
  13755. }
  13756. me.calculatePollingTimes();
  13757. me._processSuccess = options.success;
  13758. me._processFailed = options.failure;
  13759. options.scope = me;
  13760. options.success = me.getUrlCompleted;
  13761. options.failure = me.getUrlFailed;
  13762. me.options = options;
  13763. me._commit(me.options);
  13764. }
  13765. /**
  13766. * @function SuperMap.CommonServiceBase.prototype.getCredential
  13767. * @description 获取凭据信息
  13768. * @param {string} url - 服务地址。
  13769. * @returns {SuperMap.Credential} 凭据信息对象。
  13770. */
  13771. getCredential(url) {
  13772. let keyUrl = url,
  13773. credential, value;
  13774. switch (this.serverType) {
  13775. case ServerType.IPORTAL:
  13776. value = SecurityManager_SecurityManager.getToken(keyUrl);
  13777. credential = value ? new Credential(value, "token") : null;
  13778. if (!credential) {
  13779. value = SecurityManager_SecurityManager.getKey(keyUrl);
  13780. credential = value ? new Credential(value, "key") : null;
  13781. }
  13782. break;
  13783. case ServerType.ONLINE:
  13784. value = SecurityManager_SecurityManager.getKey(keyUrl);
  13785. credential = value ? new Credential(value, "key") : null;
  13786. break;
  13787. default:
  13788. //iServer or others
  13789. value = SecurityManager_SecurityManager.getToken(keyUrl);
  13790. credential = value ? new Credential(value, "token") : null;
  13791. break;
  13792. }
  13793. return credential;
  13794. }
  13795. /**
  13796. * @function SuperMap.CommonServiceBase.prototype.getUrlCompleted
  13797. * @description 请求成功后执行此方法。
  13798. * @param {Object} result - 服务器返回的结果对象。
  13799. */
  13800. getUrlCompleted(result) {
  13801. let me = this;
  13802. me._processSuccess(result);
  13803. }
  13804. /**
  13805. * @function SuperMap.CommonServiceBase.prototype.getUrlFailed
  13806. * @description 请求失败后执行此方法。
  13807. * @param {Object} result - 服务器返回的结果对象。
  13808. */
  13809. getUrlFailed(result) {
  13810. let me = this;
  13811. if (me.totalTimes > 0) {
  13812. me.totalTimes--;
  13813. me.ajaxPolling();
  13814. } else {
  13815. me._processFailed(result);
  13816. }
  13817. }
  13818. /**
  13819. *
  13820. * @function SuperMap.CommonServiceBase.prototype.ajaxPolling
  13821. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
  13822. */
  13823. ajaxPolling() {
  13824. let me = this,
  13825. url = me.options.url,
  13826. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  13827. me.index = parseInt(Math.random() * me.length);
  13828. me.url = me.urls[me.index];
  13829. url = url.replace(re, re.exec(me.url)[0]);
  13830. me.options.url = url;
  13831. me.options.isInTheSameDomain = Util_Util.isInTheSameDomain(url);
  13832. me._commit(me.options);
  13833. }
  13834. /**
  13835. * @function SuperMap.CommonServiceBase.prototype.calculatePollingTimes
  13836. * @description 计算剩余请求失败执行次数。
  13837. */
  13838. calculatePollingTimes() {
  13839. let me = this;
  13840. if (me.times) {
  13841. if (me.totalTimes > me.POLLING_TIMES) {
  13842. if (me.times > me.POLLING_TIMES) {
  13843. me.totalTimes = me.POLLING_TIMES;
  13844. } else {
  13845. me.totalTimes = me.times;
  13846. }
  13847. } else {
  13848. if (me.times < me.totalTimes) {
  13849. me.totalTimes = me.times;
  13850. }
  13851. }
  13852. } else {
  13853. if (me.totalTimes > me.POLLING_TIMES) {
  13854. me.totalTimes = me.POLLING_TIMES;
  13855. }
  13856. }
  13857. me.totalTimes--;
  13858. }
  13859. /**
  13860. * @function SuperMap.CommonServiceBase.prototype.isServiceSupportPolling
  13861. * @description 判断服务是否支持轮询。
  13862. */
  13863. isServiceSupportPolling() {
  13864. let me = this;
  13865. return !(
  13866. me.CLASS_NAME === "SuperMap.REST.ThemeService" ||
  13867. me.CLASS_NAME === "SuperMap.REST.EditFeaturesService"
  13868. );
  13869. }
  13870. /**
  13871. * @function SuperMap.CommonServiceBase.prototype.serviceProcessCompleted
  13872. * @description 状态完成,执行此方法。
  13873. * @param {Object} result - 服务器返回的结果对象。
  13874. */
  13875. serviceProcessCompleted(result) {
  13876. result = Util_Util.transformResult(result);
  13877. this.events.triggerEvent("processCompleted", {
  13878. result: result
  13879. });
  13880. }
  13881. /**
  13882. * @function SuperMap.CommonServiceBase.prototype.serviceProcessFailed
  13883. * @description 状态失败,执行此方法。
  13884. * @param {Object} result - 服务器返回的结果对象。
  13885. */
  13886. serviceProcessFailed(result) {
  13887. result = Util_Util.transformResult(result);
  13888. let error = result.error || result;
  13889. this.events.triggerEvent("processFailed", {
  13890. error: error
  13891. });
  13892. }
  13893. _commit(options) {
  13894. if (options.method === "POST" || options.method === "PUT") {
  13895. if (options.params) {
  13896. options.url = Util_Util.urlAppend(options.url,
  13897. Util_Util.getParameterString(options.params || {}));
  13898. }
  13899. options.params = options.data;
  13900. }
  13901. FetchRequest.commit(options.method, options.url, options.params, {
  13902. headers: options.headers,
  13903. withCredentials: options.withCredentials,
  13904. crossOrigin: options.crossOrigin,
  13905. timeout: options.async ? 0 : null,
  13906. proxy: options.proxy
  13907. }).then(function (response) {
  13908. if (response.text) {
  13909. return response.text();
  13910. }
  13911. if (response.json) {
  13912. return response.json();
  13913. }
  13914. return response;
  13915. }).then(function (text) {
  13916. var result = text;
  13917. if (typeof text === "string") {
  13918. result = new JSON_JSONFormat().read(text);
  13919. }
  13920. if (!result || result.error || result.code >= 300 && result.code !== 304) {
  13921. if (result && result.error) {
  13922. result = {
  13923. error: result.error
  13924. };
  13925. } else {
  13926. result = {
  13927. error: result
  13928. };
  13929. }
  13930. }
  13931. if (result.error) {
  13932. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  13933. failure(result);
  13934. } else {
  13935. result.succeed = result.succeed == undefined ? true : result.succeed;
  13936. var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
  13937. success(result);
  13938. }
  13939. }).catch(function (e) {
  13940. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  13941. failure(e);
  13942. })
  13943. }
  13944. }
  13945. SuperMap.CommonServiceBase = CommonServiceBase_CommonServiceBase;
  13946. /**
  13947. * 服务器请求回调函数
  13948. * @callback RequestCallback
  13949. * @example
  13950. * var requestCallback = function (serviceResult){
  13951. * console.log(serviceResult.result);
  13952. * }
  13953. * new QueryService(url).queryByBounds(param, requestCallback);
  13954. * @param {Object} serviceResult
  13955. * @param {Object} serviceResult.result 服务器返回结果。
  13956. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  13957. * @param {Object} serviceResult.type 事件类型。
  13958. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  13959. */
  13960. // CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  13961. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  13962. * This program are made available under the terms of the Apache License, Version 2.0
  13963. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13964. /**
  13965. * @class SuperMap.GeoCodingParameter
  13966. * @category iServer AddressMatch
  13967. * @classdesc 地理正向匹配参数类。
  13968. * @param {Object} options - 参数。
  13969. * @param {string} options.address - 地点关键词。
  13970. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  13971. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  13972. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  13973. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  13974. * @param {number} [options.maxReturn] - 最大返回结果数。
  13975. */
  13976. class GeoCodingParameter_GeoCodingParameter {
  13977. constructor(options) {
  13978. if (options.filters && typeof(options.filters) === 'string') {
  13979. options.filters = options.filters.split(',');
  13980. }
  13981. /**
  13982. * @member {string} SuperMap.GeoCodingParameter.prototype.address
  13983. * @description 地点关键词。
  13984. */
  13985. this.address = null;
  13986. /**
  13987. * @member {number} [SuperMap.GeoCodingParameter.prototype.fromIndex]
  13988. * @description 设置返回对象的起始索引值。
  13989. */
  13990. this.fromIndex = null;
  13991. /**
  13992. * @member {number} [SuperMap.GeoCodingParameter.prototype.toIndex]
  13993. * @description 设置返回对象的结束索引值。
  13994. */
  13995. this.toIndex = null;
  13996. /**
  13997. * @member {Array.<string>} [SuperMap.GeoCodingParameter.prototype.filters]
  13998. * @description 过滤字段,限定查询区域。
  13999. */
  14000. this.filters = null;
  14001. /**
  14002. * @member {string} [SuperMap.GeoCodingParameter.prototype.prjCoordSys]
  14003. * @description 查询结果的坐标系。
  14004. */
  14005. this.prjCoordSys = null;
  14006. /**
  14007. * @member {number} [SuperMap.GeoCodingParameter.prototype.maxReturn]
  14008. * @description 最大返回结果数。
  14009. */
  14010. this.maxReturn = null;
  14011. Util_Util.extend(this, options);
  14012. }
  14013. /**
  14014. * @function SuperMap.GeoCodingParameter.prototype.destroy
  14015. * @description 释放资源,将引用资源的属性置空。
  14016. */
  14017. destroy() {
  14018. this.address = null;
  14019. this.fromIndex = null;
  14020. this.toIndex = null;
  14021. this.filters = null;
  14022. this.prjCoordSys = null;
  14023. this.maxReturn = null;
  14024. }
  14025. }
  14026. SuperMap.GeoCodingParameter = GeoCodingParameter_GeoCodingParameter;
  14027. // CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  14028. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14029. * This program are made available under the terms of the Apache License, Version 2.0
  14030. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14031. /**
  14032. * @class SuperMap.GeoDecodingParameter
  14033. * @category iServer AddressMatch
  14034. * @classdesc 地理反向匹配参数类。
  14035. * @param {Object} options - 参数。
  14036. * @param {number} options.x - 查询位置的横坐标。
  14037. * @param {number} options.y - 查询位置的纵坐标。
  14038. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  14039. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  14040. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  14041. * @param {number} [options.maxReturn] - 最大返回结果数。
  14042. * @param {number} [options.geoDecodingRadius] - 查询半径。
  14043. */
  14044. class GeoDecodingParameter_GeoDecodingParameter {
  14045. constructor(options) {
  14046. if (options.filters) {
  14047. options.filters = options.filters.split(',');
  14048. }
  14049. /**
  14050. * @member {number} SuperMap.GeoDecodingParameter.prototype.x
  14051. * @description 查询位置的横坐标。
  14052. */
  14053. this.x = null;
  14054. /**
  14055. * @member {number} SuperMap.GeoDecodingParameter.prototype.y
  14056. * @description 查询位置的纵坐标。
  14057. */
  14058. this.y = null;
  14059. /**
  14060. * @member {number} [SuperMap.GeoDecodingParameter.prototype.fromIndex]
  14061. * @description 设置返回对象的起始索引值。
  14062. */
  14063. this.fromIndex = null;
  14064. /**
  14065. * @member {number} [SuperMap.GeoDecodingParameter.prototype.toIndex]
  14066. * @description 设置返回对象的结束索引值。
  14067. */
  14068. this.toIndex = null;
  14069. /**
  14070. * @member {Array.<string>} [SuperMap.GeoDecodingParameter.prototype.filters]
  14071. * @description 过滤字段,限定查询区域。
  14072. */
  14073. this.filters = null;
  14074. /**
  14075. * @member {string} [SuperMap.GeoDecodingParameter.prototype.prjCoordSys]
  14076. * @description 查询结果的坐标系。
  14077. */
  14078. this.prjCoordSys = null;
  14079. /**
  14080. * @member {number} [SuperMap.GeoDecodingParameter.prototype.maxReturn]
  14081. * @description 最大返回结果数。
  14082. */
  14083. this.maxReturn = null;
  14084. /**
  14085. * @member {number} SuperMap.GeoDecodingParameter.prototype.geoDecodingRadius
  14086. * @description 查询半径。
  14087. */
  14088. this.geoDecodingRadius = null;
  14089. Util_Util.extend(this, options);
  14090. }
  14091. /**
  14092. * @function SuperMap.GeoDecodingParameter.prototype.destroy
  14093. * @description 释放资源,将引用资源的属性置空。
  14094. */
  14095. destroy() {
  14096. this.x = null;
  14097. this.y = null;
  14098. this.fromIndex = null;
  14099. this.toIndex = null;
  14100. this.filters = null;
  14101. this.prjCoordSys = null;
  14102. this.maxReturn = null;
  14103. this.geoDecodingRadius = null;
  14104. }
  14105. }
  14106. SuperMap.GeoDecodingParameter = GeoDecodingParameter_GeoDecodingParameter;
  14107. // CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  14108. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14109. * This program are made available under the terms of the Apache License, Version 2.0
  14110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14111. /**
  14112. * @class SuperMap.AddressMatchService
  14113. * @category iServer AddressMatch
  14114. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  14115. * @param {string} url - 地址匹配服务地址。
  14116. * @param {Object} options - 参数。
  14117. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14118. * @param {Object} [options.headers] - 请求头。
  14119. */
  14120. class AddressMatchService_AddressMatchService extends CommonServiceBase_CommonServiceBase {
  14121. constructor(url, options) {
  14122. super(url, options);
  14123. this.options = options || {};
  14124. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  14125. }
  14126. /**
  14127. * @function SuperMap.AddressMatchService.prototype.destroy
  14128. * @override
  14129. */
  14130. destroy() {
  14131. super.destroy();
  14132. }
  14133. /**
  14134. * @function SuperMap.AddressMatchService.prototype.code
  14135. * @param {string} url - 正向地址匹配服务地址。
  14136. * @param {SuperMap.GeoCodingParameter} params - 正向地址匹配服务参数。
  14137. */
  14138. code(url, params) {
  14139. if (!(params instanceof GeoCodingParameter_GeoCodingParameter)) {
  14140. return;
  14141. }
  14142. this.processAsync(url, params);
  14143. }
  14144. /**
  14145. * @function SuperMap.AddressMatchService.prototype.decode
  14146. * @param {string} url - 反向地址匹配服务地址。
  14147. * @param {SuperMap.GeoDecodingParameter} params - 反向地址匹配服务参数。
  14148. */
  14149. decode(url, params) {
  14150. if (!(params instanceof GeoDecodingParameter_GeoDecodingParameter)) {
  14151. return;
  14152. }
  14153. this.processAsync(url, params);
  14154. }
  14155. /**
  14156. * @function SuperMap.AddressMatchService.prototype.processAsync
  14157. * @description 负责将客户端的动态分段服务参数传递到服务端。
  14158. * @param {string} url - 服务地址。
  14159. * @param {Object} params - 参数。
  14160. */
  14161. processAsync(url, params) {
  14162. this.request({
  14163. method: 'GET',
  14164. url,
  14165. params,
  14166. scope: this,
  14167. success: this.serviceProcessCompleted,
  14168. failure: this.serviceProcessFailed
  14169. });
  14170. }
  14171. /**
  14172. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  14173. * @param {Object} result - 服务器返回的结果对象。
  14174. * @description 服务流程是否完成
  14175. */
  14176. serviceProcessCompleted(result) {
  14177. if (result.succeed) {
  14178. delete result.succeed;
  14179. }
  14180. super.serviceProcessCompleted(result);
  14181. }
  14182. /**
  14183. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  14184. * @param {Object} result - 服务器返回的结果对象。
  14185. * @description 服务流程是否失败
  14186. */
  14187. serviceProcessFailed(result) {
  14188. super.serviceProcessFailed(result);
  14189. }
  14190. }
  14191. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  14192. // CONCATENATED MODULE: ./src/common/iServer/AggQueryBuilderParameter.js
  14193. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14194. * This program are made available under the terms of the Apache License, Version 2.0
  14195. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14196. /**
  14197. * @class SuperMap.AggQueryBuilderParameter
  14198. * @classdesc 聚合查询 QueryBuilder 参数基类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  14199. * @category iServer Data FeatureResults
  14200. * @param {Object} option - 初始化参数。
  14201. * @param {string} option.name - 查询结果名称。
  14202. * @param {SuperMap.AggregationQueryBuilderType} option.queryType - 查询类型。
  14203. */
  14204. class AggQueryBuilderParameter_AggQueryBuilderParameter {
  14205. constructor(option) {
  14206. /**
  14207. * @member {string} SuperMap.AggQueryBuilderParameter.prototype.name
  14208. * @description 查询结果名称。
  14209. */
  14210. this.name = null;
  14211. /**
  14212. * @member {SuperMap.AggregationQueryBuilderType} SuperMap.AggQueryBuilderParameter.prototype.queryType
  14213. * @description 查询类型。
  14214. */
  14215. this.queryType = null;
  14216. this.CLASS_NAME = "SuperMap.AggQueryBuilderParameter";
  14217. Util_Util.extend(this, option);
  14218. }
  14219. destroy() {
  14220. var me = this;
  14221. me.name = null;
  14222. me.queryType = null;
  14223. }
  14224. }
  14225. SuperMap.AggQueryBuilderParameter = AggQueryBuilderParameter_AggQueryBuilderParameter;
  14226. // CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  14227. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14228. * This program are made available under the terms of the Apache License, Version 2.0
  14229. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14230. /**
  14231. * @class SuperMap.AggregationParameter
  14232. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  14233. * @category iServer Data FeatureResults
  14234. * @param {Object} options - 初始化参数。
  14235. * @param {string} options.aggName - 聚合名称。
  14236. * @param {SuperMap.AggregationType} options.aggType - 聚合类型设置。
  14237. * @param {string} options.aggFieldName - 聚合字段。
  14238. * @param {SuperMap.AggregationParameter} options.subAgg - 子聚合类。
  14239. *
  14240. */
  14241. class AggregationParameter_AggregationParameter {
  14242. constructor(options) {
  14243. /**
  14244. * @member {string} SuperMap.AggregationParameter.prototype.aggName
  14245. * @description 聚合名称。
  14246. */
  14247. this.aggName = null;
  14248. /**
  14249. * @member {SuperMap.AggregationType} SuperMap.AggregationParameter.prototype.aggType
  14250. * @description 聚合类型设置类。
  14251. */
  14252. this.aggType = null;
  14253. /**
  14254. * @member {string} SuperMap.AggregationParameter.prototype.aggFieldName
  14255. * @description 聚合字段。
  14256. */
  14257. this.aggFieldName = null;
  14258. /**
  14259. * @member {SuperMap.AggregationParameter} SuperMap.AggregationParameter.prototype.subAgg
  14260. * @description 子聚合。
  14261. */
  14262. this.subAgg = null;
  14263. this.CLASS_NAME = "SuperMap.AggregationParameter";
  14264. Util_Util.extend(this, options);
  14265. }
  14266. destroy() {
  14267. var me = this;
  14268. me.aggName = null;
  14269. me.aggFieldName = null;
  14270. me.aggType = null;
  14271. if (me.subAgg) {
  14272. me.subAgg = null;
  14273. }
  14274. }
  14275. }
  14276. SuperMap.AggregationParameter = AggregationParameter_AggregationParameter;
  14277. // CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  14278. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14279. * This program are made available under the terms of the Apache License, Version 2.0
  14280. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14281. /**
  14282. * @class SuperMap.AreaSolarRadiationParameters
  14283. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  14284. * @classdesc 地区太阳辐射参数类。
  14285. * @param {Object} options - 参数。
  14286. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  14287. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  14288. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  14289. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  14290. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  14291. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  14292. * @param {number} options.latitude - 待计算区域的纬度值。
  14293. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  14294. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  14295. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  14296. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  14297. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  14298. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  14299. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  14300. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  14301. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  14302. */
  14303. class AreaSolarRadiationParameters_AreaSolarRadiationParameters {
  14304. constructor(options) {
  14305. /**
  14306. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.dataset
  14307. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  14308. */
  14309. this.dataset = null;
  14310. /**
  14311. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.targetDatasourceName
  14312. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  14313. */
  14314. this.targetDatasourceName = null;
  14315. /**
  14316. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.totalGridName
  14317. * @description 指定地区太阳辐射总辐射量数据集的名称。
  14318. */
  14319. this.totalGridName = null;
  14320. /**
  14321. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  14322. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  14323. */
  14324. this.diffuseDatasetGridName = null;
  14325. /**
  14326. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  14327. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  14328. */
  14329. this.durationDatasetGridName = null;
  14330. /**
  14331. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  14332. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  14333. */
  14334. this.directDatasetGridName = null;
  14335. /**
  14336. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.latitude
  14337. * @description 待计算区域的纬度值。
  14338. */
  14339. this.latitude = null;
  14340. /**
  14341. * @member {string} [SuperMap.AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  14342. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  14343. */
  14344. this.timeMode = "MULTIDAYS";
  14345. /**
  14346. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayStart
  14347. * @description 起始日期(年内的第几天)。
  14348. */
  14349. this.dayStart = null;
  14350. /**
  14351. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayEnd
  14352. * @description 结束日期(年内的第几天)。
  14353. */
  14354. this.dayEnd = null;
  14355. /**
  14356. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourStart]
  14357. * @description 起始时间(一天中的第几个小时)。
  14358. */
  14359. this.hourStart = null;
  14360. /**
  14361. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourEnd]
  14362. * @description 结束时间(一天中的第几个小时)。
  14363. */
  14364. this.hourEnd = null;
  14365. /**
  14366. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.transmittance]
  14367. * @description 太阳辐射穿过大气的透射率。
  14368. */
  14369. this.transmittance = null;
  14370. /**
  14371. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  14372. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  14373. */
  14374. this.hourInterval = null;
  14375. /**
  14376. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.dayInterval=5]
  14377. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  14378. */
  14379. this.dayInterval = null;
  14380. /**
  14381. * @member {boolean} [SuperMap.AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  14382. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  14383. */
  14384. this.deleteExistResultDataset = false;
  14385. Util_Util.extend(this, options);
  14386. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  14387. }
  14388. /**
  14389. * @function SuperMap.AreaSolarRadiationParameters.prototype.destroy
  14390. * @description 释放资源,将引用资源的属性置空。
  14391. */
  14392. destroy() {
  14393. var me = this;
  14394. me.dataset = null;
  14395. me.zFactor = 1.0;
  14396. me.averageCurvatureName = null;
  14397. me.profileCurvatureName = null;
  14398. me.planCurvatureName = null;
  14399. me.deleteExistResultDataset = true;
  14400. }
  14401. /**
  14402. * @function SuperMap.AreaSolarRadiationParameters.toObject
  14403. * @param {SuperMap.AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  14404. * @param {SuperMap.AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  14405. * @returns {Object} JSON对象。
  14406. * @description 将SuperMap.AreaSolarRadiationParameters对象转换成JSON对象。
  14407. */
  14408. static toObject(param, tempObj) {
  14409. var parameter = {};
  14410. for (var name in param) {
  14411. if (name !== "dataset") {
  14412. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  14413. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  14414. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  14415. if (name1 || name2 || name3) {
  14416. parameter[name] = param[name];
  14417. } else {
  14418. tempObj[name] = param[name];
  14419. }
  14420. }
  14421. }
  14422. tempObj["parameter"] = parameter;
  14423. }
  14424. }
  14425. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters_AreaSolarRadiationParameters;
  14426. // CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  14427. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14428. * This program are made available under the terms of the Apache License, Version 2.0
  14429. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14430. /**
  14431. * @class SuperMap.SpatialAnalystBase
  14432. * @category iServer SpatialAnalyst
  14433. * @classdesc 空间分析服务基类。
  14434. * @param {string} url - 地址。
  14435. * @param {Object} options - 参数。
  14436. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14437. * @param {Object} [options.headers] - 请求头。
  14438. * @extends {SuperMap.CommonServiceBase}
  14439. */
  14440. class SpatialAnalystBase_SpatialAnalystBase extends CommonServiceBase_CommonServiceBase {
  14441. constructor(url, options) {
  14442. super(url, options);
  14443. /**
  14444. * @member {SuperMap.DataFormat} [SuperMap.SpatialAnalystBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  14445. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"。
  14446. */
  14447. this.format = DataFormat.GEOJSON;
  14448. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  14449. }
  14450. /**
  14451. * @function SuperMap.SpatialAnalystBase.prototype.destroy
  14452. * @override
  14453. */
  14454. destroy() {
  14455. super.destroy();
  14456. this.format = null;
  14457. }
  14458. /**
  14459. * @function SuperMap.SpatialAnalystBase.prototype.serviceProcessCompleted
  14460. * @description 分析完成,执行此方法。
  14461. * @param {Object} result - 服务器返回的结果对象。
  14462. */
  14463. serviceProcessCompleted(result) {
  14464. var me = this, analystResult;
  14465. result = Util_Util.transformResult(result);
  14466. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  14467. //批量分析时会返回多个结果
  14468. if (Util_Util.isArray(result)) {
  14469. for (var i = 0; i < result.length; i++) {
  14470. result[i] = me.toGeoJSONResult(result[i])
  14471. }
  14472. analystResult = result;
  14473. } else {
  14474. analystResult = me.toGeoJSONResult(result);
  14475. }
  14476. }
  14477. if (!analystResult) {
  14478. analystResult = result;
  14479. }
  14480. me.events.triggerEvent("processCompleted", {result: analystResult});
  14481. }
  14482. /**
  14483. * @function SuperMap.SpatialAnalystBase.prototype.toGeoJSONResult
  14484. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  14485. * @param {Object} result - 服务器返回的结果对象。
  14486. *
  14487. */
  14488. toGeoJSONResult(result) {
  14489. if (!result) {
  14490. return null;
  14491. }
  14492. //批量叠加分析时结果这样处理
  14493. if (result.result && result.result.resultGeometry) {
  14494. result = result.result
  14495. }
  14496. var geoJSONFormat = new GeoJSON_GeoJSON();
  14497. if (result.recordsets) {
  14498. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  14499. if (recordsets[i].features) {
  14500. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  14501. }
  14502. }
  14503. } else if (result.recordset && result.recordset.features) {
  14504. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  14505. }
  14506. if (result.resultGeometry) {
  14507. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  14508. }
  14509. if (result.regions) {
  14510. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  14511. }
  14512. return result;
  14513. }
  14514. }
  14515. SuperMap.SpatialAnalystBase = SpatialAnalystBase_SpatialAnalystBase;
  14516. // CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  14517. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14518. * This program are made available under the terms of the Apache License, Version 2.0
  14519. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14520. /**
  14521. * @class SuperMap.AreaSolarRadiationService
  14522. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  14523. * @classdesc 地区太阳辐射服务类。
  14524. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  14525. * @param {Object} options - 参数。</br>
  14526. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  14527. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14528. * @param {Object} [options.headers] - 请求头。
  14529. * @extends {SuperMap.SpatialAnalystBase}
  14530. * @example 例如:
  14531. * (start code)
  14532. * var myAreaSolarRadiationService = new SuperMap.AreaSolarRadiationService(url);
  14533. * myAreaSolarRadiationService.on({
  14534. * "processCompleted": processCompleted,
  14535. * "processFailed": processFailed
  14536. * }
  14537. * );
  14538. * (end)
  14539. *
  14540. */
  14541. class AreaSolarRadiationService_AreaSolarRadiationService extends SpatialAnalystBase_SpatialAnalystBase {
  14542. constructor(url, options) {
  14543. super(url, options);
  14544. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  14545. }
  14546. /**
  14547. * @function SuperMap.AreaSolarRadiationService.prototype.destroy
  14548. * @override
  14549. */
  14550. destroy() {
  14551. super.destroy();
  14552. }
  14553. /**
  14554. * @function SuperMap.AreaSolarRadiationService.prototype.processAsync
  14555. * @description 负责将客户端的查询参数传递到服务端。
  14556. * @param {SuperMap.AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  14557. */
  14558. processAsync(parameter) {
  14559. if (!(parameter instanceof AreaSolarRadiationParameters_AreaSolarRadiationParameters)) {
  14560. return;
  14561. }
  14562. var me = this;
  14563. var parameterObject = {};
  14564. if (parameter instanceof AreaSolarRadiationParameters_AreaSolarRadiationParameters) {
  14565. me.url = Util_Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  14566. }
  14567. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  14568. AreaSolarRadiationParameters_AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  14569. var jsonParameters = Util_Util.toJSON(parameterObject);
  14570. me.request({
  14571. method: 'POST',
  14572. data: jsonParameters,
  14573. scope: me,
  14574. success: me.serviceProcessCompleted,
  14575. failure: me.serviceProcessFailed
  14576. });
  14577. }
  14578. }
  14579. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService_AreaSolarRadiationService;
  14580. // CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  14581. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14582. * This program are made available under the terms of the Apache License, Version 2.0
  14583. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14584. /**
  14585. * @class SuperMap.BufferDistance
  14586. * @category iServer SpatialAnalyst BufferAnalyst
  14587. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  14588. * @param {Object} options - 参数。
  14589. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  14590. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  14591. */
  14592. class BufferDistance_BufferDistance {
  14593. constructor(options) {
  14594. /**
  14595. * @member {string} [SuperMap.BufferDistance.prototype.exp]
  14596. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  14597. */
  14598. this.exp = null;
  14599. /**
  14600. * @member {number} [SuperMap.BufferDistance.prototype.value=100]
  14601. * @description 以数值作为缓冲区分析的距离值。单位:米。
  14602. */
  14603. this.value = 100;
  14604. Util_Util.extend(this, options);
  14605. this.CLASS_NAME = "SuperMap.BufferDistance";
  14606. }
  14607. /**
  14608. * @function SuperMap.BufferDistance.prototype.destroy
  14609. * @description 释放资源,将引用资源的属性置空。
  14610. */
  14611. destroy() {
  14612. this.exp = null;
  14613. this.value = null;
  14614. }
  14615. }
  14616. SuperMap.BufferDistance = BufferDistance_BufferDistance;
  14617. // CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  14618. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14619. * This program are made available under the terms of the Apache License, Version 2.0
  14620. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14621. /**
  14622. * @class SuperMap.BufferSetting
  14623. * @category iServer SpatialAnalyst BufferAnalyst
  14624. * @classdesc 缓冲区分析通用设置类。
  14625. * @param {Object} options - 参数。
  14626. * @param {SuperMap.BufferEndType} [options.endType=SuperMap.BufferEndType.FLAT] - 缓冲区端点枚举值。
  14627. * @param {SuperMap.BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  14628. * @param {SuperMap.BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  14629. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  14630. * @param {SuperMap.BufferRadiusUnit} [options.radiusUnit=SuperMap.BufferRadiusUnit.METER] - 缓冲半径单位。
  14631. */
  14632. class BufferSetting_BufferSetting {
  14633. constructor(options) {
  14634. /**
  14635. * @member {SuperMap.BufferEndType} [SuperMap.BufferSetting.prototype.endType = SuperMap.BufferEndType.FLAT]
  14636. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  14637. */
  14638. this.endType = BufferEndType.FLAT;
  14639. /**
  14640. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.leftDistance=100]
  14641. * @description 左侧缓冲距离。
  14642. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  14643. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  14644. */
  14645. this.leftDistance = new BufferDistance_BufferDistance();
  14646. /**
  14647. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.rightDistance=100]
  14648. * @description 右侧缓冲距离。
  14649. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  14650. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  14651. */
  14652. this.rightDistance = new BufferDistance_BufferDistance();
  14653. /**
  14654. * @member {number} [SuperMap.BufferSetting.prototype.semicircleLineSegment=4]
  14655. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  14656. */
  14657. this.semicircleLineSegment = 4;
  14658. /**
  14659. * @member {SuperMap.BufferRadiusUnit} [SuperMap.BufferSetting.prototype.radiusUnit = SuperMap.BufferRadiusUnit.METER]
  14660. * @description 缓冲半径单位,可以是{@link SuperMap.BufferRadiusUnit.METER}、{@link SuperMap.BufferRadiusUnit.MILIMETER}、
  14661. * {@link SuperMap.BufferRadiusUnit.CENTIMETER}、{@link SuperMap.BufferRadiusUnit.DECIMETER}、{@link SuperMap.BufferRadiusUnit.KILOMETER}、
  14662. * {@link SuperMap.BufferRadiusUnit.FOOT}、{@link SuperMap.BufferRadiusUnit.INCH}、{@link SuperMap.BufferRadiusUnit.MILE}、{@link SuperMap.BufferRadiusUnit.YARD}。
  14663. * 仅对BufferAnalyst有效。
  14664. */
  14665. this.radiusUnit = BufferRadiusUnit.METER;
  14666. if (options) {
  14667. Util_Util.extend(this, options);
  14668. }
  14669. this.CLASS_NAME = "SuperMap.BufferSetting";
  14670. }
  14671. /**
  14672. * @function SuperMap.BufferSetting.prototype.destroy
  14673. * @description 释放资源,将引用资源的属性置空。
  14674. */
  14675. destroy() {
  14676. let me = this;
  14677. me.endType = null;
  14678. if (me.leftDistance) {
  14679. me.leftDistance.destroy();
  14680. me.leftDistance = null;
  14681. }
  14682. if (me.rightDistance) {
  14683. me.rightDistance.destroy();
  14684. me.rightDistance = null;
  14685. }
  14686. me.semicircleLineSegment = null;
  14687. me.radiusUnit = null;
  14688. }
  14689. }
  14690. SuperMap.BufferSetting = BufferSetting_BufferSetting;
  14691. // CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  14692. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14693. * This program are made available under the terms of the Apache License, Version 2.0
  14694. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14695. /**
  14696. * @class SuperMap.BufferAnalystParameters
  14697. * @category iServer SpatialAnalyst BufferAnalyst
  14698. * @classdesc 缓冲区分析参数基类。
  14699. * @param {Object} options - 参数。
  14700. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  14701. */
  14702. class BufferAnalystParameters_BufferAnalystParameters {
  14703. constructor(options) {
  14704. var me = this;
  14705. /**
  14706. * @member {SuperMap.BufferSetting} [SuperMap.BufferAnalystParameters.prototype.bufferSetting]
  14707. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  14708. */
  14709. me.bufferSetting = new BufferSetting_BufferSetting();
  14710. Util_Util.extend(this, options);
  14711. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  14712. }
  14713. /**
  14714. * @function SuperMap.BufferAnalystParameters.prototype.destroy
  14715. * @description 释放资源,将引用资源的属性置空。
  14716. */
  14717. destroy() {
  14718. var me = this;
  14719. if (me.bufferSetting) {
  14720. me.bufferSetting.destroy();
  14721. me.bufferSetting = null;
  14722. }
  14723. }
  14724. }
  14725. SuperMap.BufferAnalystParameters = BufferAnalystParameters_BufferAnalystParameters;
  14726. // CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  14727. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14728. * This program are made available under the terms of the Apache License, Version 2.0
  14729. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14730. /**
  14731. * @class SuperMap.DataReturnOption
  14732. * @category iServer SpatialAnalyst
  14733. * @classdesc 数据返回设置类。
  14734. * @param {Object} options - 参数。
  14735. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  14736. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link SuperMap.DataReturnMode.DATASET_ONLY}或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  14737. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  14738. * @param {SuperMap.DataReturnMode} [options.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  14739. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  14740. */
  14741. class DataReturnOption_DataReturnOption {
  14742. constructor(options) {
  14743. /**
  14744. * @member {number} [SuperMap.DataReturnOption.prototype.expectCount=1000]
  14745. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  14746. */
  14747. this.expectCount = 1000;
  14748. /**
  14749. * @member {string} [SuperMap.DataReturnOption.prototype.dataset]
  14750. * @description 设置结果数据集标识,当dataReturnMode为 {@link SuperMap.DataReturnMode.DATASET_ONLY}
  14751. * 或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  14752. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  14753. */
  14754. this.dataset = null;
  14755. /**
  14756. * @member {SuperMap.DataReturnMode} [SuperMap.DataReturnOption.prototype.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY]
  14757. * @description 数据返回模式。
  14758. */
  14759. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  14760. /**
  14761. * @member {boolean} [SuperMap.DataReturnOption.prototype.deleteExistResultDataset=true]
  14762. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  14763. */
  14764. this.deleteExistResultDataset = true;
  14765. Util_Util.extend(this, options);
  14766. this.CLASS_NAME = "SuperMap.DataReturnOption";
  14767. }
  14768. /**
  14769. * @function SuperMap.DataReturnOption.prototype.destroy
  14770. * @description 释放资源,将引用资源的属性置空。
  14771. */
  14772. destroy() {
  14773. var me = this;
  14774. me.expectCount = null;
  14775. me.dataset = null;
  14776. me.dataReturnMode = null;
  14777. me.deleteExistResultDataset = null;
  14778. }
  14779. }
  14780. SuperMap.DataReturnOption = DataReturnOption_DataReturnOption;
  14781. // CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  14782. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14783. * This program are made available under the terms of the Apache License, Version 2.0
  14784. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14785. /**
  14786. * @class SuperMap.JoinItem
  14787. * @category iServer
  14788. * @classdesc 连接信息类。
  14789. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  14790. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  14791. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  14792. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  14793. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  14794. *(注意:SuperMap.JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  14795. * @param {Object} options - 参数。
  14796. * @param {string} options.foreignTableName - 外部表的名称。
  14797. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  14798. * @param {SuperMap.JoinType} options.joinType - 两个表之间连接类型。
  14799. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  14800. *(start code)
  14801. * function queryBySQL() {
  14802. * // 设置与外部表的连接信息
  14803. * var joinItem = new SuperMap.JoinItem({
  14804. * foreignTableName: "foreignTable",
  14805. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  14806. * joinType: "LEFTJOIN"
  14807. * })
  14808. * var queryParam, queryBySQLParams, queryBySQLService;
  14809. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  14810. * queryParam = new SuperMap.FilterParameter({
  14811. * name: "Countries@World",
  14812. * joinItems: [joinItem]
  14813. * }),
  14814. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  14815. * queryParams: [queryParam]
  14816. * }),
  14817. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  14818. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  14819. * });
  14820. * queryBySQLService.processAsync(queryBySQLParams);
  14821. * }
  14822. * function processCompleted(queryEventArgs) {//todo}
  14823. * function processFailed(e) {//todo}
  14824. * (end)
  14825. */
  14826. class JoinItem_JoinItem {
  14827. constructor(options) {
  14828. /**
  14829. * @member {string} SuperMap.JoinItem.prototype.foreignTableName
  14830. * @description 外部表的名称。
  14831. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  14832. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  14833. */
  14834. this.foreignTableName = null;
  14835. /**
  14836. * @member {string} SuperMap.JoinItem.prototype.joinFilter
  14837. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  14838. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  14839. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  14840. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  14841. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  14842. */
  14843. this.joinFilter = null;
  14844. /**
  14845. * @member {SuperMap.JoinType} SuperMap.JoinItem.prototype.joinType
  14846. * @description 两个表之间连接类型。
  14847. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  14848. */
  14849. this.joinType = null;
  14850. if (options) {
  14851. Util_Util.extend(this, options);
  14852. }
  14853. this.CLASS_NAME = "SuperMap.JoinItem";
  14854. }
  14855. /**
  14856. * @function SuperMap.JoinItem.prototype.destroy
  14857. * @description 释放资源,将引用资源的属性置空。
  14858. */
  14859. destroy() {
  14860. var me = this;
  14861. me.foreignTableName = null;
  14862. me.joinFilter = null;
  14863. me.joinType = null;
  14864. }
  14865. /**
  14866. * @function SuperMap.JoinItem.prototype.toServerJSONObject
  14867. * @description 转换成对应的 JSON 格式对象。
  14868. */
  14869. toServerJSONObject() {
  14870. var dataObj = {};
  14871. dataObj = Util_Util.copyAttributes(dataObj, this);
  14872. //joinFilter基本是个纯属性对象,这里不再做转换
  14873. return dataObj;
  14874. }
  14875. }
  14876. SuperMap.JoinItem = JoinItem_JoinItem;
  14877. // CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  14878. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  14879. * This program are made available under the terms of the Apache License, Version 2.0
  14880. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14881. // eslint-disable-line no-unused-vars
  14882. /**
  14883. * @class SuperMap.DatasourceConnectionInfo
  14884. * @category iServer Data
  14885. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  14886. * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  14887. * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  14888. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  14889. * @category iServer Data
  14890. * @param {Object} options - 参数。
  14891. * @param {string} options.alias - 数据源别名。
  14892. * @param {string} options.dataBase - 数据源连接的数据库名。
  14893. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  14894. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  14895. * @param {SuperMap.EngineType} [options.engineType] - 数据源连接的引擎类型。
  14896. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  14897. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  14898. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  14899. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  14900. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  14901. * @param {string} [options.user] - 登录数据库的用户名。
  14902. */
  14903. class DatasourceConnectionInfo_DatasourceConnectionInfo {
  14904. constructor(options) {
  14905. /**
  14906. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.alias
  14907. * @description 数据源别名。
  14908. */
  14909. this.alias = null;
  14910. /**
  14911. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.connect]
  14912. * @description 数据源是否自动连接数据。
  14913. */
  14914. this.connect = null;
  14915. /**
  14916. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.dataBase
  14917. * @description 数据源连接的数据库名。
  14918. */
  14919. this.dataBase = null;
  14920. /**
  14921. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.driver]
  14922. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  14923. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  14924. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  14925. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  14926. */
  14927. this.driver = null;
  14928. /**
  14929. * @member {SuperMap.EngineType} [SuperMap.DatasourceConnectionInfo.prototype.engineType]
  14930. * @description 数据源连接的引擎类型。
  14931. */
  14932. this.engineType = null;
  14933. /**
  14934. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.exclusive]
  14935. * @description 是否以独占方式打开数据源。
  14936. */
  14937. this.exclusive = null;
  14938. /**
  14939. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.OpenLinkTable]
  14940. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  14941. */
  14942. this.OpenLinkTable = null;
  14943. /**
  14944. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.password]
  14945. * @description 登录数据源连接的数据库或文件的密码。
  14946. */
  14947. this.password = null;
  14948. /**
  14949. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.readOnly]
  14950. * @description 是否以只读方式打开数据源。
  14951. */
  14952. this.readOnly = null;
  14953. /**
  14954. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.server]
  14955. * @description 数据库服务器名、文件名或服务地址。
  14956. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  14957. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  14958. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  14959. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  14960. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  14961. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  14962. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  14963. * 8.对于 SuperMapCould 数据源,为其服务地址。
  14964. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  14965. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  14966. */
  14967. this.server = null;
  14968. /**
  14969. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.user
  14970. * @description 登录数据库的用户名。
  14971. */
  14972. this.user = null;
  14973. if (options) {
  14974. Util_Util.extend(this, options);
  14975. }
  14976. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  14977. }
  14978. /**
  14979. * @function SuperMap.DatasourceConnectionInfo.prototype.destroy
  14980. * @description 释放资源,将引用资源的属性置空。
  14981. */
  14982. destroy() {
  14983. var me = this;
  14984. me.alias = null;
  14985. me.connect = null;
  14986. me.dataBase = null;
  14987. me.driver = null;
  14988. me.engineType = null;
  14989. me.exclusive = null;
  14990. me.OpenLinkTable = null;
  14991. me.password = null;
  14992. me.readOnly = null;
  14993. me.server = null;
  14994. me.user = null;
  14995. }
  14996. }
  14997. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo_DatasourceConnectionInfo;
  14998. // CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  14999. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15000. * This program are made available under the terms of the Apache License, Version 2.0
  15001. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15002. /**
  15003. * @class SuperMap.LinkItem
  15004. * @constructs SuperMap.LinkItem
  15005. * @category iServer
  15006. * @classdesc 关联信息类。
  15007. * @description 该类用于矢量数据集与外部表的关联。 外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  15008. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  15009. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link SuperMap.LinkItem}
  15010. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link SuperMap.LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  15011. * 1. 使用 {@link SuperMap.LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  15012. * 2. 使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  15013. * @param {Object} options - 参数。
  15014. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  15015. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  15016. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  15017. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  15018. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  15019. * @param {string} options.name - 此关联信息对象的名称。
  15020. * @param {Array.<string>} options.primaryKeys - 需要关联的外部属性表的主键。
  15021. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  15022. * function queryBySQL() {
  15023. * // 设置关联的外部数据库信息,alias表示数据库别名
  15024. * var dc = new SuperMap.DatasourceConnectionInfo({
  15025. * dataBase: "RelQuery",
  15026. * server: "{ip}:{port}",
  15027. * user: "sa",
  15028. * password: "map",
  15029. * driver: "SQL Server",
  15030. * connect: true,
  15031. * OpenLinkTable: false,
  15032. * alias: "RelQuery",
  15033. * engineType: EngineType.SQLPLUS,
  15034. * readOnly: false,
  15035. * exclusive: false
  15036. * });
  15037. * // 设置关联信息
  15038. * var linkItem = new SuperMap.LinkItem({
  15039. * datasourceConnectionInfo: dc,
  15040. * foreignKeys: ["name"],
  15041. * foreignTable: "Pop_2011",
  15042. * linkFields: ["SmID as Pid","pop"],
  15043. * name: "link",
  15044. * primatryKeys: ["name"],
  15045. * });
  15046. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  15047. * var queryParam, queryBySQLParams, queryBySQLService;
  15048. * queryParam = new SuperMap.FilterParameter({
  15049. * name: "Province@RelQuery",
  15050. * fields: ["SmID","name"],
  15051. * attributeFilter: "SmID<7",
  15052. * linkItems: [linkItem]
  15053. * }),
  15054. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  15055. * queryParams: [queryParam]
  15056. * }),
  15057. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  15058. * eventListeners: {
  15059. * "processCompleted": processCompleted,
  15060. * "processFailed": processFailed
  15061. * }
  15062. * });
  15063. * queryBySQLService.processAsync(queryBySQLParams);
  15064. * }
  15065. * function processCompleted(queryEventArgs) {//todo}
  15066. * function processFailed(e) {//todo}
  15067. *
  15068. */
  15069. class LinkItem_LinkItem {
  15070. constructor(options) {
  15071. /**
  15072. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.LinkItem.prototype.datasourceConnectionInfo
  15073. * @description 关联的外部数据源信息。
  15074. */
  15075. this.datasourceConnectionInfo = null;
  15076. /**
  15077. * @member {Array.<string>} SuperMap.LinkItem.prototype.foreignKeys
  15078. * @description 主空间数据集的外键。
  15079. */
  15080. this.foreignKeys = null;
  15081. /**
  15082. * @member {string} SuperMap.LinkItem.prototype.foreignTable
  15083. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  15084. */
  15085. this.foreignTable = null;
  15086. /**
  15087. * @member {Array.<string>} SuperMap.LinkItem.prototype.linkFields
  15088. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返
  15089. * 回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  15090. */
  15091. this.linkFields = null;
  15092. /**
  15093. * @member {string} SuperMap.LinkItem.prototype.linkFilter
  15094. * @description 与外部属性表的连接条件。
  15095. */
  15096. this.linkFilter = null;
  15097. /**
  15098. * @member {string} SuperMap.LinkItem.prototype.name
  15099. * @description 此关联信息对象的名称。
  15100. */
  15101. this.name = null;
  15102. /**
  15103. * @member {Array.<string>} SuperMap.LinkItem.prototype.primaryKeys
  15104. * @description 需要关联的外部属性表的主键。
  15105. */
  15106. this.primaryKeys = null;
  15107. if (options) {
  15108. Util_Util.extend(this, options);
  15109. }
  15110. this.CLASS_NAME = "SuperMap.LinkItem";
  15111. }
  15112. /**
  15113. * @function SuperMap.LinkItem.prototype.destroy
  15114. * @description 释放资源,将引用资源的属性置空。
  15115. */
  15116. destroy() {
  15117. var me = this;
  15118. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo_DatasourceConnectionInfo) {
  15119. me.datasourceConnectionInfo.destroy();
  15120. me.datasourceConnectionInfo = null;
  15121. }
  15122. me.foreignKeys = null;
  15123. me.foreignTable = null;
  15124. me.linkFields = null;
  15125. me.linkFilter = null;
  15126. me.name = null;
  15127. me.primaryKeys = null;
  15128. }
  15129. }
  15130. SuperMap.LinkItem = LinkItem_LinkItem;
  15131. // CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  15132. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15133. * This program are made available under the terms of the Apache License, Version 2.0
  15134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15135. /**
  15136. * @class SuperMap.FilterParameter
  15137. * @category iServer
  15138. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  15139. * @param {Object} options - 参数。
  15140. * @param {string} options.attributeFilter - 属性过滤条件。
  15141. * @param {string} options.name - 查询数据集名称或者图层名称。
  15142. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 与外部表的连接信息 SuperMap.JoinItem 数组。
  15143. * @param {Array.<SuperMap.LinkItem>} [options.linkItems] - 与外部表的关联信息 SuperMap.LinkItem 数组。
  15144. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  15145. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  15146. * @param {string} [options.groupBy] - 查询分组条件的字段。
  15147. * @param {Array.<string>} [options.fields] - 查询字段数组。
  15148. */
  15149. class FilterParameter_FilterParameter {
  15150. constructor(options) {
  15151. /**
  15152. * @member {string} SuperMap.FilterParameter.prototype.attributeFilter
  15153. * @description 属性过滤条件。
  15154. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  15155. * attributeFilter 就是其中的“条件表达式”。
  15156. * 该字段的用法为 attributeFilter = "过滤条件"。
  15157. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  15158. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  15159. */
  15160. this.attributeFilter = null;
  15161. /**
  15162. * @member {string} SuperMap.FilterParameter.prototype.name
  15163. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  15164. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  15165. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  15166. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  15167. * 而不同的数据源中可能存在同名的数据集,
  15168. * 使用数据集名称不能唯一的确定数据集,
  15169. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  15170. */
  15171. this.name = null;
  15172. /**
  15173. * @member {Array.<SuperMap.JoinItem>} [SuperMap.FilterParameter.prototype.joinItems]
  15174. * @description 与外部表的连接信息 SuperMap.JoinItem 数组。
  15175. */
  15176. this.joinItems = null;
  15177. /**
  15178. * @member {Array.<SuperMap.LinkItem>} [SuperMap.FilterParameter.prototype.linkItems]
  15179. * @description 与外部表的关联信息 LinkItem 数组。
  15180. */
  15181. this.linkItems = null;
  15182. /**
  15183. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.ids]
  15184. * @description 查询 id 数组,即属性表中的 SmID 值。
  15185. */
  15186. this.ids = null;
  15187. /**
  15188. * @member {string} [SuperMap.FilterParameter.prototype.orderBy]
  15189. * @description 查询排序的字段,orderBy的字段须为数值型的。
  15190. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  15191. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  15192. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  15193. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  15194. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  15195. * 分别表示国家的面积和1994年的各国人口数量。
  15196. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  15197. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  15198. */
  15199. this.orderBy = null;
  15200. /**
  15201. * @member {string} [SuperMap.FilterParameter.prototype.groupBy]
  15202. * @description 查询分组条件的字段。
  15203. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  15204. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  15205. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  15206. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  15207. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  15208. * 分别表示某个城市所属的洲和国家。
  15209. * 如果要按照国家对全球的城市进行分组, 可以设置 groupBy = "Country";
  15210. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  15211. */
  15212. this.groupBy = null;
  15213. /**
  15214. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.fields]
  15215. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  15216. */
  15217. this.fields = null;
  15218. if (options) {
  15219. Util_Util.extend(this, options);
  15220. }
  15221. this.CLASS_NAME = "SuperMap.FilterParameter";
  15222. }
  15223. /**
  15224. * @function SuperMap.FilterParameter.prototype.destroy
  15225. * @description 释放资源,将引用资源的属性置空。
  15226. */
  15227. destroy() {
  15228. var me = this;
  15229. me.attributeFilter = null;
  15230. me.name = null;
  15231. if (me.joinItems) {
  15232. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  15233. joinItems[i].destroy();
  15234. }
  15235. me.joinItems = null;
  15236. }
  15237. if (me.linkItems) {
  15238. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  15239. linkItems[i].destroy();
  15240. }
  15241. me.linkItems = null;
  15242. }
  15243. me.ids = null;
  15244. me.orderBy = null;
  15245. me.groupBy = null;
  15246. me.fields = null;
  15247. }
  15248. }
  15249. SuperMap.FilterParameter = FilterParameter_FilterParameter;
  15250. // CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  15251. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15252. * This program are made available under the terms of the Apache License, Version 2.0
  15253. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15254. /**
  15255. * @class SuperMap.DatasetBufferAnalystParameters
  15256. * @category iServer SpatialAnalyst BufferAnalyst
  15257. * @classdesc 数据集缓冲区分析参数类。
  15258. * @param {Object} options - 参数。
  15259. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  15260. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  15261. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  15262. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  15263. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  15264. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  15265. *
  15266. * @extends {SuperMap.BufferAnalystParameters}
  15267. */
  15268. class DatasetBufferAnalystParameters_DatasetBufferAnalystParameters extends BufferAnalystParameters_BufferAnalystParameters {
  15269. constructor(options) {
  15270. super(options);
  15271. /**
  15272. * @member {string} SuperMap.DatasetBufferAnalystParameters.prototype.dataset
  15273. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  15274. */
  15275. this.dataset = null;
  15276. /**
  15277. * @member {SuperMap.FilterParameter} [SuperMap.DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  15278. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  15279. */
  15280. this.filterQueryParameter = new FilterParameter_FilterParameter();
  15281. /**
  15282. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetBufferAnalystParameters.prototype.resultSetting]
  15283. * @description 结果返回设置类。
  15284. */
  15285. this.resultSetting = new DataReturnOption_DataReturnOption();
  15286. /**
  15287. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  15288. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  15289. */
  15290. this.isAttributeRetained = true;
  15291. /**
  15292. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isUnion=false]
  15293. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  15294. */
  15295. this.isUnion = false;
  15296. Util_Util.extend(this, options);
  15297. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  15298. }
  15299. /**
  15300. * @function SuperMap.DatasetBufferAnalystParameters.prototype.destroy
  15301. * @override
  15302. */
  15303. destroy() {
  15304. super.destroy();
  15305. var me = this;
  15306. me.dataset = null;
  15307. if (me.filterQueryParameter) {
  15308. me.filterQueryParameter.destroy();
  15309. me.filterQueryParameter = null;
  15310. }
  15311. if (me.resultSetting) {
  15312. me.resultSetting.destroy();
  15313. me.resultSetting = null;
  15314. }
  15315. me.isAttributeRetained = null;
  15316. me.isUnion = null;
  15317. }
  15318. /**
  15319. * @function SuperMap.DatasetBufferAnalystParameters.toObject
  15320. * @param {SuperMap.DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  15321. * @param {SuperMap.DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  15322. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  15323. * @returns {Object} JSON 对象。
  15324. */
  15325. static toObject(datasetBufferAnalystParameters, tempObj) {
  15326. for (var name in datasetBufferAnalystParameters) {
  15327. if (name === "bufferSetting") {
  15328. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  15329. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  15330. } else if (name === "resultSetting") {
  15331. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  15332. } else if (name === "dataset") {
  15333. continue;
  15334. } else {
  15335. tempObj[name] = datasetBufferAnalystParameters[name];
  15336. }
  15337. }
  15338. }
  15339. }
  15340. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters_DatasetBufferAnalystParameters;
  15341. // CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  15342. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15343. * This program are made available under the terms of the Apache License, Version 2.0
  15344. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15345. /**
  15346. * @class SuperMap.GeometryBufferAnalystParameters
  15347. * @category iServer SpatialAnalyst BufferAnalyst
  15348. * @classdesc 几何对象缓冲区分析参数类
  15349. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  15350. * @param {Object} options - 参数。
  15351. * @param {Object} options.sourceGeometry - 要做缓冲区分析的几何对象。
  15352. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  15353. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  15354. * @extends {SuperMap.BufferAnalystParameters}
  15355. */
  15356. class GeometryBufferAnalystParameters_GeometryBufferAnalystParameters extends BufferAnalystParameters_BufferAnalystParameters {
  15357. constructor(options) {
  15358. super(options);
  15359. /**
  15360. * @member {Object} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometry
  15361. * @description 要做缓冲区分析的几何对象。<br>
  15362. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  15363. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  15364. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  15365. */
  15366. this.sourceGeometry = null;
  15367. /**
  15368. * @member {number} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  15369. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  15370. */
  15371. this.sourceGeometrySRID = null;
  15372. if (options) {
  15373. Util_Util.extend(this, options);
  15374. }
  15375. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  15376. }
  15377. /**
  15378. * @function SuperMap.GeometryBufferAnalystParameters.prototype.destroy
  15379. * @override
  15380. */
  15381. destroy() {
  15382. super.destroy();
  15383. var me = this;
  15384. if (me.sourceGeometry) {
  15385. me.sourceGeometry.destroy();
  15386. me.sourceGeometry = null;
  15387. }
  15388. }
  15389. /**
  15390. * @function SuperMap.GeometryBufferAnalystParameters.toObject
  15391. * @param {SuperMap.GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  15392. * @param {SuperMap.GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  15393. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  15394. * @returns {Object} JSON 对象。
  15395. */
  15396. static toObject(geometryBufferAnalystParameters, tempObj) {
  15397. for (var name in geometryBufferAnalystParameters) {
  15398. if (name === "bufferSetting") {
  15399. var tempBufferSetting = {};
  15400. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  15401. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  15402. }
  15403. tempObj.analystParameter = tempBufferSetting;
  15404. } else if (name === "sourceGeometry") {
  15405. tempObj.sourceGeometry = ServerGeometry_ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  15406. } else {
  15407. tempObj[name] = geometryBufferAnalystParameters[name];
  15408. }
  15409. }
  15410. }
  15411. }
  15412. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters_GeometryBufferAnalystParameters;
  15413. // CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  15414. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15415. * This program are made available under the terms of the Apache License, Version 2.0
  15416. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15417. /**
  15418. * @class SuperMap.BufferAnalystService
  15419. * @category iServer SpatialAnalyst BufferAnalyst
  15420. * @classdesc 缓冲区分析服务类。
  15421. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  15422. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  15423. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  15424. * @param {Object} options - 参数。</br>
  15425. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  15426. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15427. * @param {Object} [options.headers] - 请求头。
  15428. * @extends {SuperMap.SpatialAnalystBase}
  15429. * @example 例如:
  15430. * (start code)
  15431. * var myBufferAnalystService = new SuperMap.BufferAnalystService(url, {
  15432. * eventListeners: {
  15433. * "processCompleted": bufferCompleted,
  15434. * "processFailed": bufferFailed
  15435. * }
  15436. * });
  15437. * (end)
  15438. *
  15439. *
  15440. */
  15441. class BufferAnalystService_BufferAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  15442. constructor(url, options) {
  15443. super(url, options);
  15444. /**
  15445. * @member {string} SuperMap.BufferAnalystService.prototype.mode
  15446. * @description 缓冲区分析类型
  15447. */
  15448. this.mode = null;
  15449. if (options) {
  15450. Util_Util.extend(this, options);
  15451. }
  15452. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  15453. }
  15454. /**
  15455. * @function SuperMap.BufferAnalystService.prototype.destroy
  15456. * @override
  15457. */
  15458. destroy() {
  15459. super.destroy();
  15460. this.mode = null;
  15461. }
  15462. /**
  15463. * @method SuperMap.BufferAnalystService.prototype.processAsync
  15464. * @description 负责将客户端的查询参数传递到服务端。
  15465. * @param {SuperMap.BufferAnalystParameters} parameter - 缓冲区分析参数
  15466. */
  15467. processAsync(parameter) {
  15468. var parameterObject = {};
  15469. var me = this;
  15470. if (parameter instanceof DatasetBufferAnalystParameters_DatasetBufferAnalystParameters) {
  15471. me.mode = 'datasets';
  15472. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  15473. DatasetBufferAnalystParameters_DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  15474. } else if (parameter instanceof GeometryBufferAnalystParameters_GeometryBufferAnalystParameters) {
  15475. me.mode = 'geometry';
  15476. me.url = Util_Util.urlPathAppend(me.url, 'geometry/buffer');
  15477. GeometryBufferAnalystParameters_GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  15478. }
  15479. var jsonParameters = Util_Util.toJSON(parameterObject);
  15480. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  15481. me.request({
  15482. method: "POST",
  15483. data: jsonParameters,
  15484. scope: me,
  15485. success: me.serviceProcessCompleted,
  15486. failure: me.serviceProcessFailed
  15487. });
  15488. }
  15489. }
  15490. SuperMap.BufferAnalystService = BufferAnalystService_BufferAnalystService;
  15491. // CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  15492. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15493. * This program are made available under the terms of the Apache License, Version 2.0
  15494. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15495. /**
  15496. * @class SuperMap.OutputSetting
  15497. * @category iServer ProcessingService
  15498. * @classdesc 分布式分析输出类型设置类。
  15499. * @param {Object} options - 参数。
  15500. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  15501. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  15502. * @param {SuperMap.OutputType} [options.type=SuperMap.OutputType.UDB] - 输出类型。
  15503. * @param {string} [options.outputPath] - 分析结果输出路径。
  15504. */
  15505. class OutputSetting_OutputSetting {
  15506. constructor(options) {
  15507. /**
  15508. * @member {SuperMap.OutputType} SuperMap.OutputSetting.prototype.type
  15509. * @description 分布式分析的输出类型。
  15510. */
  15511. this.type = OutputType.UDB;
  15512. /**
  15513. * @member {string} [SuperMap.OutputSetting.prototype.datasetName='analystResult']
  15514. * @description 分布式分析的输出结果数据集名称。
  15515. */
  15516. this.datasetName = "analystResult";
  15517. /**
  15518. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.OutputSetting.prototype.datasourceInfo
  15519. * @description 分布式分析的输出结果数据源连接信息。
  15520. */
  15521. this.datasourceInfo = null;
  15522. /**
  15523. * @member {string} [SuperMap.OutputSetting.prototype.outputPath]
  15524. * @description 分布式分析的分析结果输出路径。
  15525. */
  15526. this.outputPath = "";
  15527. Util_Util.extend(this, options);
  15528. this.CLASS_NAME = "SuperMap.OutputSetting";
  15529. }
  15530. /**
  15531. * @function SuperMap.OutputSetting.prototype.destroy
  15532. * @description 释放资源,将引用资源的属性置空。
  15533. */
  15534. destroy() {
  15535. var me = this;
  15536. me.type = null;
  15537. me.datasetName = null;
  15538. me.outputPath = null;
  15539. if (me.datasourceInfo instanceof DatasourceConnectionInfo_DatasourceConnectionInfo) {
  15540. me.datasourceInfo.destroy();
  15541. me.datasourceInfo = null;
  15542. }
  15543. }
  15544. }
  15545. SuperMap.OutputSetting = OutputSetting_OutputSetting;
  15546. // CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  15547. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15548. * This program are made available under the terms of the Apache License, Version 2.0
  15549. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15550. /**
  15551. * @class SuperMap.MappingParameters
  15552. * @category iServer ProcessingService
  15553. * @classdesc 分析后结果可视化的参数类。
  15554. * @param {Object} options - 参数。
  15555. * @param {Array.<SuperMap.ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  15556. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  15557. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 专题图分段模式。
  15558. * @param {number} [options.rangeCount] - 专题图分段个数。
  15559. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  15560. */
  15561. class MappingParameters_MappingParameters {
  15562. constructor(options) {
  15563. /**
  15564. * @member {Array.<SuperMap.ThemeGridRangeItem>} [SuperMap.MappingParameters.prototype.items]
  15565. * @description 栅格分段专题图子项数组。
  15566. */
  15567. this.items = null;
  15568. /**
  15569. * @member {number} [SuperMap.MappingParameters.prototype.numericPrecision=1]
  15570. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  15571. */
  15572. this.numericPrecision = 1;
  15573. /**
  15574. * @member {SuperMap.RangeMode} [SuperMap.MappingParameters.prototype.RangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  15575. * @description 专题图分段模式。
  15576. */
  15577. this.rangeMode = RangeMode.EQUALINTERVAL;
  15578. /**
  15579. * @member {number} [SuperMap.MappingParameters.prototype.rangeCount]
  15580. * @description 专题图分段个数。
  15581. */
  15582. this.rangeCount = "";
  15583. /**
  15584. * @member {SuperMap.ColorGradientType} [SuperMap.MappingParameters.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  15585. * @description 专题图颜色渐变模式。
  15586. */
  15587. this.colorGradientType = ColorGradientType.YELLOW_RED;
  15588. Util_Util.extend(this, options);
  15589. this.CLASS_NAME = "SuperMap.MappingParameters";
  15590. }
  15591. /**
  15592. * @function SuperMap.MappingParameters.prototype.destroy
  15593. * @description 释放资源,将引用资源的属性置空。
  15594. */
  15595. destroy() {
  15596. var me = this;
  15597. if (me.items) {
  15598. if (me.items.length > 0) {
  15599. for (var item in me.items) {
  15600. me.items[item].destroy();
  15601. me.items[item] = null;
  15602. }
  15603. }
  15604. me.items = null;
  15605. }
  15606. me.numericPrecision = null;
  15607. me.rangeMode = null;
  15608. me.rangeCount = null;
  15609. me.colorGradientType = null;
  15610. }
  15611. }
  15612. SuperMap.MappingParameters = MappingParameters_MappingParameters;
  15613. // CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  15614. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15615. * This program are made available under the terms of the Apache License, Version 2.0
  15616. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15617. /**
  15618. * @class SuperMap.BuffersAnalystJobsParameter
  15619. * @category iServer ProcessingService BufferAnalyst
  15620. * @classdesc 缓冲区分析任务参数类。
  15621. * @param {Object} options - 参数。
  15622. * @param {string} options.datasetName - 数据集名。
  15623. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 分析范围(默认为全图范围)。
  15624. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  15625. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  15626. * @param {SuperMap.AnalystSizeUnit} [options.distanceUnit=SuperMap.AnalystSizeUnit.METER] - 缓冲距离单位单位。
  15627. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  15628. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  15629. */
  15630. class BuffersAnalystJobsParameter_BuffersAnalystJobsParameter {
  15631. constructor(options) {
  15632. /**
  15633. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.datasetName
  15634. * @description 数据集名。
  15635. */
  15636. this.datasetName = '';
  15637. /**
  15638. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.BuffersAnalystJobsParameter.prototype.bounds
  15639. * @description 分析范围。
  15640. */
  15641. this.bounds = '';
  15642. /**
  15643. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distance='15']
  15644. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
  15645. */
  15646. this.distance = '';
  15647. /**
  15648. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  15649. * @description 缓冲距离字段。
  15650. */
  15651. this.distanceField = '';
  15652. /**
  15653. * @member {SuperMap.AnalystSizeUnit} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceUnit=SuperMap.AnalystSizeUnit.METER]
  15654. * @description 缓冲距离单位。
  15655. */
  15656. this.distanceUnit = AnalystSizeUnit.METER;
  15657. /**
  15658. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.dissolveField
  15659. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  15660. */
  15661. this.dissolveField = '';
  15662. /**
  15663. * @member {SuperMap.OutputSetting} [SuperMap.BuffersAnalystJobsParameter.prototype.output]
  15664. * @description 输出参数设置类。
  15665. */
  15666. this.output = null;
  15667. /**
  15668. * @member {SuperMap.MappingParameters} [SuperMap.BuffersAnalystJobsParameter.prototype.mappingParameters]
  15669. * @description 分析后结果可视化的参数类。
  15670. */
  15671. this.mappingParameters = null;
  15672. if (!options) {
  15673. return this;
  15674. }
  15675. Util_Util.extend(this, options);
  15676. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  15677. }
  15678. /**
  15679. * @function SuperMap.BuffersAnalystJobsParameter.prototype.destroy
  15680. * @description 释放资源,将引用资源的属性置空。
  15681. */
  15682. destroy() {
  15683. this.datasetName = null;
  15684. this.bounds = null;
  15685. this.distance = null;
  15686. this.distanceField = null;
  15687. this.distanceUnit = null;
  15688. this.dissolveField = null;
  15689. if (this.output instanceof OutputSetting_OutputSetting) {
  15690. this.output.destroy();
  15691. this.output = null;
  15692. }
  15693. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  15694. this.mappingParameters.destroy();
  15695. this.mappingParameters = null;
  15696. }
  15697. }
  15698. /**
  15699. * @function SuperMap.BuffersAnalystJobsParameter.toObject
  15700. * @param {SuperMap.BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  15701. * @param {Object} tempObj - 目标对象。
  15702. * @description 生成缓冲区分析任务对象。
  15703. */
  15704. static toObject(BuffersAnalystJobsParameter, tempObj) {
  15705. for (var name in BuffersAnalystJobsParameter) {
  15706. if (name === 'datasetName') {
  15707. tempObj['input'] = tempObj['input'] || {};
  15708. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  15709. continue;
  15710. }
  15711. if (name === 'output') {
  15712. tempObj['output'] = tempObj['output'] || {};
  15713. tempObj['output'] = BuffersAnalystJobsParameter[name];
  15714. continue;
  15715. }
  15716. tempObj['analyst'] = tempObj['analyst'] || {};
  15717. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  15718. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  15719. } else {
  15720. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  15721. }
  15722. if (name === 'mappingParameters') {
  15723. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  15724. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  15725. }
  15726. }
  15727. }
  15728. }
  15729. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter_BuffersAnalystJobsParameter;
  15730. // CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  15731. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15732. * This program are made available under the terms of the Apache License, Version 2.0
  15733. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15734. /**
  15735. * @class SuperMap.ProcessingServiceBase
  15736. * @category iServer ProcessingService
  15737. * @classdesc 分布式分析服务基类
  15738. * @extends {SuperMap.CommonServiceBase}
  15739. * @param {string} url - 分布式分析服务地址。
  15740. * @param {Object} options - 参数。
  15741. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  15742. * @param {number} options.index - 服务访问地址在数组中的位置。
  15743. * @param {number} options.length - 服务访问地址数组长度。
  15744. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  15745. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  15746. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15747. * @param {Object} [options.headers] - 请求头。
  15748. */
  15749. class ProcessingServiceBase_ProcessingServiceBase extends CommonServiceBase_CommonServiceBase {
  15750. constructor(url, options) {
  15751. options = options || {};
  15752. /*
  15753. * Constant: EVENT_TYPES
  15754. * {Array.<string>}
  15755. * 此类支持的事件类型
  15756. * - *processCompleted* 创建成功后触发的事件。
  15757. * - *processFailed* 创建失败后触发的事件 。
  15758. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  15759. */
  15760. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  15761. super(url, options);
  15762. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  15763. }
  15764. /**
  15765. * @function SuperMap.ProcessingServiceBase.prototype.destroy
  15766. * @override
  15767. */
  15768. destroy() {
  15769. super.destroy();
  15770. }
  15771. /**
  15772. * @function SuperMap.ProcessingServiceBase.prototype.getJobs
  15773. * @description 获取分布式分析任务。
  15774. * @param {string} url - 资源地址。
  15775. */
  15776. getJobs(url) {
  15777. var me = this;
  15778. FetchRequest.get(me._processUrl(url), null, {
  15779. proxy: me.proxy
  15780. }).then(function (response) {
  15781. return response.json();
  15782. }).then(function (result) {
  15783. me.events.triggerEvent("processCompleted", {
  15784. result: result
  15785. });
  15786. }).catch(function (e) {
  15787. me.eventListeners.processFailed({
  15788. error: e
  15789. });
  15790. });
  15791. }
  15792. /**
  15793. * @function SuperMap.ProcessingServiceBase.prototype.addJob
  15794. * @description 添加分布式分析任务。
  15795. * @param {string} url - 资源根地址。
  15796. * @param {Object} params - 创建一个空间分析的请求参数。
  15797. * @param {string} paramType - 请求参数类型。
  15798. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  15799. */
  15800. addJob(url, params, paramType, seconds) {
  15801. var me = this,
  15802. parameterObject = null;
  15803. if (params && params instanceof paramType) {
  15804. parameterObject = new Object();
  15805. paramType.toObject(params, parameterObject);
  15806. }
  15807. let headers = Object.assign({
  15808. 'Content-Type': 'application/x-www-form-urlencoded'
  15809. }, me.headers || {})
  15810. var options = {
  15811. proxy: me.proxy,
  15812. headers,
  15813. withCredentials: me.withCredentials,
  15814. crossOrigin: me.crossOrigin,
  15815. isInTheSameDomain: me.isInTheSameDomain
  15816. };
  15817. FetchRequest.post(me._processUrl(url), JSON.stringify(parameterObject), options).then(function (response) {
  15818. return response.json();
  15819. }).then(function (result) {
  15820. if (result.succeed) {
  15821. me.serviceProcessCompleted(result, seconds);
  15822. } else {
  15823. me.serviceProcessFailed(result);
  15824. }
  15825. }).catch(function (e) {
  15826. me.serviceProcessFailed({
  15827. error: e
  15828. });
  15829. });
  15830. }
  15831. serviceProcessCompleted(result, seconds) {
  15832. result = Util_Util.transformResult(result);
  15833. seconds = seconds || 1000;
  15834. var me = this;
  15835. if (result) {
  15836. var id = setInterval(function () {
  15837. FetchRequest.get(me._processUrl(result.newResourceLocation), {
  15838. _t: new Date().getTime()
  15839. })
  15840. .then(function (response) {
  15841. return response.json();
  15842. }).then(function (job) {
  15843. me.events.triggerEvent("processRunning", {
  15844. id: job.id,
  15845. state: job.state
  15846. });
  15847. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  15848. clearInterval(id);
  15849. me.events.triggerEvent("processFailed", {
  15850. error: job.state.errorMsg,
  15851. state: job.state.runState
  15852. });
  15853. }
  15854. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  15855. clearInterval(id);
  15856. me.events.triggerEvent("processCompleted", {
  15857. result: job
  15858. });
  15859. }
  15860. }).catch(function (e) {
  15861. clearInterval(id);
  15862. me.events.triggerEvent("processFailed", {
  15863. error: e
  15864. });
  15865. });
  15866. }, seconds);
  15867. }
  15868. }
  15869. serviceProcessFailed(result) {
  15870. super.serviceProcessFailed(result);
  15871. }
  15872. _processUrl(url) {
  15873. if (SecurityManager_SecurityManager.getToken(url)) {
  15874. url = Util_Util.urlAppend(url, 'token=' + SecurityManager_SecurityManager.getToken(url));
  15875. }
  15876. return url;
  15877. }
  15878. }
  15879. SuperMap.ProcessingServiceBase = ProcessingServiceBase_ProcessingServiceBase;
  15880. // CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  15881. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15882. * This program are made available under the terms of the Apache License, Version 2.0
  15883. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15884. /**
  15885. * @class SuperMap.BuffersAnalystJobsService
  15886. * @category iServer ProcessingService BufferAnalyst
  15887. * @classdesc 缓冲区分析服务类
  15888. * @extends {SuperMap.ProcessingServiceBase}
  15889. * @param {string} url - 服务地址。
  15890. * @param {Object} options - 参数。
  15891. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15892. * @param {Object} [options.headers] - 请求头。
  15893. */
  15894. class BuffersAnalystJobsService_BuffersAnalystJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  15895. constructor(url, options) {
  15896. super(url, options);
  15897. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  15898. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  15899. }
  15900. /**
  15901. *@override
  15902. */
  15903. destroy() {
  15904. super.destroy();
  15905. }
  15906. /**
  15907. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJobs
  15908. * @description 获取缓冲区分析所有任务
  15909. */
  15910. getBuffersJobs() {
  15911. super.getJobs(this.url);
  15912. }
  15913. /**
  15914. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJob
  15915. * @description 获取指定id的缓冲区分析服务
  15916. * @param {string} id - 指定要获取数据的id。
  15917. */
  15918. getBuffersJob(id) {
  15919. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  15920. }
  15921. /**
  15922. * @function SuperMap.BuffersAnalystJobsService.prototype.addBufferJob
  15923. * @description 新建缓冲区分析服务
  15924. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  15925. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  15926. */
  15927. addBuffersJob(params, seconds) {
  15928. super.addJob(this.url, params, BuffersAnalystJobsParameter_BuffersAnalystJobsParameter, seconds);
  15929. }
  15930. }
  15931. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService_BuffersAnalystJobsService;
  15932. // CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  15933. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15934. * This program are made available under the terms of the Apache License, Version 2.0
  15935. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15936. /**
  15937. * @class SuperMap.BurstPipelineAnalystParameters
  15938. * @category iServer NetworkAnalyst BurstAnalyse
  15939. * @classdesc 爆管分析参数类。
  15940. * @param {Object} options - 参数。
  15941. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  15942. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  15943. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  15944. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  15945. */
  15946. class BurstPipelineAnalystParameters_BurstPipelineAnalystParameters {
  15947. constructor(options) {
  15948. var me = this;
  15949. /**
  15950. * @member {Array.<number>} SuperMap.BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  15951. * @description 指定的设施点 ID 数组。
  15952. */
  15953. this.sourceNodeIDs = null;
  15954. /**
  15955. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.edgeID]
  15956. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  15957. */
  15958. this.edgeID = null;
  15959. /**
  15960. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.nodeID]
  15961. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  15962. */
  15963. this.nodeID = null;
  15964. /**
  15965. * @member {boolean} [SuperMap.BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  15966. * @description 指定不确定流向是否有效。
  15967. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  15968. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  15969. */
  15970. this.isUncertainDirectionValid = false;
  15971. Util_Util.extend(me, options);
  15972. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  15973. }
  15974. /**
  15975. * @function SuperMap.BurstPipelineAnalystParameters.prototype.destroy
  15976. * @description 释放资源,将引用资源的属性置空。
  15977. */
  15978. destroy() {
  15979. var me = this;
  15980. me.sourceNodeIDs = null;
  15981. me.edgeID = null;
  15982. me.nodeID = null;
  15983. me.isUncertainDirectionValid = null;
  15984. }
  15985. }
  15986. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters_BurstPipelineAnalystParameters;
  15987. // CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  15988. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  15989. * This program are made available under the terms of the Apache License, Version 2.0
  15990. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15991. /**
  15992. * @class SuperMap.NetworkAnalystServiceBase
  15993. * @category iServer NetworkAnalyst
  15994. * @classdesc 网络分析服务基类。
  15995. * @description 网络分析服务基类。
  15996. * @extends {SuperMap.CommonServiceBase}
  15997. * @param {string} url - 网络分析服务地址。
  15998. * @param {Object} options - 参数。
  15999. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16000. * @param {Object} [options.headers] - 请求头。
  16001. */
  16002. class NetworkAnalystServiceBase_NetworkAnalystServiceBase extends CommonServiceBase_CommonServiceBase {
  16003. constructor(url, options) {
  16004. super(url, options);
  16005. /**
  16006. * @member {SuperMap.DataFormat} [SuperMap.NetworkAnalystServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  16007. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  16008. */
  16009. this.format = DataFormat.GEOJSON;
  16010. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  16011. }
  16012. /**
  16013. * @function SuperMap.NetworkAnalystServiceBase.prototype.destroy
  16014. * @description 释放资源,将引用的资源属性置空。
  16015. */
  16016. destroy() {
  16017. super.destroy();
  16018. this.format = null;
  16019. }
  16020. /**
  16021. * @function SuperMap.NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  16022. * @description 分析完成,执行此方法。
  16023. * @param {Object} result - 服务器返回的结果对象。
  16024. */
  16025. serviceProcessCompleted(result) {
  16026. var me = this, analystResult;
  16027. result = Util_Util.transformResult(result);
  16028. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  16029. analystResult = me.toGeoJSONResult(result);
  16030. }
  16031. if (!analystResult) {
  16032. analystResult = result;
  16033. }
  16034. me.events.triggerEvent("processCompleted", {result: analystResult});
  16035. }
  16036. /**
  16037. * @function SuperMap.NetworkAnalystServiceBase.prototype.toGeoJSONResult
  16038. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  16039. * @param {Object} result - 服务器返回的结果对象。
  16040. * @returns {GeoJSONObject} GeoJSON 对象。
  16041. */
  16042. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  16043. return null;
  16044. }
  16045. }
  16046. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase_NetworkAnalystServiceBase;
  16047. // CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  16048. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16049. * This program are made available under the terms of the Apache License, Version 2.0
  16050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16051. /**
  16052. * @class SuperMap.BurstPipelineAnalystService
  16053. * @category iServer NetworkAnalyst BurstAnalyse
  16054. * @classdesc 爆管分析服务类,即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  16055. * @extends {SuperMap.NetworkAnalystServiceBase}
  16056. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  16057. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  16058. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  16059. * @param {Object} options - 参数。
  16060. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  16061. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16062. * @param {Object} [options.headers] - 请求头。
  16063. */
  16064. class BurstPipelineAnalystService_BurstPipelineAnalystService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  16065. constructor(url, options) {
  16066. super(url, options);
  16067. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  16068. }
  16069. /**
  16070. * @function SuperMap.BurstPipelineAnalystService.prototype.destroy
  16071. * @override
  16072. */
  16073. destroy() {
  16074. super.destroy();
  16075. }
  16076. /**
  16077. * @function SuperMap.BurstPipelineAnalystService.prototype.processAsync
  16078. * @description 负责将客户端的查询参数传递到服务端。
  16079. * @params {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析参数类
  16080. */
  16081. processAsync(params) {
  16082. if (!(params instanceof BurstPipelineAnalystParameters_BurstPipelineAnalystParameters)) {
  16083. return null;
  16084. }
  16085. var me = this, jsonObject;
  16086. me.url = Util_Util.urlPathAppend(me.url, 'burstAnalyse');
  16087. jsonObject = {
  16088. sourceNodeIDs: params.sourceNodeIDs,
  16089. isUncertainDirectionValid: params.isUncertainDirectionValid
  16090. };
  16091. //必传参数不正确,就终止
  16092. if (params.edgeID !== null && params.nodeID !== null) {
  16093. throw new Error('edgeID and nodeID cannot be null at the same time.');
  16094. }
  16095. if (params.edgeID === null && params.nodeID === null) {
  16096. throw new Error('edgeID and nodeID cannot be null at the same time.');
  16097. }
  16098. if (params.edgeID !== null) {
  16099. jsonObject.edgeID = params.edgeID;
  16100. } else {
  16101. jsonObject.nodeID = params.nodeID;
  16102. }
  16103. me.request({
  16104. method: "GET",
  16105. params: jsonObject,
  16106. scope: me,
  16107. success: me.serviceProcessCompleted,
  16108. failure: me.serviceProcessFailed
  16109. });
  16110. }
  16111. }
  16112. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService_BurstPipelineAnalystService;
  16113. // CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  16114. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16115. * This program are made available under the terms of the Apache License, Version 2.0
  16116. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16117. /**
  16118. * @class SuperMap.ChartFeatureInfoSpecsService
  16119. * @category iServer Map Chart
  16120. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  16121. * 用户可以通过两种方式获取查询结果:
  16122. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  16123. * 另一种是使用 AsyncResponder 类实现异步处理。
  16124. * @extends {SuperMap.CommonServiceBase}
  16125. * @param {string} url - 地图(特指海图)服务地址。
  16126. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  16127. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  16128. * @param {Object} options - 参数。
  16129. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  16130. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  16131. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  16132. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16133. * @param {Object} [options.headers] - 请求头。
  16134. */
  16135. class ChartFeatureInfoSpecsService_ChartFeatureInfoSpecsService extends CommonServiceBase_CommonServiceBase {
  16136. constructor(url, options) {
  16137. super(url, options);
  16138. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  16139. }
  16140. /**
  16141. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.destroy
  16142. * @override
  16143. */
  16144. destroy() {
  16145. super.destroy();
  16146. Util_Util.reset(this);
  16147. }
  16148. /**
  16149. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.processAsync
  16150. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  16151. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  16152. * 事件。用可以通过户两种方式获取图层信息:
  16153. * 1. 通过 AsyncResponder 类获取(推荐使用);
  16154. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  16155. */
  16156. processAsync() {
  16157. var me = this, method = "GET";
  16158. if (!me.isTempLayers) {
  16159. Util_Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  16160. }
  16161. me.request({
  16162. method: method,
  16163. params: null,
  16164. scope: me,
  16165. success: me.serviceProcessCompleted,
  16166. failure: me.serviceProcessFailed
  16167. });
  16168. }
  16169. }
  16170. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService_ChartFeatureInfoSpecsService;
  16171. // CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  16172. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16173. * This program are made available under the terms of the Apache License, Version 2.0
  16174. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16175. /**
  16176. * @class SuperMap.ChartQueryFilterParameter
  16177. * @category iServer Map Chart
  16178. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  16179. * @param {Object} options - 参数。
  16180. * @param {string} options.attributeFilter - 属性字段过滤条件。
  16181. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  16182. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  16183. * @param {boolean} [options.isQueryLine] - 是否查询线。
  16184. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  16185. */
  16186. class ChartQueryFilterParameter_ChartQueryFilterParameter {
  16187. constructor(options) {
  16188. /**
  16189. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryPoint]
  16190. * @description 是否查询点。
  16191. */
  16192. this.isQueryPoint = null;
  16193. /**
  16194. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryLine]
  16195. * @description 是否查询线。
  16196. */
  16197. this.isQueryLine = null;
  16198. /**
  16199. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryRegion]
  16200. * @description 是否查询面。
  16201. */
  16202. this.isQueryRegion = null;
  16203. /**
  16204. * @member {string} SuperMap.ChartQueryFilterParameter.prototype.attributeFilter
  16205. * @description 属性字段过滤条件。
  16206. */
  16207. this.attributeFilter = null;
  16208. /**
  16209. * @member {number} SuperMap.ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  16210. * @description 查询的物标代号。
  16211. */
  16212. this.chartFeatureInfoSpecCode = null;
  16213. Util_Util.extend(this, options);
  16214. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  16215. }
  16216. /**
  16217. * @function SuperMap.ChartQueryFilterParameter.prototype.destroy
  16218. * @description 释放资源,将引用资源的属性置空。
  16219. */
  16220. destroy() {
  16221. var me = this;
  16222. me.isQueryPoint = null;
  16223. me.isQueryLine = null;
  16224. me.isQueryRegion = null;
  16225. me.attributeFilter = null;
  16226. me.chartFeatureInfoSpecCode = null;
  16227. }
  16228. /**
  16229. * @function SuperMap.ChartQueryFilterParameter.prototype.toJson
  16230. * @description 将属性信息转化成 JSON 格式字符串。
  16231. */
  16232. toJson() {
  16233. var json = "";
  16234. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  16235. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  16236. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  16237. if (this.attributeFilter) {
  16238. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  16239. }
  16240. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  16241. json = "{" + json + "}";
  16242. return json;
  16243. }
  16244. }
  16245. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter_ChartQueryFilterParameter;
  16246. // CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  16247. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16248. * This program are made available under the terms of the Apache License, Version 2.0
  16249. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16250. /**
  16251. * @class SuperMap.ChartQueryParameters
  16252. * @category iServer Map Chart
  16253. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  16254. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  16255. * @param {Object} options - 参数。
  16256. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  16257. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  16258. * @param {Array.<{SuperMap.ChartQueryFilterParameter}>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  16259. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 海图查询范围。当进行海图范围查询时,此参数为必选。
  16260. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  16261. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  16262. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  16263. */
  16264. class ChartQueryParameters_ChartQueryParameters {
  16265. constructor(options) {
  16266. /**
  16267. * @member {string} SuperMap.ChartQueryParameters.prototype.queryMode
  16268. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery") 。
  16269. */
  16270. this.queryMode = null;
  16271. /**
  16272. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.ChartQueryParameters.prototype.bounds
  16273. * @description 海图查询范围。
  16274. */
  16275. this.bounds = null;
  16276. /**
  16277. * @member {Array.<string>} SuperMap.ChartQueryParameters.prototype.chartLayerNames
  16278. * @description 查询的海图图层的名称。
  16279. */
  16280. this.chartLayerNames = null;
  16281. /**
  16282. * @member {Array.<SuperMap.ChartQueryFilterParameter>} SuperMap.ChartQueryParameters.prototype.chartQueryFilterParameters
  16283. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  16284. */
  16285. this.chartQueryFilterParameters = null;
  16286. /**
  16287. * @member {boolean} [SuperMap.ChartQueryParameters.prototype.returnContent=true]
  16288. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  16289. */
  16290. this.returnContent = true;
  16291. /**
  16292. * @member {number} [SuperMap.ChartQueryParameters.prototype.startRecord=0]
  16293. * @description 查询起始记录位置。
  16294. */
  16295. this.startRecord = 0;
  16296. /**
  16297. * @member {number} [SuperMap.ChartQueryParameters.prototype.expectCount]
  16298. * @description 期望查询结果返回的记录数,该值大于0。
  16299. */
  16300. this.expectCount = null;
  16301. Util_Util.extend(this, options);
  16302. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  16303. }
  16304. /**
  16305. * @function SuperMap.ChartQueryParameters.prototype.destroy
  16306. * @description 释放资源,将引用资源的属性置空。
  16307. */
  16308. destroy() {
  16309. var me = this;
  16310. me.queryMode = null;
  16311. me.bounds = null;
  16312. me.chartLayerNames = null;
  16313. me.chartQueryFilterParameters = null;
  16314. me.returnContent = true;
  16315. me.startRecord = 0;
  16316. me.expectCount = null;
  16317. }
  16318. /**
  16319. * @function SuperMap.ChartQueryParameters.prototype.getVariablesJson
  16320. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  16321. * @returns {string} JSON 字符串。
  16322. */
  16323. getVariablesJson() {
  16324. var json = "";
  16325. json += "\"queryMode\":\"" + this.queryMode + "\",";
  16326. if (this.chartLayerNames && this.chartLayerNames.length) {
  16327. var chartLayersArray = [];
  16328. var layerLength = this.chartLayerNames.length;
  16329. for (var i = 0; i < layerLength; i++) {
  16330. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  16331. }
  16332. var layerNames = "[" + chartLayersArray.join(",") + "]";
  16333. json += "\"chartLayerNames\":" + layerNames + ",";
  16334. }
  16335. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  16336. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  16337. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  16338. "\"y\":" + this.bounds.top + "}" + "},";
  16339. }
  16340. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  16341. var chartParamArray = [];
  16342. var chartLength = this.chartQueryFilterParameters.length;
  16343. for (var j = 0; j < chartLength; j++) {
  16344. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  16345. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter_ChartQueryFilterParameter)) {
  16346. continue;
  16347. }
  16348. chartParamArray.push(chartQueryFilterParameter.toJson());
  16349. }
  16350. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  16351. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  16352. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  16353. chartParamsJson += "\"expectCount\":" + this.expectCount;
  16354. chartParamsJson = "{" + chartParamsJson + "}";
  16355. json += "\"chartQueryParameters\":" + chartParamsJson;
  16356. }
  16357. json = "{" + json + "}";
  16358. return json;
  16359. }
  16360. }
  16361. SuperMap.ChartQueryParameters = ChartQueryParameters_ChartQueryParameters;
  16362. // CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  16363. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16364. * This program are made available under the terms of the Apache License, Version 2.0
  16365. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16366. /**
  16367. * @class SuperMap.QueryParameters
  16368. * @category iServer Map QueryResults
  16369. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  16370. * @param {Object} options - 参数。
  16371. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  16372. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  16373. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  16374. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  16375. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  16376. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  16377. * @param {number} [options.startRecord=0] - 查询起始记录号。
  16378. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  16379. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  16380. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  16381. */
  16382. class QueryParameters_QueryParameters {
  16383. constructor(options) {
  16384. if (!options) {
  16385. return;
  16386. }
  16387. /**
  16388. * @member {string} [SuperMap.QueryParameters.prototype.customParams]
  16389. * @description 自定义参数,供扩展使用。
  16390. */
  16391. this.customParams = null;
  16392. /**
  16393. * @member {Object} [SuperMap.QueryParameters.prototype.prjCoordSys]
  16394. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  16395. */
  16396. this.prjCoordSys = null;
  16397. /**
  16398. * @member {number} [SuperMap.QueryParameters.prototype.expectCount=100000]
  16399. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  16400. * 如果实际不足100000条则返回实际记录条数。
  16401. */
  16402. this.expectCount = 100000;
  16403. /**
  16404. * @member {SuperMap.GeometryType} [SuperMap.QueryParameters.prototype.networkType=SuperMap.GeometryType.LINE]
  16405. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  16406. */
  16407. this.networkType = GeometryType.LINE;
  16408. /**
  16409. * @member {SuperMap.QueryOption} [SuperMap.QueryParameters.prototype.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY]
  16410. * @description 查询结果类型枚举类。
  16411. * 该类描述查询结果返回类型,包括只返回属性、
  16412. * 只返回几何实体以及返回属性和几何实体。
  16413. */
  16414. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  16415. /**
  16416. * @member {Array.<SuperMap.FilterParameter>} SuperMap.QueryParameters.prototype.queryParams
  16417. * @description 查询过滤条件参数数组。
  16418. * 该类用于设置查询数据集的查询过滤参数。
  16419. */
  16420. this.queryParams = null;
  16421. /**
  16422. * @member {number} [SuperMap.QueryParameters.prototype.startRecord=0]
  16423. * @description 查询起始记录号。
  16424. */
  16425. this.startRecord = 0;
  16426. /**
  16427. * @member {number} [SuperMap.QueryParameters.prototype.holdTime=10]
  16428. * @description 资源在服务端保存的时间,单位为分钟。
  16429. */
  16430. this.holdTime = 10;
  16431. /**
  16432. * @member {boolean} [SuperMap.QueryParameters.prototype.returnCustomResult=false]
  16433. * @description 仅供三维使用。
  16434. */
  16435. this.returnCustomResult = false;
  16436. /**
  16437. * @member {boolean} [SuperMap.QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  16438. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  16439. */
  16440. this.returnFeatureWithFieldCaption = false;
  16441. Util_Util.extend(this, options);
  16442. this.CLASS_NAME = "SuperMap.QueryParameters";
  16443. }
  16444. /**
  16445. * @function SuperMap.QueryParameters.prototype.destroy
  16446. * @description 释放资源,将引用资源的属性置空。
  16447. */
  16448. destroy() {
  16449. var me = this;
  16450. me.customParams = null;
  16451. me.expectCount = null;
  16452. me.networkType = null;
  16453. me.queryOption = null;
  16454. if (me.queryParams) {
  16455. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  16456. qps[i].destroy();
  16457. }
  16458. me.queryParams = null;
  16459. }
  16460. me.startRecord = null;
  16461. me.holdTime = null;
  16462. me.returnCustomResult = null;
  16463. me.prjCoordSys = null;
  16464. }
  16465. }
  16466. SuperMap.QueryParameters = QueryParameters_QueryParameters;
  16467. // CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  16468. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16469. * This program are made available under the terms of the Apache License, Version 2.0
  16470. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16471. /**
  16472. * @class SuperMap.ChartQueryService
  16473. * @category iServer Map Chart
  16474. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  16475. * 用户可以通过两种方式获取查询结果:
  16476. * 1.通过 AsyncResponder 类获取(推荐使用);
  16477. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  16478. * @extends {SuperMap.CommonServiceBase}
  16479. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  16480. * @param {Object} options - 参数。
  16481. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  16482. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  16483. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  16484. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16485. * @param {Object} [options.headers] - 请求头。
  16486. * @example
  16487. * 下面示例显示了如何进行海图属性查询:
  16488. * var nameArray = ["GB4X0000_52000"];
  16489. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  16490. * isQueryPoint:true,
  16491. * isQueryLine:true,
  16492. * isQueryRegion:true,
  16493. * attributeFilter:"SmID<10",
  16494. * chartFeatureInfoSpecCode:1
  16495. * });
  16496. *
  16497. * var chartQueryParameters = new SuperMap.ChartQueryParameters({
  16498. * queryMode:"ChartAttributeQuery",
  16499. * chartLayerNames:nameArray,
  16500. * returnContent:true,
  16501. * chartQueryFilterParameters:[chartQueryFilterParameter]
  16502. * });
  16503. *
  16504. * var chartQueryService = new SuperMap.ChartQueryService(url);
  16505. *
  16506. * chartQueryService.events.on({
  16507. * "processCompleted":processCompleted,
  16508. * "processFailed":processFailed
  16509. * });
  16510. * chartQueryService.processAsync(chartQueryParameters);
  16511. */
  16512. class ChartQueryService_ChartQueryService extends CommonServiceBase_CommonServiceBase {
  16513. constructor(url, options) {
  16514. super(url, options);
  16515. options = options || {};
  16516. /**
  16517. * @member {boolean} SuperMap.ChartQueryService.prototype.returnContent
  16518. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  16519. */
  16520. this.returnContent = null;
  16521. /**
  16522. * @member {SuperMap.DataFormat} SuperMap.ChartQueryService.prototype.format
  16523. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  16524. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  16525. */
  16526. this.format = DataFormat.GEOJSON;
  16527. Util_Util.extend(this, options);
  16528. var me = this;
  16529. if (options.format) {
  16530. me.format = options.format.toUpperCase();
  16531. }
  16532. if (!me.url) {
  16533. return;
  16534. }
  16535. me.url = Util_Util.urlPathAppend(me.url, 'queryResults');
  16536. this.CLASS_NAME = "SuperMap.ChartQueryService";
  16537. }
  16538. /**
  16539. * @function SuperMap.ChartQueryService.prototype.destroy
  16540. * @override
  16541. */
  16542. destroy() {
  16543. var me = this;
  16544. CommonServiceBase_CommonServiceBase.prototype.destroy.apply(this, arguments);
  16545. me.returnContent = null;
  16546. me.format = null;
  16547. }
  16548. /**
  16549. * @function SuperMap.ChartQueryService.prototype.processAsync
  16550. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  16551. * @param {SuperMap.ChartQueryParameters} params - 查询参数。
  16552. */
  16553. processAsync(params) {
  16554. //todo重点需要添加代码的地方
  16555. if (!(params instanceof ChartQueryParameters_ChartQueryParameters)) {
  16556. return;
  16557. }
  16558. var me = this, jsonParameters;
  16559. me.returnContent = params.returnContent;
  16560. jsonParameters = params.getVariablesJson();
  16561. if (me.returnContent) {
  16562. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  16563. }
  16564. me.request({
  16565. method: "POST",
  16566. data: jsonParameters,
  16567. scope: me,
  16568. success: me.serviceProcessCompleted,
  16569. failure: me.serviceProcessFailed
  16570. });
  16571. }
  16572. /**
  16573. * @function SuperMap.ChartQueryService.prototype.serviceProcessCompleted
  16574. * @description 查询完成,执行此方法。
  16575. * @param {Object} result - 服务器返回的结果对象。
  16576. */
  16577. serviceProcessCompleted(result) {
  16578. var me = this;
  16579. result = Util_Util.transformResult(result);
  16580. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  16581. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  16582. if (recordsets[i].features) {
  16583. var geoJSONFormat = new GeoJSON_GeoJSON();
  16584. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  16585. }
  16586. }
  16587. }
  16588. me.events.triggerEvent("processCompleted", {result: result});
  16589. }
  16590. /**
  16591. * @function SuperMap.ChartQueryService.prototype.getQueryParameters
  16592. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  16593. * @param {Object} params - JSON 字符串表示的查询参数。
  16594. * @returns {SuperMap.QueryParameters} 返回查询结果
  16595. */
  16596. getQueryParameters(params) {
  16597. return new QueryParameters_QueryParameters({
  16598. queryMode: params.queryMode,
  16599. bounds: params.bounds,
  16600. chartLayerNames: params.chartLayerNames,
  16601. chartQueryFilterParameters: params.chartQueryFilterParameters,
  16602. returnContent: params.returnContent
  16603. });
  16604. }
  16605. }
  16606. SuperMap.ChartQueryService = ChartQueryService_ChartQueryService;
  16607. // CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  16608. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16609. * This program are made available under the terms of the Apache License, Version 2.0
  16610. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16611. /**
  16612. * @class SuperMap.ClipParameter
  16613. * @category iServer SpatialAnalyst InterpolationAnalyst
  16614. * @classdesc 用于裁剪的参数。
  16615. * @description 优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  16616. * @param {Object} options - 参数。
  16617. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  16618. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  16619. * @param {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} [options.clipRegion] - 用户指定的裁剪区域。
  16620. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  16621. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  16622. */
  16623. class ClipParameter_ClipParameter {
  16624. constructor(options) {
  16625. /**
  16626. * @member {string} SuperMap.ClipParameter.prototype.clipDatasetName
  16627. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  16628. */
  16629. this.clipDatasetName = null;
  16630. /**
  16631. * @member {string} SuperMap.ClipParameter.prototype.clipDatasourceName
  16632. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  16633. */
  16634. this.clipDatasourceName = null;
  16635. /**
  16636. * @member {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} SuperMap.ClipParameter.prototype.clipRegion
  16637. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  16638. */
  16639. this.clipRegion = null;
  16640. /**
  16641. * @member {boolean} [SuperMap.ClipParameter.prototype.isClipInRegion=true]
  16642. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  16643. */
  16644. this.isClipInRegion = true;
  16645. /**
  16646. * @member {boolean} [SuperMap.ClipParameter.prototype.isExactClip=true]
  16647. * @description 是否使用精确裁剪。
  16648. */
  16649. this.isExactClip = null;
  16650. if (options) {
  16651. Util_Util.extend(this, options);
  16652. }
  16653. this.CLASS_NAME = "SuperMap.ClipParameter";
  16654. }
  16655. /**
  16656. * @function SuperMap.ClipParameter.prototype.destroy
  16657. * @description 释放资源,将引用资源的属性置空。
  16658. */
  16659. destroy() {
  16660. var me = this;
  16661. me.clipDatasetName = null;
  16662. me.clipDatasourceName = null;
  16663. me.clipRegion = null;
  16664. me.isClipInRegion = null;
  16665. me.isExactClip = null;
  16666. }
  16667. /**
  16668. * @function SuperMap.ClipParameter.prototype.toJSON
  16669. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  16670. * @returns {string} 返回转换后的 JSON 字符串。
  16671. */
  16672. toJSON() {
  16673. return Util_Util.toJSON({
  16674. isClipInRegion: this.isClipInRegion,
  16675. clipDatasetName: this.clipDatasetName,
  16676. clipDatasourceName: this.clipDatasourceName,
  16677. isExactClip: this.isExactClip,
  16678. clipRegion: ServerGeometry_ServerGeometry.fromGeometry(this.clipRegion)
  16679. });
  16680. }
  16681. }
  16682. SuperMap.ClipParameter = ClipParameter_ClipParameter;
  16683. // CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  16684. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16685. * This program are made available under the terms of the Apache License, Version 2.0
  16686. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16687. /**
  16688. * @class SuperMap.ColorDictionary
  16689. * @category iServer Map Theme
  16690. * @classdesc 颜色对照表类。
  16691. * @description 颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  16692. * @param {Object} options - 参数。
  16693. * @param {number} options.elevation - 高程值。
  16694. * @param {SuperMap.ServerColor} options.color - 服务端颜色类。
  16695. */
  16696. class ColorDictionary_ColorDictionary {
  16697. constructor(options) {
  16698. options = options || {};
  16699. /**
  16700. * @member {number} SuperMap.ColorDictionary.prototype.elevation
  16701. * @description 高程值。
  16702. */
  16703. this.elevation = null;
  16704. /**
  16705. * @member {SuperMap.ServerColor} SuperMap.ColorDictionary.prototype.color
  16706. * @description 服务端颜色类。
  16707. */
  16708. this.color = null;
  16709. Util_Util.extend(this, options);
  16710. var me = this,
  16711. c = me.color;
  16712. if (c) {
  16713. me.color = new ServerColor(c.red, c.green, c.blue);
  16714. }
  16715. this.CLASS_NAME = "SuperMap.ColorDictionary";
  16716. }
  16717. /**
  16718. * @function SuperMap.ColorDictionary.prototype.destroy
  16719. * @description 释放资源,将引用资源的属性置空。
  16720. */
  16721. destroy() {
  16722. Util_Util.reset(this);
  16723. }
  16724. /**
  16725. * @function SuperMap.ColorDictionary.prototype.toServerJSONObject
  16726. * @description 转换成对应的 JSON 格式对象。
  16727. * @returns {Object} JSON 对象。
  16728. */
  16729. toServerJSONObject() {
  16730. var dataObj = {};
  16731. dataObj = Util_Util.copyAttributes(dataObj, this);
  16732. return dataObj;
  16733. }
  16734. }
  16735. SuperMap.ColorDictionary = ColorDictionary_ColorDictionary;
  16736. // CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  16737. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16738. * This program are made available under the terms of the Apache License, Version 2.0
  16739. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16740. /**
  16741. * @class SuperMap.TransportationAnalystResultSetting
  16742. * @category iServer NetworkAnalyst
  16743. * @classdesc 交通网络分析结果参数类。
  16744. * @description 通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  16745. * @param {Object} options - 参数。
  16746. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  16747. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  16748. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  16749. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  16750. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  16751. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  16752. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  16753. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  16754. */
  16755. class TransportationAnalystResultSetting_TransportationAnalystResultSetting {
  16756. constructor(options) {
  16757. if (!options) {
  16758. return;
  16759. }
  16760. /**
  16761. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  16762. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  16763. */
  16764. this.returnEdgeFeatures = false;
  16765. /**
  16766. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  16767. * @description 返回的弧段要素集合中是否包含几何对象信息。
  16768. */
  16769. this.returnEdgeGeometry = false;
  16770. /**
  16771. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  16772. * @description 返回结果中是否包含经过弧段 ID 集合。
  16773. */
  16774. this.returnEdgeIDs = false;
  16775. /**
  16776. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  16777. * @description 是否在分析结果中包含结点要素集合。
  16778. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  16779. */
  16780. this.returnNodeFeatures = false;
  16781. /**
  16782. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  16783. * @description 返回的结点要素集合中是否包含几何对象信息。
  16784. */
  16785. this.returnNodeGeometry = false;
  16786. /**
  16787. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  16788. * @description 返回结果中是否包含经过结点 ID 集合。
  16789. */
  16790. this.returnNodeIDs = false;
  16791. /**
  16792. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnPathGuides
  16793. * @description 返回分析结果中是否包含行驶导引集合。
  16794. */
  16795. this.returnPathGuides = false;
  16796. /**
  16797. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnRoutes
  16798. * @description 返回分析结果中是否包含路由对象的集合。
  16799. */
  16800. this.returnRoutes = false;
  16801. Util_Util.extend(this, options);
  16802. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  16803. }
  16804. /**
  16805. * @function SuperMap.TransportationAnalystResultSetting.prototype.destroy
  16806. * @description 释放资源,将引用资源的属性置空。
  16807. */
  16808. destroy() {
  16809. var me = this;
  16810. me.returnEdgeFeatures = null;
  16811. me.returnEdgeGeometry = null;
  16812. me.returnEdgeIDs = null;
  16813. me.returnNodeFeatures = null;
  16814. me.returnNodeGeometry = null;
  16815. me.returnNodeIDs = null;
  16816. me.returnPathGuides = null;
  16817. me.returnRoutes = null;
  16818. }
  16819. }
  16820. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting_TransportationAnalystResultSetting;
  16821. // CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  16822. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16823. * This program are made available under the terms of the Apache License, Version 2.0
  16824. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16825. /**
  16826. * @class SuperMap.TransportationAnalystParameter
  16827. * @category iServer NetworkAnalyst
  16828. * @classdesc 交通网络分析通用参数类。
  16829. * @description 该类主要用来提供交通网络分析所需的通用参数。
  16830. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  16831. * @param {Object} options - 参数。
  16832. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  16833. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  16834. * @param {string} options.turnWeightField - 转向权重字段的名称。
  16835. * @param {SuperMap.TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  16836. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  16837. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  16838. */
  16839. class TransportationAnalystParameter_TransportationAnalystParameter {
  16840. constructor(options) {
  16841. if (!options) {
  16842. return;
  16843. }
  16844. /**
  16845. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierEdgeIDs
  16846. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  16847. */
  16848. this.barrierEdgeIDs = null;
  16849. /**
  16850. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierNodeIDs
  16851. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  16852. */
  16853. this.barrierNodeIDs = null;
  16854. /**
  16855. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransportationAnalystParameter.prototype.barrierPoints
  16856. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  16857. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  16858. */
  16859. this.barrierPoints = null;
  16860. /**
  16861. * @member {string} [SuperMap.TransportationAnalystParameter.prototype.weightFieldName]
  16862. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  16863. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  16864. */
  16865. this.weightFieldName = null;
  16866. /**
  16867. * @member {string} SuperMap.TransportationAnalystParameter.prototype.turnWeightField
  16868. * @description 转向权重字段的名称。
  16869. */
  16870. this.turnWeightField = null;
  16871. /**
  16872. * @member {SuperMap.TransportationAnalystResultSetting} SuperMap.TransportationAnalystParameter.prototype.resultSetting
  16873. * @description 分析结果返回内容。
  16874. */
  16875. this.resultSetting = new TransportationAnalystResultSetting_TransportationAnalystResultSetting();
  16876. Util_Util.extend(this, options);
  16877. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  16878. }
  16879. /**
  16880. * @function SuperMap.TransportationAnalystParameter.prototype.destroy
  16881. * @description 释放资源,将引用资源的属性置空。
  16882. */
  16883. destroy() {
  16884. var me = this;
  16885. me.barrierEdgeIDs = null;
  16886. me.barrierNodeIDs = null;
  16887. me.weightFieldName = null;
  16888. me.turnWeightField = null;
  16889. if (me.resultSetting) {
  16890. me.resultSetting.destroy();
  16891. me.resultSetting = null;
  16892. }
  16893. if (me.barrierPoints && me.barrierPoints.length) {
  16894. for (var i in me.barrierPoints) {
  16895. me.barrierPoints[i].destroy();
  16896. }
  16897. }
  16898. me.barrierPoints = null;
  16899. }
  16900. }
  16901. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter_TransportationAnalystParameter;
  16902. // CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  16903. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16904. * This program are made available under the terms of the Apache License, Version 2.0
  16905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16906. /**
  16907. * @class SuperMap.ComputeWeightMatrixParameters
  16908. * @category iServer NetworkAnalyst WeightMatrix
  16909. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  16910. * @param {Object} options - 参数。
  16911. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  16912. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 要计算耗费矩阵的点数组。
  16913. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  16914. */
  16915. class ComputeWeightMatrixParameters_ComputeWeightMatrixParameters {
  16916. constructor(options) {
  16917. /**
  16918. * @member {boolean} [SuperMap.ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  16919. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  16920. */
  16921. this.isAnalyzeById = false;
  16922. /**
  16923. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.ComputeWeightMatrixParameters.prototype.nodes
  16924. * @description 要计算耗费矩阵的点数组。
  16925. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  16926. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  16927. */
  16928. this.nodes = null;
  16929. /**
  16930. * @member {SuperMap.TransportationAnalystParameter} SuperMap.ComputeWeightMatrixParameters.prototype.parameter
  16931. * @description 交通网络分析通用参数。
  16932. */
  16933. this.parameter = new TransportationAnalystParameter_TransportationAnalystParameter();
  16934. Util_Util.extend(this, options);
  16935. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  16936. }
  16937. /**
  16938. * @function SuperMap.ComputeWeightMatrixParameters.prototype.destroy
  16939. * @description 释放资源,将引用资源的属性置空。
  16940. */
  16941. destroy() {
  16942. var me = this;
  16943. me.isAnalyzeById = null;
  16944. me.nodes = null;
  16945. if (me.parameter) {
  16946. me.parameter.destroy();
  16947. me.parameter = null;
  16948. }
  16949. }
  16950. }
  16951. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters_ComputeWeightMatrixParameters;
  16952. // CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  16953. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  16954. * This program are made available under the terms of the Apache License, Version 2.0
  16955. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16956. /**
  16957. * @class SuperMap.ComputeWeightMatrixService
  16958. * @category iServer NetworkAnalyst WeightMatrix
  16959. * @classdesc 耗费矩阵分析服务类。
  16960. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  16961. * 用来存储指定的任意两点间的资源消耗。
  16962. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  16963. * @extends {SuperMap.NetworkAnalystServiceBase}
  16964. * @example
  16965. * var mycomputeWeightMatrixService = new SuperMap.ComputeWeightMatrixService(url,{
  16966. * eventListeners: {
  16967. * "processCompleted": computeWeightMatrixCompleted,
  16968. * "processFailed": computeWeightMatrixnError
  16969. * }
  16970. * });
  16971. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  16972. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  16973. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  16974. * @param {Object} options - 参数。
  16975. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  16976. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16977. * @param {Object} [options.headers] - 请求头。
  16978. */
  16979. class ComputeWeightMatrixService_ComputeWeightMatrixService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  16980. constructor(url, options) {
  16981. super(url, options);
  16982. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  16983. }
  16984. /**
  16985. * @function SuperMap.ComputeWeightMatrixService.prototype.destroy
  16986. * @override
  16987. */
  16988. destroy() {
  16989. super.destroy();
  16990. }
  16991. /**
  16992. * @function SuperMap.ComputeWeightMatrixService.prototype.processAsync
  16993. * @description 负责将客户端的查询参数传递到服务端。
  16994. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  16995. */
  16996. processAsync(params) {
  16997. if (!(params instanceof ComputeWeightMatrixParameters_ComputeWeightMatrixParameters)) {
  16998. return;
  16999. }
  17000. var me = this,
  17001. jsonObject;
  17002. me.url = Util_Util.urlPathAppend(me.url, 'weightmatrix');
  17003. jsonObject = {
  17004. parameter: Util_Util.toJSON(params.parameter),
  17005. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  17006. };
  17007. me.request({
  17008. method: "GET",
  17009. params: jsonObject,
  17010. scope: me,
  17011. success: me.serviceProcessCompleted,
  17012. failure: me.serviceProcessFailed
  17013. });
  17014. }
  17015. /**
  17016. * @function SuperMap.ComputeWeightMatrixService.prototype.getJson
  17017. * @description 将对象转化为JSON字符串。
  17018. * @param {boolean} isAnalyzeById - 是否通过id分析
  17019. * @param {Array.<SuperMap.ComputeWeightMatrixParameters>} params - 分析参数数组
  17020. * @returns {string} 转化后的JSON字符串。
  17021. */
  17022. getJson(isAnalyzeById, params) {
  17023. var jsonString = "[",
  17024. len = params ? params.length : 0;
  17025. if (isAnalyzeById === false) {
  17026. for (let i = 0; i < len; i++) {
  17027. if (i > 0) {
  17028. jsonString += ",";
  17029. }
  17030. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  17031. }
  17032. } else if (isAnalyzeById === true) {
  17033. for (let i = 0; i < len; i++) {
  17034. if (i > 0) {
  17035. jsonString += ",";
  17036. }
  17037. jsonString += params[i];
  17038. }
  17039. }
  17040. jsonString += ']';
  17041. return jsonString;
  17042. }
  17043. }
  17044. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService_ComputeWeightMatrixService;
  17045. // CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  17046. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17047. * This program are made available under the terms of the Apache License, Version 2.0
  17048. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17049. /**
  17050. * @class SuperMap.DataFlowService
  17051. * @category iServer DataFlow
  17052. * @classdesc 数据流服务类
  17053. * @extends {SuperMap.CommonServiceBase}
  17054. * @param {string} url - 数据流服务地址
  17055. * @param {Object} options - 参数。
  17056. * @param {function} options.style - 设置数据加载样式。
  17057. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  17058. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  17059. * @param {Object} [options.excludeField] - -排除字段。
  17060. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17061. * @param {Object} [options.headers] - 请求头。
  17062. */
  17063. class DataFlowService_DataFlowService extends CommonServiceBase_CommonServiceBase {
  17064. constructor(url, options) {
  17065. options = options || {};
  17066. /*
  17067. * @constant EVENT_TYPES
  17068. * {Array.<string>}
  17069. * 此类支持的事件类型
  17070. */
  17071. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  17072. super(url, options);
  17073. /**
  17074. * @member {GeoJSONObject} SuperMap.DataFlowService.prototype.geometry
  17075. * @description 指定几何范围,该范围内的要素才能被订阅。
  17076. */
  17077. this.geometry = null;
  17078. /**
  17079. * @member {Object} SuperMap.DataFlowService.prototype.prjCoordSys
  17080. * @description 动态投影参数
  17081. */
  17082. this.prjCoordSys = null;
  17083. /**
  17084. * @member {Object} SuperMap.DataFlowService.prototype.excludeField
  17085. * @description 排除字段
  17086. */
  17087. this.excludeField = null;
  17088. Util_Util.extend(this, options);
  17089. this.CLASS_NAME = "SuperMap.DataFlowService";
  17090. }
  17091. /**
  17092. * @function SuperMap.DataFlowService.prototype.initBroadcast
  17093. * @description 初始化广播
  17094. * @returns {SuperMap.DataFlowService}
  17095. */
  17096. initBroadcast() {
  17097. var me = this;
  17098. this.broadcastWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'broadcast'));
  17099. this.broadcastWebSocket.onopen = function (e) {
  17100. me.broadcastWebSocket.isOpen = true;
  17101. e.eventType = 'broadcastSocketConnected';
  17102. me.events.triggerEvent('broadcastSocketConnected', e);
  17103. };
  17104. this.broadcastWebSocket.onclose = function (e) {
  17105. me.broadcastWebSocket.isOpen = false;
  17106. e.eventType = 'broadcastSocketConnected';
  17107. me.events.triggerEvent('broadcastSocketConnected', e);
  17108. };
  17109. this.broadcastWebSocket.onerror = function (e) {
  17110. e.eventType = 'broadcastSocketError';
  17111. me.events.triggerEvent('broadcastSocketError', e);
  17112. };
  17113. return this;
  17114. }
  17115. /**
  17116. * @function SuperMap.DataFlowService.prototype.broadcast
  17117. * @description 加载广播数据。
  17118. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  17119. */
  17120. broadcast(geoJSONFeature) {
  17121. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  17122. this.events.triggerEvent('broadcastFailed');
  17123. return;
  17124. }
  17125. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  17126. this.events.triggerEvent('broadcastSucceeded');
  17127. }
  17128. /**
  17129. * @function SuperMap.DataFlowService.prototype.initSubscribe
  17130. * @description 初始化订阅数据
  17131. * @returns {this} this
  17132. */
  17133. initSubscribe() {
  17134. var me = this;
  17135. this.subscribeWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'subscribe'));
  17136. this.subscribeWebSocket.onopen = function (e) {
  17137. me.subscribeWebSocket.send(me._getFilterParams());
  17138. e.eventType = 'subscribeSocketConnected';
  17139. me.events.triggerEvent('subscribeSocketConnected', e);
  17140. };
  17141. this.subscribeWebSocket.onerror = function (e) {
  17142. e.eventType = 'subscribeSocketError';
  17143. me.events.triggerEvent('subscribeSocketError', e);
  17144. };
  17145. this.subscribeWebSocket.onmessage = function (e) {
  17146. me._onMessage(e);
  17147. };
  17148. return this;
  17149. }
  17150. /**
  17151. * @function SuperMap.DataFlowService.prototype.setExcludeField
  17152. * @description 设置排除字段
  17153. * @param {Object} excludeField - 排除字段
  17154. * @returns {this} this
  17155. */
  17156. setExcludeField(excludeField) {
  17157. this.excludeField = excludeField;
  17158. this.subscribeWebSocket.send(this._getFilterParams());
  17159. return this;
  17160. }
  17161. /**
  17162. * @function SuperMap.DataFlowService.prototype.setGeometry
  17163. * @description 设置添加的几何要素数据
  17164. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  17165. * @returns {this} this
  17166. */
  17167. setGeometry(geometry) {
  17168. this.geometry = geometry;
  17169. this.subscribeWebSocket.send(this._getFilterParams());
  17170. return this;
  17171. }
  17172. /**
  17173. * @function SuperMap.DataFlowService.prototype.unSubscribe
  17174. * @description 结束订阅数据
  17175. */
  17176. unSubscribe() {
  17177. if (!this.subscribeWebSocket) {
  17178. return;
  17179. }
  17180. this.subscribeWebSocket.close();
  17181. this.subscribeWebSocket = null;
  17182. }
  17183. /**
  17184. * @function SuperMap.DataFlowService.prototype.unBroadcast
  17185. * @description 结束加载广播
  17186. */
  17187. unBroadcast() {
  17188. if (!this.broadcastWebSocket) {
  17189. return;
  17190. }
  17191. this.broadcastWebSocket.close();
  17192. this.broadcastWebSocket = null;
  17193. }
  17194. /**
  17195. * @function SuperMap.DataFlowService.prototype.destroy
  17196. * @override
  17197. */
  17198. destroy() {
  17199. CommonServiceBase_CommonServiceBase.prototype.destroy.apply(this, arguments);
  17200. var me = this;
  17201. me.geometry = null;
  17202. me.prjCoordSys = null;
  17203. me.excludeField = null;
  17204. this.unBroadcast();
  17205. this.unSubscribe();
  17206. }
  17207. _getFilterParams() {
  17208. var filter = {
  17209. filterParam: {
  17210. prjCoordSys: this.prjCoordSys,
  17211. excludeField: this.excludeField,
  17212. geometry: this.geometry
  17213. }
  17214. };
  17215. return Util_Util.toJSON(filter);
  17216. }
  17217. _onMessage(e) {
  17218. if (e.data && e.data.indexOf("filterParam") >= 0) {
  17219. var filterParam = JSON.parse(e.data);
  17220. e.filterParam = filterParam;
  17221. e.eventType = 'setFilterParamSucceeded';
  17222. this.events.triggerEvent('setFilterParamSucceeded', e);
  17223. return;
  17224. }
  17225. var feature = JSON.parse(e.data);
  17226. e.featureResult = feature;
  17227. e.eventType = 'messageSucceeded';
  17228. this.events.triggerEvent('messageSucceeded', e);
  17229. }
  17230. _connect(url) {
  17231. url = this._appendCredentials(url);
  17232. if ("WebSocket" in window) {
  17233. return new WebSocket(url);
  17234. } else if ("MozWebSocket" in window) {
  17235. var mozWebSocket = window.MozWebSocket;
  17236. return new mozWebSocket(url);
  17237. } else {
  17238. console.log("no WebSocket");
  17239. return null;
  17240. }
  17241. }
  17242. _appendCredentials(url) {
  17243. var token = SecurityManager_SecurityManager.getToken(url);
  17244. if (token) {
  17245. url = Util_Util.urlAppend(url, "token=" + token);
  17246. }
  17247. return url;
  17248. }
  17249. }
  17250. SuperMap.DataFlowService = DataFlowService_DataFlowService;
  17251. // CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  17252. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17253. * This program are made available under the terms of the Apache License, Version 2.0
  17254. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17255. /**
  17256. * @class SuperMap.DatasetInfo
  17257. * @category iServer Data
  17258. * @classdesc 数据集信息类。
  17259. * @description 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  17260. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  17261. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  17262. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  17263. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  17264. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  17265. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  17266. * @param {Object} options - 参数。
  17267. * @param {SuperMap.Bounds} [options.bounds] - 数据集范围,该字段只读。
  17268. * @param {string} [options.dataSourceName] - 数据源名称,该字段只读。
  17269. * @param {string} [options.description] - 数据集的描述信息。
  17270. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式,该字段只读。
  17271. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  17272. * @param {string} options.name - 数据集名称,该字段必须且只读。
  17273. * @param {SuperMap.Projection} [options.prjCoordSys] - 数据集的投影信息。
  17274. * @param {string} [options.tableName] - 表名,该字段只读。
  17275. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  17276. */
  17277. class DatasetInfo_DatasetInfo {
  17278. constructor(options) {
  17279. options = options || {};
  17280. /**
  17281. * @member {SuperMap.Bounds} [SuperMap.DatasetInfo.prototype.bounds]
  17282. * @description 数据集范围,该字段只读。
  17283. */
  17284. this.bounds = null;
  17285. /**
  17286. * @member {string} [SuperMap.DatasetInfo.prototype.dataSourceName]
  17287. * @description 数据源名称,该字段只读。
  17288. */
  17289. this.dataSourceName = null;
  17290. /**
  17291. * @member {string} [SuperMap.DatasetInfo.prototype.description]
  17292. * @description 数据集的描述信息。
  17293. */
  17294. this.description = null;
  17295. /**
  17296. * @member {string} [SuperMap.DatasetInfo.prototype.encodeType]
  17297. * @description 数据集存储时的压缩编码方式,该字段只读。
  17298. */
  17299. this.encodeType = null;
  17300. /**
  17301. * @member {boolean} [SuperMap.DatasetInfo.prototype.isReadOnly]
  17302. * @description 数据集是否为只读。
  17303. */
  17304. this.isReadOnly = null;
  17305. /**
  17306. * @member {string} SuperMap.DatasetInfo.prototype.name
  17307. * @description 数据集名称,该字段必须且只读。
  17308. */
  17309. this.name = null;
  17310. /**
  17311. * @member {SuperMap.Projection} [SuperMap.DatasetInfo.prototype.prjCoordSys]
  17312. * @description 数据集的投影信息。
  17313. */
  17314. this.prjCoordSys = null;
  17315. /**
  17316. * @member {string} [SuperMap.DatasetInfo.prototype.tableName]
  17317. * @description 表名,该字段只读。
  17318. */
  17319. this.tableName = null;
  17320. /**
  17321. * @member {string} SuperMap.DatasetInfo.prototype.type
  17322. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  17323. */
  17324. this.type = null;
  17325. Util_Util.extend(this, options);
  17326. var b = this.bounds;
  17327. if (b) {
  17328. this.bounds = new Bounds_Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  17329. }
  17330. this.CLASS_NAME = "SuperMap.DatasetInfo";
  17331. }
  17332. /**
  17333. * @function SuperMap.DatasetInfo.prototype.destroy
  17334. * @description 释放资源,将引用资源的属性置空。
  17335. */
  17336. destroy() {
  17337. Util_Util.reset(this);
  17338. }
  17339. /**
  17340. * @function SuperMap.DatasetInfo.prototype.toServerJSONObject
  17341. * @description 转换成对应的 JSON 格式对象。
  17342. * @returns {Object} JSON 对象。
  17343. */
  17344. toServerJSONObject() {
  17345. var dataObj = {};
  17346. dataObj = Util_Util.copyAttributes(dataObj, this);
  17347. if (dataObj.bounds) {
  17348. if (dataObj.bounds.toServerJSONObject) {
  17349. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  17350. }
  17351. }
  17352. return dataObj;
  17353. }
  17354. }
  17355. SuperMap.DatasetInfo = DatasetInfo_DatasetInfo;
  17356. // CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  17357. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17358. * This program are made available under the terms of the Apache License, Version 2.0
  17359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17360. /**
  17361. * @class SuperMap.OverlayAnalystParameters
  17362. * @category iServer SpatialAnalyst OverlayAnalyst
  17363. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  17364. * @param {Object} options - 参数。
  17365. */
  17366. class OverlayAnalystParameters_OverlayAnalystParameters {
  17367. constructor(options) {
  17368. /**
  17369. * @member {SuperMap.OverlayOperationType} [SuperMap.OverlayAnalystParameters.prototype.operation=SuperMap.OverlayOperationType.UNION]
  17370. * @description 指定叠加分析操作类型。
  17371. */
  17372. this.operation = OverlayOperationType.UNION;
  17373. if (options) {
  17374. Util_Util.extend(this, options);
  17375. }
  17376. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  17377. }
  17378. /**
  17379. * @function SuperMap.OverlayAnalystParameters.prototype.destroy
  17380. * @description 释放资源,将引用资源的属性置空。
  17381. */
  17382. destroy() {
  17383. var me = this;
  17384. me.operation = null;
  17385. }
  17386. }
  17387. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters_OverlayAnalystParameters;
  17388. // CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  17389. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17390. * This program are made available under the terms of the Apache License, Version 2.0
  17391. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17392. /**
  17393. * @class SuperMap.DatasetOverlayAnalystParameters
  17394. * @category iServer SpatialAnalyst OverlayAnalyst
  17395. * @classdesc 数据集叠加分析参数类。
  17396. * @param {Object} options - 参数。
  17397. * @param {string} options.operateDataset - 叠加分析中操作数据集的名称。
  17398. * @param {string} options.sourceDataset - 叠加分析中源数据集的名称。
  17399. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  17400. * @param {SuperMap.FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  17401. * @param {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  17402. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  17403. * @param {SuperMap.FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  17404. * @param {number} [options.tolerance=0] - 容限。
  17405. * @param {SuperMap.OverlayOperationType} options.operation - 叠加操作枚举值。
  17406. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  17407. * @extends {SuperMap.GetFeaturesParametersBase}
  17408. */
  17409. class DatasetOverlayAnalystParameters_DatasetOverlayAnalystParameters extends OverlayAnalystParameters_OverlayAnalystParameters {
  17410. constructor(options) {
  17411. super(options);
  17412. /**
  17413. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDataset
  17414. * @description 叠加分析中操作数据集的名称。
  17415. */
  17416. this.operateDataset = null;
  17417. /**
  17418. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  17419. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  17420. */
  17421. this.operateDatasetFields = [];
  17422. /**
  17423. * @member {SuperMap.FilterParameter} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  17424. * @description 设置操作数据集中空间对象过滤条件。
  17425. */
  17426. this.operateDatasetFilter = new FilterParameter_FilterParameter();
  17427. /**
  17428. * @member {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateRegions]
  17429. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  17430. */
  17431. this.operateRegions = [];
  17432. /**
  17433. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDataset
  17434. * @description 叠加分析中源数据集的名称。
  17435. */
  17436. this.sourceDataset = null;
  17437. /**
  17438. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  17439. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  17440. */
  17441. this.sourceDatasetFields = [];
  17442. /**
  17443. * @member {SuperMap.FilterParameter} [SuperMap.DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  17444. * @description 设置源数据集中空间对象过滤条件。
  17445. */
  17446. this.sourceDatasetFilter = new FilterParameter_FilterParameter();
  17447. /**
  17448. * @member {number} [SuperMap.DatasetOverlayAnalystParameters.prototype.tolerance=0]
  17449. * @description 容限。
  17450. */
  17451. this.tolerance = 0;
  17452. /**
  17453. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetOverlayAnalystParameters.prototype.resultSetting]
  17454. * @description 结果返回设置类。
  17455. */
  17456. this.resultSetting = new DataReturnOption_DataReturnOption();
  17457. Util_Util.extend(this, options);
  17458. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  17459. }
  17460. /**
  17461. * @function SuperMap.DatasetOverlayAnalystParameters.prototype.destroy
  17462. * @override
  17463. */
  17464. destroy() {
  17465. super.destroy();
  17466. var me = this;
  17467. me.operateDataset = null;
  17468. me.operateDatasetFields = null;
  17469. if (me.operateDatasetFilter) {
  17470. me.operateDatasetFilter.destroy();
  17471. me.operateDatasetFilter = null;
  17472. }
  17473. if (me.operateRegions) {
  17474. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  17475. opRegions[i].destroy();
  17476. }
  17477. me.operateRegions = null;
  17478. }
  17479. me.sourceDataset = null;
  17480. me.sourceDatasetFields = null;
  17481. if (me.sourceDatasetFilter) {
  17482. me.sourceDatasetFilter.destroy();
  17483. me.sourceDatasetFilter = null;
  17484. }
  17485. me.tolerance = null;
  17486. if (me.resultSetting) {
  17487. me.resultSetting.destroy();
  17488. me.resultSetting = null;
  17489. }
  17490. }
  17491. /**
  17492. * @function SuperMap.DatasetOverlayAnalystParameters.toObject
  17493. * @param {SuperMap.DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  17494. * @param {SuperMap.DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  17495. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  17496. * @returns {Object} JSON 对象。
  17497. */
  17498. static toObject(datasetOverlayAnalystParameters, tempObj) {
  17499. for (var name in datasetOverlayAnalystParameters) {
  17500. if (name === "sourceDataset") {
  17501. continue;
  17502. } else if (name === "operateRegions") {
  17503. tempObj.operateRegions = [];
  17504. var ors = datasetOverlayAnalystParameters.operateRegions;
  17505. for (var index in ors) {
  17506. if (ors.hasOwnProperty(index)) { //icl542
  17507. tempObj.operateRegions[index] = ServerGeometry_ServerGeometry.fromGeometry(ors[index]);
  17508. }
  17509. }
  17510. } else if (name === "resultSetting") {
  17511. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  17512. } else {
  17513. tempObj[name] = datasetOverlayAnalystParameters[name];
  17514. }
  17515. }
  17516. }
  17517. }
  17518. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters_DatasetOverlayAnalystParameters;
  17519. // CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  17520. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17521. * This program are made available under the terms of the Apache License, Version 2.0
  17522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17523. /**
  17524. * @class SuperMap.SurfaceAnalystParametersSetting
  17525. * @category iServer SpatialAnalyst SurfaceAnalyst
  17526. * @classdesc 表面分析参数设置类。
  17527. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  17528. * @param {Object} options - 参数。
  17529. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  17530. * @param {number} [options.datumValue=0] - 获取或设置表面分析中提取等值线、提取等值面的基准值。
  17531. * @param {Array.<number>} options.expectedZValues - 获取或设置期望分析结果的 Z 值集合。
  17532. * @param {number} [options.interval=0] - 获取或设置等值距。等值距是两条等值线之间的间隔值。
  17533. * @param {number} [options.resampleTolerance=0] - 获取或设置重采样容限。
  17534. * @param {SuperMap.SmoothMethod} [options.smoothMethod=SuperMap.SmoothMethod.BSPLINE] - 获取或设置光滑处理所使用的方法。
  17535. * @param {number} [options.smoothness=0] - 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  17536. */
  17537. class SurfaceAnalystParametersSetting_SurfaceAnalystParametersSetting {
  17538. constructor(options) {
  17539. /**
  17540. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.SurfaceAnalystParametersSetting.prototype.clipRegion]
  17541. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  17542. */
  17543. this.clipRegion = null;
  17544. /**
  17545. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.datumValue=0]
  17546. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  17547. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。 例如,高程范围为 220 -1550 的 DEM 栅格数据,
  17548. * 如果设基准值为 0, 等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  17549. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  17550. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  17551. */
  17552. this.datumValue = 0;
  17553. /**
  17554. * @member {Array.<number>} SuperMap.SurfaceAnalystParametersSetting.prototype.expectedZValues
  17555. * @description 获取或设置期望分析结果的 Z 值集合。
  17556. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  17557. */
  17558. this.expectedZValues = null;
  17559. /**
  17560. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.interval=0]
  17561. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  17562. */
  17563. this.interval = 0;
  17564. /**
  17565. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  17566. * @description 获取或设置重采样容限。
  17567. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  17568. */
  17569. this.resampleTolerance = 0;
  17570. /**
  17571. * @member {SuperMap.SmoothMethod} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothMethod=SuperMap.SmoothMethod.BSPLINE]
  17572. * @description 获取或设置光滑处理所使用的方法。
  17573. */
  17574. this.smoothMethod = SmoothMethod.BSPLINE;
  17575. /**
  17576. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothness=0]
  17577. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  17578. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  17579. * 随着光滑度的增加,提取的等值线越光滑.当然光滑度越大,
  17580. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  17581. * 光滑度太高会出现等值线相交的问题。
  17582. */
  17583. this.smoothness = 0;
  17584. if (options) {
  17585. Util_Util.extend(this, options);
  17586. }
  17587. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  17588. }
  17589. /**
  17590. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.destroy
  17591. * @description 释放资源,将引用资源的属性置空。
  17592. */
  17593. destroy() {
  17594. var me = this;
  17595. if (me.clipRegion) {
  17596. me.clipRegion.destroy();
  17597. me.clipRegion = null;
  17598. }
  17599. me.datumValue = null;
  17600. me.expectedZValues = null;
  17601. me.interval = null;
  17602. me.resampleTolerance = null;
  17603. me.smoothMethod = null;
  17604. me.smoothness = null;
  17605. }
  17606. /**
  17607. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.toJSON
  17608. * @description 将对象转化为 JSON 字符串。
  17609. * @returns {string} 对象 JSON 字符串。
  17610. */
  17611. toJSON() {
  17612. let json = "'datumValue':" + Util_Util.toJSON(this.datumValue);
  17613. json += ",'interval':" + Util_Util.toJSON(this.interval);
  17614. json += ",'resampleTolerance':" + Util_Util.toJSON(this.resampleTolerance);
  17615. json += ",'smoothMethod':" + Util_Util.toJSON(this.smoothMethod);
  17616. json += ",'smoothness':" + Util_Util.toJSON(this.smoothness);
  17617. if (this.expectedZValues != null) {
  17618. json += "," + "'expectedZValues':" + Util_Util.toJSON(this.expectedZValues);
  17619. }
  17620. if (this.clipRegion != null) {
  17621. var serverGeometry = this.clipRegion;
  17622. if (this.clipRegion instanceof Geometry_Geometry && this.clipRegion.components) {
  17623. serverGeometry = ServerGeometry_ServerGeometry.fromGeometry(this.clipRegion)
  17624. }
  17625. json += ",'clipRegion':" + Util_Util.toJSON(serverGeometry);
  17626. }
  17627. return "{" + json + "}";
  17628. }
  17629. }
  17630. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting_SurfaceAnalystParametersSetting;
  17631. // CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  17632. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17633. * This program are made available under the terms of the Apache License, Version 2.0
  17634. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17635. /**
  17636. * @class SuperMap.SurfaceAnalystParameters
  17637. * @category iServer SpatialAnalyst SurfaceAnalyst
  17638. * @classdesc 表面分析提取操作参数类。
  17639. * @description 通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  17640. * {@link SuperMap.DatasetSurfaceAnalystParameters} 和 {@link SuperMap.GeometrySurfaceAnalystParameters} 继承自该类。
  17641. * @param {Object} options - 参数。
  17642. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  17643. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  17644. * @param {SuperMap.DataReturnOption} options.resultSetting - 结果返回设置类。
  17645. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  17646. */
  17647. class SurfaceAnalystParameters_SurfaceAnalystParameters {
  17648. constructor(options) {
  17649. /**
  17650. * @member {number} SuperMap.SurfaceAnalystParameters.prototype.resolution
  17651. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  17652. */
  17653. this.resolution = 0;
  17654. /**
  17655. * @member {SuperMap.SurfaceAnalystParametersSetting} SuperMap.SurfaceAnalystParameters.prototype.extractParameter
  17656. * @description 获取或设置表面分析参数。
  17657. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  17658. */
  17659. this.extractParameter = new SurfaceAnalystParametersSetting_SurfaceAnalystParametersSetting();
  17660. /**
  17661. * @member {SuperMap.DataReturnOption} SuperMap.SurfaceAnalystParameters.prototype.resultSetting
  17662. * @description 结果返回设置类。
  17663. */
  17664. this.resultSetting = new DataReturnOption_DataReturnOption();
  17665. /**
  17666. * @member {SuperMap.SurfaceAnalystMethod} [SuperMap.SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE]
  17667. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  17668. */
  17669. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  17670. if (options) {
  17671. Util_Util.extend(this, options);
  17672. }
  17673. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  17674. }
  17675. /**
  17676. * @function SuperMap.SurfaceAnalystParameters.prototype.destroy
  17677. * @description 释放资源,将引用资源的属性置空。
  17678. */
  17679. destroy() {
  17680. var me = this;
  17681. me.resolution = null;
  17682. if (me.extractParameter) {
  17683. me.extractParameter.destroy();
  17684. me.extractParameter = null;
  17685. }
  17686. if (me.resultSetting) {
  17687. me.resultSetting.destroy();
  17688. me.resultSetting = null;
  17689. }
  17690. me.surfaceAnalystMethod = null;
  17691. }
  17692. }
  17693. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters_SurfaceAnalystParameters;
  17694. // CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  17695. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17696. * This program are made available under the terms of the Apache License, Version 2.0
  17697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17698. /**
  17699. * @class SuperMap.DatasetSurfaceAnalystParameters
  17700. * @category iServer SpatialAnalyst SurfaceAnalyst
  17701. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  17702. * @param {Object} options - 参数。
  17703. * @param {string} options.dataset - 要用来做数据集表面分析的数据源中数据集的名称。
  17704. * @param {string} options.zValueFieldName - 获取或设置用于提取操作的字段名称。
  17705. * @param {integer} options.resolution - 获取或设置指定中间结果(栅格数据集)的分辨率。
  17706. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  17707. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 获取或设置查询过滤条件参数。
  17708. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  17709. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  17710. * @extends {SuperMap.SurfaceAnalystParameters}
  17711. */
  17712. class DatasetSurfaceAnalystParameters_DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters_SurfaceAnalystParameters {
  17713. constructor(options) {
  17714. super(options);
  17715. /**
  17716. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.dataset
  17717. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  17718. */
  17719. this.dataset = null;
  17720. /**
  17721. * @member {SuperMap.FilterParameter} SuperMap.DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  17722. * @description 获取或设置查询过滤条件参数。
  17723. */
  17724. this.filterQueryParameter = new FilterParameter_FilterParameter();
  17725. /**
  17726. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  17727. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  17728. */
  17729. this.zValueFieldName = null;
  17730. if (options) {
  17731. Util_Util.extend(this, options);
  17732. }
  17733. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  17734. }
  17735. /**
  17736. * @function SuperMap.DatasetSurfaceAnalystParameters.prototype.destroy
  17737. * @override
  17738. */
  17739. destroy() {
  17740. super.destroy();
  17741. var me = this;
  17742. me.dataset = null;
  17743. if (me.filterQueryParameter) {
  17744. me.filterQueryParameter.destroy();
  17745. me.filterQueryParameter = null;
  17746. }
  17747. me.zValueFieldName = null;
  17748. }
  17749. /**
  17750. * @function SuperMap.DatasetSurfaceAnalystParameters.toObject
  17751. * @param {SuperMap.DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  17752. * @param {SuperMap.DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  17753. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  17754. * @returns JSON 对象。
  17755. */
  17756. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  17757. for (var name in datasetSurfaceAnalystParameters) {
  17758. if (name === "filterQueryParameter") {
  17759. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  17760. }
  17761. if (name === "extractParameter") {
  17762. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry_Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  17763. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry_ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  17764. }
  17765. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  17766. } else if (name === "dataset") {
  17767. continue;
  17768. } else if (name === "surfaceAnalystMethod") {
  17769. continue;
  17770. } else {
  17771. tempObj[name] = datasetSurfaceAnalystParameters[name];
  17772. }
  17773. }
  17774. }
  17775. }
  17776. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters_DatasetSurfaceAnalystParameters;
  17777. // CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  17778. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17779. * This program are made available under the terms of the Apache License, Version 2.0
  17780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17781. /**
  17782. * @class SuperMap.ThiessenAnalystParameters
  17783. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  17784. * @classdesc 泰森多边形分析参数基类。
  17785. * @param {Object} options - 参数。
  17786. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  17787. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  17788. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  17789. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  17790. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  17791. */
  17792. class ThiessenAnalystParameters_ThiessenAnalystParameters {
  17793. constructor(options) {
  17794. if (!options) {
  17795. return;
  17796. }
  17797. /**
  17798. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.ThiessenAnalystParameters.prototype.clipRegion]
  17799. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  17800. */
  17801. this.clipRegion = null;
  17802. /**
  17803. * @member {boolean} [SuperMap.ThiessenAnalystParameters.prototype.createResultDataset=false]
  17804. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  17805. */
  17806. this.createResultDataset = false;
  17807. /**
  17808. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasetName
  17809. * @description 指定结果数据集名称。
  17810. */
  17811. this.resultDatasetName = null;
  17812. /**
  17813. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasourceName
  17814. * @description 指定结果数据集所在数据源。
  17815. */
  17816. this.resultDatasourceName = null;
  17817. /**
  17818. * @member {boolean} SuperMap.ThiessenAnalystParameters.prototype.returnResultRegion
  17819. * @description 是否返回分析得到的多边形面数组。
  17820. */
  17821. this.returnResultRegion = true;
  17822. Util_Util.extend(this, options);
  17823. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  17824. }
  17825. /**
  17826. * @function SuperMap.ThiessenAnalystParameters.prototype.destroy
  17827. * @description 释放资源,将引用资源的属性置空。
  17828. */
  17829. destroy() {
  17830. var me = this;
  17831. if (me.clipRegion) {
  17832. me.clipRegion.destroy();
  17833. me.clipRegion = null;
  17834. }
  17835. me.createResultDataset = null;
  17836. me.resultDatasetName = null;
  17837. me.resultDatasourceName = null;
  17838. me.returnResultRegion = null;
  17839. }
  17840. }
  17841. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters_ThiessenAnalystParameters;
  17842. // CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  17843. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17844. * This program are made available under the terms of the Apache License, Version 2.0
  17845. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17846. /**
  17847. * @class SuperMap.DatasetThiessenAnalystParameters
  17848. * @category iServer SpatialAnalyst ThiessenAnalyst
  17849. * @classdesc 数据集泰森多边形分析参数类。
  17850. * @param {Object} options - 参数。
  17851. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  17852. * @extends {SuperMap.ThiessenAnalystParameters}
  17853. */
  17854. class DatasetThiessenAnalystParameters_DatasetThiessenAnalystParameters extends ThiessenAnalystParameters_ThiessenAnalystParameters {
  17855. constructor(options) {
  17856. super(options);
  17857. /**
  17858. * @member {SuperMap.FilterParameter} [SuperMap.DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  17859. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  17860. * @example
  17861. * var filterQueryParameter = new SuperMap.FilterParameter({
  17862. * name: "Countries@World",
  17863. * attributeFilter: "SmID>100"
  17864. * });
  17865. */
  17866. this.filterQueryParameter = null;
  17867. /**
  17868. * @member {string} SuperMap.DatasetThiessenAnalystParameters.prototype.dataset
  17869. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  17870. */
  17871. this.dataset = null;
  17872. if (options) {
  17873. Util_Util.extend(this, options);
  17874. }
  17875. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  17876. }
  17877. /**
  17878. * @function SuperMap.DatasetThiessenAnalystParameters.prototype.destroy
  17879. * @override
  17880. */
  17881. destroy() {
  17882. super.destroy();
  17883. var me = this;
  17884. if (me.filterQueryParameter) {
  17885. me.filterQueryParameter.destroy();
  17886. me.filterQueryParameter = null;
  17887. }
  17888. }
  17889. /**
  17890. * @function SuperMap.DatasetThiessenAnalystParameters.toObject
  17891. * @param {SuperMap.DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  17892. * @param {SuperMap.DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  17893. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  17894. * @returns JSON 对象。
  17895. */
  17896. static toObject(datasetThiessenAnalystParameters, tempObj) {
  17897. for (var name in datasetThiessenAnalystParameters) {
  17898. if (name === "clipRegion") {
  17899. tempObj.clipRegion = ServerGeometry_ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  17900. } else {
  17901. tempObj[name] = datasetThiessenAnalystParameters[name];
  17902. }
  17903. }
  17904. }
  17905. }
  17906. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters_DatasetThiessenAnalystParameters;
  17907. // CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  17908. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  17909. * This program are made available under the terms of the Apache License, Version 2.0
  17910. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17911. /**
  17912. * @class SuperMap.DensityKernelAnalystParameters
  17913. * @category iServer SpatialAnalyst DensityAnalyst
  17914. * @classdesc 核密度分析参数类。
  17915. * @param {Object} options - 参数。
  17916. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  17917. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  17918. * @param {string} options.resultGridName - 指定结果数据集名称。
  17919. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  17920. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  17921. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  17922. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  17923. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  17924. */
  17925. class DensityKernelAnalystParameters_DensityKernelAnalystParameters {
  17926. constructor(options) {
  17927. /**
  17928. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.dataset
  17929. * @description 要用来做核密度分析数据源中数据集的名称。
  17930. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  17931. * 注:核密度分析支持点数据集和线数据集。
  17932. */
  17933. this.dataset = null;
  17934. /**
  17935. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} [SuperMap.DensityKernelAnalystParameters.prototype.bounds]
  17936. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  17937. * 如果缺省,则默认为原数据集的范围。
  17938. */
  17939. this.bounds = null;
  17940. /**
  17941. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.fieldName
  17942. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  17943. */
  17944. this.fieldName = null;
  17945. /**
  17946. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  17947. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  17948. */
  17949. this.resultGridDatasetResolution = null;
  17950. /**
  17951. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.searchRadius]
  17952. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  17953. */
  17954. this.searchRadius = null;
  17955. /**
  17956. * @member {string} [SuperMap.DensityKernelAnalystParameters.prototype.targetDatasource]
  17957. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  17958. */
  17959. this.targetDatasource = null;
  17960. /**
  17961. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.resultGridName
  17962. * @description 指定结果数据集名称。
  17963. */
  17964. this.resultGridName = null;
  17965. /**
  17966. * @member {boolean} [SuperMap.DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  17967. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  17968. */
  17969. this.deleteExistResultDataset = false;
  17970. Util_Util.extend(this, options);
  17971. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  17972. }
  17973. /**
  17974. * @function SuperMap.DensityKernelAnalystParameters.prototype.destroy
  17975. * @description 释放资源,将引用资源的属性置空。
  17976. */
  17977. destroy() {
  17978. var me = this;
  17979. me.dataset = null;
  17980. me.bounds = null;
  17981. me.fieldName = null;
  17982. me.resultGridDatasetResolution = null;
  17983. me.searchRadius = null;
  17984. me.targetDatasource = null;
  17985. me.resultGridName = null;
  17986. me.deleteExistResultDataset = null;
  17987. }
  17988. /**
  17989. * @function SuperMap.DensityKernelAnalystParameters.toObject
  17990. * @param {SuperMap.DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  17991. * @param {SuperMap.DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  17992. * @description 将核密度分析参数对象转换成 JSON 对象。
  17993. * @returns JSON 对象。
  17994. */
  17995. static toObject(densityKernelAnalystParameters, tempObj) {
  17996. for (var name in densityKernelAnalystParameters) {
  17997. if (name !== "dataset") {
  17998. tempObj[name] = densityKernelAnalystParameters[name];
  17999. }
  18000. }
  18001. }
  18002. }
  18003. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters_DensityKernelAnalystParameters;
  18004. // CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  18005. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18006. * This program are made available under the terms of the Apache License, Version 2.0
  18007. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18008. /**
  18009. * @class SuperMap.DensityAnalystService
  18010. * @category iServer SpatialAnalyst DensityAnalyst
  18011. * @classdesc
  18012. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  18013. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  18014. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  18015. * @param {Object} options - 参数。</br>
  18016. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18017. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18018. * @param {Object} [options.headers] - 请求头。
  18019. * @extends {SuperMap.SpatialAnalystBase}
  18020. * @example 例如:
  18021. * var myDensityAnalystService = new SuperMap.DensityAnalystService(url);
  18022. * myDensityAnalystService.on({
  18023. * "processCompleted": processCompleted,
  18024. * "processFailed": processFailed
  18025. * }
  18026. * );
  18027. */
  18028. class DensityAnalystService_DensityAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  18029. constructor(url, options) {
  18030. super(url, options);
  18031. /**
  18032. * @member {string} SuperMap.DensityAnalystService.prototype.mode
  18033. * @description 密度分析类型。
  18034. */
  18035. this.mode = null;
  18036. if (options) {
  18037. Util_Util.extend(this, options);
  18038. }
  18039. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  18040. }
  18041. /**
  18042. * @function SuperMap.DensityAnalystService.prototype.destroy
  18043. * @description 释放资源,将引用资源的属性置空。
  18044. */
  18045. destroy() {
  18046. super.destroy();
  18047. this.mode = null;
  18048. }
  18049. /**
  18050. * @function SuperMap.DensityAnalystService.prototype.processAsync
  18051. * @description 负责将客户端的查询参数传递到服务端。
  18052. * @param {SuperMap.DensityKernelAnalystParameters} parameter - 核密度分析参数。
  18053. */
  18054. processAsync(parameter) {
  18055. var me = this;
  18056. var parameterObject = new Object();
  18057. if (parameter instanceof DensityKernelAnalystParameters_DensityKernelAnalystParameters) {
  18058. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  18059. me.mode = "kernel";
  18060. }
  18061. DensityKernelAnalystParameters_DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  18062. var jsonParameters = Util_Util.toJSON(parameterObject);
  18063. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  18064. me.request({
  18065. method: "POST",
  18066. data: jsonParameters,
  18067. scope: me,
  18068. success: me.serviceProcessCompleted,
  18069. failure: me.serviceProcessFailed
  18070. });
  18071. }
  18072. }
  18073. SuperMap.DensityAnalystService = DensityAnalystService_DensityAnalystService;
  18074. // CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  18075. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18076. * This program are made available under the terms of the Apache License, Version 2.0
  18077. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18078. /**
  18079. * @class SuperMap.EditFeaturesParameters
  18080. * @category iServer Data Feature
  18081. * @classdesc 数据服务中数据集添加、修改、删除参数类。
  18082. * @category iServer Data
  18083. * @param {Object} options - 参数。
  18084. * @param {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} options.features - 当前需要创建或者是修改的要素集。
  18085. * @param {boolean} [options.returnContent=false] - 是返回创建要素的 ID 数组还是返回 featureResult 资源的 URI。
  18086. * @param {SuperMap.EditType} [options.editType=SuperMap.EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  18087. * @param {Array.<string|integer>} [options.IDs] - 删除要素时的要素的 ID 数组。
  18088. */
  18089. class EditFeaturesParameters_EditFeaturesParameters {
  18090. constructor(options) {
  18091. /**
  18092. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSourceName
  18093. * @description 当前需要创建或者是修改的要素的数据源。
  18094. */
  18095. this.dataSourceName = null;
  18096. /**
  18097. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSetName
  18098. * @description 当前需要创建或者是修改的要素的数据集。
  18099. */
  18100. this.dataSetName = null;
  18101. /**
  18102. * @member {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} SuperMap.EditFeaturesParameters.prototype.features
  18103. * @description 当前需要创建或者是修改的要素集。
  18104. */
  18105. this.features = null;
  18106. /**
  18107. * @member {SuperMap.EditType} [SuperMap.EditFeaturesParameters.prototype.editType=SuperMap.EditType.ADD]
  18108. * @description 要素集更新类型 (add、update、delete)。
  18109. */
  18110. this.editType = EditType.ADD;
  18111. /**
  18112. * @member {Array.<string|number>} [SuperMap.EditFeaturesParameters.prototype.IDs]
  18113. * @description 执行删除时要素集 ID 集合。
  18114. */
  18115. this.IDs = null;
  18116. /**
  18117. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.returnContent=false]
  18118. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  18119. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  18120. */
  18121. this.returnContent = false;
  18122. /**
  18123. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.isUseBatch=false]
  18124. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  18125. */
  18126. this.isUseBatch = false;
  18127. Util_Util.extend(this, options);
  18128. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  18129. }
  18130. /**
  18131. * @function SuperMap.EditFeaturesParameters.prototype.destroy
  18132. * @description 释放资源,将引用资源的属性置空。
  18133. */
  18134. destroy() {
  18135. var me = this;
  18136. me.dataSourceName = null;
  18137. me.dataSetName = null;
  18138. me.features = null;
  18139. me.editType = null;
  18140. me.IDs = null;
  18141. me.returnContent = null;
  18142. }
  18143. /**
  18144. * @function SuperMap.EditFeaturesParameters.prototype.toJsonParameters
  18145. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  18146. * @param {SuperMap.EditFeaturesParameters} params - 地物编辑参数。
  18147. * @returns {string} JSON 字符串。
  18148. */
  18149. static toJsonParameters(params) {
  18150. var feature,
  18151. len,
  18152. features,
  18153. editType = params.editType;
  18154. if (editType === EditType.DELETE) {
  18155. if (params.IDs === null) {
  18156. return;
  18157. }
  18158. features = {ids: params.IDs};
  18159. } else {
  18160. features = [];
  18161. if (params.features) {
  18162. len = params.features.length;
  18163. for (var i = 0; i < len; i++) {
  18164. feature = params.features[i];
  18165. feature.geometry = ServerGeometry_ServerGeometry.fromGeometry(feature.geometry);
  18166. features.push(feature);
  18167. }
  18168. }
  18169. }
  18170. return Util_Util.toJSON(features);
  18171. }
  18172. }
  18173. SuperMap.EditFeaturesParameters = EditFeaturesParameters_EditFeaturesParameters;
  18174. // CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  18175. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18176. * This program are made available under the terms of the Apache License, Version 2.0
  18177. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18178. /**
  18179. * @class SuperMap.EditFeaturesService
  18180. * @category iServer Data Feature
  18181. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  18182. * @extends {SuperMap.CommonServiceBase}
  18183. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  18184. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  18185. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  18186. * @param {Object} options - 参数。</br>
  18187. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  18188. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  18189. * @param {SuperMap.DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  18190. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18191. * @param {Object} [options.headers] - 请求头。
  18192. * @example
  18193. * var myService = new SuperMap.EditFeaturesService(url, {eventListeners: {
  18194. * "processCompleted": editFeatureCompleted,
  18195. * "processFailed": editFeatureError
  18196. * }
  18197. * };
  18198. *
  18199. */
  18200. class EditFeaturesService_EditFeaturesService extends CommonServiceBase_CommonServiceBase {
  18201. constructor(url, options) {
  18202. super(url, options);
  18203. /**
  18204. * @member {boolean} [SuperMap.EditFeaturesService.prototype.returnContent=false]
  18205. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  18206. */
  18207. this.returnContent = false;
  18208. /**
  18209. * @member {boolean} [SuperMap.EditFeaturesService.prototype.isUseBatch=false]
  18210. * @description 是否使用批量添加要素功能,要素添加时有效。
  18211. * 批量添加能够提高要素编辑效率。
  18212. * true 表示批量添加;false 表示不使用批量添加。
  18213. */
  18214. this.isUseBatch = false;
  18215. if (options) {
  18216. Util_Util.extend(this, options);
  18217. }
  18218. this.url = Util_Util.urlPathAppend(this.url, 'features');
  18219. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  18220. }
  18221. /**
  18222. * @function SuperMap.EditFeaturesService.prototype.destroy
  18223. * @override
  18224. */
  18225. destroy() {
  18226. super.destroy();
  18227. var me = this;
  18228. me.returnContent = null;
  18229. me.isUseBatch = null;
  18230. me.fromIndex = null;
  18231. me.toIndex = null;
  18232. }
  18233. /**
  18234. * @function SuperMap.EditFeaturesService.prototype.processAsync
  18235. * @description 负责将客户端的更新参数传递到服务端。
  18236. * @param {SuperMap.EditFeaturesParameters} params - 编辑要素参数。
  18237. */
  18238. processAsync(params) {
  18239. if (!(params instanceof EditFeaturesParameters_EditFeaturesParameters)) {
  18240. return;
  18241. }
  18242. var me = this,
  18243. method = "POST",
  18244. ids = "",
  18245. editType = params.editType,
  18246. jsonParameters = null;
  18247. me.returnContent = params.returnContent;
  18248. me.isUseBatch = params.isUseBatch;
  18249. jsonParameters = EditFeaturesParameters_EditFeaturesParameters.toJsonParameters(params);
  18250. if (editType === EditType.DELETE) {
  18251. ids = Util_Util.toJSON(params.IDs);
  18252. me.url = Util_Util.urlAppend(me.url, "ids=" + ids);
  18253. method = "DELETE";
  18254. jsonParameters = ids;
  18255. } else if (editType === EditType.UPDATE) {
  18256. method = "PUT";
  18257. } else {
  18258. if (me.isUseBatch) {
  18259. me.url = Util_Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  18260. me.returnContent = false;
  18261. }
  18262. if (me.returnContent) {
  18263. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  18264. method = "POST";
  18265. }
  18266. }
  18267. me.request({
  18268. method: method,
  18269. data: jsonParameters,
  18270. scope: me,
  18271. success: me.serviceProcessCompleted,
  18272. failure: me.serviceProcessFailed
  18273. });
  18274. }
  18275. }
  18276. SuperMap.EditFeaturesService = EditFeaturesService_EditFeaturesService;
  18277. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  18278. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18279. * This program are made available under the terms of the Apache License, Version 2.0
  18280. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18281. /**
  18282. * @class SuperMap.FacilityAnalyst3DParameters
  18283. * @category iServer FacilityAnalyst3D
  18284. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18285. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  18286. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起
  18287. * 作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  18288. * @param {Object} options - 参数。
  18289. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  18290. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18291. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18292. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18293. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18294. */
  18295. class FacilityAnalyst3DParameters_FacilityAnalyst3DParameters {
  18296. constructor(options) {
  18297. /**
  18298. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.edgeID]
  18299. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18300. */
  18301. this.edgeID = null;
  18302. /**
  18303. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.nodeID]
  18304. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18305. */
  18306. this.nodeID = null;
  18307. /**
  18308. * @member {string} SuperMap.FacilityAnalyst3DParameters.prototype.weightName
  18309. * @description 指定的权值字段信息对象的名称。
  18310. */
  18311. this.weightName = null;
  18312. /**
  18313. * @member {boolean} [SuperMap.FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  18314. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18315. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找
  18316. */
  18317. this.isUncertainDirectionValid = false;
  18318. Util_Util.extend(this, options);
  18319. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  18320. }
  18321. /**
  18322. * @function SuperMap.FacilityAnalyst3DParameters.prototype.destroy
  18323. * @override
  18324. */
  18325. destroy() {
  18326. var me = this;
  18327. me.edgeID = null;
  18328. me.nodeID = null;
  18329. me.weightName = null;
  18330. me.isUncertainDirectionValid = null;
  18331. }
  18332. }
  18333. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters_FacilityAnalyst3DParameters;
  18334. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  18335. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18336. * This program are made available under the terms of the Apache License, Version 2.0
  18337. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18338. /**
  18339. * @class SuperMap.FacilityAnalystSinks3DParameters
  18340. * @category iServer FacilityAnalyst3D Sinks
  18341. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18342. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟
  18343. * 能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、
  18344. * 转向表、耗费等属性在最近设施分析时同样可设置。
  18345. * @extends {SuperMap.FacilityAnalyst3DParameters}
  18346. * @param {Object} options - 参数。
  18347. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  18348. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18349. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18350. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18351. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18352. */
  18353. class FacilityAnalystSinks3DParameters_FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters_FacilityAnalyst3DParameters {
  18354. constructor(options) {
  18355. super(options);
  18356. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  18357. }
  18358. /**
  18359. * @function SuperMap.FacilityAnalystSinks3DParameters.prototype.destroy
  18360. * @override
  18361. */
  18362. destroy() {
  18363. super.destroy();
  18364. }
  18365. }
  18366. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters_FacilityAnalystSinks3DParameters;
  18367. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  18368. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18369. * This program are made available under the terms of the Apache License, Version 2.0
  18370. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18371. /**
  18372. * @class SuperMap.FacilityAnalystSinks3DService
  18373. * @category iServer FacilityAnalyst3D Sinks
  18374. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  18375. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  18376. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18377. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  18378. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  18379. * @extends {SuperMap.CommonServiceBase}
  18380. * @example
  18381. * var myFacilityAnalystSinks3DService = new SuperMap.FacilityAnalystSinks3DService(url, {
  18382. * eventListeners: {
  18383. * "processCompleted": facilityAnalystSinks3DCompleted,
  18384. * "processFailed": facilityAnalystSinks3DError
  18385. * }
  18386. * });
  18387. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  18388. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  18389. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  18390. * @param {Object} options - 参数。<br>
  18391. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18392. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18393. * @param {Object} [options.headers] - 请求头。
  18394. */
  18395. class FacilityAnalystSinks3DService_FacilityAnalystSinks3DService extends CommonServiceBase_CommonServiceBase {
  18396. constructor(url, options) {
  18397. super(url, options);
  18398. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  18399. }
  18400. /**
  18401. * @function SuperMap.FacilityAnalystSinks3DService.prototype.destroy
  18402. * @override
  18403. */
  18404. destroy() {
  18405. CommonServiceBase_CommonServiceBase.prototype.destroy.apply(this, arguments);
  18406. }
  18407. /**
  18408. * @function SuperMap.FacilityAnalystSinks3DService.prototype.processAsync
  18409. * @description 负责将客户端的查询参数传递到服务端。
  18410. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  18411. */
  18412. processAsync(params) {
  18413. if (!(params instanceof FacilityAnalystSinks3DParameters_FacilityAnalystSinks3DParameters)) {
  18414. return;
  18415. }
  18416. var me = this, jsonObject;
  18417. me.url = Util_Util.urlPathAppend(me.url, 'sinks');
  18418. jsonObject = {
  18419. edgeID: params.edgeID,
  18420. nodeID: params.nodeID,
  18421. weightName: params.weightName,
  18422. isUncertainDirectionValid: params.isUncertainDirectionValid
  18423. };
  18424. me.request({
  18425. method: "GET",
  18426. params: jsonObject,
  18427. scope: me,
  18428. success: me.serviceProcessCompleted,
  18429. failure: me.serviceProcessFailed
  18430. });
  18431. }
  18432. }
  18433. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService_FacilityAnalystSinks3DService;
  18434. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  18435. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18436. * This program are made available under the terms of the Apache License, Version 2.0
  18437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18438. /**
  18439. * @class SuperMap.FacilityAnalystSources3DParameters
  18440. * @category iServer FacilityAnalyst3D Sources
  18441. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18442. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分
  18443. * 钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍
  18444. * 点、转向表、耗费等属性在最近设施分析时同样可设置。
  18445. * @extends {SuperMap.FacilityAnalyst3DParameters}
  18446. * @param {Object} options - 参数。
  18447. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  18448. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18449. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18450. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18451. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18452. */
  18453. class FacilityAnalystSources3DParameters_FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters_FacilityAnalyst3DParameters {
  18454. constructor(options) {
  18455. super(options);
  18456. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  18457. }
  18458. /**
  18459. * @function SuperMap.FacilityAnalystSources3DParameters.prototype.destroy
  18460. * @override
  18461. */
  18462. destroy() {
  18463. super.destroy();
  18464. }
  18465. }
  18466. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters_FacilityAnalystSources3DParameters;
  18467. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  18468. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18469. * This program are made available under the terms of the Apache License, Version 2.0
  18470. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18471. /**
  18472. * @class SuperMap.FacilityAnalystSources3DService
  18473. * @category iServer FacilityAnalyst3D Sources
  18474. * @classdesc 最近设施分析服务类(源查找资源)
  18475. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  18476. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18477. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  18478. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  18479. * @extends {SuperMap.CommonServiceBase}
  18480. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18481. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18482. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18483. * @param {Object} options - 参数。
  18484. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18485. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18486. * @param {Object} [options.headers] - 请求头。
  18487. */
  18488. class FacilityAnalystSources3DService_FacilityAnalystSources3DService extends CommonServiceBase_CommonServiceBase {
  18489. constructor(url, options) {
  18490. super(url, options);
  18491. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  18492. }
  18493. /**
  18494. * @function SuperMap.FacilityAnalystSources3DService.prototype.destroy
  18495. * @override
  18496. */
  18497. destroy() {
  18498. super.destroy();
  18499. }
  18500. /**
  18501. * @function SuperMap.FacilityAnalystSources3DService.prototype.processAsync
  18502. * @description 负责将客户端的查询参数传递到服务端。
  18503. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  18504. */
  18505. processAsync(params) {
  18506. if (!(params instanceof FacilityAnalystSources3DParameters_FacilityAnalystSources3DParameters)) {
  18507. return;
  18508. }
  18509. var me = this, jsonObject;
  18510. me.url = Util_Util.urlPathAppend(me.url, 'sources');
  18511. jsonObject = {
  18512. edgeID: params.edgeID,
  18513. nodeID: params.nodeID,
  18514. weightName: params.weightName,
  18515. isUncertainDirectionValid: params.isUncertainDirectionValid
  18516. };
  18517. me.request({
  18518. method: "GET",
  18519. params: jsonObject,
  18520. scope: me,
  18521. success: me.serviceProcessCompleted,
  18522. failure: me.serviceProcessFailed
  18523. });
  18524. }
  18525. }
  18526. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService_FacilityAnalystSources3DService;
  18527. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  18528. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18529. * This program are made available under the terms of the Apache License, Version 2.0
  18530. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18531. /**
  18532. * @class SuperMap.FacilityAnalystStreamParameters
  18533. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  18534. * @classdesc 上游/下游关键设施查找资源参数类。
  18535. * @param {Object} options - 参数。
  18536. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  18537. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  18538. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18539. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18540. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  18541. */
  18542. class FacilityAnalystStreamParameters_FacilityAnalystStreamParameters {
  18543. constructor(options) {
  18544. /**
  18545. * @member {Array.<number>} [SuperMap.FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  18546. * @description 指定的设施点 ID 数组。
  18547. */
  18548. this.sourceNodeIDs = null;
  18549. /**
  18550. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.edgeID]
  18551. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18552. */
  18553. this.edgeID = null;
  18554. /**
  18555. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.nodeID]
  18556. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18557. */
  18558. this.nodeID = null;
  18559. /**
  18560. * @member {boolean} [SuperMap.FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  18561. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18562. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18563. */
  18564. this.isUncertainDirectionValid = false;
  18565. /**
  18566. * @member {number} SuperMap.FacilityAnalystStreamParameters.prototype.queryType
  18567. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  18568. */
  18569. this.queryType = null;
  18570. Util_Util.extend(this, options);
  18571. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  18572. }
  18573. /**
  18574. * @function SuperMap.FacilityAnalystStreamParameters.prototype.destroy
  18575. * @description 释放资源,将引用资源的属性置空。
  18576. */
  18577. destroy() {
  18578. var me = this;
  18579. me.edgeID = null;
  18580. me.nodeID = null;
  18581. me.weightName = null;
  18582. me.isUncertainDirectionValid = null;
  18583. me.type = null;
  18584. }
  18585. }
  18586. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters_FacilityAnalystStreamParameters;
  18587. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  18588. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18589. * This program are made available under the terms of the Apache License, Version 2.0
  18590. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18591. /**
  18592. * @class SuperMap.FacilityAnalystStreamService
  18593. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  18594. * @classdesc 上游/下游 关键设施查找资源服务类;即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  18595. * @extends SuperMap.NetworkAnalystServiceBase
  18596. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18597. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18598. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  18599. * @param {Object} options - 参数。
  18600. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18601. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18602. * @param {Object} [options.headers] - 请求头。
  18603. */
  18604. class FacilityAnalystStreamService_FacilityAnalystStreamService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  18605. constructor(url, options) {
  18606. super(url, options);
  18607. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  18608. }
  18609. /**
  18610. * @function SuperMap.FacilityAnalystStreamService.prototype.destroy
  18611. * @override
  18612. */
  18613. destroy() {
  18614. super.destroy();
  18615. }
  18616. /**
  18617. * @function SuperMap.FacilityAnalystStreamService.prototype.processAsync
  18618. * @description 负责将客户端的查询参数传递到服务端。
  18619. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  18620. */
  18621. processAsync(params) {
  18622. if (!(params instanceof FacilityAnalystStreamParameters_FacilityAnalystStreamParameters)) {
  18623. return;
  18624. }
  18625. var me = this,
  18626. jsonObject;
  18627. //URL 通过参数类型来判断是 上游 还是下游 查询
  18628. if (params.queryType === 0) {
  18629. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  18630. } else if (params.queryType === 1) {
  18631. me.url = Util_Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  18632. } else {
  18633. return;
  18634. }
  18635. jsonObject = {
  18636. sourceNodeIDs: params.sourceNodeIDs,
  18637. isUncertainDirectionValid: params.isUncertainDirectionValid
  18638. };
  18639. if (params.edgeID !== null && params.nodeID !== null) {
  18640. return;
  18641. }
  18642. if (params.edgeID === null && params.nodeID === null) {
  18643. return;
  18644. }
  18645. if (params.edgeID !== null) {
  18646. jsonObject.edgeID = params.edgeID;
  18647. } else {
  18648. jsonObject.nodeID = params.nodeID;
  18649. }
  18650. me.request({
  18651. method: "GET",
  18652. params: jsonObject,
  18653. scope: me,
  18654. success: me.serviceProcessCompleted,
  18655. failure: me.serviceProcessFailed
  18656. });
  18657. }
  18658. }
  18659. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService_FacilityAnalystStreamService;
  18660. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  18661. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18662. * This program are made available under the terms of the Apache License, Version 2.0
  18663. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18664. /**
  18665. * @class SuperMap.FacilityAnalystTracedown3DParameters
  18666. * @category iServer FacilityAnalyst3D TraceDownResult
  18667. * @classdesc 下游追踪资源参数类。
  18668. * @extends {SuperMap.FacilityAnalyst3DParameters}
  18669. * @param {Object} options - 参数。
  18670. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  18671. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18672. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18673. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18674. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18675. */
  18676. class FacilityAnalystTracedown3DParameters_FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters_FacilityAnalyst3DParameters {
  18677. constructor(options) {
  18678. super(options);
  18679. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  18680. }
  18681. /**
  18682. * @function SuperMap.FacilityAnalystTracedown3DParameters.prototype.destroy
  18683. * @override
  18684. */
  18685. destroy() {
  18686. super.destroy();
  18687. }
  18688. }
  18689. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters_FacilityAnalystTracedown3DParameters;
  18690. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  18691. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18692. * This program are made available under the terms of the Apache License, Version 2.0
  18693. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18694. /**
  18695. * @class SuperMap.FacilityAnalystTracedown3DService
  18696. * @category iServer FacilityAnalyst3D TraceDownResult
  18697. * @classdesc 下游追踪资源服务类
  18698. * @extends {SuperMap.CommonServiceBase}
  18699. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18700. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18701. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18702. * @param {Object} options - 参数。
  18703. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18704. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18705. * @param {Object} [options.headers] - 请求头。
  18706. */
  18707. class FacilityAnalystTracedown3DService_FacilityAnalystTracedown3DService extends CommonServiceBase_CommonServiceBase {
  18708. constructor(url, options) {
  18709. super(url, options);
  18710. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  18711. }
  18712. /**
  18713. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.destroy
  18714. * @override
  18715. */
  18716. destroy() {
  18717. super.destroy();
  18718. }
  18719. /**
  18720. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.processAsync
  18721. * @description 负责将客户端的查询参数传递到服务端。
  18722. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  18723. */
  18724. processAsync(params) {
  18725. if (!(params instanceof FacilityAnalystTracedown3DParameters_FacilityAnalystTracedown3DParameters)) {
  18726. return;
  18727. }
  18728. var me = this, jsonObject;
  18729. me.url = Util_Util.urlPathAppend(me.url, 'tracedownresult');
  18730. jsonObject = {
  18731. edgeID: params.edgeID,
  18732. nodeID: params.nodeID,
  18733. weightName: params.weightName,
  18734. isUncertainDirectionValid: params.isUncertainDirectionValid
  18735. };
  18736. me.request({
  18737. method: "GET",
  18738. params: jsonObject,
  18739. scope: me,
  18740. success: me.serviceProcessCompleted,
  18741. failure: me.serviceProcessFailed
  18742. });
  18743. }
  18744. }
  18745. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService_FacilityAnalystTracedown3DService;
  18746. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  18747. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18748. * This program are made available under the terms of the Apache License, Version 2.0
  18749. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18750. /**
  18751. * @class SuperMap.FacilityAnalystTraceup3DParameters
  18752. * @category iServer FacilityAnalyst3D TraceUpResult
  18753. * @classdesc 上游追踪资源参数类。
  18754. * @extends {SuperMap.FacilityAnalyst3DParameters}
  18755. * @param {Object} options - 参数。
  18756. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  18757. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  18758. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  18759. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18760. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18761. */
  18762. class FacilityAnalystTraceup3DParameters_FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters_FacilityAnalyst3DParameters {
  18763. constructor(options) {
  18764. super(options);
  18765. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  18766. }
  18767. /**
  18768. * @function SuperMap.FacilityAnalystTraceup3DParameters.prototype.destroy
  18769. * @override
  18770. */
  18771. destroy() {
  18772. super.destroy();
  18773. }
  18774. }
  18775. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters_FacilityAnalystTraceup3DParameters;
  18776. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  18777. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18778. * This program are made available under the terms of the Apache License, Version 2.0
  18779. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18780. /**
  18781. * @class SuperMap.FacilityAnalystTraceup3DService
  18782. * @category iServer FacilityAnalyst3D TraceUpResult
  18783. * @classdesc 上游追踪资源服务类
  18784. * @extends {SuperMap.CommonServiceBase}
  18785. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18786. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18787. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18788. * @param {Object} options - 参数。
  18789. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18790. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18791. * @param {Object} [options.headers] - 请求头。
  18792. */
  18793. class FacilityAnalystTraceup3DService_FacilityAnalystTraceup3DService extends CommonServiceBase_CommonServiceBase {
  18794. /**
  18795. * @function SuperMap.FacilityAnalystTraceup3DService.constructor
  18796. * @description 上游追踪资源服务类构造函数。
  18797. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18798. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18799. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18800. * @param {Object} options - 参数。
  18801. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18802. */
  18803. constructor(url, options) {
  18804. super(url, options);
  18805. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  18806. }
  18807. /**
  18808. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.destroy
  18809. * @override
  18810. */
  18811. destroy() {
  18812. super.destroy();
  18813. }
  18814. /**
  18815. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.processAsync
  18816. * @description 负责将客户端的查询参数传递到服务端。
  18817. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  18818. */
  18819. processAsync(params) {
  18820. if (!(params instanceof FacilityAnalystTraceup3DParameters_FacilityAnalystTraceup3DParameters)) {
  18821. return;
  18822. }
  18823. var me = this, jsonObject;
  18824. me.url = Util_Util.urlPathAppend(me.url, 'traceupresult');
  18825. jsonObject = {
  18826. edgeID: params.edgeID,
  18827. nodeID: params.nodeID,
  18828. weightName: params.weightName,
  18829. isUncertainDirectionValid: params.isUncertainDirectionValid
  18830. };
  18831. me.request({
  18832. method: "GET",
  18833. params: jsonObject,
  18834. scope: me,
  18835. success: me.serviceProcessCompleted,
  18836. failure: me.serviceProcessFailed
  18837. });
  18838. }
  18839. }
  18840. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService_FacilityAnalystTraceup3DService;
  18841. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  18842. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18843. * This program are made available under the terms of the Apache License, Version 2.0
  18844. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18845. /**
  18846. * @class SuperMap.FacilityAnalystUpstream3DParameters
  18847. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  18848. * @classdesc 上游关键设施查找资源参数类。
  18849. * @extends {SuperMap.FacilityAnalyst3DParameters}
  18850. * @param {Object} options - 参数。
  18851. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  18852. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  18853. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  18854. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18855. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18856. */
  18857. class FacilityAnalystUpstream3DParameters_FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters_FacilityAnalyst3DParameters {
  18858. constructor(options) {
  18859. super(options);
  18860. options = options || {};
  18861. this.sourceNodeIDs = null;
  18862. Util_Util.extend(this, options);
  18863. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  18864. }
  18865. /**
  18866. * @function SuperMap.FacilityAnalystUpstream3DParameters.prototype.destroy
  18867. * @override
  18868. */
  18869. destroy() {
  18870. super.destroy();
  18871. this.sourceNodeIDs = null;
  18872. }
  18873. }
  18874. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters_FacilityAnalystUpstream3DParameters;
  18875. // CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  18876. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18877. * This program are made available under the terms of the Apache License, Version 2.0
  18878. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18879. /**
  18880. * @class SuperMap.FacilityAnalystUpstream3DService
  18881. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  18882. * @classdesc 上游关键设施查找资源服务类
  18883. * @extends {SuperMap.CommonServiceBase}
  18884. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18885. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18886. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18887. * @param {Object} options - 参数。
  18888. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18889. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18890. * @param {Object} [options.headers] - 请求头。
  18891. */
  18892. class FacilityAnalystUpstream3DService_FacilityAnalystUpstream3DService extends CommonServiceBase_CommonServiceBase {
  18893. constructor(url, options) {
  18894. super(url, options);
  18895. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  18896. }
  18897. /**
  18898. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.destroy
  18899. * @override
  18900. */
  18901. destroy() {
  18902. super.destroy();
  18903. }
  18904. /**
  18905. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.processAsync
  18906. * @description 负责将客户端的查询参数传递到服务端。
  18907. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  18908. */
  18909. processAsync(params) {
  18910. if (!(params instanceof FacilityAnalystUpstream3DParameters_FacilityAnalystUpstream3DParameters)) {
  18911. return;
  18912. }
  18913. var me = this, jsonObject;
  18914. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  18915. jsonObject = {
  18916. sourceNodeIDs: params.sourceNodeIDs,
  18917. edgeID: params.edgeID,
  18918. nodeID: params.nodeID,
  18919. isUncertainDirectionValid: params.isUncertainDirectionValid
  18920. };
  18921. me.request({
  18922. method: "GET",
  18923. params: jsonObject,
  18924. scope: me,
  18925. success: me.serviceProcessCompleted,
  18926. failure: me.serviceProcessFailed
  18927. });
  18928. }
  18929. }
  18930. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService_FacilityAnalystUpstream3DService;
  18931. // CONCATENATED MODULE: ./src/common/iServer/FilterAggParameter.js
  18932. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18933. * This program are made available under the terms of the Apache License, Version 2.0
  18934. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18935. /**
  18936. * @class SuperMap.FilterAggParameter
  18937. * @classdesc 过滤条件参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  18938. * @category iServer Data FeatureResults
  18939. * @param {Object} options - 初始化参数。
  18940. * @param {SuperMap.AggQueryBuilderParameter} options.filterParam - 过滤条件参数设置类。
  18941. * @param {SuperMap.AggregationType} [options.aggType=AggregationType.FILTER] - 聚合类型。
  18942. */
  18943. class FilterAggParameter_FilterAggParameter extends AggregationParameter_AggregationParameter {
  18944. constructor(options) {
  18945. super(options);
  18946. /**
  18947. * @member {SuperMap.AggQueryBuilderParameter} SuperMap.FilterAggParameter.prototype.filterParam
  18948. * @description 过滤条件参数设置类。
  18949. */
  18950. this.filterParam = null;
  18951. /**
  18952. * @member {SuperMap.AggregationType} [SuperMap.FilterAggParameter.prototype.aggType=AggregationType.FILTER]
  18953. * @description 聚合类型。
  18954. */
  18955. this.aggType = AggregationType.FILTER;
  18956. this.CLASS_NAME = "SuperMap.FilterAggParameter";
  18957. Util_Util.extend(this, options);
  18958. }
  18959. destroy() {
  18960. super.destroy();
  18961. var me = this;
  18962. if (me.filterParam) {
  18963. me.filterParam = null;
  18964. }
  18965. }
  18966. }
  18967. SuperMap.FilterAggParameter = FilterAggParameter_FilterAggParameter;
  18968. // CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  18969. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  18970. * This program are made available under the terms of the Apache License, Version 2.0
  18971. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18972. /**
  18973. * @class SuperMap.FieldParameters
  18974. * @category iServer Data Field
  18975. * @classdesc 字段信息查询参数类。
  18976. * @param {Object} options - 参数。
  18977. * @param {string} options.datasource - 数据源名称。
  18978. * @param {string} options.dataset - 数据集名称。
  18979. */
  18980. class FieldParameters_FieldParameters {
  18981. constructor(options) {
  18982. /**
  18983. * @member {string} SuperMap.FieldParameters.prototype.datasource
  18984. * @description 要查询的数据集所在的数据源名称。
  18985. */
  18986. this.datasource = null;
  18987. /**
  18988. * @member {string} SuperMap.FieldParameters.prototype.dataset
  18989. * @description 要查询的数据集名称。
  18990. */
  18991. this.dataset = null;
  18992. if (options) {
  18993. Util_Util.extend(this, options);
  18994. }
  18995. this.CLASS_NAME = "SuperMap.FieldParameters";
  18996. }
  18997. /**
  18998. * @function SuperMap.FieldParameters.prototype.destroy
  18999. * @description 释放资源,将引用资源的属性置空。
  19000. */
  19001. destroy() {
  19002. var me = this;
  19003. me.datasource = null;
  19004. me.dataset = null;
  19005. }
  19006. }
  19007. SuperMap.FieldParameters = FieldParameters_FieldParameters;
  19008. // CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  19009. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19010. * This program are made available under the terms of the Apache License, Version 2.0
  19011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19012. /**
  19013. * @class SuperMap.FieldStatisticsParameters
  19014. * @category iServer Data Field
  19015. * @classdesc 字段统计信息查询参数类。
  19016. * @param {Object} options - 参数。
  19017. * @param {string} options.datasource - 数据源名称。
  19018. * @param {string} options.dataset - 数据集名称。
  19019. * @param {string} options.fieldName - 字段名。
  19020. * @param {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} statisticMode - 字段统计方法类型。
  19021. * @extends {SuperMap.FieldParameters}
  19022. */
  19023. class FieldStatisticsParameters_FieldStatisticsParameters extends FieldParameters_FieldParameters {
  19024. constructor(options) {
  19025. super(options);
  19026. /**
  19027. * @member {string} SuperMap.FieldStatisticsParameters.prototype.fieldName
  19028. * @description 字段名
  19029. */
  19030. this.fieldName = null;
  19031. /**
  19032. * @member {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} SuperMap.FieldStatisticsParameters.prototype.statisticMode
  19033. * @description 字段统计方法类型
  19034. */
  19035. this.statisticMode = null;
  19036. if (options) {
  19037. Util_Util.extend(this, options);
  19038. }
  19039. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  19040. }
  19041. /**
  19042. * @function SuperMap.FieldStatisticsParameters.prototype.destroy
  19043. * @description 释放资源,将引用资源的属性置空。
  19044. */
  19045. destroy() {
  19046. var me = this;
  19047. me.fieldName = null;
  19048. me.statisticMode = null;
  19049. }
  19050. }
  19051. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters_FieldStatisticsParameters;
  19052. // CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  19053. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19054. * This program are made available under the terms of the Apache License, Version 2.0
  19055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19056. /**
  19057. * @class SuperMap.FieldStatisticService
  19058. * @category iServer Data Field
  19059. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  19060. * @extends {SuperMap.CommonServiceBase}
  19061. * @param {string} url - 服务的访问地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  19062. * @param {Object} options - 参数。
  19063. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  19064. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  19065. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  19066. * @param {string} options.datasource - 数据集所在的数据源名称。
  19067. * @param {string} options.dataset - 数据集名称。
  19068. * @param {string} options.field - 查询统计的目标字段名称。
  19069. * @param {SuperMap.StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  19070. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19071. * @param {Object} [options.headers] - 请求头。
  19072. * @example
  19073. * var myService = new SuperMap.FieldStatisticService(url, {eventListeners: {
  19074. * "processCompleted": fieldStatisticCompleted,
  19075. * "processFailed": fieldStatisticError
  19076. * },
  19077. * datasource: "World",
  19078. * dataset: "Countries",
  19079. * field: "SmID",
  19080. * statisticMode: StatisticMode.AVERAGE
  19081. * };
  19082. */
  19083. class FieldStatisticService_FieldStatisticService extends CommonServiceBase_CommonServiceBase {
  19084. constructor(url, options) {
  19085. super(url, options);
  19086. /**
  19087. * @member {string} SuperMap.FieldStatisticService.prototype.datasource
  19088. * @description 数据集所在的数据源名称。
  19089. */
  19090. this.datasource = null;
  19091. /**
  19092. * @member {string} SuperMap.FieldStatisticService.prototype.dataset
  19093. * @description 数据集名称。
  19094. */
  19095. this.dataset = null;
  19096. /**
  19097. * @member {string} SuperMap.FieldStatisticService.prototype.field
  19098. * @description 查询统计的目标字段名称。
  19099. */
  19100. this.field = null;
  19101. /**
  19102. * @member {SuperMap.StatisticMode} SuperMap.FieldStatisticService.prototype.statisticMode
  19103. * @description 字段查询统计的方法类型。
  19104. */
  19105. this.statisticMode = null;
  19106. if (options) {
  19107. Util_Util.extend(this, options);
  19108. }
  19109. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  19110. }
  19111. /**
  19112. * @function SuperMap.FieldStatisticService.prototype.destroy
  19113. * @override
  19114. */
  19115. destroy() {
  19116. super.destroy();
  19117. var me = this;
  19118. me.datasource = null;
  19119. me.dataset = null;
  19120. me.field = null;
  19121. me.statisticMode = null;
  19122. }
  19123. /**
  19124. * @function SuperMap.FieldStatisticService.prototype.processAsync
  19125. * @description 执行服务,进行指定字段的查询统计。
  19126. */
  19127. processAsync() {
  19128. var me = this,
  19129. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  19130. me.url = Util_Util.urlPathAppend(me.url, fieldStatisticURL);
  19131. me.request({
  19132. method: "GET",
  19133. data: null,
  19134. scope: me,
  19135. success: me.serviceProcessCompleted,
  19136. failure: me.serviceProcessFailed
  19137. });
  19138. }
  19139. }
  19140. SuperMap.FieldStatisticService = FieldStatisticService_FieldStatisticService;
  19141. // CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  19142. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19143. * This program are made available under the terms of the Apache License, Version 2.0
  19144. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19145. /**
  19146. * @class SuperMap.FindClosestFacilitiesParameters
  19147. * @category iServer NetworkAnalyst ClosestFacility
  19148. * @classdesc 最近设施分析参数类。
  19149. * @param {Object} options - 参数。
  19150. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  19151. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  19152. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  19153. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  19154. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  19155. * @param {number} [options.maxWeight=0] - 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  19156. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19157. */
  19158. class FindClosestFacilitiesParameters_FindClosestFacilitiesParameters {
  19159. constructor(options) {
  19160. /**
  19161. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} SuperMap.FindClosestFacilitiesParameters.prototype.event
  19162. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  19163. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  19164. */
  19165. this.event = null;
  19166. /**
  19167. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  19168. * @description 要查找的设施点数量。
  19169. */
  19170. this.expectFacilityCount = 1;
  19171. /**
  19172. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} [SuperMap.FindClosestFacilitiesParameters.prototype.facilities=false]
  19173. * @description 设施点集合,一般为提供服务的服务设施位置。
  19174. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  19175. */
  19176. this.facilities = null;
  19177. /**
  19178. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.fromEvent=false]
  19179. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  19180. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点
  19181. * 不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最
  19182. * 近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  19183. */
  19184. this.fromEvent = false;
  19185. /**
  19186. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  19187. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  19188. */
  19189. this.isAnalyzeById = false;
  19190. /**
  19191. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.maxWeight=0]
  19192. * @description 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  19193. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  19194. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  19195. */
  19196. this.maxWeight = 0;
  19197. /**
  19198. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindClosestFacilitiesParameters.prototype.parameter]
  19199. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  19200. * 它为 SuperMap.TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  19201. * 则返回结果空间信息等都为空。
  19202. */
  19203. this.parameter = new TransportationAnalystParameter_TransportationAnalystParameter();
  19204. Util_Util.extend(this, options);
  19205. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  19206. }
  19207. /**
  19208. * @function SuperMap.FindClosestFacilitiesParameters.prototype.destroy
  19209. * @description 释放资源,将引用资源的属性置空。
  19210. */
  19211. destroy() {
  19212. var me = this;
  19213. me.event = null;
  19214. me.expectFacilityCount = null;
  19215. me.facilities = null;
  19216. me.fromEvent = null;
  19217. me.isAnalyzeById = null;
  19218. me.maxWeight = null;
  19219. if (me.parameter) {
  19220. me.parameter.destroy();
  19221. me.parameter = null;
  19222. }
  19223. }
  19224. }
  19225. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters_FindClosestFacilitiesParameters;
  19226. // CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  19227. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19228. * This program are made available under the terms of the Apache License, Version 2.0
  19229. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19230. /**
  19231. * @class SuperMap.FindClosestFacilitiesService
  19232. * @category iServer NetworkAnalyst ClosestFacility
  19233. * @classdesc 最近设施分析服务类。
  19234. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  19235. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19236. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  19237. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  19238. * @extends {SuperMap.NetworkAnalystServiceBase}
  19239. * @example
  19240. * var myfindClosestFacilitiesService = new SuperMap.FindClosestFacilitiesService(url, {
  19241. * eventListeners: {
  19242. * "processCompleted": findClosestFacilitiesCompleted,
  19243. * "processFailed": findClosestFacilitiesError
  19244. * }
  19245. * });
  19246. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19247. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19248. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19249. * @param {Object} options - 参数。
  19250. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19251. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19252. * @param {Object} [options.headers] - 请求头。
  19253. */
  19254. class FindClosestFacilitiesService_FindClosestFacilitiesService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  19255. /*
  19256. * @function SuperMap.FindClosestFacilitiesService.prototype.constructor
  19257. * @description 最近设施分析服务类构造函数。
  19258. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19259. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19260. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19261. * @param {Object} options - 选参数。<br>
  19262. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19263. */
  19264. constructor(url, options) {
  19265. super(url, options);
  19266. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  19267. }
  19268. /**
  19269. * @function SuperMap.FindClosestFacilitiesService.prototype.destroy
  19270. * @override
  19271. */
  19272. destroy() {
  19273. super.destroy();
  19274. }
  19275. /**
  19276. * @function SuperMap.FindClosestFacilitiesService.prototype.processAsync
  19277. * @description 负责将客户端的查询参数传递到服务端。
  19278. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  19279. */
  19280. processAsync(params) {
  19281. if (!(params instanceof FindClosestFacilitiesParameters_FindClosestFacilitiesParameters)) {
  19282. return;
  19283. }
  19284. var me = this,
  19285. jsonObject;
  19286. me.url = Util_Util.urlPathAppend(me.url, 'closestfacility');
  19287. jsonObject = {
  19288. expectFacilityCount: params.expectFacilityCount,
  19289. fromEvent: params.fromEvent,
  19290. maxWeight: params.maxWeight,
  19291. parameter: Util_Util.toJSON(params.parameter),
  19292. event: Util_Util.toJSON(params.event),
  19293. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  19294. };
  19295. me.request({
  19296. method: "GET",
  19297. params: jsonObject,
  19298. scope: me,
  19299. success: me.serviceProcessCompleted,
  19300. failure: me.serviceProcessFailed
  19301. });
  19302. }
  19303. /**
  19304. * @function SuperMap.FindClosestFacilitiesService.prototype.getJson
  19305. * @description 将对象转化为JSON字符串。
  19306. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  19307. * @param {Array} params - 分析参数数组
  19308. * @returns {Object} 转化后的JSON字符串。
  19309. */
  19310. getJson(isAnalyzeById, params) {
  19311. var jsonString = "[",
  19312. len = params ? params.length : 0;
  19313. if (isAnalyzeById === false) {
  19314. for (let i = 0; i < len; i++) {
  19315. if (i > 0) {
  19316. jsonString += ",";
  19317. }
  19318. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  19319. }
  19320. } else if (isAnalyzeById === true) {
  19321. for (let i = 0; i < len; i++) {
  19322. if (i > 0) {
  19323. jsonString += ",";
  19324. }
  19325. jsonString += params[i];
  19326. }
  19327. }
  19328. jsonString += ']';
  19329. return jsonString;
  19330. }
  19331. /**
  19332. * @function SuperMap.FindClosestFacilitiesService.prototype.toGeoJSONResult
  19333. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19334. * @param {Object} result - 服务器返回的结果对象。
  19335. */
  19336. toGeoJSONResult(result) {
  19337. if (!result || !result.facilityPathList) {
  19338. return result;
  19339. }
  19340. var geoJSONFormat = new GeoJSON_GeoJSON();
  19341. result.facilityPathList.map(function (path) {
  19342. if (path.route) {
  19343. path.route = geoJSONFormat.toGeoJSON(path.route);
  19344. }
  19345. if (path.pathGuideItems) {
  19346. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  19347. }
  19348. if (path.edgeFeatures) {
  19349. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  19350. }
  19351. if (path.nodeFeatures) {
  19352. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  19353. }
  19354. return path;
  19355. });
  19356. return result;
  19357. }
  19358. }
  19359. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService_FindClosestFacilitiesService;
  19360. // CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  19361. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19362. * This program are made available under the terms of the Apache License, Version 2.0
  19363. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19364. /**
  19365. * @class SuperMap.FindLocationParameters
  19366. * @category iServer NetworkAnalyst Location
  19367. * @classdesc 选址分区分析参数类。
  19368. * @param {Object} options - 参数。
  19369. * @param {string} options.turnWeightField - 转向权值字段的名称。
  19370. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  19371. * @param {Array.<SuperMap.SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  19372. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  19373. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  19374. */
  19375. class FindLocationParameters_FindLocationParameters {
  19376. constructor(options) {
  19377. /**
  19378. * @member {number} [SuperMap.FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  19379. * @description 期望用于最终设施选址的资源供给中心数量。
  19380. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  19381. */
  19382. this.expectedSupplyCenterCount = null;
  19383. /**
  19384. * @member {boolean} [SuperMap.FindLocationParameters.prototype.isFromCenter=false]
  19385. * @description 是否从中心点开始分配资源。
  19386. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  19387. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  19388. */
  19389. this.isFromCenter = false;
  19390. /**
  19391. * @member {Array.<SuperMap.SupplyCenter>} SuperMap.FindLocationParameters.prototype.supplyCenters
  19392. * @description 资源供给中心集合。
  19393. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  19394. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  19395. */
  19396. this.supplyCenters = null;
  19397. /**
  19398. * @member {string} SuperMap.FindLocationParameters.prototype.turnWeightField
  19399. * @description 转向权值字段的名称。
  19400. */
  19401. this.turnWeightField = null;
  19402. /**
  19403. * @member {string} SuperMap.FindLocationParameters.prototype.weightName
  19404. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  19405. */
  19406. this.weightName = null;
  19407. Util_Util.extend(this, options);
  19408. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  19409. }
  19410. /**
  19411. * @function SuperMap.FindLocationParameters.prototype.destroy
  19412. * @description 释放资源,将引用资源的属性置空。
  19413. */
  19414. destroy() {
  19415. var me = this;
  19416. me.expectedSupplyCenterCount = null;
  19417. me.isFromCenter = null;
  19418. me.turnWeightField = null;
  19419. me.weightName = null;
  19420. if (me.supplyCenters) {
  19421. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  19422. supplyCenters[i].destroy();
  19423. }
  19424. me.supplyCenters = null;
  19425. }
  19426. }
  19427. }
  19428. SuperMap.FindLocationParameters = FindLocationParameters_FindLocationParameters;
  19429. // CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  19430. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19431. * This program are made available under the terms of the Apache License, Version 2.0
  19432. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19433. /**
  19434. * @class SuperMap.FindLocationService
  19435. * @category iServer NetworkAnalyst Location
  19436. * @classdesc 选址分区分析服务类。
  19437. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  19438. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  19439. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  19440. * @extends {SuperMap.NetworkAnalystServiceBase}
  19441. * @example
  19442. * (start code)
  19443. * var findLocationService = new SuperMap.FindLocationService(url, {
  19444. * eventListeners: {
  19445. * "processCompleted": findLocationCompleted,
  19446. * "processFailed": findLocationError
  19447. * }
  19448. * });
  19449. * (end)
  19450. * @param {string} url - 服务的访问地址。
  19451. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  19452. * @param {Object} options - 参数。
  19453. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19454. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19455. * @param {Object} [options.headers] - 请求头。
  19456. */
  19457. class FindLocationService_FindLocationService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  19458. constructor(url, options) {
  19459. super(url, options);
  19460. this.CLASS_NAME = "SuperMap.FindLocationService";
  19461. }
  19462. /**
  19463. * @function SuperMap.FindLocationService.prototype.destroy
  19464. * @override
  19465. */
  19466. destroy() {
  19467. super.destroy();
  19468. }
  19469. /**
  19470. * @function SuperMap.FindLocationService.prototype.processAsync
  19471. * @description 负责将客户端的查询参数传递到服务端。
  19472. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类
  19473. */
  19474. processAsync(params) {
  19475. if (!(params instanceof FindLocationParameters_FindLocationParameters)) {
  19476. return;
  19477. }
  19478. var me = this,
  19479. jsonObject;
  19480. me.url = Util_Util.urlPathAppend(me.url, 'location');
  19481. jsonObject = {
  19482. isFromCenter: params.isFromCenter,
  19483. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  19484. weightName: params.weightName,
  19485. turnWeightField: params.turnWeightField,
  19486. returnEdgeFeature: true,
  19487. returnEdgeGeometry: true,
  19488. returnNodeFeature: true,
  19489. mapParameter: Util_Util.toJSON(params.mapParameter),
  19490. supplyCenters: me.getCentersJson(params.supplyCenters)
  19491. };
  19492. me.request({
  19493. method: "GET",
  19494. params: jsonObject,
  19495. scope: me,
  19496. success: me.serviceProcessCompleted,
  19497. failure: me.serviceProcessFailed
  19498. });
  19499. }
  19500. /**
  19501. * @function SuperMap.FindLocationService.prototype.getCentersJson
  19502. * @description 将数组对象转化为JSON字符串。
  19503. * @param {Array} params - 需要转换的参数
  19504. * @returns {string} 转化后的JSON字符串。
  19505. */
  19506. getCentersJson(params) {
  19507. var json = "[",
  19508. len = params ? params.length : 0;
  19509. for (var i = 0; i < len; i++) {
  19510. if (i > 0) {
  19511. json += ",";
  19512. }
  19513. json += Util_Util.toJSON(params[i]);
  19514. }
  19515. json += "]";
  19516. return json;
  19517. }
  19518. /**
  19519. * @function SuperMap.FindLocationService.prototype.toGeoJSONResult
  19520. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19521. * @param {Object} result - 服务器返回的结果对象。
  19522. */
  19523. toGeoJSONResult(result) {
  19524. if (!result) {
  19525. return null;
  19526. }
  19527. var geoJSONFormat = new GeoJSON_GeoJSON();
  19528. if (result.demandResults) {
  19529. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  19530. }
  19531. if (result.supplyResults) {
  19532. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  19533. }
  19534. return result;
  19535. }
  19536. }
  19537. SuperMap.FindLocationService = FindLocationService_FindLocationService;
  19538. // CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  19539. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19540. * This program are made available under the terms of the Apache License, Version 2.0
  19541. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19542. /**
  19543. * @class SuperMap.FindMTSPPathsParameters
  19544. * @category iServer NetworkAnalyst MTSPPath
  19545. * @classdesc 多旅行商分析参数类
  19546. * @param {Object} options - 参数。
  19547. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 配送中心集合。
  19548. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 配送目标集合。
  19549. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  19550. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  19551. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19552. */
  19553. class FindMTSPPathsParameters_FindMTSPPathsParameters {
  19554. constructor(options) {
  19555. /**
  19556. * @member SuperMap.FindMTSPPathsParameters.prototype.centers - {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>}
  19557. * @description 配送中心集合。
  19558. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  19559. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  19560. */
  19561. this.centers = null;
  19562. /**
  19563. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  19564. * @description 配送模式是否为总花费最小方案。
  19565. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  19566. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  19567. */
  19568. this.hasLeastTotalCost = false;
  19569. /**
  19570. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  19571. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  19572. */
  19573. this.isAnalyzeById = false;
  19574. /**
  19575. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindMTSPPathsParameters.prototype.nodes
  19576. * @description 配送目标集合。
  19577. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  19578. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  19579. */
  19580. this.nodes = null;
  19581. /**
  19582. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindMTSPPathsParameters.prototype.parameter]
  19583. * @description 交通网络分析通用参数。
  19584. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  19585. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  19586. */
  19587. this.parameter = new TransportationAnalystParameter_TransportationAnalystParameter();
  19588. Util_Util.extend(this, options);
  19589. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  19590. }
  19591. /**
  19592. * @function SuperMap.FindMTSPPathsParameters.prototype.destroy
  19593. * @description 释放资源,将引用资源的属性置空。
  19594. */
  19595. destroy() {
  19596. var me = this;
  19597. me.centers = null;
  19598. me.hasLeastTotalCost = null;
  19599. me.isAnalyzeById = null;
  19600. me.nodes = null;
  19601. me.maxWeight = null;
  19602. if (me.parameter) {
  19603. me.parameter.destroy();
  19604. me.parameter = null;
  19605. }
  19606. }
  19607. }
  19608. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters_FindMTSPPathsParameters;
  19609. // CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  19610. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19611. * This program are made available under the terms of the Apache License, Version 2.0
  19612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19613. /**
  19614. * @class SuperMap.FindMTSPPathsService
  19615. * @category iServer NetworkAnalyst MTSPPath
  19616. * @classdesc 多旅行商分析服务类
  19617. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  19618. * 查找经济有效的配送路径,并给出相应的行走路线。
  19619. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  19620. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  19621. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取
  19622. * @extends {SuperMap.NetworkAnalystServiceBase}
  19623. * @example
  19624. * var myFindMTSPPathsService = new SuperMap.FindMTSPPathsService(url, {
  19625. * eventListeners: {
  19626. * "processCompleted": findMTSPPathsCompleted,
  19627. * "processFailed": findMTSPPathsError
  19628. * }
  19629. * });
  19630. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19631. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19632. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19633. * @param {Object} options - 互服务时所需可选参数。如:
  19634. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19635. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19636. * @param {Object} [options.headers] - 请求头。
  19637. */
  19638. class FindMTSPPathsService_FindMTSPPathsService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  19639. constructor(url, options) {
  19640. super(url, options);
  19641. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  19642. }
  19643. /**
  19644. * @function SuperMap.FindMTSPPathsService.prototype.destroy
  19645. * @override
  19646. */
  19647. destroy() {
  19648. super.destroy();
  19649. }
  19650. /**
  19651. * @function SuperMap.FindMTSPPathsService..prototype.processAsync
  19652. * @description 负责将客户端的查询参数传递到服务端。
  19653. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  19654. */
  19655. processAsync(params) {
  19656. if (!(params instanceof FindMTSPPathsParameters_FindMTSPPathsParameters)) {
  19657. return;
  19658. }
  19659. var me = this,
  19660. jsonObject,
  19661. //end = me.url.substr(me.url.length - 1, 1),
  19662. centers = me.getJson(params.isAnalyzeById, params.centers),
  19663. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  19664. me.url = Util_Util.urlPathAppend(me.url, 'mtsppath');
  19665. jsonObject = {
  19666. centers: centers,
  19667. nodes: nodes,
  19668. parameter: Util_Util.toJSON(params.parameter),
  19669. hasLeastTotalCost: params.hasLeastTotalCost
  19670. };
  19671. me.request({
  19672. method: "GET",
  19673. params: jsonObject,
  19674. scope: me,
  19675. success: me.serviceProcessCompleted,
  19676. failure: me.serviceProcessFailed
  19677. });
  19678. }
  19679. /**
  19680. * @function SuperMap.FindMTSPPathsService.prototype.getJson
  19681. * @description 将对象转化为JSON字符串。
  19682. * @param {boolean} isAnalyzeById - 是否通过id分析
  19683. * @param {Array} params - 需要转换的数字
  19684. * @returns {Object} 转化后的JSON字符串。
  19685. */
  19686. getJson(isAnalyzeById, params) {
  19687. var jsonString = "[",
  19688. len = params ? params.length : 0;
  19689. if (isAnalyzeById === false) {
  19690. for (let i = 0; i < len; i++) {
  19691. if (i > 0) {
  19692. jsonString += ",";
  19693. }
  19694. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  19695. }
  19696. } else if (isAnalyzeById === true) {
  19697. for (let i = 0; i < len; i++) {
  19698. if (i > 0) {
  19699. jsonString += ",";
  19700. }
  19701. jsonString += params[i];
  19702. }
  19703. }
  19704. jsonString += ']';
  19705. return jsonString;
  19706. }
  19707. /**
  19708. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  19709. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19710. * @param {Object} result - 服务器返回的结果对象。
  19711. */
  19712. toGeoJSONResult(result) {
  19713. if (!result || !result.pathList) {
  19714. return null;
  19715. }
  19716. var geoJSONFormat = new GeoJSON_GeoJSON();
  19717. result.pathList.map(function (path) {
  19718. if (path.route) {
  19719. path.route = geoJSONFormat.toGeoJSON(path.route);
  19720. }
  19721. if (path.pathGuideItems) {
  19722. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  19723. }
  19724. if (path.edgeFeatures) {
  19725. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  19726. }
  19727. if (path.nodeFeatures) {
  19728. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  19729. }
  19730. return path;
  19731. });
  19732. return result;
  19733. }
  19734. }
  19735. SuperMap.FindMTSPPathsService = FindMTSPPathsService_FindMTSPPathsService;
  19736. // CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  19737. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19738. * This program are made available under the terms of the Apache License, Version 2.0
  19739. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19740. /**
  19741. * @class SuperMap.FindPathParameters
  19742. * @category iServer NetworkAnalyst Path
  19743. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  19744. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  19745. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  19746. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  19747. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  19748. * 阻抗值通过 SuperMap.TransportationAnalystParameter.weightFieldName 设置。
  19749. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link SuperMap.TransportationAnalystParameter.turnWeightField} 设置。
  19750. *
  19751. * @param {Object} options - 参数。
  19752. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  19753. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  19754. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  19755. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19756. */
  19757. class FindPathParameters_FindPathParameters {
  19758. constructor(options) {
  19759. /**
  19760. * @member {boolean} [SuperMap.FindPathParameters.prototype.isAnalyzeById=false]
  19761. * @description 是否通过节点 ID 指定路径分析的结点。
  19762. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  19763. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindPathParameters.nodes = [ID1,ID2,...];
  19764. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  19765. */
  19766. this.isAnalyzeById = false;
  19767. /**
  19768. * @member {boolean} [SuperMap.FindPathParameters.prototype.hasLeastEdgeCount=false]
  19769. * @description 是否按照弧段数最少的进行最佳路径分析。
  19770. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  19771. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  19772. */
  19773. this.hasLeastEdgeCount = null;
  19774. /**
  19775. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindPathParameters.prototype.nodes
  19776. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  19777. * 当 SuperMap.FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  19778. * 当 SuperMap.FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  19779. */
  19780. this.nodes = null;
  19781. /**
  19782. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindPathParameters.prototype.parameter
  19783. * @description 交通网络分析通用参数。
  19784. */
  19785. this.parameter = new TransportationAnalystParameter_TransportationAnalystParameter();
  19786. Util_Util.extend(this, options);
  19787. this.CLASS_NAME = "SuperMap.FindPathParameters";
  19788. }
  19789. /**
  19790. * @function SuperMap.FindPathParameters.prototype.destroy
  19791. * @description 释放资源,将引用资源的属性置空。
  19792. */
  19793. destroy() {
  19794. var me = this;
  19795. me.isAnalyzeById = null;
  19796. me.hasLeastEdgeCount = null;
  19797. me.nodes = null;
  19798. if (me.parameter) {
  19799. me.parameter.destroy();
  19800. me.parameter = null;
  19801. }
  19802. }
  19803. }
  19804. SuperMap.FindPathParameters = FindPathParameters_FindPathParameters;
  19805. // CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  19806. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19807. * This program are made available under the terms of the Apache License, Version 2.0
  19808. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19809. /**
  19810. * @class SuperMap.FindPathService
  19811. * @category iServer NetworkAnalyst Path
  19812. * @classdesc 最佳路径分析服务类。
  19813. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  19814. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  19815. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  19816. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  19817. * @extends {SuperMap.NetworkAnalystServiceBase}
  19818. * @example
  19819. * var myFindPathService = new SuperMap.FindPathService(url, {
  19820. * eventListeners: {
  19821. * "processCompleted": findPathCompleted,
  19822. * "processFailed": findPathError
  19823. * }
  19824. * });
  19825. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19826. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19827. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19828. * @param {Object} options - 参数。
  19829. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19830. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19831. * @param {Object} [options.headers] - 请求头。
  19832. */
  19833. class FindPathService_FindPathService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  19834. constructor(url, options) {
  19835. super(url, options);
  19836. this.CLASS_NAME = "SuperMap.FindPathService";
  19837. }
  19838. /**
  19839. * @function SuperMap.FindPathService.prototype.destroy
  19840. * @override
  19841. */
  19842. destroy() {
  19843. super.destroy();
  19844. }
  19845. /**
  19846. * @function SuperMap.FindPathService.prototype.processAsync
  19847. * @description 负责将客户端的查询参数传递到服务端。
  19848. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类
  19849. */
  19850. processAsync(params) {
  19851. if (!(params instanceof FindPathParameters_FindPathParameters)) {
  19852. return;
  19853. }
  19854. var me = this, jsonObject;
  19855. me.url = Util_Util.urlPathAppend(me.url, 'path');
  19856. jsonObject = {
  19857. hasLeastEdgeCount: params.hasLeastEdgeCount,
  19858. parameter: Util_Util.toJSON(params.parameter),
  19859. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  19860. };
  19861. me.request({
  19862. method: "GET",
  19863. params: jsonObject,
  19864. scope: me,
  19865. success: me.serviceProcessCompleted,
  19866. failure: me.serviceProcessFailed
  19867. });
  19868. }
  19869. /**
  19870. * @function SuperMap.FindPathService.prototype.getJson
  19871. * @description 将对象转化为JSON字符串。
  19872. * @param {boolean} isAnalyzeById - 是否通过id分析
  19873. * @param {Array} params - 需要转换的数字
  19874. * @returns {Object} 转化后的JSON字符串。
  19875. */
  19876. getJson(isAnalyzeById, params) {
  19877. var jsonString = "[",
  19878. len = params ? params.length : 0;
  19879. if (isAnalyzeById === false) {
  19880. for (let i = 0; i < len; i++) {
  19881. if (i > 0) {
  19882. jsonString += ",";
  19883. }
  19884. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  19885. }
  19886. } else if (isAnalyzeById === true) {
  19887. for (let i = 0; i < len; i++) {
  19888. if (i > 0) {
  19889. jsonString += ",";
  19890. }
  19891. jsonString += params[i];
  19892. }
  19893. }
  19894. jsonString += ']';
  19895. return jsonString;
  19896. }
  19897. /**
  19898. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  19899. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19900. * @param {Object} result - 服务器返回的结果对象。
  19901. */
  19902. toGeoJSONResult(result) {
  19903. if (!result || !result.pathList || result.pathList.length < 1) {
  19904. return null;
  19905. }
  19906. var geoJSONFormat = new GeoJSON_GeoJSON();
  19907. result.pathList.forEach(function (path) {
  19908. if (path.route) {
  19909. path.route = geoJSONFormat.toGeoJSON(path.route);
  19910. }
  19911. if (path.pathGuideItems) {
  19912. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  19913. }
  19914. if (path.edgeFeatures) {
  19915. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  19916. }
  19917. if (path.nodeFeatures) {
  19918. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  19919. }
  19920. });
  19921. return result;
  19922. }
  19923. }
  19924. SuperMap.FindPathService = FindPathService_FindPathService;
  19925. // CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  19926. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  19927. * This program are made available under the terms of the Apache License, Version 2.0
  19928. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19929. /**
  19930. * @class SuperMap.FindServiceAreasParameters
  19931. * @category iServer NetworkAnalyst ServiceArea
  19932. * @classdesc 服务区分析参数类。
  19933. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  19934. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  19935. * @param {Object} options - 参数。
  19936. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  19937. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 服务站点数组。
  19938. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  19939. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  19940. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  19941. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19942. */
  19943. class FindServiceAreasParameters_FindServiceAreasParameters {
  19944. constructor(options) {
  19945. /**
  19946. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isAnalyzeById=false]
  19947. * @description 是否通过节点 ID 指定路径分析的结点。
  19948. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  19949. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [ID1,ID2,...];
  19950. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  19951. */
  19952. this.isAnalyzeById = false;
  19953. /**
  19954. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  19955. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  19956. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  19957. */
  19958. this.isCenterMutuallyExclusive = false;
  19959. /**
  19960. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindServiceAreasParameters.prototype.centers
  19961. * @description 服务站点数组。
  19962. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  19963. */
  19964. this.centers = null;
  19965. /**
  19966. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isFromCenter=false]
  19967. * @description 是否从中心点开始分析。
  19968. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  19969. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  19970. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  19971. */
  19972. this.isFromCenter = false;
  19973. /**
  19974. * APIProperty: weights
  19975. * @member {Array.<number>} SuperMap.FindServiceAreasParameters.prototype.weights
  19976. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  19977. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  19978. */
  19979. this.weights = null;
  19980. /**
  19981. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindServiceAreasParameters.prototype.parameter
  19982. * @description 交通网络分析通用参数。
  19983. */
  19984. this.parameter = new TransportationAnalystParameter_TransportationAnalystParameter();
  19985. Util_Util.extend(this, options);
  19986. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  19987. }
  19988. /**
  19989. * @function SuperMap.FindServiceAreasParameters.prototype.destroy
  19990. * @description 释放资源,将引用资源的属性置空。
  19991. */
  19992. destroy() {
  19993. var me = this;
  19994. me.isAnalyzeById = null;
  19995. me.isCenterMutuallyExclusive = null;
  19996. me.centers = null;
  19997. me.isFromCenter = null;
  19998. me.weights = null;
  19999. if (me.parameter) {
  20000. me.parameter.destroy();
  20001. me.parameter = null;
  20002. }
  20003. }
  20004. }
  20005. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters_FindServiceAreasParameters;
  20006. // CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  20007. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20008. * This program are made available under the terms of the Apache License, Version 2.0
  20009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20010. /**
  20011. * @class SuperMap.FindServiceAreasService
  20012. * @category iServer NetworkAnalyst ServiceArea
  20013. * @classdesc 服务区分析服务类。
  20014. * 服务区分析是以指定服务站点为中心,
  20015. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  20016. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  20017. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  20018. * @extends {SuperMap.NetworkAnalystServiceBase}
  20019. * @example
  20020. * var myFindServiceAreasService = new SuperMap.FindServiceAreasService(url, {
  20021. * eventListeners: {
  20022. * "processCompleted": findServiceAreasCompleted,
  20023. * "processFailed": findServiceAreasError
  20024. * }
  20025. * });
  20026. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20027. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20028. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20029. * @param {Object} options - 互服务时所需可选参数。如:
  20030. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  20031. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20032. * @param {Object} [options.headers] - 请求头。
  20033. */
  20034. class FindServiceAreasService_FindServiceAreasService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  20035. constructor(url, options) {
  20036. super(url, options);
  20037. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  20038. }
  20039. /**
  20040. * @function SuperMap.FindServiceAreasService.prototype.destroy
  20041. * @override
  20042. */
  20043. destroy() {
  20044. super.destroy();
  20045. }
  20046. /**
  20047. * @function SuperMap.FindServiceAreasService.prototype.processAsync
  20048. * @description 负责将客户端的查询参数传递到服务端。
  20049. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类
  20050. */
  20051. processAsync(params) {
  20052. if (!(params instanceof FindServiceAreasParameters_FindServiceAreasParameters)) {
  20053. return;
  20054. }
  20055. var me = this, jsonObject;
  20056. me.url = Util_Util.urlPathAppend(me.url, 'servicearea');
  20057. jsonObject = {
  20058. isFromCenter: params.isFromCenter,
  20059. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  20060. parameter: Util_Util.toJSON(params.parameter),
  20061. centers: me.getJson(params.isAnalyzeById, params.centers),
  20062. weights: me.getJson(true, params.weights)
  20063. };
  20064. me.request({
  20065. method: "GET",
  20066. params: jsonObject,
  20067. scope: me,
  20068. success: me.serviceProcessCompleted,
  20069. failure: me.serviceProcessFailed
  20070. });
  20071. }
  20072. /**
  20073. * @function SuperMap.FindServiceAreasService.prototype.getJson
  20074. * @description 将对象转化为JSON字符串。
  20075. * @param {boolean} isAnalyzeById - 是否通过id分析
  20076. * @param {Array} params - 需要转换的数字
  20077. * @returns {Object} 转化后的JSON字符串。
  20078. */
  20079. getJson(isAnalyzeById, params) {
  20080. var jsonString = "[",
  20081. len = params ? params.length : 0;
  20082. if (isAnalyzeById === false) {
  20083. for (let i = 0; i < len; i++) {
  20084. if (i > 0) {
  20085. jsonString += ",";
  20086. }
  20087. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  20088. }
  20089. } else if (isAnalyzeById === true) {
  20090. for (let i = 0; i < len; i++) {
  20091. if (i > 0) {
  20092. jsonString += ",";
  20093. }
  20094. jsonString += params[i];
  20095. }
  20096. }
  20097. jsonString += ']';
  20098. return jsonString;
  20099. }
  20100. /**
  20101. * @function SuperMap.FindServiceAreasService.prototype.toGeoJSONResult
  20102. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20103. * @param {Object} result - 服务器返回的结果对象。。
  20104. */
  20105. toGeoJSONResult(result) {
  20106. if (!result || !result.serviceAreaList) {
  20107. return result;
  20108. }
  20109. var geoJSONFormat = new GeoJSON_GeoJSON();
  20110. result.serviceAreaList.map(function (serviceArea) {
  20111. if (serviceArea.serviceRegion) {
  20112. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  20113. }
  20114. if (serviceArea.edgeFeatures) {
  20115. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  20116. }
  20117. if (serviceArea.nodeFeatures) {
  20118. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  20119. }
  20120. if (serviceArea.routes) {
  20121. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  20122. }
  20123. return serviceArea;
  20124. });
  20125. return result;
  20126. }
  20127. }
  20128. SuperMap.FindServiceAreasService = FindServiceAreasService_FindServiceAreasService;
  20129. // CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  20130. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20131. * This program are made available under the terms of the Apache License, Version 2.0
  20132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20133. /**
  20134. * @class SuperMap.FindTSPPathsParameters
  20135. * @category iServer NetworkAnalyst TSPPath
  20136. * @classdesc 旅行商分析参数类。
  20137. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  20138. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  20139. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同
  20140. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  20141. * @param {Object} options - 参数。
  20142. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  20143. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  20144. * @param {Array.<(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)>} options.nodes - 配送目标集合。
  20145. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20146. */
  20147. class FindTSPPathsParameters_FindTSPPathsParameters {
  20148. constructor(options) {
  20149. /**
  20150. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.endNodeAssigned=false]
  20151. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  20152. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  20153. */
  20154. this.endNodeAssigned = false;
  20155. /**
  20156. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.isAnalyzeById=false]
  20157. * @description 是否通过节点 ID 号来指定途经点。
  20158. */
  20159. this.isAnalyzeById = false;
  20160. /**
  20161. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindTSPPathsParameters.prototype.nodes
  20162. * @description 旅行商分析途经点数组。
  20163. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  20164. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  20165. */
  20166. this.nodes = null;
  20167. /**
  20168. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindTSPPathsParameters.prototype.parameter]
  20169. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  20170. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  20171. * 字段,则返回结果空间信息等都为空。
  20172. */
  20173. this.parameter = new TransportationAnalystParameter_TransportationAnalystParameter();
  20174. Util_Util.extend(this, options);
  20175. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  20176. }
  20177. /**
  20178. * @function SuperMap.FindTSPPathsParameters.prototype.destroy
  20179. * @description 释放资源,将引用资源的属性置空。
  20180. */
  20181. destroy() {
  20182. var me = this;
  20183. me.endNodeAssigned = null;
  20184. me.isAnalyzeById = null;
  20185. me.nodes = null;
  20186. if (me.parameter) {
  20187. me.parameter.destroy();
  20188. me.parameter = null;
  20189. }
  20190. }
  20191. }
  20192. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters_FindTSPPathsParameters;
  20193. // CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  20194. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20195. * This program are made available under the terms of the Apache License, Version 2.0
  20196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20197. /**
  20198. * @class SuperMap.FindTSPPathsService
  20199. * @category iServer NetworkAnalyst TSPPath
  20200. * @classdesc 旅行商分析服务类
  20201. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  20202. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  20203. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  20204. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  20205. * @extends {SuperMap.NetworkAnalystServiceBase}
  20206. * @example
  20207. * (start code)
  20208. * var myFindTSPPathsService = new SuperMap.FindTSPPathsService(url, {
  20209. * eventListeners: {
  20210. * "processCompleted": findTSPPathsCompleted,
  20211. * "processFailed": findTSPPathsError
  20212. * }
  20213. * });
  20214. * (end)
  20215. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20216. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20217. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20218. * @param {Object} options - 参数。
  20219. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20220. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20221. * @param {Object} [options.headers] - 请求头。
  20222. */
  20223. class FindTSPPathsService_FindTSPPathsService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  20224. constructor(url, options) {
  20225. super(url, options);
  20226. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  20227. }
  20228. /**
  20229. * @function SuperMap.FindTSPPathsService.prototype.destroy
  20230. * @override
  20231. */
  20232. destroy() {
  20233. super.destroy();
  20234. }
  20235. /**
  20236. * @function SuperMap.FindTSPPathsService.prototype.processAsync
  20237. * @description 负责将客户端的查询参数传递到服务端。
  20238. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  20239. */
  20240. processAsync(params) {
  20241. if (!(params instanceof FindTSPPathsParameters_FindTSPPathsParameters)) {
  20242. return;
  20243. }
  20244. var me = this, jsonObject;
  20245. me.url = Util_Util.urlPathAppend(me.url, 'tsppath');
  20246. jsonObject = {
  20247. parameter: SuperMap.Util.toJSON(params.parameter),
  20248. endNodeAssigned: params.endNodeAssigned,
  20249. nodes: me.getNodesJson(params)
  20250. };
  20251. me.request({
  20252. method: "GET",
  20253. params: jsonObject,
  20254. scope: me,
  20255. success: me.serviceProcessCompleted,
  20256. failure: me.serviceProcessFailed
  20257. });
  20258. }
  20259. /**
  20260. * @function SuperMap.FindTSPPathsService.prototype.getNodesJson
  20261. * @description 将节点对象转化为JSON字符串。
  20262. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  20263. * @returns {string} 转化后的JSON字符串。
  20264. */
  20265. getNodesJson(params) {
  20266. var jsonParameters = "", nodesString, i, len, nodes;
  20267. if (params.isAnalyzeById === false) {
  20268. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  20269. if (i > 0) {
  20270. nodesString += ",";
  20271. }
  20272. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  20273. }
  20274. nodesString += ']';
  20275. jsonParameters += nodesString;
  20276. } else if (params.isAnalyzeById === true) {
  20277. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  20278. for (let i = 0; i < len; i++) {
  20279. if (i > 0) {
  20280. nodeIDsString += ",";
  20281. }
  20282. nodeIDsString += nodes[i];
  20283. }
  20284. nodeIDsString += ']';
  20285. jsonParameters += nodeIDsString;
  20286. }
  20287. return jsonParameters;
  20288. }
  20289. /**
  20290. * @function SuperMap.FindTSPPathsService.prototype.toGeoJSONResult
  20291. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20292. * @param {Object} result - 服务器返回的结果对象。
  20293. */
  20294. toGeoJSONResult(result) {
  20295. if (!result || !result.tspPathList) {
  20296. return null;
  20297. }
  20298. var geoJSONFormat = new GeoJSON_GeoJSON();
  20299. result.tspPathList.forEach(function (path) {
  20300. if (path.route) {
  20301. path.route = geoJSONFormat.toGeoJSON(path.route);
  20302. }
  20303. if (path.pathGuideItems) {
  20304. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  20305. }
  20306. if (path.edgeFeatures) {
  20307. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  20308. }
  20309. if (path.nodeFeatures) {
  20310. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  20311. }
  20312. });
  20313. return result;
  20314. }
  20315. }
  20316. SuperMap.FindTSPPathsService = FindTSPPathsService_FindTSPPathsService;
  20317. // CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  20318. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20319. * This program are made available under the terms of the Apache License, Version 2.0
  20320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20321. /**
  20322. * @class SuperMap.GenerateSpatialDataParameters
  20323. * @category iServer SpatialAnalyst GenerateSpatialData
  20324. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  20325. * @param {Object} options - 参数。
  20326. * @param {string} options.routeTable - 路由数据集。
  20327. * @param {string} options.routeIDField - 路由数据集的标识字段。
  20328. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  20329. * @param {SuperMap.DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  20330. * @param {string} [options.attributeFilter] - 属性过滤条件。
  20331. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  20332. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  20333. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  20334. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  20335. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  20336. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  20337. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  20338. */
  20339. class GenerateSpatialDataParameters_GenerateSpatialDataParameters {
  20340. constructor(options) {
  20341. /**
  20342. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeTable
  20343. * @description 路由数据集。
  20344. */
  20345. this.routeTable = null;
  20346. /**
  20347. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeIDField
  20348. * @description 路由数据集的标识字段。
  20349. */
  20350. this.routeIDField = null;
  20351. /**
  20352. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.attributeFilter]
  20353. * @description 属性过滤条件。
  20354. * 当 {@link SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  20355. */
  20356. this.attributeFilter = null;
  20357. /**
  20358. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventTable
  20359. * @description 用于生成空间数据的事件表名。
  20360. */
  20361. this.eventTable = null;
  20362. /**
  20363. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventRouteIDField
  20364. * @description 用于生成空间数据的事件表的路由标识字段。
  20365. */
  20366. this.eventRouteIDField = null;
  20367. /**
  20368. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureField]
  20369. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义
  20370. */
  20371. this.measureField = null;
  20372. /**
  20373. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureStartField]
  20374. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  20375. */
  20376. this.measureStartField = null;
  20377. /**
  20378. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureEndField]
  20379. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  20380. */
  20381. this.measureEndField = null;
  20382. /**
  20383. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureOffsetField]
  20384. * @description 刻度偏移量字段。
  20385. */
  20386. this.measureOffsetField = null;
  20387. /**
  20388. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.errorInfoField]
  20389. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  20390. */
  20391. this.errorInfoField = null;
  20392. /**
  20393. * @member {Array.<string>} [SuperMap.GenerateSpatialDataParameters.prototype.retainedFields]
  20394. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  20395. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  20396. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  20397. */
  20398. this.retainedFields = null;
  20399. /**
  20400. * @member {SuperMap.DataReturnOption} SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption
  20401. * @description 设置数据返回的选项。
  20402. */
  20403. this.dataReturnOption = null;
  20404. if (options) {
  20405. Util_Util.extend(this, options);
  20406. }
  20407. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  20408. }
  20409. /**
  20410. * @function SuperMap.GenerateSpatialDataParameters.prototype.destroy
  20411. * @description 释放资源,将引用资源的属性置空。
  20412. */
  20413. destroy() {
  20414. var me = this;
  20415. if (me.routeTable) {
  20416. me.routeTable = null;
  20417. }
  20418. me.routeIDField = null;
  20419. me.attributeFilter = null;
  20420. me.eventTable = null;
  20421. me.eventRouteIDField = null;
  20422. me.measureField = null;
  20423. me.measureStartField = null;
  20424. me.measureEndField = null;
  20425. me.measureOffsetField = null;
  20426. me.errorInfoField = null;
  20427. if (me.dataReturnOption) {
  20428. me.dataReturnOption.destroy();
  20429. me.dataReturnOption = null;
  20430. }
  20431. }
  20432. }
  20433. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters_GenerateSpatialDataParameters;
  20434. // CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  20435. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20436. * This program are made available under the terms of the Apache License, Version 2.0
  20437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20438. /**
  20439. * @class SuperMap.GenerateSpatialDataService
  20440. * @category iServer SpatialAnalyst GenerateSpatialData
  20441. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  20442. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  20443. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  20444. * @param {Object} options - 参数。</br>
  20445. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20446. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20447. * @param {Object} [options.headers] - 请求头。
  20448. * @extends {SuperMap.SpatialAnalystBase}
  20449. * @example 实例化该类如下例所示:
  20450. * (start code)
  20451. * function GenerateSpatialData(){
  20452. *
  20453. * //配置数据返回选项(option)
  20454. * var option = new SuperMap.DataReturnOption({
  20455. * expectCount: 1000,
  20456. * dataset: "generateSpatialData",
  20457. * deleteExistResultDataset: true,
  20458. * dataReturnMode: SuperMap.DataReturnMode.DATASET_ONLY
  20459. * }),
  20460. * //配置动态分段参数(Parameters)
  20461. * parameters = new SuperMap.GenerateSpatialDataParameters({
  20462. * routeTable: "RouteDT_road@Changchun",
  20463. * routeIDField: "RouteID",
  20464. * eventTable: "LinearEventTabDT@Changchun",
  20465. * eventRouteIDField: "RouteID",
  20466. * measureField: "",
  20467. * measureStartField: "LineMeasureFrom",
  20468. * measureEndField: "LineMeasureTo",
  20469. * measureOffsetField: "",
  20470. * errorInfoField: "",
  20471. * retainedFields:[],
  20472. * dataReturnOption: option
  20473. * }),
  20474. * //配置动态分段iService
  20475. * iService = new SuperMap.GenerateSpatialDataService(Changchun_spatialanalyst, {
  20476. * eventListeners: {
  20477. * processCompleted: generateCompleted,
  20478. * processFailed: generateFailded
  20479. * }
  20480. * });
  20481. * //执行
  20482. * iService.processAsync(parameters);
  20483. * function Completed(generateSpatialDataEventArgs){//todo};
  20484. * function Error(generateSpatialDataEventArgs){//todo};
  20485. * (end)
  20486. */
  20487. class GenerateSpatialDataService_GenerateSpatialDataService extends SpatialAnalystBase_SpatialAnalystBase {
  20488. constructor(url, options) {
  20489. super(url, options);
  20490. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  20491. }
  20492. /**
  20493. * @function SuperMap.GenerateSpatialDataService.prototype.destroy
  20494. * @override
  20495. */
  20496. destroy() {
  20497. super.destroy();
  20498. }
  20499. /**
  20500. * @function SuperMap.GenerateSpatialDataService.prototype.processAsync
  20501. * @description 负责将客户端的动态分段服务参数传递到服务端。
  20502. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  20503. */
  20504. processAsync(params) {
  20505. if (!(params instanceof GenerateSpatialDataParameters_GenerateSpatialDataParameters)) {
  20506. return;
  20507. }
  20508. var me = this,
  20509. jsonParameters;
  20510. jsonParameters = me.getJsonParameters(params);
  20511. me.request({
  20512. method: "POST",
  20513. data: jsonParameters,
  20514. scope: me,
  20515. success: me.serviceProcessCompleted,
  20516. failure: me.serviceProcessFailed
  20517. });
  20518. }
  20519. /**
  20520. * @function SuperMap.GenerateSpatialDataService.prototype.getJsonParameters
  20521. * @description 将参数转化为 JSON 字符串。
  20522. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  20523. * @returns {string}转化后的JSON字符串。
  20524. */
  20525. getJsonParameters(params) {
  20526. var jsonParameters = "",
  20527. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  20528. me = this;
  20529. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  20530. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  20531. jsonParameters = Util_Util.toJSON(params);
  20532. return jsonParameters;
  20533. }
  20534. }
  20535. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService_GenerateSpatialDataService;
  20536. // CONCATENATED MODULE: ./src/common/iServer/GeoBoundingBoxQueryBuilderParameter.js
  20537. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20538. * This program are made available under the terms of the Apache License, Version 2.0
  20539. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20540. /**
  20541. * @class SuperMap.GeoBoundingBoxQueryBuilderParameter
  20542. * @classdesc bounds 查询参数设置类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  20543. * @category iServer Data FeatureResults
  20544. * @param {Object} options - 参数。
  20545. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 查询范围。
  20546. * @param {SuperMap.AggregationQueryBuilderType} [options.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX] - 查询类型。
  20547. */
  20548. class GeoBoundingBoxQueryBuilderParameter_GeoBoundingBoxQueryBuilderParameter extends AggQueryBuilderParameter_AggQueryBuilderParameter {
  20549. constructor(options) {
  20550. super(options);
  20551. /**
  20552. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.bounds
  20553. * @description 查询范围。
  20554. */
  20555. this.bounds = null;
  20556. /**
  20557. * @member {SuperMap.AggregationQueryBuilderType} [SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX]
  20558. * @description 查询类型。
  20559. */
  20560. this.queryType = AggregationQueryBuilderType.GEO_BOUNDING_BOX;
  20561. this.CLASS_NAME = "SuperMap.GeoBoundingBoxQueryBuilderParameter";
  20562. Util_Util.extend(this, options);
  20563. }
  20564. destroy() {
  20565. super.destroy();
  20566. this.bounds = null;
  20567. this.queryType = null;
  20568. }
  20569. }
  20570. SuperMap.GeoBoundingBoxQueryBuilderParameter = GeoBoundingBoxQueryBuilderParameter_GeoBoundingBoxQueryBuilderParameter
  20571. // CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  20572. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20573. * This program are made available under the terms of the Apache License, Version 2.0
  20574. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20575. /**
  20576. * @class SuperMap.GeoHashGridAggParameter
  20577. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  20578. * @category iServer Data FeatureResults
  20579. * @param {Object} option - 初始化参数。
  20580. * @param {number} [option.precision=5] - 网格中数字的精度。
  20581. * @param {SuperMap.AggregationType} [option.aggType=SuperMap.AggregationType.GEOHASH_GRID] - 格网聚合类型。
  20582. */
  20583. class GeoHashGridAggParameter_GeoHashGridAggParameter extends AggregationParameter_AggregationParameter {
  20584. constructor(option) {
  20585. super(option);
  20586. /**
  20587. * @member {number} [SuperMap.GeoHashGridAggParameter.prototype.precision=5]
  20588. * @description 网格中数字的精度。
  20589. */
  20590. this.precision = 5;
  20591. /**
  20592. * @member {SuperMap.AggregationType} [SuperMap.GeoHashGridAggParameter.prototype.aggType=SuperMap.AggregationType.GEOHASH_GRID]
  20593. * @description 格网聚合类型。
  20594. */
  20595. this.aggType = AggregationType.GEOHASH_GRID;
  20596. Util_Util.extend(this, option);
  20597. this.CLASS_NAME = "SuperMap.GeoHashGridAggParameter";
  20598. }
  20599. destroy() {
  20600. super.destroy();
  20601. this.aggType = null;
  20602. }
  20603. /**
  20604. * @function SuperMap.GeoHashGridAggParameter.toJsonParameters
  20605. * @description 将对象转为 JSON 格式。
  20606. * @param param 转换对象。
  20607. * @returns {string|object}
  20608. */
  20609. static toJsonParameters(param) {
  20610. var parameters = {
  20611. aggName: param.aggName,
  20612. aggFieldName: param.aggFieldName,
  20613. aggType: param.aggType,
  20614. precision: param.precision
  20615. };
  20616. if (param.subAgg) {
  20617. parameters.subAgg = param.subAgg;
  20618. }
  20619. return Util_Util.toJson(parameters);
  20620. }
  20621. }
  20622. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter_GeoHashGridAggParameter;
  20623. // CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  20624. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20625. * This program are made available under the terms of the Apache License, Version 2.0
  20626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20627. /**
  20628. * @class SuperMap.GeometryOverlayAnalystParameters
  20629. * @category iServer SpatialAnalyst OverlayAnalyst
  20630. * @classdesc
  20631. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  20632. * @param {Object} options - 参数。
  20633. * @param {Object} options.operateGeometry - 叠加分析的操作几何对象。 </br>
  20634. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  20635. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。</br>
  20636. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。
  20637. * @param {Object} options.sourceGeometry - 叠加分析的源几何对象。
  20638. * @param {Array.<Object>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  20639. * @param {Array.<Object>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  20640. * @param {SuperMap.OverlayOperationType} [options.operation] - 叠加操作枚举值。
  20641. * @extends {SuperMap.OverlayAnalystParameters}
  20642. */
  20643. class GeometryOverlayAnalystParameters_GeometryOverlayAnalystParameters extends OverlayAnalystParameters_OverlayAnalystParameters {
  20644. constructor(options) {
  20645. super(options);
  20646. if (options && options.operateGeometry) {
  20647. this.operateGeometry = options.operateGeometry;
  20648. }
  20649. if (options && options.sourceGeometry) {
  20650. this.sourceGeometry = options.sourceGeometry;
  20651. }
  20652. if (options && options.operateGeometries) {
  20653. this.operateGeometries = options.operateGeometries;
  20654. }
  20655. if (options && options.sourceGeometries) {
  20656. this.sourceGeometries = options.sourceGeometries;
  20657. }
  20658. if (options) {
  20659. Util_Util.extend(this, options);
  20660. }
  20661. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  20662. }
  20663. /**
  20664. * @function SuperMap.GeometryOverlayAnalystParameters.prototype.destroy
  20665. * @override
  20666. */
  20667. destroy() {
  20668. super.destroy();
  20669. var me = this;
  20670. if (me.sourceGeometry) {
  20671. me.sourceGeometry.destroy();
  20672. me.sourceGeometry = null;
  20673. }
  20674. if (me.sourceGeometries) {
  20675. me.sourceGeometries.destroy();
  20676. me.sourceGeometries = null;
  20677. }
  20678. if (me.sourceGeometry) {
  20679. me.sourceGeometry.destroy();
  20680. me.sourceGeometry = null;
  20681. }
  20682. if (me.operateGeometries) {
  20683. me.operateGeometries.destroy();
  20684. me.operateGeometries = null;
  20685. }
  20686. }
  20687. /**
  20688. * @function SuperMap.GeometryOverlayAnalystParameters.toObject
  20689. * @param {SuperMap.GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  20690. * @param {SuperMap.GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  20691. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  20692. * @returns {Object} JSON 对象。
  20693. */
  20694. static toObject(geometryOverlayAnalystParameters, tempObj) {
  20695. for (var name in geometryOverlayAnalystParameters) {
  20696. if (name === "sourceGeometry") {
  20697. tempObj.sourceGeometry = ServerGeometry_ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  20698. } else if (name === "sourceGeometries") {
  20699. var sourceGeometries = [];
  20700. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  20701. sourceGeometries.push(ServerGeometry_ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  20702. }
  20703. tempObj.sourceGeometries = sourceGeometries;
  20704. } else if (name === "operateGeometry") {
  20705. tempObj.operateGeometry = ServerGeometry_ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  20706. } else if (name === "operateGeometries") {
  20707. var operateGeometries = [];
  20708. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  20709. operateGeometries.push(ServerGeometry_ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  20710. }
  20711. tempObj.operateGeometries = operateGeometries;
  20712. } else {
  20713. tempObj[name] = geometryOverlayAnalystParameters[name];
  20714. }
  20715. }
  20716. }
  20717. }
  20718. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters_GeometryOverlayAnalystParameters;
  20719. // CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  20720. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20721. * This program are made available under the terms of the Apache License, Version 2.0
  20722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20723. /**
  20724. * @class SuperMap.GeometrySurfaceAnalystParameters
  20725. * @category iServer SpatialAnalyst SurfaceAnalyst
  20726. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  20727. * @param {Object} options - 参数。
  20728. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 表面分析的坐标点数组。
  20729. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  20730. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  20731. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  20732. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  20733. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod = SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  20734. * @extends {SuperMap.SurfaceAnalystParameters}
  20735. */
  20736. class GeometrySurfaceAnalystParameters_GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters_SurfaceAnalystParameters {
  20737. constructor(options) {
  20738. super(options);
  20739. /**
  20740. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometrySurfaceAnalystParameters.prototype.points
  20741. * @description 获取或设置用于表面分析的坐标点数组。
  20742. */
  20743. this.points = null;
  20744. /**
  20745. * @member {Array.<number>} SuperMap.GeometrySurfaceAnalystParameters.prototype.zValues
  20746. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  20747. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  20748. */
  20749. this.zValues = null;
  20750. if (options) {
  20751. Util_Util.extend(this, options);
  20752. }
  20753. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  20754. }
  20755. /**
  20756. * @function SuperMap.GeometrySurfaceAnalystParameters.prototype.destroy
  20757. * @override
  20758. */
  20759. destroy() {
  20760. super.destroy();
  20761. var me = this;
  20762. if (me.points) {
  20763. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  20764. points[i].destroy();
  20765. }
  20766. me.points = null;
  20767. }
  20768. me.zValues = null;
  20769. }
  20770. }
  20771. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters_GeometrySurfaceAnalystParameters;
  20772. // CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  20773. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  20774. * This program are made available under the terms of the Apache License, Version 2.0
  20775. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20776. /**
  20777. * @class SuperMap.GeometryThiessenAnalystParameters
  20778. * @constructs SuperMap.GeometryThiessenAnalystParameters
  20779. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  20780. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  20781. * @param {Object} options - 参数。
  20782. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 使用点数组进行分析时使用的几何对象。
  20783. * @extends {SuperMap.ThiessenAnalystParameters}
  20784. */
  20785. class GeometryThiessenAnalystParameters_GeometryThiessenAnalystParameters extends ThiessenAnalystParameters_ThiessenAnalystParameters {
  20786. constructor(options) {
  20787. super(options);
  20788. /**
  20789. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometryThiessenAnalystParameters.prototype.points
  20790. * @description 使用点数组进行分析时使用的几何对象。
  20791. */
  20792. this.points = null;
  20793. if (options) {
  20794. Util_Util.extend(this, options);
  20795. }
  20796. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  20797. }
  20798. /**
  20799. * @function SuperMap.GeometryThiessenAnalystParameters.prototype.destroy
  20800. * @override
  20801. */
  20802. destroy() {
  20803. super.destroy();
  20804. var me = this;
  20805. if (me.points) {
  20806. for (var i = me.points.length - 1; i >= 0; i--) {
  20807. me.points[i].destroy();
  20808. }
  20809. me.points = null;
  20810. }
  20811. }
  20812. /**
  20813. * @function SuperMap.GeometryThiessenAnalystParameters.toObject
  20814. * @param {SuperMap.GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  20815. * @param {SuperMap.GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  20816. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  20817. * @returns {Object} JSON 对象。
  20818. */
  20819. static toObject(geometryThiessenAnalystParameters, tempObj) {
  20820. for (var name in geometryThiessenAnalystParameters) {
  20821. if (name === "clipRegion") {
  20822. tempObj.clipRegion = ServerGeometry_ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  20823. } else {
  20824. tempObj[name] = geometryThiessenAnalystParameters[name];
  20825. }
  20826. }
  20827. }
  20828. }
  20829. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters_GeometryThiessenAnalystParameters;
  20830. // CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  20831. /**
  20832. * @class SuperMap.GeoprocessingService
  20833. * @category iServer GeoprocessingService
  20834. * @classdesc 地理处理服务接口的基类。
  20835. * @version 10.1.0
  20836. * @extends {SuperMap.CommonServiceBase}
  20837. * @param {string} url - 服务地址。
  20838. * @param {Object} options - 参数。
  20839. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  20840. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
  20841. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  20842. */
  20843. class GeoprocessingService_GeoprocessingService extends CommonServiceBase_CommonServiceBase {
  20844. constructor(url, options) {
  20845. options = options || {};
  20846. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  20847. super(url, options);
  20848. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  20849. this.headers = {};
  20850. this.crossOrigin = true;
  20851. }
  20852. /**
  20853. * @function SuperMap.GeoprocessingService.prototype.getTools
  20854. * @description 获取地理处理工具列表。
  20855. */
  20856. getTools() {
  20857. this._get(`${this.url}/list`);
  20858. }
  20859. /**
  20860. * @function SuperMap.GeoprocessingService.prototype.getTool
  20861. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  20862. * @param {string} identifier - 地理处理工具ID。
  20863. */
  20864. getTool(identifier) {
  20865. this._get(`${this.url}/${identifier}`);
  20866. }
  20867. /**
  20868. * @function SuperMap.GeoprocessingService.prototype.execute
  20869. * @description 同步执行地理处理工具。
  20870. * @param {string} identifier - 地理处理工具ID。
  20871. * @param {Object} parameter - 地理处理工具的输入参数。
  20872. * @param {Object} environment - 地理处理工具的环境参数。
  20873. */
  20874. execute(identifier, parameter, environment) {
  20875. parameter = parameter ? parameter : null;
  20876. environment = environment ? environment : null;
  20877. const executeParamter = { parameter, environment };
  20878. this._get(`${this.url}/${identifier}/execute`, executeParamter);
  20879. }
  20880. /**
  20881. * @function SuperMap.GeoprocessingService.prototype.submitJob
  20882. * @description 异步执行地理处理工具。
  20883. * @param {string} identifier - 地理处理工具ID。
  20884. * @param {Object} parameter - 地理处理工具的输入参数。
  20885. * @param {Object} environments - 地理处理工具的环境参数。
  20886. */
  20887. submitJob(identifier, parameter, environments) {
  20888. parameter = parameter ? parameter : null;
  20889. environments = environments ? environments : null;
  20890. const asyncParamter = { parameter: parameter, environments: environments };
  20891. this.request({
  20892. url: `${this.url}/${identifier}/jobs`,
  20893. headers: { 'Content-type': 'application/json' },
  20894. method: 'POST',
  20895. data: JSON.stringify(asyncParamter),
  20896. scope: this,
  20897. success: this.serviceProcessCompleted,
  20898. failure: this.serviceProcessFailed
  20899. });
  20900. }
  20901. /**
  20902. * @function SuperMap.GeoprocessingService.prototype.waitForJobCompletion
  20903. * @description 获取地理处理异步执行状态信息。
  20904. * @param {string} jobId - 地理处理任务ID。
  20905. * @param {string} identifier - 地理处理工具ID。
  20906. * @param {Object} options - 状态信息参数。
  20907. * @param {number} options.interval - 定时器时间间隔。
  20908. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  20909. */
  20910. waitForJobCompletion(jobId, identifier, options) {
  20911. const me = this;
  20912. const timer = setInterval(function () {
  20913. const serviceProcessCompleted = function (serverResult) {
  20914. const state = serverResult.state.runState;
  20915. if (options.statusCallback) {
  20916. options.statusCallback(state);
  20917. }
  20918. switch (state) {
  20919. case 'FINISHED':
  20920. clearInterval(timer);
  20921. me.events.triggerEvent('processCompleted', {
  20922. result: serverResult
  20923. });
  20924. break;
  20925. case 'FAILED':
  20926. clearInterval(timer);
  20927. me.events.triggerEvent('processFailed', {
  20928. result: serverResult
  20929. });
  20930. break;
  20931. case 'CANCELED':
  20932. clearInterval(timer);
  20933. me.events.triggerEvent('processFailed', {
  20934. result: serverResult
  20935. });
  20936. break;
  20937. }
  20938. };
  20939. me._get(`${me.url}/${identifier}/jobs/${jobId}`, null, serviceProcessCompleted);
  20940. }, options.interval);
  20941. }
  20942. /**
  20943. * @function SuperMap.GeoprocessingService.prototype.getJobInfo
  20944. * @description 获取地理处理任务的执行信息。
  20945. * @param {string} identifier - 地理处理工具ID。
  20946. * @param {string} jobId - 地理处理任务ID。
  20947. */
  20948. getJobInfo(identifier, jobId) {
  20949. this._get(`${this.url}/${identifier}/jobs/${jobId}`);
  20950. }
  20951. /**
  20952. * @function SuperMap.GeoprocessingService.prototype.cancelJob
  20953. * @description 取消地理处理任务的异步执行。
  20954. * @param {string} identifier - 地理处理工具ID。
  20955. * @param {string} jobId - 地理处理任务ID。
  20956. */
  20957. cancelJob(identifier, jobId) {
  20958. this._get(`${this.url}/${identifier}/jobs/${jobId}/cancel`);
  20959. }
  20960. /**
  20961. * @function SuperMap.GeoprocessingService.prototype.getJobs
  20962. * @description 获取地理处理服务任务列表。
  20963. * @param {string} identifier - 地理处理工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  20964. */
  20965. getJobs(identifier) {
  20966. let url = `${this.url}/jobs`;
  20967. if (identifier) {
  20968. url = `${this.url}/${identifier}/jobs`;
  20969. }
  20970. this._get(url);
  20971. }
  20972. /**
  20973. * @function SuperMap.GeoprocessingService.prototype.getResults
  20974. * @description 地理处理工具执行的结果等,支持结果过滤。
  20975. * @param {string} identifier - 地理处理工具ID。
  20976. * @param {string} jobId - 地理处理任务ID。
  20977. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  20978. */
  20979. getResults(identifier, jobId, filter) {
  20980. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  20981. if (filter) {
  20982. url = `${url}/${filter}`;
  20983. }
  20984. this._get(url);
  20985. }
  20986. _get(url, paramter, serviceProcessCompleted, serviceProcessFailed) {
  20987. this.request({
  20988. url: url,
  20989. method: 'GET',
  20990. params: paramter,
  20991. headers: { 'Content-type': 'application/json' },
  20992. scope: this,
  20993. success: serviceProcessCompleted ? serviceProcessCompleted : this.serviceProcessCompleted,
  20994. failure: serviceProcessFailed ? serviceProcessFailed : this.serviceProcessFailed
  20995. });
  20996. }
  20997. }
  20998. SuperMap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  20999. // CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  21000. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21001. * This program are made available under the terms of the Apache License, Version 2.0
  21002. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21003. /**
  21004. * @class SuperMap.GeoRelationAnalystParameters
  21005. * @category iServer SpatialAnalyst GeoRelationAnalyst
  21006. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  21007. * @param {Object} options - 参数。
  21008. * @param {SuperMap.FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  21009. * @param {SuperMap.FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  21010. * @param {SuperMap.SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  21011. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  21012. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  21013. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  21014. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  21015. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  21016. */
  21017. class GeoRelationAnalystParameters_GeoRelationAnalystParameters {
  21018. constructor(options) {
  21019. /**
  21020. * @member {string} SuperMap.GeoRelationAnalystParameters.prototype.dataset
  21021. * @description 源数据集名称。
  21022. */
  21023. this.dataset = null;
  21024. /**
  21025. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.sourceFilter
  21026. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  21027. */
  21028. this.sourceFilter = null;
  21029. /**
  21030. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.referenceFilter
  21031. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  21032. */
  21033. this.referenceFilter = null;
  21034. /**
  21035. * @member {SuperMap.SpatialRelationType} SuperMap.GeoRelationAnalystParameters.prototype.spatialRelationType
  21036. * @description 指定的空间关系类型。
  21037. */
  21038. this.spatialRelationType = null;
  21039. /**
  21040. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.isBorderInside]
  21041. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  21042. */
  21043. this.isBorderInside = null;
  21044. /**
  21045. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnFeature]
  21046. * @description 是否返回 Feature 信息。
  21047. */
  21048. this.returnFeature = null;
  21049. /**
  21050. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  21051. * @description 是否仅返回满足指定空间关系的空间对象。
  21052. */
  21053. this.returnGeoRelatedOnly = null;
  21054. /**
  21055. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  21056. * @description 分析结果起始记录位置。
  21057. */
  21058. this.startRecord = 0;
  21059. /**
  21060. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.expectCount=500]
  21061. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  21062. */
  21063. this.expectCount = 500;
  21064. if (options) {
  21065. Util_Util.extend(this, options);
  21066. }
  21067. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  21068. }
  21069. /**
  21070. * @function SuperMap.GeoRelationAnalystParameters.prototype.destroy
  21071. * @description 释放资源,将引用资源的属性置空。
  21072. */
  21073. destroy() {
  21074. var me = this;
  21075. if (me.sourceFilter) {
  21076. me.sourceFilter.destroy();
  21077. }
  21078. me.sourceFilter = null;
  21079. if (me.referenceFilter) {
  21080. me.referenceFilter.destroy();
  21081. }
  21082. me.referenceFilter = null;
  21083. me.dataset = null;
  21084. me.spatialRelationType = null;
  21085. me.isBorderInside = null;
  21086. me.returnFeature = null;
  21087. me.returnGeoRelatedOnly = null;
  21088. me.startRecord = null;
  21089. me.expectCount = null;
  21090. }
  21091. }
  21092. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters_GeoRelationAnalystParameters;
  21093. // CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  21094. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21095. * This program are made available under the terms of the Apache License, Version 2.0
  21096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21097. /**
  21098. * @class SuperMap.GeoRelationAnalystService
  21099. * @category iServer SpatialAnalyst GeoRelationAnalyst
  21100. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  21101. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  21102. * @param {Object} options - 参数。</br>
  21103. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21104. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21105. * @param {Object} [options.headers] - 请求头。
  21106. * @extends {SuperMap.SpatialAnalystBase}
  21107. * @example 实例化该类如下例所示:
  21108. * (start code)
  21109. * function datasetGeoRelationAnalystProcess() {
  21110. * var referenceFilter = new SuperMap.FilterParameter({
  21111. * name:"Frame_R@Changchun",
  21112. * attributeFilter:"SmID>0"});
  21113. * var sourceFilter = new SuperMap.FilterParameter({
  21114. * attributeFilter:"SmID>0"});
  21115. * //初始化服务类
  21116. * var datasetGeoRelationService = new SuperMap.GeoRelationAnalystService(
  21117. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  21118. * //构建参数类
  21119. * datasetGeoRelationParameters = new SuperMap.GeoRelationAnalystParameters({
  21120. * dataset: "Park@Changchun",
  21121. * startRecord: 0,
  21122. * expectCount: 20,
  21123. * sourceFilter: sourceFilter,
  21124. * referenceFilter: referenceFilter,
  21125. * spatialRelationType: SuperMap.SpatialRelationType.INTERSECT,
  21126. * isBorderInside: true,
  21127. * returnFeature: true,
  21128. * returnGeoRelatedOnly: true
  21129. * });
  21130. * datasetGeoRelationService.events.on({
  21131. * "processCompleted": datasetGeoRelationAnalystCompleted,
  21132. * "processFailed": datasetGeoRelationAnalystFailed});
  21133. * //执行
  21134. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  21135. * }
  21136. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  21137. * function Error(datasetGeoRelationAnalystFailed){//todo};
  21138. * (end)
  21139. *
  21140. */
  21141. class GeoRelationAnalystService_GeoRelationAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  21142. constructor(url, options) {
  21143. super(url, options);
  21144. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  21145. }
  21146. /**
  21147. * @function SuperMap.GeoRelationAnalystService.prototype.destroy
  21148. * @override
  21149. */
  21150. destroy() {
  21151. super.destroy();
  21152. }
  21153. /**
  21154. * @function SuperMap.GeoRelationAnalystService.prototype.processAsync
  21155. * @description 负责将客户端的空间关系分析参数传递到服务端
  21156. * @param {SuperMap.GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  21157. */
  21158. processAsync(parameter) {
  21159. if (!(parameter instanceof GeoRelationAnalystParameters_GeoRelationAnalystParameters)) {
  21160. return;
  21161. }
  21162. var me = this;
  21163. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  21164. var jsonParameters = SuperMap.Util.toJSON(parameter);
  21165. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  21166. me.request({
  21167. method: "POST",
  21168. data: jsonParameters,
  21169. scope: me,
  21170. success: me.serviceProcessCompleted,
  21171. failure: me.serviceProcessFailed
  21172. });
  21173. }
  21174. }
  21175. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService_GeoRelationAnalystService;
  21176. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  21177. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21178. * This program are made available under the terms of the Apache License, Version 2.0
  21179. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21180. /**
  21181. * @class SuperMap.GetFeaturesParametersBase
  21182. * @category iServer Data FeatureResults
  21183. * @classdesc 要素查询参数基类。
  21184. * @param {Object} options - 参数。
  21185. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21186. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21187. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21188. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21189. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21190. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21191. */
  21192. class GetFeaturesParametersBase_GetFeaturesParametersBase {
  21193. constructor(options) {
  21194. /**
  21195. * @member {Array.<string>} SuperMap.GetFeaturesParametersBase.prototype.datasetName
  21196. * @description 数据集集合中的数据集名称列表。
  21197. */
  21198. this.datasetNames = null;
  21199. /**
  21200. * @member {string} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  21201. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  21202. */
  21203. this.targetEpsgCode = null;
  21204. /**
  21205. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  21206. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21207. */
  21208. this.targetPrj = null;
  21209. /**
  21210. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnContent=true]
  21211. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  21212. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  21213. * 如果为 false,则返回的是查询结果资源的 URI。
  21214. */
  21215. this.returnContent = true;
  21216. /**
  21217. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.fromIndex=0]
  21218. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  21219. */
  21220. this.fromIndex = 0;
  21221. /**
  21222. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.toIndex=19]
  21223. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  21224. */
  21225. this.toIndex = 19;
  21226. /**
  21227. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnCountOnly=false]
  21228. * @description 只返回查询结果的总数。
  21229. */
  21230. this.returnCountOnly = false;
  21231. /**
  21232. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.maxFeatures=1000]
  21233. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  21234. */
  21235. this.maxFeatures = null;
  21236. /**
  21237. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.aggregations
  21238. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  21239. */
  21240. this.aggregations = null;
  21241. Util_Util.extend(this, options);
  21242. this.CLASS_NAME = "SuperMap.GetFeaturesParametersBase";
  21243. }
  21244. /**
  21245. *
  21246. * @function SuperMap.GetFeaturesParametersBase.prototype.destroy
  21247. * @description 释放资源,将引用资源的属性置空。
  21248. */
  21249. destroy() {
  21250. var me = this;
  21251. me.datasetNames = null;
  21252. me.returnContent = null;
  21253. me.fromIndex = null;
  21254. me.toIndex = null;
  21255. me.maxFeatures = null;
  21256. me.targetEpsgCode = null;
  21257. me.targetPrj = null;
  21258. if (me.aggregation) {
  21259. me.aggregation = null;
  21260. }
  21261. }
  21262. }
  21263. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase_GetFeaturesParametersBase;
  21264. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  21265. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21266. * This program are made available under the terms of the Apache License, Version 2.0
  21267. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21268. /**
  21269. * @class SuperMap.GetFeaturesByBoundsParameters
  21270. * @category iServer Data FeatureResults
  21271. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  21272. * @param {Object} options - 参数。
  21273. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 用于查询的范围对象。
  21274. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21275. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  21276. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21277. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  21278. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21279. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21280. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21281. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21282. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21283. * @extends {SuperMap.GetFeaturesParametersBase}
  21284. */
  21285. class GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters extends GetFeaturesParametersBase_GetFeaturesParametersBase {
  21286. constructor(options) {
  21287. super(options);
  21288. /**
  21289. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.getFeatureMode
  21290. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  21291. */
  21292. this.getFeatureMode = GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  21293. /**
  21294. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GetFeaturesByBoundsParameters.prototype.bounds
  21295. * @description 用于查询的范围对象。
  21296. *
  21297. */
  21298. this.bounds = null;
  21299. /**
  21300. * @member {Array.<string>} SuperMap.GetFeaturesByBoundsParameters.prototype.fields
  21301. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21302. */
  21303. this.fields = null;
  21304. /**
  21305. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.attributeFilter
  21306. * @description 范围查询属性过滤条件。
  21307. */
  21308. this.attributeFilter = null;
  21309. /**
  21310. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  21311. * @description 空间查询模式常量。
  21312. */
  21313. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  21314. Util_Util.extend(this, options);
  21315. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsParameters";
  21316. }
  21317. /**
  21318. * @function SuperMap.GetFeaturesByBoundsParameters.prototype.destroy
  21319. * @override
  21320. */
  21321. destroy() {
  21322. super.destroy();
  21323. var me = this;
  21324. if (me.bounds) {
  21325. me.bounds.destroy();
  21326. me.bounds = null;
  21327. }
  21328. if (me.fields) {
  21329. while (me.fields.length > 0) {
  21330. me.fields.pop();
  21331. }
  21332. me.fields = null;
  21333. }
  21334. me.attributeFilter = null;
  21335. me.spatialQueryMode = null;
  21336. me.getFeatureMode = null;
  21337. }
  21338. /**
  21339. * @function SuperMap.GetFeaturesByBoundsParameters.toJsonParameters
  21340. * @description 将 {@link SuperMap.GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  21341. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 范围查询参数。
  21342. * @returns {string} 转化后的 JSON 字符串。
  21343. *
  21344. */
  21345. static toJsonParameters(params) {
  21346. var filterParameter,
  21347. bounds,
  21348. parasByBounds;
  21349. bounds = {
  21350. "leftBottom": {"x": params.bounds.left, "y": params.bounds.bottom},
  21351. "rightTop": {"x": params.bounds.right, "y": params.bounds.top}
  21352. };
  21353. parasByBounds = {
  21354. datasetNames: params.datasetNames,
  21355. getFeatureMode: GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  21356. bounds: bounds,
  21357. spatialQueryMode: params.spatialQueryMode
  21358. };
  21359. if (params.fields) {
  21360. filterParameter = new FilterParameter_FilterParameter();
  21361. filterParameter.name = params.datasetNames;
  21362. filterParameter.fields = params.fields;
  21363. parasByBounds.queryParameter = filterParameter;
  21364. }
  21365. if (params.attributeFilter) {
  21366. parasByBounds.attributeFilter = params.attributeFilter;
  21367. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  21368. }
  21369. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21370. parasByBounds.maxFeatures = params.maxFeatures;
  21371. }
  21372. if (params.targetEpsgCode) {
  21373. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  21374. }
  21375. if (!params.targetEpsgCode && params.targetPrj) {
  21376. parasByBounds.targetPrj = params.targetPrj;
  21377. }
  21378. return Util_Util.toJSON(parasByBounds);
  21379. }
  21380. }
  21381. GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters.getFeatureMode = {
  21382. "BOUNDS": "BOUNDS",
  21383. "BOUNDS_ATTRIBUTEFILTER": "BOUNDS_ATTRIBUTEFILTER"
  21384. };
  21385. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters;
  21386. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  21387. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21388. * This program are made available under the terms of the Apache License, Version 2.0
  21389. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21390. /**
  21391. * @class SuperMap.GetFeaturesServiceBase
  21392. * @category iServer Data FeatureResults
  21393. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  21394. * @extends SuperMap.CommonServiceBase
  21395. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  21396. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  21397. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21398. * @param {Object} options - 参数。
  21399. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  21400. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21401. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21402. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21403. * @param {Object} [options.headers] - 请求头。
  21404. * @example
  21405. * var myService = new SuperMap.GetFeaturesServiceBase(url, {
  21406. * eventListeners: {
  21407. * "processCompleted": getFeatureCompleted,
  21408. * "processFailed": getFeatureError
  21409. * }
  21410. * });
  21411. */
  21412. class GetFeaturesServiceBase_GetFeaturesServiceBase extends CommonServiceBase_CommonServiceBase {
  21413. constructor(url, options) {
  21414. super(url, options);
  21415. options = options || {};
  21416. /**
  21417. * @member {boolean} [SuperMap.GetFeaturesServiceBase.prototype.returnContent=true]
  21418. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  21419. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  21420. * 如果为 false,则返回的是查询结果资源的 URI。
  21421. */
  21422. this.returnContent = true;
  21423. /**
  21424. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.fromIndex=0]
  21425. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  21426. */
  21427. this.fromIndex = 0;
  21428. /**
  21429. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.toIndex=19]
  21430. * @description 查询结果的最大索引号。
  21431. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  21432. */
  21433. this.toIndex = 19;
  21434. /**
  21435. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.maxFeatures=1000]
  21436. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  21437. */
  21438. this.maxFeatures = null;
  21439. /**
  21440. * @member {string} [SuperMap.GetFeaturesServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  21441. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。
  21442. * 参数格式为 "ISERVER","GEOJSON"。
  21443. */
  21444. this.format = DataFormat.GEOJSON;
  21445. Util_Util.extend(this, options);
  21446. this.url = Util_Util.urlPathAppend(this.url, 'featureResults');
  21447. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  21448. }
  21449. /**
  21450. * @function SuperMap.GetFeaturesServiceBase.prototype.destroy
  21451. * @description 释放资源,将引用资源的属性置空。
  21452. */
  21453. destroy() {
  21454. super.destroy();
  21455. var me = this;
  21456. me.returnContent = null;
  21457. me.fromIndex = null;
  21458. me.toIndex = null;
  21459. me.maxFeatures = null;
  21460. me.format = null;
  21461. }
  21462. /**
  21463. * @function SuperMap.GetFeaturesServiceBase.prototype.processAsync
  21464. * @description 将客户端的查询参数传递到服务端。
  21465. * @param {Object} params - 查询参数。
  21466. */
  21467. processAsync(params) {
  21468. if (!params) {
  21469. return;
  21470. }
  21471. var me = this,
  21472. jsonParameters = null,
  21473. firstPara = true;
  21474. me.returnContent = params.returnContent;
  21475. me.fromIndex = params.fromIndex;
  21476. me.toIndex = params.toIndex;
  21477. me.maxFeatures = params.maxFeatures;
  21478. if (me.returnContent) {
  21479. me.url = Util_Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  21480. firstPara = false;
  21481. }
  21482. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  21483. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  21484. me.url = Util_Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  21485. }
  21486. if (params.returnCountOnly) {
  21487. me.url = Util_Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  21488. }
  21489. jsonParameters = me.getJsonParameters(params);
  21490. me.request({
  21491. method: "POST",
  21492. data: jsonParameters,
  21493. scope: me,
  21494. success: me.serviceProcessCompleted,
  21495. failure: me.serviceProcessFailed
  21496. });
  21497. }
  21498. /**
  21499. * @function SuperMap.GetFeaturesServiceBase.prototype.getFeatureComplete
  21500. * @description 查询完成,执行此方法。
  21501. * @param {Object} result - 服务器返回的结果对象。
  21502. */
  21503. serviceProcessCompleted(result) {
  21504. var me = this;
  21505. result = Util_Util.transformResult(result);
  21506. if (me.format === DataFormat.GEOJSON && result.features) {
  21507. var geoJSONFormat = new GeoJSON_GeoJSON();
  21508. result.features = geoJSONFormat.toGeoJSON(result.features);
  21509. }
  21510. me.events.triggerEvent("processCompleted", {result: result});
  21511. }
  21512. }
  21513. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase_GetFeaturesServiceBase;
  21514. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  21515. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21516. * This program are made available under the terms of the Apache License, Version 2.0
  21517. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21518. /**
  21519. * @class SuperMap.GetFeaturesByBoundsService
  21520. * @category iServer Data FeatureResults
  21521. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  21522. * @description 数据集范围查询服务类构造函数。
  21523. * @extends {SuperMap.GetFeaturesServiceBase}
  21524. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  21525. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21526. * @param {Object} options - 参数。
  21527. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  21528. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21529. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21530. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21531. * @param {Object} [options.headers] - 请求头。
  21532. * @example
  21533. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  21534. * eventListeners: {
  21535. * "processCompleted": getFeatureCompleted,
  21536. * "processFailed": getFeatureError
  21537. * }
  21538. * });
  21539. * function getFeatureCompleted(object){//todo};
  21540. * function getFeatureError(object){//todo}
  21541. */
  21542. class GetFeaturesByBoundsService_GetFeaturesByBoundsService extends GetFeaturesServiceBase_GetFeaturesServiceBase {
  21543. constructor(url, options) {
  21544. super(url, options);
  21545. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  21546. }
  21547. /**
  21548. * @function SuperMap.GetFeaturesByBoundsService.prototype.destroy
  21549. * @override
  21550. */
  21551. destroy() {
  21552. super.destroy();
  21553. }
  21554. /**
  21555. * @function SuperMap.GetFeaturesByBoundsService.prototype.getJsonParameters
  21556. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  21557. * @param params {SuperMap.GetFeaturesByBoundsParameters}
  21558. * @returns {string} 转化后的 JSON 字符串。
  21559. *
  21560. */
  21561. getJsonParameters(params) {
  21562. return GetFeaturesByBoundsParameters_GetFeaturesByBoundsParameters.toJsonParameters(params);
  21563. }
  21564. }
  21565. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService_GetFeaturesByBoundsService;
  21566. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  21567. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21568. * This program are made available under the terms of the Apache License, Version 2.0
  21569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21570. /**
  21571. * @class SuperMap.GetFeaturesByBufferParameters
  21572. * @category iServer Data FeatureResults
  21573. * @classdesc 数据服务中数据集缓冲区查询参数类。
  21574. * @param {Object} options - 参数。
  21575. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  21576. * @param {Object} options.geometry - 空间查询条件。</br>
  21577. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  21578. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21579. * @param {string} [options.attributeFilter] - 属性查询条件。
  21580. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21581. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21582. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21583. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21584. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21585. * @extends {SuperMap.GetFeaturesParametersBase}
  21586. */
  21587. class GetFeaturesByBufferParameters_GetFeaturesByBufferParameters extends GetFeaturesParametersBase_GetFeaturesParametersBase {
  21588. constructor(options) {
  21589. super(options);
  21590. /**
  21591. * @member {number} SuperMap.GetFeaturesByBufferParameters.prototype.bufferDistance
  21592. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  21593. */
  21594. this.bufferDistance = null;
  21595. /**
  21596. * @member {string} SuperMap.GetFeaturesByBufferParameters.prototype.attributeFilter
  21597. * @description 属性查询条件。
  21598. */
  21599. this.attributeFilter = null;
  21600. /**
  21601. * @member {Object} SuperMap.GetFeaturesByBufferParameters.prototype.geometry
  21602. * @description 空间查询条件。 <br>
  21603. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  21604. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  21605. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  21606. */
  21607. this.geometry = null;
  21608. /**
  21609. * @member {Array.<string>} SuperMap.GetFeaturesByBufferParameters.prototype.fields
  21610. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21611. */
  21612. this.fields = null;
  21613. Util_Util.extend(this, options);
  21614. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferParameters";
  21615. }
  21616. /**
  21617. * @function SuperMap.GetFeaturesByBufferParameters.prototype.destroy
  21618. * @override
  21619. */
  21620. destroy() {
  21621. super.destroy();
  21622. var me = this;
  21623. me.bufferDistance = null;
  21624. me.attributeFilter = null;
  21625. if (me.fields) {
  21626. while (me.fields.length > 0) {
  21627. me.fields.pop();
  21628. }
  21629. me.fields = null;
  21630. }
  21631. if (me.geometry) {
  21632. me.geometry.destroy();
  21633. me.geometry = null;
  21634. }
  21635. }
  21636. /**
  21637. * @function SuperMap.GetFeaturesByBufferParameters.toJsonParameters
  21638. * @description 将 SuperMap.GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  21639. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  21640. * @returns {string} 转化后的 JSON 字符串。
  21641. */
  21642. static toJsonParameters(params) {
  21643. var filterParameter,
  21644. paramsBySql,
  21645. geometry;
  21646. geometry = ServerGeometry_ServerGeometry.fromGeometry(params.geometry);
  21647. paramsBySql = {
  21648. datasetNames: params.datasetNames,
  21649. getFeatureMode: "BUFFER",
  21650. bufferDistance: params.bufferDistance,
  21651. geometry: geometry
  21652. };
  21653. if (params.fields) {
  21654. filterParameter = new FilterParameter_FilterParameter();
  21655. filterParameter.name = params.datasetNames;
  21656. filterParameter.fields = params.fields;
  21657. paramsBySql.queryParameter = filterParameter;
  21658. }
  21659. if (params.attributeFilter) {
  21660. paramsBySql.attributeFilter = params.attributeFilter;
  21661. paramsBySql.getFeatureMode = "BUFFER_ATTRIBUTEFILTER";
  21662. }
  21663. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21664. paramsBySql.maxFeatures = params.maxFeatures;
  21665. }
  21666. if (params.targetEpsgCode) {
  21667. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  21668. }
  21669. if (!params.targetEpsgCode && params.targetPrj) {
  21670. paramsBySql.targetPrj = params.targetPrj;
  21671. }
  21672. return Util_Util.toJSON(paramsBySql);
  21673. }
  21674. }
  21675. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters_GetFeaturesByBufferParameters;
  21676. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  21677. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21678. * This program are made available under the terms of the Apache License, Version 2.0
  21679. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21680. /**
  21681. * @class SuperMap.GetFeaturesByBufferService
  21682. * @category iServer Data FeatureResults
  21683. * @classdesc 数据服务中数据集缓冲区查询服务类。
  21684. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  21685. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  21686. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21687. * @param {Object} options - 参数。
  21688. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21689. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21690. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21691. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21692. * @param {Object} [options.headers] - 请求头。
  21693. * @extends {SuperMap.GetFeaturesServiceBase}
  21694. * @example
  21695. * var myGetFeaturesByBufferService = new SuperMap.GetFeaturesByBufferService(url, {
  21696. * eventListeners: {
  21697. * "processCompleted": GetFeaturesCompleted,
  21698. * "processFailed": GetFeaturesError
  21699. * }
  21700. * });
  21701. * function GetFeaturesCompleted(object){//todo};
  21702. * function GetFeaturesError(object){//todo};
  21703. */
  21704. class GetFeaturesByBufferService_GetFeaturesByBufferService extends GetFeaturesServiceBase_GetFeaturesServiceBase {
  21705. constructor(url, options) {
  21706. super(url, options);
  21707. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  21708. }
  21709. /**
  21710. * @function SuperMap.GetFeaturesByBufferService.prototype.destroy
  21711. * @override
  21712. */
  21713. destroy() {
  21714. super.destroy();
  21715. }
  21716. /**
  21717. * @function SuperMap.GetFeaturesByBufferService.prototype.getJsonParameters
  21718. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  21719. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  21720. * @returns {Object} 转化后的 JSON 字符串。
  21721. */
  21722. getJsonParameters(params) {
  21723. if (!(params instanceof GetFeaturesByBufferParameters_GetFeaturesByBufferParameters)) {
  21724. return;
  21725. }
  21726. return SuperMap.GetFeaturesByBufferParameters.toJsonParameters(params);
  21727. }
  21728. }
  21729. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService_GetFeaturesByBufferService;
  21730. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  21731. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21732. * This program are made available under the terms of the Apache License, Version 2.0
  21733. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21734. /**
  21735. * @class SuperMap.GetFeaturesByGeometryParameters
  21736. * @category iServer Data FeatureResults
  21737. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  21738. * @param {Object} options - 参数。
  21739. * @param {Object} options.geometry - 用于查询的几何对象。
  21740. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21741. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  21742. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21743. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  21744. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21745. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21746. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21747. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21748. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21749. * @extends {SuperMap.GetFeaturesParametersBase}
  21750. */
  21751. class GetFeaturesByGeometryParameters_GetFeaturesByGeometryParameters extends GetFeaturesParametersBase_GetFeaturesParametersBase {
  21752. constructor(options) {
  21753. super(options);
  21754. /**
  21755. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.getFeatureMode
  21756. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  21757. */
  21758. this.getFeatureMode = "SPATIAL";
  21759. /**
  21760. * @member {Object} SuperMap.GetFeaturesByGeometryParameters.prototype.geometry
  21761. * @description 用于查询的几何对象。 </br>
  21762. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  21763. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  21764. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  21765. */
  21766. this.geometry = null;
  21767. /**
  21768. * @member {Array.<string>} SuperMap.GetFeaturesByGeometryParameters.prototype.fields
  21769. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21770. */
  21771. this.fields = null;
  21772. /**
  21773. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.attributeFilter
  21774. * @description 几何查询属性过滤条件。
  21775. */
  21776. this.attributeFilter = null;
  21777. /**
  21778. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  21779. * @description 空间查询模式常量。
  21780. */
  21781. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  21782. Util_Util.extend(this, options);
  21783. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryParameters";
  21784. }
  21785. /**
  21786. * @function SuperMap.GetFeaturesByGeometryParameters.prototype.destroy
  21787. * @description 释放资源,将引用资源的属性置空。
  21788. */
  21789. destroy() {
  21790. super.destroy();
  21791. var me = this;
  21792. if (me.geometry) {
  21793. me.geometry.destroy();
  21794. me.geometry = null;
  21795. }
  21796. if (me.fields) {
  21797. while (me.fields.length > 0) {
  21798. me.fields.pop();
  21799. }
  21800. me.fields = null;
  21801. }
  21802. me.attributeFilter = null;
  21803. me.spatialQueryMode = null;
  21804. me.getFeatureMode = null;
  21805. }
  21806. /**
  21807. * @function SuperMap.GetFeaturesByGeometryParameters.toJsonParameters
  21808. * @description 将 SuperMap.GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  21809. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询参数对象。
  21810. * @returns {string} 转化后的 JSON 字符串。
  21811. */
  21812. static toJsonParameters(params) {
  21813. var filterParameter,
  21814. geometry,
  21815. parasByGeometry;
  21816. geometry = ServerGeometry_ServerGeometry.fromGeometry(params.geometry);
  21817. parasByGeometry = {
  21818. datasetNames: params.datasetNames,
  21819. getFeatureMode: "SPATIAL",
  21820. geometry: geometry,
  21821. spatialQueryMode: params.spatialQueryMode
  21822. };
  21823. if (params.fields) {
  21824. filterParameter = new FilterParameter_FilterParameter();
  21825. filterParameter.name = params.datasetNames;
  21826. filterParameter.fields = params.fields;
  21827. parasByGeometry.queryParameter = filterParameter;
  21828. }
  21829. if (params.attributeFilter) {
  21830. parasByGeometry.attributeFilter = params.attributeFilter;
  21831. parasByGeometry.getFeatureMode = "SPATIAL_ATTRIBUTEFILTER";
  21832. }
  21833. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21834. parasByGeometry.maxFeatures = params.maxFeatures;
  21835. }
  21836. if (params.targetEpsgCode) {
  21837. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  21838. }
  21839. if (!params.targetEpsgCode && params.targetPrj) {
  21840. parasByGeometry.targetPrj = params.targetPrj;
  21841. }
  21842. return Util_Util.toJSON(parasByGeometry);
  21843. }
  21844. }
  21845. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters_GetFeaturesByGeometryParameters;
  21846. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  21847. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21848. * This program are made available under the terms of the Apache License, Version 2.0
  21849. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21850. /**
  21851. * @class SuperMap.GetFeaturesByGeometryService
  21852. * @category iServer Data FeatureResults
  21853. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  21854. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  21855. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  21856. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  21857. * @param {Object} options - 参数。</br>
  21858. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21859. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21860. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21861. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21862. * @param {Object} [options.headers] - 请求头。
  21863. * @extends {SuperMap.GetFeaturesServiceBase}
  21864. * @example
  21865. * var myService = new SuperMap.GetFeaturesByGeometryService(url, {
  21866. * eventListeners: {
  21867. * "processCompleted": getFeatureCompleted,
  21868. * "processFailed": getFeatureError
  21869. * }
  21870. * });
  21871. * function getFeatureCompleted(object){//todo};
  21872. * function getFeatureError(object){//todo}
  21873. */
  21874. class GetFeaturesByGeometryService_GetFeaturesByGeometryService extends GetFeaturesServiceBase_GetFeaturesServiceBase {
  21875. constructor(url, options) {
  21876. super(url, options);
  21877. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  21878. }
  21879. /**
  21880. * @function SuperMap.GetFeaturesByGeometryService.prototype.destroy
  21881. * @override
  21882. */
  21883. destroy() {
  21884. super.destroy();
  21885. }
  21886. /**
  21887. * @function SuperMap.GetFeaturesByGeometryService.prototype.getJsonParameters
  21888. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  21889. * @description 将查询参数转化为 JSON 字符串。
  21890. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  21891. * @returns {Object} 转化后的 JSON 字符串。
  21892. */
  21893. getJsonParameters(params) {
  21894. return GetFeaturesByGeometryParameters_GetFeaturesByGeometryParameters.toJsonParameters(params);
  21895. }
  21896. }
  21897. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService_GetFeaturesByGeometryService;
  21898. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  21899. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21900. * This program are made available under the terms of the Apache License, Version 2.0
  21901. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21902. /**
  21903. * @class SuperMap.GetFeaturesByIDsParameters
  21904. * @category iServer Data FeatureResults
  21905. * @classdesc ID查询参数类。
  21906. * @param {Object} options - 参数。
  21907. * @param {Array.<number>} options.IDs - 所要查询指定的元素 ID 信息。
  21908. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21909. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  21910. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21911. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21912. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21913. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21914. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21915. * @extends {SuperMap.GetFeaturesParametersBase}
  21916. */
  21917. class GetFeaturesByIDsParameters_GetFeaturesByIDsParameters extends GetFeaturesParametersBase_GetFeaturesParametersBase {
  21918. constructor(options) {
  21919. super(options);
  21920. /**
  21921. * @member {string} SuperMap.GetFeaturesByIDsParameters.prototype.getFeatureMode
  21922. * @description 数据集查询模式。
  21923. */
  21924. this.getFeatureMode = "ID";
  21925. /**
  21926. * @member {Array.<number>} SuperMap.GetFeaturesByIDsParameters.prototype.IDs
  21927. * @description 所要查询指定的元素 ID 信息。
  21928. */
  21929. this.IDs = null;
  21930. /**
  21931. * @member {Array.<string>} SuperMap.GetFeaturesByIDsParameters.prototype.fields
  21932. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21933. */
  21934. this.fields = null;
  21935. Util_Util.extend(this, options);
  21936. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsParameters";
  21937. }
  21938. /**
  21939. * @function SuperMap.GetFeaturesByIDsParameters.prototype.destroy
  21940. * @override
  21941. */
  21942. destroy() {
  21943. super.destroy();
  21944. var me = this;
  21945. me.IDs = null;
  21946. me.getFeatureMode = null;
  21947. if (me.fields) {
  21948. while (me.fields.length > 0) {
  21949. me.fields.pop();
  21950. }
  21951. me.fields = null;
  21952. }
  21953. }
  21954. /**
  21955. * @function SuperMap.GetFeaturesByIDsParameters.toJsonParameters
  21956. * @description 将 SuperMap.GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  21957. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID 查询参数对象。
  21958. * @returns {string} 转化后的 JSON 字符串。
  21959. */
  21960. static toJsonParameters(params) {
  21961. var parasByIDs, filterParameter;
  21962. parasByIDs = {
  21963. datasetNames: params.datasetNames,
  21964. getFeatureMode: "ID",
  21965. ids: params.IDs
  21966. };
  21967. if (params.fields) {
  21968. filterParameter = new FilterParameter_FilterParameter();
  21969. filterParameter.name = params.datasetNames;
  21970. filterParameter.fields = params.fields;
  21971. parasByIDs.queryParameter = filterParameter;
  21972. }
  21973. if (params.targetEpsgCode) {
  21974. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  21975. }
  21976. if (!params.targetEpsgCode && params.targetPrj) {
  21977. parasByIDs.targetPrj = params.targetPrj;
  21978. }
  21979. return Util_Util.toJSON(parasByIDs);
  21980. }
  21981. }
  21982. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters_GetFeaturesByIDsParameters;
  21983. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  21984. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  21985. * This program are made available under the terms of the Apache License, Version 2.0
  21986. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21987. /**
  21988. * @class SuperMap.GetFeaturesByIDsService
  21989. * @category iServer Data FeatureResults
  21990. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  21991. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  21992. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  21993. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21994. * @param {Object} options - 参数。</br>
  21995. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21996. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21997. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21998. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21999. * @param {Object} [options.headers] - 请求头。
  22000. * @extends {SuperMap.GetFeaturesServiceBase}
  22001. * @example
  22002. * var myGetFeaturesByIDsService = new SuperMap.GetFeaturesByIDsService(url, {
  22003. * eventListeners: {
  22004. * "processCompleted": getFeatureCompleted,
  22005. * "processFailed": getFeatureError
  22006. * }
  22007. * });
  22008. * function getFeatureCompleted(object){//todo};
  22009. * function getFeatureError(object){//todo}
  22010. */
  22011. class GetFeaturesByIDsService_GetFeaturesByIDsService extends GetFeaturesServiceBase_GetFeaturesServiceBase {
  22012. constructor(url, options) {
  22013. super(url, options);
  22014. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  22015. }
  22016. /**
  22017. * @function SuperMap.GetFeaturesByIDsService.prototype.destroy
  22018. * @override
  22019. */
  22020. destroy() {
  22021. super.destroy();
  22022. }
  22023. /**
  22024. * @function SuperMap.GetFeaturesByIDsService.prototype.getJsonParameters
  22025. * @description 将查询参数转化为 JSON 字符串。
  22026. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  22027. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID查询参数类。
  22028. * @returns {string} 转化后的 JSON 字符串。
  22029. */
  22030. getJsonParameters(params) {
  22031. return GetFeaturesByIDsParameters_GetFeaturesByIDsParameters.toJsonParameters(params);
  22032. }
  22033. }
  22034. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService_GetFeaturesByIDsService;
  22035. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  22036. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22037. * This program are made available under the terms of the Apache License, Version 2.0
  22038. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22039. /**
  22040. * @class SuperMap.GetFeaturesBySQLParameters
  22041. * @category iServer Data FeatureResults
  22042. * @classdesc 数据服务中数据集 SQL 查询参数类。
  22043. * @param {Object} options - 参数。
  22044. * @param {SuperMap.FilterParameter} options.queryParameter - 查询过滤条件参数。
  22045. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  22046. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22047. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22048. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22049. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22050. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22051. * @extends {SuperMap.GetFeaturesParametersBase}
  22052. */
  22053. class GetFeaturesBySQLParameters_GetFeaturesBySQLParameters extends GetFeaturesParametersBase_GetFeaturesParametersBase {
  22054. constructor(options) {
  22055. super(options);
  22056. /**
  22057. * @member {string} SuperMap.GetFeaturesBySQLParameters.prototype.getFeatureMode
  22058. * @description 数据集查询模式。
  22059. */
  22060. this.getFeatureMode = "SQL";
  22061. /**
  22062. * @member {SuperMap.FilterParameter} SuperMap.GetFeaturesBySQLParameters.prototype.queryParameter
  22063. * @description 查询过滤条件参数类。
  22064. */
  22065. this.queryParameter = null;
  22066. Util_Util.extend(this, options);
  22067. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLParameters";
  22068. }
  22069. /**
  22070. * @function SuperMap.GetFeaturesBySQLParameters.prototype.destroy
  22071. * @override
  22072. */
  22073. destroy() {
  22074. super.destroy();
  22075. var me = this;
  22076. me.getFeatureMode = null;
  22077. if (me.queryParameter) {
  22078. me.queryParameter.destroy();
  22079. me.queryParameter = null;
  22080. }
  22081. }
  22082. /**
  22083. * @function SuperMap.GetFeaturesBySQLParameters.prototype.toJsonParameters
  22084. * @description 将 SuperMap.GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  22085. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  22086. * @returns {string} 转化后的 JSON 字符串。
  22087. */
  22088. static toJsonParameters(params) {
  22089. var paramsBySql = {
  22090. datasetNames: params.datasetNames,
  22091. getFeatureMode: "SQL",
  22092. queryParameter: params.queryParameter
  22093. };
  22094. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22095. paramsBySql.maxFeatures = params.maxFeatures;
  22096. }
  22097. if (params.aggregations) {
  22098. paramsBySql.aggregations = params.aggregations;
  22099. }
  22100. if (params.targetEpsgCode) {
  22101. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  22102. }
  22103. if (!params.targetEpsgCode && params.targetPrj) {
  22104. paramsBySql.targetPrj = params.targetPrj;
  22105. }
  22106. return Util_Util.toJSON(paramsBySql);
  22107. }
  22108. }
  22109. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters_GetFeaturesBySQLParameters;
  22110. // CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  22111. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22112. * This program are made available under the terms of the Apache License, Version 2.0
  22113. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22114. /**
  22115. * @class SuperMap.GetFeaturesBySQLService
  22116. * @constructs SuperMap.GetFeaturesBySQLService
  22117. * @category iServer Data FeatureResults
  22118. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  22119. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  22120. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  22121. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22122. * @param {Object} options - 参数。</br>
  22123. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22124. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22125. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22126. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22127. * @param {Object} [options.headers] - 请求头。
  22128. * @extends {SuperMap.GetFeaturesServiceBase}
  22129. * @example
  22130. * var myGetFeaturesBySQLService = new SuperMap.GetFeaturesBySQLService(url, {
  22131. * eventListeners: {
  22132. * "processCompleted": GetFeaturesCompleted,
  22133. * "processFailed": GetFeaturesError
  22134. * }
  22135. * });
  22136. * function getFeaturesCompleted(object){//todo};
  22137. * function getFeaturesError(object){//todo};
  22138. *
  22139. */
  22140. class GetFeaturesBySQLService_GetFeaturesBySQLService extends GetFeaturesServiceBase_GetFeaturesServiceBase {
  22141. constructor(url, options) {
  22142. super(url, options);
  22143. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  22144. }
  22145. /**
  22146. * @function SuperMap.GetFeaturesBySQLService.prototype.destroy
  22147. * @override
  22148. */
  22149. destroy() {
  22150. super.destroy();
  22151. }
  22152. /*
  22153. * @function SuperMap.GetFeaturesBySQLService.prototype.getJsonParameters
  22154. * @description 将查询参数转化为 JSON 字符串。
  22155. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  22156. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  22157. * @returns {string} 转化后的 JSON 字符串。
  22158. */
  22159. getJsonParameters(params) {
  22160. return GetFeaturesBySQLParameters_GetFeaturesBySQLParameters.toJsonParameters(params);
  22161. }
  22162. }
  22163. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService_GetFeaturesBySQLService;
  22164. // CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  22165. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22166. * This program are made available under the terms of the Apache License, Version 2.0
  22167. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22168. /**
  22169. * @class SuperMap.GetFieldsService
  22170. * @category iServer Data Field
  22171. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  22172. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  22173. * @param {Object} options - 参数。</br>
  22174. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22175. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22176. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22177. * @param {string}options.datasource - 要查询的数据集所在的数据源名称。</br>
  22178. * @param {string}options.dataset - 要查询的数据集名称。</br>
  22179. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22180. * @param {Object} [options.headers] - 请求头。
  22181. * @extends {SuperMap.CommonServiceBase}
  22182. * @example
  22183. * var myService = new SuperMap.GetFieldsService(url, {eventListeners: {
  22184. * "processCompleted": getFieldsCompleted,
  22185. * "processFailed": getFieldsError
  22186. * },
  22187. * datasource: "World",
  22188. * dataset: "Countries"
  22189. * };
  22190. *
  22191. */
  22192. class GetFieldsService_GetFieldsService extends CommonServiceBase_CommonServiceBase {
  22193. constructor(url, options) {
  22194. super(url, options);
  22195. /**
  22196. * @member {string} SuperMap.GetFieldsService.prototype.datasource
  22197. * @description 要查询的数据集所在的数据源名称。
  22198. */
  22199. this.datasource = null;
  22200. /**
  22201. * @member {string} SuperMap.GetFieldsService.prototype.dataset
  22202. * @description 要查询的数据集名称。
  22203. */
  22204. this.dataset = null;
  22205. if (options) {
  22206. Util_Util.extend(this, options);
  22207. }
  22208. this.CLASS_NAME = "SuperMap.GetFieldsService";
  22209. }
  22210. /**
  22211. * @function SuperMap.GetFieldsService.prototype.destroy
  22212. * @override
  22213. */
  22214. destroy() {
  22215. super.destroy();
  22216. var me = this;
  22217. me.datasource = null;
  22218. me.dataset = null;
  22219. }
  22220. /**
  22221. * @function SuperMap.GetFieldsService.prototype.processAsync
  22222. * @description 执行服务,查询指定数据集的字段信息。
  22223. */
  22224. processAsync() {
  22225. var me = this;
  22226. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  22227. me.request({
  22228. method: "GET",
  22229. data: null,
  22230. scope: me,
  22231. success: me.serviceProcessCompleted,
  22232. failure: me.serviceProcessFailed
  22233. });
  22234. }
  22235. }
  22236. SuperMap.GetFieldsService = GetFieldsService_GetFieldsService;
  22237. // CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  22238. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22239. * This program are made available under the terms of the Apache License, Version 2.0
  22240. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22241. /**
  22242. * @class SuperMap.GetGridCellInfosParameters
  22243. * @category iServer Data Grid
  22244. * @classdesc 数据服务栅格查询参数类。
  22245. * @param {Object} options - 参数。
  22246. * @param {string} options.datasetName - 数据集名称。
  22247. * @param {string} options.dataSourceName - 数据源名称。
  22248. * @param {number} options.X - 要查询的地理位置 X 轴。
  22249. * @param {number} options.Y - 要查询的地理位置 Y 轴。
  22250. */
  22251. class GetGridCellInfosParameters_GetGridCellInfosParameters {
  22252. constructor(options) {
  22253. /**
  22254. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.datasetName
  22255. * @description 数据集名称。
  22256. */
  22257. this.datasetName = null;
  22258. /**
  22259. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.dataSourceName
  22260. * @description 数据源名称。
  22261. */
  22262. this.dataSourceName = null;
  22263. /**
  22264. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.X
  22265. * @description 要查询的地理位置 X 轴。
  22266. */
  22267. this.X = null;
  22268. /**
  22269. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.Y
  22270. * @description 要查询的地理位置 Y 轴。
  22271. */
  22272. this.Y = null;
  22273. Util_Util.extend(this, options);
  22274. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  22275. }
  22276. /**
  22277. * @function SuperMap.GetGridCellInfosParameters.prototype.destroy
  22278. * @description 释放资源,将引用的资源属性置空。
  22279. */
  22280. destroy() {
  22281. var me = this;
  22282. me.datasetName = null;
  22283. me.dataSourceName = null;
  22284. me.X = null;
  22285. me.Y = null;
  22286. }
  22287. }
  22288. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters_GetGridCellInfosParameters;
  22289. // CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  22290. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22291. * This program are made available under the terms of the Apache License, Version 2.0
  22292. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22293. /**
  22294. * @class SuperMap.GetGridCellInfosService
  22295. * @category iServer Data Grid
  22296. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  22297. * @param {string} url - 查询服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  22298. * @param {Object} options - 参数。</br>
  22299. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  22300. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22301. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22302. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22303. * @param {Object} [options.headers] - 请求头。
  22304. * @extends {SuperMap.CommonServiceBase}
  22305. * @example
  22306. * var myService = new SuperMap.GetGridCellInfosService(url, {eventListeners: {
  22307. * "processCompleted": queryCompleted,
  22308. * "processFailed": queryError
  22309. * }
  22310. * });
  22311. *
  22312. */
  22313. class GetGridCellInfosService_GetGridCellInfosService extends CommonServiceBase_CommonServiceBase {
  22314. constructor(url, options) {
  22315. super(url, options);
  22316. /**
  22317. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetName
  22318. * @description 数据集名称。
  22319. */
  22320. this.datasetName = null;
  22321. /**
  22322. * @member {string} SuperMap.GetGridCellInfosService.prototype.dataSourceName
  22323. * @description 数据源名称。
  22324. */
  22325. this.dataSourceName = null;
  22326. /**
  22327. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetType
  22328. * @description 数据集类型。
  22329. */
  22330. this.datasetType = null;
  22331. /**
  22332. * @member {number} SuperMap.GetGridCellInfosService.prototype.X
  22333. * @description 要查询的地理位置X轴
  22334. */
  22335. this.X = null;
  22336. /**
  22337. * @member {number} SuperMap.GetGridCellInfosService.prototype.Y
  22338. * @description 要查询的地理位置Y轴
  22339. */
  22340. this.Y = null;
  22341. if (options) {
  22342. Util_Util.extend(this, options);
  22343. }
  22344. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  22345. }
  22346. /**
  22347. * @function SuperMap.GetGridCellInfosService.prototype.destroy
  22348. * @override
  22349. */
  22350. destroy() {
  22351. super.destroy();
  22352. var me = this;
  22353. me.X = null;
  22354. me.Y = null;
  22355. me.datasetName = null;
  22356. me.dataSourceName = null;
  22357. me.datasetType = null;
  22358. }
  22359. /**
  22360. * @function SuperMap.GetGridCellInfosService.prototype.processAsync
  22361. * @description 执行服务,查询数据集信息。
  22362. * @param {SuperMap.GetGridCellInfosParameters} params - 查询参数。
  22363. */
  22364. processAsync(params) {
  22365. if (!(params instanceof GetGridCellInfosParameters_GetGridCellInfosParameters)) {
  22366. return;
  22367. }
  22368. Util_Util.extend(this, params);
  22369. var me = this;
  22370. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  22371. me.queryRequest(me.getDatasetInfoCompleted, me.getDatasetInfoFailed);
  22372. }
  22373. /**
  22374. * @function SuperMap.GetGridCellInfosService.prototype.queryRequest
  22375. * @description 执行服务,查询。
  22376. * @callback {function} successFun - 成功后执行的函数。
  22377. * @callback {function} failedFunc - 失败后执行的函数。
  22378. */
  22379. queryRequest(successFun, failedFunc) {
  22380. var me = this;
  22381. me.request({
  22382. method: "GET",
  22383. data: null,
  22384. scope: me,
  22385. success: successFun,
  22386. failure: failedFunc
  22387. });
  22388. }
  22389. /**
  22390. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoCompleted
  22391. * @description 数据集查询完成,执行此方法。
  22392. * @param {Object} result - 服务器返回的结果对象。
  22393. */
  22394. getDatasetInfoCompleted(result) {
  22395. var me = this;
  22396. result = Util_Util.transformResult(result);
  22397. me.datasetType = result.datasetInfo.type;
  22398. me.queryGridInfos();
  22399. }
  22400. /**
  22401. * @function SuperMap.GetGridCellInfosService.prototype.queryGridInfos
  22402. * @description 执行服务,查询数据集栅格信息信息。
  22403. */
  22404. queryGridInfos() {
  22405. var me = this;
  22406. me.url = Util_Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  22407. if (me.X != null && me.Y != null) {
  22408. me.url = Util_Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  22409. }
  22410. me.queryRequest(me.serviceProcessCompleted, me.serviceProcessFailed);
  22411. }
  22412. /**
  22413. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoFailed
  22414. * @description 数据集查询失败,执行此方法。
  22415. * @param {Object} result - 服务器返回的结果对象。
  22416. */
  22417. getDatasetInfoFailed(result) {
  22418. var me = this;
  22419. me.serviceProcessFailed(result);
  22420. }
  22421. }
  22422. SuperMap.GetGridCellInfosService = GetGridCellInfosService_GetGridCellInfosService;
  22423. // CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  22424. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22425. * This program are made available under the terms of the Apache License, Version 2.0
  22426. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22427. /**
  22428. * @class SuperMap.ThemeMemoryData
  22429. * @category iServer Map Theme
  22430. * @classdesc 专题图内存数据类。
  22431. * @param {Array} srcData - 原始值数组。
  22432. * @param {Array} targetData - 外部值数组。
  22433. */
  22434. class ThemeMemoryData {
  22435. constructor(srcData, targetData) {
  22436. /**
  22437. * @member {Array} SuperMap.ThemeMemoryData.prototype.srcData
  22438. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  22439. */
  22440. this.srcData = srcData;
  22441. /**
  22442. * @member {Array} SuperMap.ThemeMemoryData.prototype.targetData
  22443. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  22444. */
  22445. this.targetData = targetData;
  22446. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  22447. }
  22448. /**
  22449. * @function SuperMap.ThemeMemoryData.prototype.destroy
  22450. * @description 释放资源,将引用资源的属性置空。
  22451. */
  22452. destroy() {
  22453. var me = this;
  22454. me.srcData = null;
  22455. me.targetData = null;
  22456. }
  22457. /**
  22458. * @function SuperMap.ThemeMemoryData.prototype.toJSON
  22459. * @description 将 SuperMap.ThemeMemoryData 对象转化为 JSON 字符串。
  22460. * @returns {string} 返回转换后的 JSON 字符串。
  22461. */
  22462. toJSON() {
  22463. if (this.srcData && this.targetData) {
  22464. var memoryDataStr = "";
  22465. var count = Math.min(this.srcData.length, this.targetData.length);
  22466. for (var i = 0; i < count; i++) {
  22467. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  22468. }
  22469. //去除多余的逗号
  22470. if (i > 0) {
  22471. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  22472. }
  22473. return "{" + memoryDataStr + "}";
  22474. } else {
  22475. return null;
  22476. }
  22477. }
  22478. }
  22479. SuperMap.ThemeMemoryData = ThemeMemoryData;
  22480. // CONCATENATED MODULE: ./src/common/iServer/Theme.js
  22481. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22482. * This program are made available under the terms of the Apache License, Version 2.0
  22483. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22484. /**
  22485. * @class SuperMap.Theme
  22486. * @category iServer Map Theme
  22487. * @classdesc 专题图基类。
  22488. * @param {string} type - 专题图类型。
  22489. * @param {Object} options - 参数。
  22490. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  22491. */
  22492. class Theme_Theme {
  22493. constructor(type, options) {
  22494. if (!type) {
  22495. return this;
  22496. }
  22497. /**
  22498. * @member {SuperMap.ThemeMemoryData} SuperMap.Theme.prototype.memoryData
  22499. * @description 专题图内存数据。<br>
  22500. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  22501. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  22502. */
  22503. this.memoryData = null;
  22504. /**
  22505. * @member {string} SuperMap.Theme.prototype.type
  22506. * @description 专题图类型。
  22507. */
  22508. this.type = type;
  22509. if (options) {
  22510. Util_Util.extend(this, options);
  22511. }
  22512. this.CLASS_NAME = "SuperMap.Theme";
  22513. }
  22514. /**
  22515. * @function SuperMap.Theme.prototype.destroy
  22516. * @description 释放资源,将引用资源的属性置空。
  22517. */
  22518. destroy() {
  22519. var me = this;
  22520. if (me.memoryData) {
  22521. me.memoryData.destroy();
  22522. me.memoryData = null;
  22523. }
  22524. me.type = null;
  22525. }
  22526. /**
  22527. * @function SuperMap.Theme.prototype.toServerJSONObject
  22528. * @description 转换成对应的 JSON 格式对象。
  22529. * @returns {Object} 对应的 JSON 格式对象。
  22530. */
  22531. toServerJSONObject() {
  22532. //return 子类实现
  22533. return;
  22534. }
  22535. }
  22536. SuperMap.Theme = Theme_Theme;
  22537. // CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  22538. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22539. * This program are made available under the terms of the Apache License, Version 2.0
  22540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22541. /**
  22542. * @class SuperMap.ServerTextStyle
  22543. * @category iServer Map Theme
  22544. * @classdesc 服务端文本风格类。
  22545. * @description 该类用于定义文本风格的相关属性。
  22546. * @param {Object} options - 参数。
  22547. * @param {SuperMap.TextAlignment} [options.align=SuperMap.TextAlignment.BASELINECENTER] - 文本的对齐方式。
  22548. * @param {SuperMap.ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  22549. * @param {SuperMap.ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  22550. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  22551. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  22552. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  22553. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  22554. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  22555. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  22556. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  22557. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  22558. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  22559. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  22560. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  22561. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  22562. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  22563. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  22564. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  22565. */
  22566. class ServerTextStyle_ServerTextStyle {
  22567. constructor(options) {
  22568. /**
  22569. * @member {SuperMap.TextAlignment} [SuperMap.ServerTextStyle.prototype.align= SuperMap.TextAlignment.BASELINECENTER]
  22570. * @description 文本的对齐方式。
  22571. */
  22572. this.align = TextAlignment.BASELINECENTER;
  22573. /**
  22574. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.backColor=(255, 255, 255)]
  22575. * @description 文本的背景色。
  22576. */
  22577. this.backColor = new ServerColor(255, 255, 255);
  22578. /**
  22579. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  22580. * @description 文本的前景色。
  22581. */
  22582. this.foreColor = new ServerColor(0, 0, 0);
  22583. /**
  22584. * @member {boolean} [SuperMap.ServerTextStyle.prototype.backOpaque=false]
  22585. * @description 文本背景是否不透明。true 表示文本背景不透明。
  22586. */
  22587. this.backOpaque = false;
  22588. /**
  22589. * @member {boolean} [SuperMap.ServerTextStyle.prototype.sizeFixed=true]
  22590. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  22591. */
  22592. this.sizeFixed = true;
  22593. /**
  22594. * @member {number} [SuperMap.ServerTextStyle.prototype.fontHeight=6]
  22595. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  22596. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  22597. */
  22598. this.fontHeight = 6;
  22599. /**
  22600. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWidth=0]
  22601. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  22602. */
  22603. this.fontWidth = 0;
  22604. /**
  22605. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWeight=400]
  22606. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  22607. */
  22608. this.fontWeight = 400;
  22609. /**
  22610. * @member {string} [SuperMap.ServerTextStyle.prototype.fontName="Times New Roman"]
  22611. * @description 文本字体的名称。
  22612. */
  22613. this.fontName = "Times New Roman";
  22614. /**
  22615. * @member {boolean} [SuperMap.ServerTextStyle.prototype.bold=false]
  22616. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  22617. */
  22618. this.bold = false;
  22619. /**
  22620. * @member {boolean} [SuperMap.ServerTextStyle.prototype.italic=false]
  22621. * @description 文本是否采用斜体。true 表示采用斜体。
  22622. */
  22623. this.italic = false;
  22624. /**
  22625. * @member {number} [SuperMap.ServerTextStyle.prototype.italicAngle=0]
  22626. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  22627. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  22628. */
  22629. this.italicAngle = 0;
  22630. /**
  22631. * @member {boolean} [SuperMap.ServerTextStyle.prototype.shadow=false]
  22632. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  22633. */
  22634. this.shadow = false;
  22635. /**
  22636. * @member {boolean} [SuperMap.ServerTextStyle.prototype.strikeout=false]
  22637. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  22638. */
  22639. this.strikeout = false;
  22640. /**
  22641. * @member {boolean} [SuperMap.ServerTextStyle.prototype.outline=false]
  22642. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  22643. */
  22644. this.outline = false;
  22645. /**
  22646. * @member {number} [SuperMap.ServerTextStyle.prototype.opaqueRate=0]
  22647. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  22648. */
  22649. this.opaqueRate = 0;
  22650. /**
  22651. * @member {boolean} [SuperMap.ServerTextStyle.prototype.underline=false]
  22652. * @description 文本字体是否加下划线。true 表示加下划线。
  22653. */
  22654. this.underline = false;
  22655. /**
  22656. * @member {number} [SuperMap.ServerTextStyle.prototype.rotation=0.0]
  22657. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  22658. */
  22659. this.rotation = 0.0;
  22660. if (options) {
  22661. Util_Util.extend(this, options);
  22662. }
  22663. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  22664. }
  22665. /**
  22666. * @function SuperMap.ServerTextStyle.prototype.destroy
  22667. * @description 释放资源,将引用资源的属性置空。
  22668. */
  22669. destroy() {
  22670. var me = this;
  22671. me.align = null;
  22672. if (me.backColor) {
  22673. me.backColor.destroy();
  22674. me.backColor = null;
  22675. }
  22676. if (me.foreColor) {
  22677. me.foreColor.destroy();
  22678. me.foreColor = null;
  22679. }
  22680. me.backOpaque = null;
  22681. me.sizeFixed = null;
  22682. me.fontHeight = null;
  22683. me.fontWidth = null;
  22684. me.fontWeight = null;
  22685. me.fontName = null;
  22686. me.bold = null;
  22687. me.italic = null;
  22688. me.italicAngle = null;
  22689. me.shadow = null;
  22690. me.strikeout = null;
  22691. me.outline = null;
  22692. me.opaqueRate = null;
  22693. me.underline = null;
  22694. me.rotation = null;
  22695. }
  22696. /**
  22697. * @function SuperMap.ServerTextStyle.fromObj
  22698. * @description 从传入对象获服务端文本风格类。
  22699. * @param {Object} obj - 传入对象
  22700. * @returns {SuperMap.ServerTextStyle} 返回服务端文本风格对象
  22701. */
  22702. static fromObj(obj) {
  22703. var res = new ServerTextStyle_ServerTextStyle(obj);
  22704. Util_Util.copy(res, obj);
  22705. res.backColor = ServerColor.fromJson(obj.backColor);
  22706. res.foreColor = ServerColor.fromJson(obj.foreColor);
  22707. return res;
  22708. }
  22709. }
  22710. SuperMap.ServerTextStyle = ServerTextStyle_ServerTextStyle;
  22711. // CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  22712. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22713. * This program are made available under the terms of the Apache License, Version 2.0
  22714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22715. /**
  22716. * @class SuperMap.ThemeLabelItem
  22717. * @category iServer Map Theme
  22718. * @classdesc 分段标签专题图的子项。
  22719. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,分段标签专题图允许用户通过 rangeExpression
  22720. * 字段指定用于分段的数值型字段,同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  22721. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  22722. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 SuperMap.ThemeLabelItem[0].start=0,
  22723. * SuperMap.ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  22724. * @param {Object} options - 参数。
  22725. * @param {string} [options.caption] - 专题图子项的名称。
  22726. * @param {number} [options.end=0] - 标签专题图子项的终止值。
  22727. * @param {number} [options.start=0] - 标签专题图子项的分段起始值。
  22728. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  22729. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  22730. */
  22731. class ThemeLabelItem_ThemeLabelItem {
  22732. constructor(options) {
  22733. /**
  22734. * @member {string} [SuperMap.ThemeLabelItem.prototype.caption]
  22735. * @description 标签专题子项的标题。
  22736. */
  22737. this.caption = null;
  22738. /**
  22739. * @member {number} [SuperMap.ThemeLabelItem.prototype.end=0]
  22740. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  22741. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  22742. */
  22743. this.end = 0;
  22744. /**
  22745. * @member {number} [SuperMap.ThemeLabelItem.prototype.start=0]
  22746. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  22747. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  22748. */
  22749. this.start = 0;
  22750. /**
  22751. * @member {boolean} [SuperMap.ThemeLabelItem.prototype.visible=true]
  22752. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  22753. */
  22754. this.visible = true;
  22755. /**
  22756. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelItem.prototype.style
  22757. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  22758. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  22759. */
  22760. this.style = new ServerTextStyle_ServerTextStyle();
  22761. if (options) {
  22762. Util_Util.extend(this, options);
  22763. }
  22764. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  22765. }
  22766. /**
  22767. * @function SuperMap.ThemeLabelItem.prototype.destroy
  22768. * @description 释放资源,将引用资源的属性置空。
  22769. */
  22770. destroy() {
  22771. var me = this;
  22772. me.caption = null;
  22773. me.end = null;
  22774. me.start = null;
  22775. if (me.style) {
  22776. me.style.destroy();
  22777. me.style = null;
  22778. }
  22779. me.visible = null;
  22780. }
  22781. /**
  22782. * @function SuperMap.ThemeLabelItem.fromObj
  22783. * @description 从传入对象获取分段标签专题图的子项类。
  22784. * @param {Object} obj - 传入对象。
  22785. * @returns {SuperMap.ThemeLabelItem} ThemeLabelItem 对象。
  22786. */
  22787. static fromObj(obj) {
  22788. if (!obj) {
  22789. return;
  22790. }
  22791. var t = new ThemeLabelItem_ThemeLabelItem();
  22792. Util_Util.copy(t, obj);
  22793. return t;
  22794. }
  22795. }
  22796. SuperMap.ThemeLabelItem = ThemeLabelItem_ThemeLabelItem;
  22797. // CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  22798. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22799. * This program are made available under the terms of the Apache License, Version 2.0
  22800. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22801. /**
  22802. * @class SuperMap.ThemeUniqueItem
  22803. * @category iServer Map Theme
  22804. * @classdesc 单值专题图子项类。
  22805. * @description 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表
  22806. * 省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  22807. * @param {Object} options - 参数。
  22808. * @param {string} options.unique - 单值专题图子项的单值。
  22809. * @param {string} [options.caption] - 单值专题图子项的标题。
  22810. * @param {SuperMap.ServerStyle} [options.style] - 单值专题图子项的风格。
  22811. * @param {boolean} [options.visible=true] - 单值专题图子项是否可见。
  22812. */
  22813. class ThemeUniqueItem_ThemeUniqueItem {
  22814. constructor(options) {
  22815. /**
  22816. * @member {string} [SuperMap.ThemeUniqueItem.prototype.caption]
  22817. * @description 单值专题图子项的标题。
  22818. */
  22819. this.caption = null;
  22820. /**
  22821. * @member {SuperMap.ServerStyle} [SuperMap.ThemeUniqueItem.prototype.style]
  22822. * @description 单值专题图子项的显示风格。
  22823. */
  22824. this.style = new ServerStyle_ServerStyle();
  22825. /**
  22826. * @member {string} SuperMap.ThemeUniqueItem.prototype.unique
  22827. * @description 单值专题图子项的值,可以为数字、字符串等。
  22828. */
  22829. this.unique = null;
  22830. /**
  22831. * @member {boolean} [SuperMap.ThemeUniqueItem.prototype.visible=true]
  22832. * @description 单值专题图子项的可见性。
  22833. */
  22834. this.visible = true;
  22835. if (options) {
  22836. Util_Util.extend(this, options);
  22837. }
  22838. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  22839. }
  22840. /**
  22841. * @function SuperMap.ThemeUniqueItem.prototype.destroy
  22842. * @description 释放资源,将引用资源的属性置空。
  22843. */
  22844. destroy() {
  22845. var me = this;
  22846. me.caption = null;
  22847. me.unique = null;
  22848. if (me.style) {
  22849. me.style.destroy();
  22850. me.style = null;
  22851. }
  22852. me.visible = null;
  22853. }
  22854. /**
  22855. * @function SuperMap.ThemeUniqueItem.prototype.toServerJSONObject
  22856. * @description 转换成对应的 JSON 格式对象。
  22857. * @returns {Object} 对应的 JSON 格式对象。
  22858. */
  22859. toServerJSONObject() {
  22860. var obj = {};
  22861. obj = Util_Util.copyAttributes(obj, this);
  22862. if (obj.style) {
  22863. if (obj.style.toServerJSONObject) {
  22864. obj.style = obj.style.toServerJSONObject();
  22865. }
  22866. }
  22867. return obj;
  22868. }
  22869. /**
  22870. * @function SuperMap.ThemeUniqueItem.fromObj
  22871. * @description 从传入对象获取单值专题图子项类。
  22872. * @param {Object} obj - 传入对象。
  22873. * @returns {SuperMap.ThemeUniqueItem} ThemeUniqueItem 对象。
  22874. */
  22875. static fromObj(obj) {
  22876. var res = new ThemeUniqueItem_ThemeUniqueItem();
  22877. Util_Util.copy(res, obj);
  22878. res.style = ServerStyle_ServerStyle.fromJson(obj.style);
  22879. return res;
  22880. }
  22881. }
  22882. SuperMap.ThemeUniqueItem = ThemeUniqueItem_ThemeUniqueItem;
  22883. // CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  22884. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22885. * This program are made available under the terms of the Apache License, Version 2.0
  22886. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22887. /**
  22888. * @class SuperMap.ThemeFlow
  22889. * @category iServer Map Theme
  22890. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  22891. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  22892. * @param {Object} options - 参数。
  22893. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  22894. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  22895. * @param {SuperMap.ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  22896. */
  22897. class ThemeFlow_ThemeFlow {
  22898. constructor(options) {
  22899. /**
  22900. * @member {boolean} [SuperMap.ThemeFlow.prototype.flowEnabled=false]
  22901. * @description 是否流动显示标签或符号。<br>
  22902. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  22903. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  22904. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  22905. */
  22906. this.flowEnabled = false;
  22907. /**
  22908. * @member {boolean} [SuperMap.ThemeFlow.prototype.leaderLineDisplayed=false]
  22909. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  22910. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  22911. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  22912. */
  22913. this.leaderLineDisplayed = false;
  22914. /**
  22915. * @member {SuperMap.ServerStyle} SuperMap.ThemeFlow.prototype.leaderLineStyle
  22916. * @description 标签或符号与其标注对象之间牵引线的风格。
  22917. */
  22918. this.leaderLineStyle = new ServerStyle_ServerStyle();
  22919. if (options) {
  22920. Util_Util.extend(this, options);
  22921. }
  22922. this.CLASS_NAME = "SuperMap.ThemeFlow";
  22923. }
  22924. /**
  22925. * @function SuperMap.ThemeFlow.prototype.destroy
  22926. * @description 释放资源,将引用资源的属性置空。
  22927. */
  22928. destroy() {
  22929. var me = this;
  22930. me.flowEnabled = null;
  22931. me.leaderLineDisplayed = null;
  22932. if (me.leaderLineStyle) {
  22933. me.leaderLineStyle.destroy();
  22934. me.leaderLineStyle = null;
  22935. }
  22936. }
  22937. /**
  22938. * @function SuperMap.ThemeFlow.fromObj
  22939. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  22940. * @param {Object} obj - 传入对象。
  22941. * @returns {SuperMap.ThemeFlow} ThemeFlow 对象。
  22942. */
  22943. static fromObj(obj) {
  22944. if (!obj) {
  22945. return;
  22946. }
  22947. var res = new ThemeFlow_ThemeFlow();
  22948. Util_Util.copy(res, obj);
  22949. res.leaderLineStyle = ServerStyle_ServerStyle.fromJson(obj.leaderLineStyle);
  22950. return res;
  22951. }
  22952. }
  22953. SuperMap.ThemeFlow = ThemeFlow_ThemeFlow;
  22954. // CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  22955. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  22956. * This program are made available under the terms of the Apache License, Version 2.0
  22957. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22958. /**
  22959. * @class SuperMap.ThemeOffset
  22960. * @category iServer Map Theme
  22961. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  22962. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  22963. * @param {Object} options - 参数。
  22964. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  22965. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  22966. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  22967. */
  22968. class ThemeOffset_ThemeOffset {
  22969. constructor(options) {
  22970. /**
  22971. * @member {boolean} [SuperMap.ThemeOffset.prototype.offsetFixed=false]
  22972. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,则文本或符号的偏移量不随地图的缩放而变化。
  22973. */
  22974. this.offsetFixed = false;
  22975. /**
  22976. * @member {string} [SuperMap.ThemeOffset.prototype.offsetX=0.0]
  22977. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  22978. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  22979. */
  22980. this.offsetX = "0.0";
  22981. /**
  22982. * @member {string} [SuperMap.ThemeOffset.prototype.offsetY=0.0]
  22983. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  22984. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  22985. */
  22986. this.offsetY = "0.0";
  22987. if (options) {
  22988. Util_Util.extend(this, options);
  22989. }
  22990. this.CLASS_NAME = "SuperMap.ThemeOffset";
  22991. }
  22992. /**
  22993. * @function SuperMap.ThemeOffset.prototype.destroy
  22994. * @description 释放资源,将引用资源的属性置空。
  22995. */
  22996. destroy() {
  22997. var me = this;
  22998. me.offsetFixed = null;
  22999. me.offsetX = null;
  23000. me.offsetY = null;
  23001. }
  23002. /**
  23003. * @function SuperMap.ThemeOffset.fromObj
  23004. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  23005. * @param {Object} obj - 传入对象。
  23006. * @returns {SuperMap.ThemeOffset} ThemeOffset 对象。
  23007. */
  23008. static fromObj(obj) {
  23009. if (!obj) {
  23010. return;
  23011. }
  23012. var res = new ThemeOffset_ThemeOffset();
  23013. Util_Util.copy(res, obj);
  23014. return res;
  23015. }
  23016. }
  23017. SuperMap.ThemeOffset = ThemeOffset_ThemeOffset;
  23018. // CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  23019. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23020. * This program are made available under the terms of the Apache License, Version 2.0
  23021. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23022. /**
  23023. * @class SuperMap.LabelMixedTextStyle
  23024. * @category iServer Map Theme
  23025. * @classdesc 标签文本复合风格类
  23026. * @description 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段。<br>
  23027. * 1. 利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  23028. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  23029. * 2. 利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  23030. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  23031. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  23032. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  23033. * @param {Object} options - 参数。
  23034. * @param {SuperMap.ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  23035. * @param {string} [options.separator] - 文本的分隔符。
  23036. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  23037. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  23038. * @param {Array.<SuperMap.ServerTextStyle>} [options.styles] - 文本样式集合。
  23039. */
  23040. class LabelMixedTextStyle_LabelMixedTextStyle {
  23041. constructor(options) {
  23042. /**
  23043. * @member {SuperMap.ServerTextStyle} SuperMap.LabelMixedTextStyle.prototype.defaultStyle
  23044. * @description 默认的文本复合风格,即 SuperMap.ServerTextStyle 各字段的默认值。
  23045. */
  23046. this.defaultStyle = null;
  23047. /**
  23048. * @member {string} SuperMap.LabelMixedTextStyle.prototype.separator
  23049. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  23050. * 比如文本 “5_109” 被 “_” 隔符为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  23051. * 在显示时,“5” 和分隔符 “_” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  23052. */
  23053. this.separator = null;
  23054. /**
  23055. * @member {boolean} [SuperMap.LabelMixedTextStyle.prototype.separatorEnabled=false]
  23056. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  23057. * 分段后,同一分段内的字符具有相同的显示风格。
  23058. */
  23059. this.separatorEnabled = false;
  23060. /**
  23061. * @member {Array.<number>} SuperMap.LabelMixedTextStyle.prototype.splitIndexes
  23062. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  23063. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  23064. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  23065. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  23066. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  23067. */
  23068. this.splitIndexes = null;
  23069. /**
  23070. * @member {Array.<SuperMap.ServerTextStyle>} SuperMap.LabelMixedTextStyle.prototype.styles
  23071. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  23072. * 如果有分段没有风格对应则使用 defaultStyle。
  23073. */
  23074. this.styles = new ServerTextStyle_ServerTextStyle();
  23075. if (options) {
  23076. Util_Util.extend(this, options);
  23077. }
  23078. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  23079. }
  23080. /**
  23081. * @function SuperMap.LabelMixedTextStyle.prototype.destroy
  23082. * @description 释放资源,将引用资源的属性置空。
  23083. */
  23084. destroy() {
  23085. var me = this;
  23086. if (me.defaultStyle) {
  23087. me.defaultStyle.destroy();
  23088. me.defaultStyle = null;
  23089. }
  23090. me.separator = null;
  23091. me.separatorEnabled = null;
  23092. if (me.splitIndexes) {
  23093. me.splitIndexes = null;
  23094. }
  23095. if (me.styles) {
  23096. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  23097. styles[i].destroy();
  23098. }
  23099. me.styles = null;
  23100. }
  23101. }
  23102. /**
  23103. * @function SuperMap.LabelMixedTextStyle.fromObj
  23104. * @description 从传入对象获取标签文本复合风格类。
  23105. * @param {Object} obj - 传入对象。
  23106. * @returns {SuperMap.LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  23107. */
  23108. static fromObj(obj) {
  23109. if (!obj) {
  23110. return;
  23111. }
  23112. var res = new LabelMixedTextStyle_LabelMixedTextStyle();
  23113. var stys = obj.styles;
  23114. Util_Util.copy(res, obj);
  23115. res.defaultStyle = new ServerTextStyle_ServerTextStyle(obj.defaultStyle);
  23116. if (stys) {
  23117. res.styles = [];
  23118. for (var i = 0, len = stys.length; i < len; i++) {
  23119. res.styles.push(new ServerTextStyle_ServerTextStyle(stys[i]));
  23120. }
  23121. }
  23122. return res;
  23123. }
  23124. }
  23125. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle_LabelMixedTextStyle;
  23126. // CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  23127. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23128. * This program are made available under the terms of the Apache License, Version 2.0
  23129. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23130. /**
  23131. * @class SuperMap.ThemeLabelText
  23132. * @category iServer Map Theme
  23133. * @classdesc 标签中文本风格类。
  23134. * 通过该类可以设置标签中的文本字体大小和显示风格。
  23135. * @param {Object} options - 参数。
  23136. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  23137. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  23138. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  23139. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  23140. * @param {SuperMap.ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  23141. * @param {SuperMap.LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  23142. */
  23143. class ThemeLabelText_ThemeLabelText {
  23144. constructor(options) {
  23145. /**
  23146. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextHeight=0]
  23147. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23148. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为 0.1 毫米。
  23149. */
  23150. this.maxTextHeight = 0;
  23151. /**
  23152. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextWidth=0]
  23153. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23154. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为 0.1 毫米。
  23155. */
  23156. this.maxTextWidth = 0;
  23157. /**
  23158. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextHeight=0]
  23159. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23160. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为 0.1 毫米。
  23161. */
  23162. this.minTextHeight = 0;
  23163. /**
  23164. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextWidth=0]
  23165. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23166. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为 0.1 毫米。
  23167. */
  23168. this.minTextWidth = 0;
  23169. /**
  23170. * @member {SuperMap.ServerTextStyle} [SuperMap.ThemeLabelText.prototype.uniformStyle]
  23171. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  23172. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  23173. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  23174. */
  23175. this.uniformStyle = new ServerTextStyle_ServerTextStyle();
  23176. /**
  23177. *@member {SuperMap.LabelMixedTextStyle} [SuperMap.ThemeLabelText.prototype.uniformMixedStyle]
  23178. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标
  23179. * 签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  23180. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  23181. */
  23182. this.uniformMixedStyle = null;
  23183. if (options) {
  23184. Util_Util.extend(this, options);
  23185. }
  23186. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  23187. }
  23188. /**
  23189. * @function SuperMap.ThemeLabelText.prototype.destroy
  23190. * @description 释放资源,将引用资源的属性置空。
  23191. */
  23192. destroy() {
  23193. var me = this;
  23194. me.maxTextHeight = null;
  23195. me.maxTextWidth = null;
  23196. me.minTextHeight = null;
  23197. me.minTextWidth = null;
  23198. if (me.uniformStyle) {
  23199. me.uniformStyle.destroy();
  23200. me.uniformStyle = null;
  23201. }
  23202. if (me.uniformMixedStyle) {
  23203. me.uniformMixedStyle.destroy();
  23204. me.uniformMixedStyle = null;
  23205. }
  23206. }
  23207. /**
  23208. * @function SuperMap.ThemeLabelText.fromObj
  23209. * @description 从传入对象获取标签中文本风格类。
  23210. * @param {Object} obj - 传入对象。
  23211. * @returns {SuperMap.ThemeLabelText} ThemeLabelText 对象。
  23212. */
  23213. static fromObj(obj) {
  23214. if (!obj) {
  23215. return;
  23216. }
  23217. var res = new ThemeLabelText_ThemeLabelText();
  23218. Util_Util.copy(res, obj);
  23219. res.uniformStyle = ServerTextStyle_ServerTextStyle.fromObj(obj.uniformStyle);
  23220. res.uniformMixedStyle = LabelMixedTextStyle_LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  23221. return res;
  23222. }
  23223. }
  23224. SuperMap.ThemeLabelText = ThemeLabelText_ThemeLabelText;
  23225. // CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  23226. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23227. * This program are made available under the terms of the Apache License, Version 2.0
  23228. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23229. /**
  23230. * @class SuperMap.ThemeLabelAlongLine
  23231. * @category iServer Map Theme
  23232. * @classdesc 标签沿线标注样式类。
  23233. * @param {Object} options - 参数。
  23234. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  23235. * @param {SuperMap.AlongLineDirection} [options.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  23236. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  23237. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  23238. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  23239. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  23240. */
  23241. class ThemeLabelAlongLine_ThemeLabelAlongLine {
  23242. constructor(options) {
  23243. /**
  23244. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.isAlongLine=true]
  23245. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  23246. */
  23247. this.isAlongLine = true;
  23248. /**
  23249. * @member {SuperMap.AlongLineDirection} [SuperMap.ThemeLabelAlongLine.prototype.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT]
  23250. * @description 标签沿线标注方向。
  23251. */
  23252. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  23253. /**
  23254. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.angleFixed=false]
  23255. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  23256. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  23257. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  23258. */
  23259. this.angleFixed = false;
  23260. /**
  23261. * @member {boolean} SuperMap.ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  23262. * @description 沿线循环标注时是否避免标签重复标注。
  23263. */
  23264. this.repeatedLabelAvoided = false;
  23265. /**
  23266. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  23267. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  23268. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  23269. */
  23270. this.repeatIntervalFixed = false;
  23271. /**
  23272. * @member {number} [SuperMap.ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  23273. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  23274. * 的时候,labelRepeatInterval 属性才有效。
  23275. */
  23276. this.labelRepeatInterval = 0;
  23277. if (options) {
  23278. Util_Util.extend(this, options);
  23279. }
  23280. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  23281. }
  23282. /**
  23283. * @function SuperMap.ThemeLabelAlongLine.prototype.destroy
  23284. * @description 释放资源,将引用资源的属性置空。
  23285. */
  23286. destroy() {
  23287. var me = this;
  23288. me.isAlongLine = null;
  23289. me.alongLineDirection = null;
  23290. me.angleFixed = null;
  23291. me.repeatedLabelAvoided = null;
  23292. me.repeatIntervalFixed = null;
  23293. me.labelRepeatInterval = null;
  23294. }
  23295. /**
  23296. * @function SuperMap.ThemeLabelAlongLine.fromObj
  23297. * @description 从传入对象获取标签沿线标注样式类。
  23298. * @param {Object} obj - 传入对象。
  23299. * @returns {SuperMap.ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  23300. */
  23301. static fromObj(obj) {
  23302. if (!obj) {
  23303. return;
  23304. }
  23305. var t = new ThemeLabelAlongLine_ThemeLabelAlongLine();
  23306. Util_Util.copy(t, obj);
  23307. return t;
  23308. }
  23309. }
  23310. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine_ThemeLabelAlongLine;
  23311. // CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  23312. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23313. * This program are made available under the terms of the Apache License, Version 2.0
  23314. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23315. /**
  23316. * @class SuperMap.ThemeLabelBackground
  23317. * @category iServer Map Theme
  23318. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  23319. * @param {Object} options - 参数。
  23320. * @param {SuperMap.LabelBackShape} [options.labelBackShape=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景风格。
  23321. * @param {SuperMap.ServerStyle} [options.backStyle=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  23322. */
  23323. class ThemeLabelBackground_ThemeLabelBackground {
  23324. constructor(options) {
  23325. /**
  23326. * @member {SuperMap.LabelBackShape} [SuperMap.ThemeLabelBackground.prototype.labelBackShape=SuperMap.LabelBackShape.NONE]
  23327. * @description 标签专题图中标签背景风格。当背景形状
  23328. * labelBackShape 属性设为 NONE(即无背景形状) 时,backStyle 属性无效。
  23329. */
  23330. this.labelBackShape = LabelBackShape.NONE;
  23331. /**
  23332. * @member {SuperMap.ServerStyle} [SuperMap.ThemeLabelBackground.prototype.backStyle=SuperMap.LabelBackShape.NON]
  23333. * @description 标签专题图中标签背景的形状枚举类。背景类型可
  23334. * 以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  23335. */
  23336. this.backStyle = new ServerStyle_ServerStyle();
  23337. if (options) {
  23338. Util_Util.extend(this, options);
  23339. }
  23340. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  23341. }
  23342. /**
  23343. * @function SuperMap.ThemeLabelBackground.prototype.destroy
  23344. * @description 释放资源,将引用资源的属性置空。
  23345. */
  23346. destroy() {
  23347. var me = this;
  23348. me.labelBackShape = null;
  23349. if (me.backStyle) {
  23350. me.backStyle.destroy();
  23351. me.backStyle = null;
  23352. }
  23353. }
  23354. /**
  23355. * @function SuperMap.ThemeLabelBackground.fromObj
  23356. * @description 从传入对象获取标签背景风格类。
  23357. * @param {Object} obj - 传入对象。
  23358. * @returns {SuperMap.ThemeLabelBackground} ThemeLabelBackground 对象。
  23359. */
  23360. static fromObj(obj) {
  23361. if (!obj) {
  23362. return;
  23363. }
  23364. var t = new ThemeLabelBackground_ThemeLabelBackground();
  23365. t.labelBackShape = obj.labelBackShape;
  23366. t.backStyle = ServerStyle_ServerStyle.fromJson(obj.backStyle);
  23367. return t;
  23368. }
  23369. }
  23370. SuperMap.ThemeLabelBackground = ThemeLabelBackground_ThemeLabelBackground;
  23371. // CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  23372. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23373. * This program are made available under the terms of the Apache License, Version 2.0
  23374. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23375. /**
  23376. * @class SuperMap.ThemeLabel
  23377. * @category iServer Map Theme
  23378. * @classdesc 标签专题图类。
  23379. * @extends SuperMap.Theme
  23380. * @param {Object} options - 参数。
  23381. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 分段标签专题图的子项数组。
  23382. * @param {string} options.labelExpression - 标注字段表达式。
  23383. * @param {Array.<SuperMap.LabelMatrixCell>} options.matrixCells - 矩阵标签元素数组。
  23384. * @param {SuperMap.ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  23385. * @param {SuperMap.ThemeLabelBackground} [options.background] - 标签专题图中标签的背景风格类。
  23386. * @param {SuperMap.ThemeFlow} [options.flow] - 标签专题图标签流动显示与牵引线设置类。
  23387. * @param {SuperMap.LabelOverLengthMode} [options.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  23388. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  23389. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  23390. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  23391. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  23392. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  23393. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  23394. * @param {SuperMap.ThemeLabelText} options.text - 标签中文本风格。
  23395. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  23396. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23397. */
  23398. class ThemeLabel_ThemeLabel extends Theme_Theme {
  23399. constructor(options) {
  23400. super("LABEL", options);
  23401. /**
  23402. * @member {SuperMap.ThemeLabelAlongLine} [SuperMap.ThemeLabel.prototype.alongLine]
  23403. * @description 标签沿线标注方向样式类。
  23404. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  23405. */
  23406. this.alongLine = new ThemeLabelAlongLine_ThemeLabelAlongLine();
  23407. /**
  23408. * @member {SuperMap.ThemeLabelBackground} [SuperMap.ThemeLabel.prototype.background]
  23409. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  23410. */
  23411. this.background = new ThemeLabelBackground_ThemeLabelBackground();
  23412. /**
  23413. * @member {SuperMap.ThemeFlow} [SuperMap.ThemeLabel.prototype.flow]
  23414. * @description 标签专题图标签流动显示与牵引线设置类。通过该字段可以设置标签是否流动显示和牵引线风格。
  23415. */
  23416. this.flow = new ThemeFlow_ThemeFlow();
  23417. /**
  23418. * @member {Array.<SuperMap.ThemeUniqueItem>} [SuperMap.ThemeLabel.prototype.items]
  23419. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  23420. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  23421. */
  23422. this.items = null;
  23423. /**
  23424. * @member {Array.<SuperMap.ThemeLabelUniqueItem>} SuperMap.ThemeLabel.prototype.uniqueItems
  23425. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  23426. */
  23427. this.uniqueItems = null;
  23428. /**
  23429. * @member {string} SuperMap.ThemeLabel.prototype.labelExpression
  23430. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  23431. */
  23432. this.labelExpression = null;
  23433. /**
  23434. * @member {SuperMap.LabelOverLengthMode} [SuperMap.ThemeLabel.prototype.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  23435. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  23436. */
  23437. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  23438. /**
  23439. * @member {Array.<SuperMap.LabelMatrixCell>} SuperMap.ThemeLabel.prototype.matrixCells
  23440. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  23441. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  23442. */
  23443. this.matrixCells = null;
  23444. /**
  23445. * @member {number} [SuperMap.ThemeLabel.prototype.maxLabelLength=256]
  23446. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  23447. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  23448. */
  23449. this.maxLabelLength = 256;
  23450. /**
  23451. * @member {number} [SuperMap.ThemeLabel.prototype.numericPrecision=0]
  23452. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  23453. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  23454. */
  23455. this.numericPrecision = 0;
  23456. /**
  23457. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeLabel.prototype.offset]
  23458. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  23459. */
  23460. this.offset = new ThemeOffset_ThemeOffset();
  23461. /**
  23462. * @member {boolean} [SuperMap.ThemeLabel.prototype.overlapAvoided=true]
  23463. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  23464. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  23465. */
  23466. this.overlapAvoided = true;
  23467. /**
  23468. * @member {string} SuperMap.ThemeLabel.prototype.rangeExpression
  23469. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  23470. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  23471. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  23472. */
  23473. this.rangeExpression = null;
  23474. /**
  23475. * @member {string} SuperMap.ThemeLabel.prototype.uniqueExpression
  23476. * @description 用于制作单值专题图的字段或字段表达式。
  23477. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  23478. */
  23479. this.uniqueExpression = null;
  23480. /**
  23481. * @member {boolean} [SuperMap.ThemeLabel.prototype.smallGeometryLabeled=false]
  23482. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  23483. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  23484. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  23485. */
  23486. this.smallGeometryLabeled = false;
  23487. /**
  23488. * @member {SuperMap.ThemeLabelText} SuperMap.ThemeLabel.prototype.text
  23489. * @description 标签中文本风格。
  23490. */
  23491. this.text = new ThemeLabelText_ThemeLabelText();
  23492. /**
  23493. * @member {number} [SuperMap.ThemeLabel.prototype.textSpace=0]
  23494. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  23495. */
  23496. this.textSpace = 0;
  23497. if (options) {
  23498. Util_Util.extend(this, options);
  23499. }
  23500. this.CLASS_NAME = "SuperMap.ThemeLabel";
  23501. }
  23502. /**
  23503. * @function SuperMap.ThemeLabel.prototype.destroy
  23504. * @override
  23505. */
  23506. destroy() {
  23507. super.destroy();
  23508. var me = this;
  23509. me.alongLine = null;
  23510. if (me.background) {
  23511. me.background.destroy();
  23512. me.background = null;
  23513. }
  23514. me.flow = null;
  23515. if (me.items) {
  23516. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  23517. items[i].destroy();
  23518. }
  23519. me.items = null;
  23520. }
  23521. if (me.uniqueItems) {
  23522. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  23523. uniqueItems[j].destory();
  23524. }
  23525. me.uniqueItems = null;
  23526. }
  23527. me.labelExpression = null;
  23528. me.labelOverLengthMode = null;
  23529. me.matrixCells = null;
  23530. me.maxLabelLength = null;
  23531. me.numericPrecision = null;
  23532. me.overlapAvoided = null;
  23533. me.rangeExpression = null;
  23534. me.uniqueExpression = null;
  23535. if (me.offset) {
  23536. me.offset.destroy();
  23537. me.offset = null;
  23538. }
  23539. me.overlapAvoided = null;
  23540. me.smallGeometryLabeled = null;
  23541. if (me.text) {
  23542. me.text.destroy();
  23543. me.text = null;
  23544. }
  23545. me.textSpace = null;
  23546. }
  23547. /**
  23548. * @function SuperMap.ThemeLabel.prototype.toJSON
  23549. * @description 将themeLabel对象转化为 JSON 字符串。
  23550. * @returns {string} 返回转换后的 JSON 字符串。
  23551. */
  23552. toJSON() {
  23553. return Util_Util.toJSON(this.toServerJSONObject());
  23554. }
  23555. /**
  23556. * @function SuperMap.ThemeLabel.prototype.toServerJSONObject
  23557. * @description 转换成对应的 JSON 格式对象。
  23558. * @returns {Object} 对应的 JSON 格式对象。
  23559. */
  23560. toServerJSONObject() {
  23561. var obj = {};
  23562. obj.type = this.type;
  23563. obj.memoryData = this.memoryData;
  23564. if (this.alongLine) {
  23565. obj.alongLine = this.alongLine.isAlongLine;
  23566. obj.alongLineDirection = this.alongLine.alongLineDirection;
  23567. obj.angleFixed = this.alongLine.angleFixed;
  23568. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  23569. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  23570. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  23571. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  23572. }
  23573. if (this.offset) {
  23574. obj.offsetFixed = this.offset.offsetFixed;
  23575. obj.offsetX = this.offset.offsetX;
  23576. obj.offsetY = this.offset.offsetY;
  23577. }
  23578. if (this.flow) {
  23579. obj.flowEnabled = this.flow.flowEnabled;
  23580. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  23581. obj.leaderLineStyle = this.flow.leaderLineStyle;
  23582. }
  23583. if (this.text) {
  23584. obj.maxTextHeight = this.text.maxTextHeight;
  23585. obj.maxTextWidth = this.text.maxTextWidth;
  23586. obj.minTextHeight = this.text.minTextHeight;
  23587. obj.minTextWidth = this.text.minTextWidth;
  23588. obj.uniformStyle = this.text.uniformStyle;
  23589. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  23590. }
  23591. if (this.background) {
  23592. obj.labelBackShape = this.background.labelBackShape;
  23593. obj.backStyle = this.background.backStyle;
  23594. }
  23595. obj.labelOverLengthMode = this.labelOverLengthMode;
  23596. obj.maxLabelLength = this.maxLabelLength;
  23597. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  23598. obj.rangeExpression = this.rangeExpression;
  23599. obj.uniqueExpression = this.uniqueExpression;
  23600. obj.numericPrecision = this.numericPrecision;
  23601. obj.items = this.items;
  23602. obj.uniqueItems = this.uniqueItems;
  23603. obj.labelExpression = this.labelExpression;
  23604. obj.overlapAvoided = this.overlapAvoided;
  23605. obj.matrixCells = this.matrixCells;
  23606. obj.textSpace = this.textSpace;
  23607. return obj;
  23608. }
  23609. /**
  23610. * @function SuperMap.ThemeLabel.fromObj
  23611. * @description 从传入对象获取标签专题图类。
  23612. * @param {Object} obj - 传入对象。
  23613. * @returns {SuperMap.ThemeLabel} ThemeLabel 对象。
  23614. */
  23615. static fromObj(obj) {
  23616. if (!obj) {
  23617. return;
  23618. }
  23619. var lab = new ThemeLabel_ThemeLabel();
  23620. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  23621. obj.matrixCells = null;
  23622. Util_Util.copy(lab, obj);
  23623. lab.alongLine = ThemeLabelAlongLine_ThemeLabelAlongLine.fromObj(obj);
  23624. lab.background = ThemeLabelBackground_ThemeLabelBackground.fromObj(obj);
  23625. lab.flow = new ThemeFlow_ThemeFlow({
  23626. flowEnabled: obj.flowEnabled,
  23627. leaderLineDisplayed: obj.leaderLineDisplayed,
  23628. leaderLineStyle: obj.leaderLineStyle
  23629. });
  23630. if (itemsL) {
  23631. lab.items = [];
  23632. for (var i = 0, len = itemsL.length; i < len; i++) {
  23633. lab.items.push(ThemeLabelItem_ThemeLabelItem.fromObj(itemsL[i]));
  23634. }
  23635. }
  23636. if (itemsU) {
  23637. lab.uniqueItems = [];
  23638. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  23639. lab.uniqueItems.push(ThemeUniqueItem_ThemeUniqueItem.fromObj(itemsU[j]));
  23640. }
  23641. }
  23642. if (cells) {
  23643. lab.matrixCells = [];
  23644. for (let i = 0, len = cells.length; i < len; i++) {
  23645. //TODO
  23646. //lab.matrixCells.push(SuperMap.LabelMatrixCell.fromObj(cells[i]));
  23647. }
  23648. }
  23649. lab.offset = ThemeOffset_ThemeOffset.fromObj(obj);
  23650. lab.text = ThemeLabelText_ThemeLabelText.fromObj(obj);
  23651. return lab;
  23652. }
  23653. }
  23654. SuperMap.ThemeLabel = ThemeLabel_ThemeLabel;
  23655. // CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  23656. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23657. * This program are made available under the terms of the Apache License, Version 2.0
  23658. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23659. /**
  23660. * @class SuperMap.ThemeUnique
  23661. * @category iServer Map Theme
  23662. * @classdesc 单值专题图。
  23663. * @description 单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  23664. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  23665. * @extends {SuperMap.Theme}
  23666. * @param {Object} options - 参数。
  23667. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 单值专题图子项类数组。
  23668. * @param {string} options.uniqueExpression - 用于制作单值专题图的字段或字段表达式。
  23669. * @param {SuperMap.ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  23670. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  23671. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23672. */
  23673. class ThemeUnique_ThemeUnique extends Theme_Theme {
  23674. constructor(options) {
  23675. super("UNIQUE", options);
  23676. /**
  23677. * @member {SuperMap.ServerStyle} SuperMap.ThemeUnique.prototype.defaultStyle
  23678. * @description 未参与单值专题图制作的对象的显示风格。
  23679. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  23680. */
  23681. this.defaultStyle = new ServerStyle_ServerStyle();
  23682. /**
  23683. * @member {Array.<SuperMap.ThemeUniqueItem>} SuperMap.ThemeUnique.prototype.items
  23684. * @description 单值专题图子项类数组。
  23685. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  23686. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  23687. */
  23688. this.items = null;
  23689. /**
  23690. * @member {string} SuperMap.ThemeUnique.prototype.uniqueExpression
  23691. * @description 用于制作单值专题图的字段或字段表达式。
  23692. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  23693. */
  23694. this.uniqueExpression = null;
  23695. /**
  23696. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeUnique.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  23697. * @description 渐变颜色枚举类。
  23698. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  23699. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  23700. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  23701. * 该配色方案对于这几个子项将不起作用。
  23702. */
  23703. this.colorGradientType = ColorGradientType.YELLOW_RED;
  23704. if (options) {
  23705. Util_Util.extend(this, options);
  23706. }
  23707. this.CLASS_NAME = "SuperMap.ThemeUnique";
  23708. }
  23709. /**
  23710. * @function SuperMap.ThemeUnique.prototype.destroy
  23711. * @override
  23712. */
  23713. destroy() {
  23714. super.destroy();
  23715. var me = this;
  23716. me.uniqueExpression = null;
  23717. me.colorGradientType = null;
  23718. if (me.items) {
  23719. if (me.items.length > 0) {
  23720. for (var item in me.items) {
  23721. me.items[item].destroy();
  23722. me.items[item] = null;
  23723. }
  23724. }
  23725. me.items = null;
  23726. }
  23727. if (me.defaultStyle) {
  23728. me.defaultStyle.destroy();
  23729. me.defaultStyle = null;
  23730. }
  23731. }
  23732. /**
  23733. * @function SuperMap.ThemeUnique.prototype.toServerJSONObject
  23734. * @description 转换成对应的 JSON 格式对象。
  23735. * @returns {Object} 对应的 JSON 格式对象。
  23736. */
  23737. toServerJSONObject() {
  23738. var obj = {};
  23739. obj = Util_Util.copyAttributes(obj, this);
  23740. if (obj.defaultStyle) {
  23741. if (obj.defaultStyle.toServerJSONObject) {
  23742. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  23743. }
  23744. }
  23745. if (obj.items) {
  23746. var items = [],
  23747. len = obj.items.length;
  23748. for (var i = 0; i < len; i++) {
  23749. items.push(obj.items[i].toServerJSONObject());
  23750. }
  23751. obj.items = items;
  23752. }
  23753. return obj;
  23754. }
  23755. /**
  23756. * @function SuperMap.ThemeUnique.fromObj
  23757. * @description 从传入对象获取单值专题图类。
  23758. * @param {Object} obj - 传入对象。
  23759. * @returns {SuperMap.ThemeUnique} ThemeUnique 对象。
  23760. */
  23761. static fromObj(obj) {
  23762. var res = new ThemeUnique_ThemeUnique();
  23763. var uItems = obj.items;
  23764. var len = uItems ? uItems.length : 0;
  23765. Util_Util.extend(res, obj);
  23766. res.items = [];
  23767. res.defaultStyle = ServerStyle_ServerStyle.fromJson(obj.defaultStyle);
  23768. for (var i = 0; i < len; i++) {
  23769. res.items.push(ThemeUniqueItem_ThemeUniqueItem.fromObj(uItems[i]));
  23770. }
  23771. return res;
  23772. }
  23773. }
  23774. SuperMap.ThemeUnique = ThemeUnique_ThemeUnique;
  23775. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  23776. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23777. * This program are made available under the terms of the Apache License, Version 2.0
  23778. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23779. /**
  23780. * @class SuperMap.ThemeGraphAxes
  23781. * @category iServer Map Theme
  23782. * @classdesc 统计专题图坐标轴样式类。
  23783. * @param {Object} options - 参数。
  23784. * @param {SuperMap.ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  23785. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  23786. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  23787. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  23788. * @param {SuperMap.ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  23789. */
  23790. class ThemeGraphAxes_ThemeGraphAxes {
  23791. constructor(options) {
  23792. /**
  23793. * @member {SuperMap.ServerColor} [SuperMap.ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  23794. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  23795. */
  23796. this.axesColor = new ServerColor(0, 0, 0);
  23797. /**
  23798. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesDisplayed=false]
  23799. * @description 是否显示坐标轴。<br>
  23800. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  23801. */
  23802. this.axesDisplayed = false;
  23803. /**
  23804. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesGridDisplayed=false]
  23805. * @description 是否在统计图坐标轴上显示网格。
  23806. */
  23807. this.axesGridDisplayed = false;
  23808. /**
  23809. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesTextDisplayed=false]
  23810. * @description 是否显示坐标轴的文本标注。
  23811. */
  23812. this.axesTextDisplayed = false;
  23813. /**
  23814. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphAxes.prototype.axesTextStyle
  23815. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  23816. */
  23817. this.axesTextStyle = new ServerTextStyle_ServerTextStyle();
  23818. if (options) {
  23819. Util_Util.extend(this, options);
  23820. }
  23821. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  23822. }
  23823. /**
  23824. * @function SuperMap.ThemeGraphAxes.prototype.destroy
  23825. * @description 释放资源,将引用资源的属性置空。
  23826. */
  23827. destroy() {
  23828. var me = this;
  23829. if (me.axesColor) {
  23830. me.axesColor.destroy();
  23831. me.axesColor = null;
  23832. }
  23833. me.axesDisplayed = null;
  23834. me.axesGridDisplayed = null;
  23835. me.axesTextDisplayed = null;
  23836. if (me.axesTextStyle) {
  23837. me.axesTextStyle.destroy();
  23838. me.axesTextStyle = null;
  23839. }
  23840. }
  23841. /**
  23842. * @function SuperMap.ThemeGraphAxes.fromObj
  23843. * @description 从传入对象获取统计专题图坐标轴样式类。
  23844. * @param {Object} obj - 传入对象。
  23845. * @returns {SuperMap.ThemeGraphAxes} ThemeGraphAxes 对象。
  23846. */
  23847. static fromObj(obj) {
  23848. if (!obj) {
  23849. return;
  23850. }
  23851. var res = new ThemeGraphAxes_ThemeGraphAxes();
  23852. Util_Util.copy(res, obj);
  23853. res.axesColor = ServerColor.fromJson(obj.axesColor);
  23854. res.axesTextStyle = ServerTextStyle_ServerTextStyle.fromObj(obj.axesTextStyle);
  23855. return res;
  23856. }
  23857. }
  23858. SuperMap.ThemeGraphAxes = ThemeGraphAxes_ThemeGraphAxes;
  23859. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  23860. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23861. * This program are made available under the terms of the Apache License, Version 2.0
  23862. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23863. /**
  23864. * @class SuperMap.ThemeGraphSize
  23865. * @category iServer Map Theme
  23866. * @classdesc 统计专题图符号尺寸类。
  23867. * @param {Object} options - 参数。
  23868. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  23869. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  23870. */
  23871. class ThemeGraphSize_ThemeGraphSize {
  23872. constructor(options) {
  23873. /**
  23874. * @member {number} [SuperMap.ThemeGraphSize.prototype.maxGraphSize=0]
  23875. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  23876. */
  23877. this.maxGraphSize = 0;
  23878. /**
  23879. * @member {number} [SuperMap.ThemeGraphSize.prototype.minGraphSize=0]
  23880. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  23881. */
  23882. this.minGraphSize = 0;
  23883. if (options) {
  23884. Util_Util.extend(this, options);
  23885. }
  23886. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  23887. }
  23888. /**
  23889. * @function SuperMap.ThemeGraphSize.prototype.destroy
  23890. * @description 释放资源,将引用资源的属性置空。
  23891. */
  23892. destroy() {
  23893. var me = this;
  23894. me.maxGraphSize = null;
  23895. me.minGraphSize = null;
  23896. }
  23897. /**
  23898. * @function SuperMap.ThemeGraphSize.fromObj
  23899. * @description 从传入对象获统计专题图符号尺寸类。
  23900. * @param {Object} obj - 传入对象。
  23901. * @returns {SuperMap.ThemeGraphSize} ThemeGraphSize 对象。
  23902. */
  23903. static fromObj(obj) {
  23904. var res = new ThemeGraphSize_ThemeGraphSize();
  23905. Util_Util.copy(res, obj);
  23906. return res;
  23907. }
  23908. }
  23909. SuperMap.ThemeGraphSize = ThemeGraphSize_ThemeGraphSize;
  23910. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  23911. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23912. * This program are made available under the terms of the Apache License, Version 2.0
  23913. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23914. /**
  23915. * @class SuperMap.ThemeGraphText
  23916. * @category iServer Map Theme
  23917. * @classdesc 统计图文字标注风格类。
  23918. * @param {Object} options - 可选参数。
  23919. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  23920. * @param {SuperMap.ThemeGraphTextFormat} [options.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  23921. * @param {SuperMap.ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  23922. */
  23923. class ThemeGraphText_ThemeGraphText {
  23924. constructor(options) {
  23925. /**
  23926. * @member {boolean} [SuperMap.ThemeGraphText.prototype.graphTextDisplayed=false]
  23927. * @description 是否显示统计图上的文字标注。
  23928. */
  23929. this.graphTextDisplayed = false;
  23930. /**
  23931. * @member {SuperMap.ThemeGraphTextFormat} [SuperMap.ThemeGraphText.prototype.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION]
  23932. * @description 统计专题图文本显示格式。
  23933. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  23934. */
  23935. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  23936. /**
  23937. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphText.prototype.graphTextStyle
  23938. * @description 统计图上的文字标注风格。
  23939. */
  23940. this.graphTextStyle = new ServerTextStyle_ServerTextStyle();
  23941. if (options) {
  23942. Util_Util.extend(this, options);
  23943. }
  23944. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  23945. }
  23946. /**
  23947. * @function SuperMap.ThemeGraphText.prototype.destroy
  23948. * @description 释放资源,将引用资源的属性置空。
  23949. */
  23950. destroy() {
  23951. var me = this;
  23952. me.graphTextDisplayed = null;
  23953. me.graphTextFormat = null;
  23954. if (me.graphTextStyle) {
  23955. me.graphTextStyle.destroy();
  23956. me.graphTextStyle = null;
  23957. }
  23958. }
  23959. /**
  23960. * @function SuperMap.ThemeGraphText.fromObj
  23961. * @description 从传入对象获取统计图文字标注风格类。
  23962. * @param {Object} obj - 传入对象。
  23963. * @returns {SuperMap.ThemeGraphText} ThemeGraphText 对象。
  23964. */
  23965. static fromObj(obj) {
  23966. var res = new ThemeGraphText_ThemeGraphText();
  23967. Util_Util.copy(res, obj);
  23968. res.graphTextStyle = ServerTextStyle_ServerTextStyle.fromObj(obj.graphTextStyle);
  23969. return res;
  23970. }
  23971. }
  23972. SuperMap.ThemeGraphText = ThemeGraphText_ThemeGraphText;
  23973. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  23974. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  23975. * This program are made available under the terms of the Apache License, Version 2.0
  23976. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23977. /**
  23978. * @class SuperMap.ThemeGraphItem
  23979. * @category iServer Map Theme
  23980. * @classdesc 统计专题图子项类。
  23981. * @param {Object} options - 参数。
  23982. * @param {string} [options.caption] - 专题图子项的名称。
  23983. * @param {string} options.graphExpression - 统计专题图的专题变量。
  23984. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  23985. * @param {SuperMap.ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格
  23986. */
  23987. class ThemeGraphItem_ThemeGraphItem {
  23988. constructor(options) {
  23989. /**
  23990. * @member {string} [SuperMap.ThemeGraphItem.prototype.caption]
  23991. * @description 专题图子项的名称。
  23992. */
  23993. this.caption = null;
  23994. /**
  23995. * @member {string} SuperMap.ThemeGraphItem.prototype.graphExpression
  23996. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  23997. */
  23998. this.graphExpression = null;
  23999. /**
  24000. * @member {Array.<number>} [SuperMap.ThemeGraphItem.prototype.memoryDoubleValues]
  24001. * @description 内存数组方式制作专题图时的值数组。<br>
  24002. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link SuperMap.ThemeGraph.memoryKeys})中的记录制作专题图。
  24003. * 值数组的数值个数必须与键数组中数值的个数一致。 值数组中的值将代替原来的专题值来制作统计专题图。
  24004. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  24005. */
  24006. this.memoryDoubleValues = null;
  24007. /**
  24008. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraphItem.prototype.uniformStyle]
  24009. * @description 统计专题图子项的显示风格。
  24010. * 每一个统计专题图子项都对应一种显示风格。
  24011. */
  24012. this.uniformStyle = new ServerStyle_ServerStyle();
  24013. if (options) {
  24014. Util_Util.extend(this, options);
  24015. }
  24016. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  24017. }
  24018. /**
  24019. * @function SuperMap.ThemeGraphItem.prototype.destroy
  24020. * @description 释放资源,将引用资源的属性置空。
  24021. */
  24022. destroy() {
  24023. var me = this;
  24024. me.caption = null;
  24025. me.graphExpression = null;
  24026. me.memoryDoubleValues = null;
  24027. me.uniformStyle = null;
  24028. }
  24029. /**
  24030. * @function SuperMap.ThemeGraphItem.fromObj
  24031. * @description 从传入对象获取统计专题图子项类。
  24032. * @param {Object} obj - 传入对象。
  24033. * @returns {SuperMap.ThemeGraphItem} ThemeGraphItem 对象。
  24034. */
  24035. static fromObj(obj) {
  24036. if (!obj) {
  24037. return;
  24038. }
  24039. var res = new ThemeGraphItem_ThemeGraphItem();
  24040. Util_Util.copy(res, obj);
  24041. res.uniformStyle = ServerStyle_ServerStyle.fromJson(obj.uniformStyle);
  24042. return res;
  24043. }
  24044. }
  24045. SuperMap.ThemeGraphItem = ThemeGraphItem_ThemeGraphItem;
  24046. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  24047. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24048. * This program are made available under the terms of the Apache License, Version 2.0
  24049. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24050. /**
  24051. * @class SuperMap.ThemeGraph
  24052. * @category iServer Map Theme
  24053. * @classdesc 统计专题图类。
  24054. * @extends {SuperMap.Theme}
  24055. * @param {Object} options - 参数。
  24056. * @param {Array.<SuperMap.ThemeGraphItem>} options.items - 统计专题图子项集合。
  24057. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  24058. * @param {SuperMap.ThemeFlow} [options.flow] - 统计专题图流动显示与牵引线设置。
  24059. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  24060. * @param {SuperMap.ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  24061. * @param {SuperMap.ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  24062. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  24063. * @param {SuperMap.ThemeGraphText} [options.graphText] - 统计图上的文字是否可以见以及文字标注风格。
  24064. * @param {SuperMap.GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  24065. * @param {SuperMap.ThemeGraphType} [options.graphType=SuperMap.ThemeGraphType.AREA] - 统计专题图类型。
  24066. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  24067. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  24068. * @param {SuperMap.ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  24069. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  24070. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  24071. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  24072. */
  24073. class ThemeGraph_ThemeGraph extends Theme_Theme {
  24074. constructor(options) {
  24075. super("GRAPH", options);
  24076. /**
  24077. * @member {number} [SuperMap.ThemeGraph.prototype.barWidth=0]
  24078. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  24079. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  24080. */
  24081. this.barWidth = 0;
  24082. /**
  24083. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraph.prototype.flow
  24084. * @description 统计专题图流动显示与牵引线设置。
  24085. * 通过该字段可以设置统计符号是否流动显示和牵引线风格。
  24086. */
  24087. this.flow = new ThemeFlow_ThemeFlow();
  24088. /**
  24089. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraph.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  24090. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  24091. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  24092. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  24093. */
  24094. this.graduatedMode = GraduatedMode.CONSTANT;
  24095. /**
  24096. * @member {SuperMap.ThemeGraphAxes} SuperMap.ThemeGraph.prototype.graphAxes
  24097. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  24098. */
  24099. this.graphAxes = new ThemeGraphAxes_ThemeGraphAxes();
  24100. /**
  24101. * @member {SuperMap.ThemeGraphSize} [SuperMap.ThemeGraph.prototype.graphSize=0]
  24102. * @description 用于设置统计符号的最大最小尺寸。
  24103. */
  24104. this.graphSize = new ThemeGraphSize_ThemeGraphSize();
  24105. /**
  24106. * @member {boolean} [SuperMap.ThemeGraph.prototype.graphSizeFixed=false]
  24107. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  24108. */
  24109. this.graphSizeFixed = false;
  24110. /**
  24111. * @member {SuperMap.ThemeGraphText} SuperMap.ThemeGraph.prototype.graphText
  24112. * @description 统计图上的文字是否可以见以及文字标注风格。
  24113. */
  24114. this.graphText = new ThemeGraphText_ThemeGraphText();
  24115. /**
  24116. * @member {SuperMap.ThemeGraphType} [SuperMap.ThemeGraph.prototype.graphType=SuperMap.ThemeGraphType.AREA]
  24117. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  24118. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  24119. */
  24120. this.graphType = ThemeGraphType.AREA;
  24121. /**
  24122. * @member {SuperMap.GraphAxesTextDisplayMode} [SuperMap.ThemeGraph.prototype.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE]
  24123. * @description 统计专题图坐标轴文本显示模式。
  24124. */
  24125. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  24126. /**
  24127. * @member {Array.<SuperMap.ThemeGraphItem>} SuperMap.ThemeGraph.prototype.items
  24128. * @description 统计专题图子项集合。
  24129. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  24130. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  24131. */
  24132. this.items = null;
  24133. /**
  24134. * @member {Array.<number>} SuperMap.ThemeGraph.prototype.memoryKeys
  24135. * @description 以内存数组方式制作专题图时的键数组。
  24136. * 键数组内的数值代表 SmID 值,它与 SuperMap.ThemeGraphItem 类中的值数组(SuperMap.ThemeGraphItem.memoryDoubleValues)要关联起来应用。
  24137. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  24138. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  24139. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  24140. * @example
  24141. * memoryKeys 的使用方法如下:
  24142. * function addThemeGraph() {
  24143. * removeTheme();
  24144. * //创建统计专题图对象,SuperMap.ThemeGraph 必设 items。
  24145. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  24146. * var style1 = new SuperMap.ServerStyle({
  24147. * fillForeColor: new SuperMap.ServerColor(92,73,234),
  24148. * lineWidth: 0.1
  24149. * }),
  24150. * style2 = new SuperMap.ServerStyle({
  24151. * fillForeColor: new SuperMap.ServerColor(211,111,240),
  24152. * lineWidth: 0.1
  24153. * }),
  24154. * item1 = new SuperMap.ThemeGraphItem({
  24155. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  24156. * caption: "1992-1995人口增长率",
  24157. * graphExpression: "Pop_Rate95",
  24158. * uniformStyle: style1
  24159. * }),
  24160. * item2 = new SuperMap.ThemeGraphItem({
  24161. * //以内存数组方式制作专题图时的值数组
  24162. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  24163. * caption: "1995-1999人口增长率", //专题图子项的名称
  24164. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  24165. * uniformStyle: style2 //统计专题图子项的显示风格
  24166. * }),
  24167. * themeGraph = new SuperMap.ThemeGraph({
  24168. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  24169. * memoryKeys:[1,2,4,8,10,12],
  24170. * items: new Array(item1,item2),
  24171. * barWidth: 0.03,
  24172. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  24173. * graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
  24174. * //graphAxes用于设置统计图中坐标轴样式相关信息
  24175. * graphAxes: new SuperMap.ThemeGraphAxes({
  24176. * axesDisplayed: true
  24177. * }),
  24178. * graphSize: new SuperMap.ThemeGraphSize({
  24179. * maxGraphSize: 1,
  24180. * minGraphSize: 0.35
  24181. * }),
  24182. * //统计图上的文字是否可以见以及文字标注风格
  24183. * graphText: new SuperMap.ThemeGraphText({
  24184. * graphTextDisplayed: true,
  24185. * graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
  24186. * graphTextStyle: new SuperMap.ServerTextStyle({
  24187. * sizeFixed: true,
  24188. * fontHeight: 9,
  24189. * fontWidth: 5
  24190. * })
  24191. * }),
  24192. * //统计专题图类型为三维柱状图
  24193. * graphType: SuperMap.ThemeGraphType.BAR3D
  24194. * }),
  24195. * //专题图参数对象
  24196. * themeParameters = new SuperMap.ThemeParameters({
  24197. * themes: [themeGraph],
  24198. * dataSourceNames: ["Jingjin"],
  24199. * datasetNames: ["BaseMap_R"]
  24200. * }),
  24201. * //与服务端交互
  24202. * themeService=new SuperMap.ThemeService(url, {
  24203. * eventListeners: {
  24204. * "processCompleted": ThemeCompleted,
  24205. * "processFailed": themeFailed
  24206. * }
  24207. * });
  24208. * themeService.processAsync(themeParameters);
  24209. * }
  24210. */
  24211. this.memoryKeys = null;
  24212. /**
  24213. * @member {boolean} [SuperMap.ThemeGraph.prototype.negativeDisplayed=false]
  24214. * @description 专题图中是否显示属性为负值的数据。true 表示显示;falese 不显示。
  24215. */
  24216. this.negativeDisplayed = false;
  24217. /**
  24218. * @member {SuperMap.ThemeOffset} SuperMap.ThemeGraph.prototype.offset
  24219. * @description 用于设置统计图相对于要素内点的偏移量。
  24220. */
  24221. this.offset = new ThemeOffset_ThemeOffset();
  24222. /**
  24223. * @member {boolean} SuperMap.ThemeGraph.prototype.overlapAvoided
  24224. * @description 统计图是否采用避让方式显示。<br>
  24225. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  24226. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  24227. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  24228. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  24229. */
  24230. this.overlapAvoided = true;
  24231. /**
  24232. * @member {number} [SuperMap.ThemeGraph.prototype.roseAngle=0]
  24233. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  24234. */
  24235. this.roseAngle = 0;
  24236. /**
  24237. * @member {number} [SuperMap.ThemeGraph.prototype.startAngle=0]
  24238. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  24239. */
  24240. this.startAngle = 0;
  24241. if (options) {
  24242. Util_Util.extend(this, options);
  24243. }
  24244. this.CLASS_NAME = "SuperMap.ThemeGraph";
  24245. }
  24246. /**
  24247. * @function SuperMap.ThemeGraph.prototype.destroy
  24248. * @override
  24249. */
  24250. destroy() {
  24251. super.destroy();
  24252. var me = this;
  24253. me.barWidth = null;
  24254. if (me.flow) {
  24255. me.flow.destroy();
  24256. me.flow = null;
  24257. }
  24258. me.graduatedMode = null;
  24259. if (me.graphAxes) {
  24260. me.graphAxes.destroy();
  24261. me.graphAxes = null;
  24262. }
  24263. if (me.graphSize) {
  24264. me.graphSize.destroy();
  24265. me.graphSize = null;
  24266. }
  24267. me.graphSizeFixed = null;
  24268. if (me.graphText) {
  24269. me.graphText.destroy();
  24270. me.graphText = null;
  24271. }
  24272. me.graphType = null;
  24273. if (me.items) {
  24274. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  24275. items[i].destroy();
  24276. }
  24277. me.items = null;
  24278. }
  24279. me.memoryKeys = null;
  24280. me.negativeDisplayed = null;
  24281. if (me.offset) {
  24282. me.offset.destroy();
  24283. me.offset = null;
  24284. }
  24285. me.overlapAvoided = null;
  24286. me.roseAngle = null;
  24287. me.startAngle = null;
  24288. me.graphAxesTextDisplayMode = null;
  24289. }
  24290. /**
  24291. * @function SuperMap.ThemeGraph.prototype.toJSON
  24292. * @description 将 SuperMap.ThemeGraph 对象转化为 JSON 字符串。
  24293. * @returns {string} 返回转换后的 JSON 字符串。
  24294. */
  24295. toJSON() {
  24296. return Util_Util.toJSON(this.toServerJSONObject());
  24297. }
  24298. /**
  24299. * @function SuperMap.ThemeGraph.prototype.toServerJSONObject
  24300. * @description 转换成对应的 JSON 格式对象。
  24301. * @returns {Object} 对应的 JSON 格式对象。
  24302. */
  24303. toServerJSONObject() {
  24304. var obj = {};
  24305. obj.type = this.type;
  24306. if (this.graphText) {
  24307. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  24308. obj.graphTextFormat = this.graphText.graphTextFormat;
  24309. obj.graphTextStyle = this.graphText.graphTextStyle;
  24310. }
  24311. if (this.flow) {
  24312. obj.flowEnabled = this.flow.flowEnabled;
  24313. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  24314. obj.leaderLineStyle = this.flow.leaderLineStyle;
  24315. }
  24316. if (this.graphAxes) {
  24317. obj.axesColor = this.graphAxes.axesColor;
  24318. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  24319. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  24320. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  24321. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  24322. }
  24323. if (this.graphSize) {
  24324. obj.maxGraphSize = this.graphSize.maxGraphSize;
  24325. obj.minGraphSize = this.graphSize.minGraphSize;
  24326. }
  24327. if (this.offset) {
  24328. obj.offsetFixed = this.offset.offsetFixed;
  24329. obj.offsetX = this.offset.offsetX;
  24330. obj.offsetY = this.offset.offsetY;
  24331. }
  24332. obj.barWidth = this.barWidth;
  24333. obj.graduatedMode = this.graduatedMode;
  24334. obj.graphSizeFixed = this.graphSizeFixed;
  24335. obj.graphType = this.graphType;
  24336. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  24337. obj.items = this.items;
  24338. obj.memoryKeys = this.memoryKeys;
  24339. obj.negativeDisplayed = this.negativeDisplayed;
  24340. obj.overlapAvoided = this.overlapAvoided;
  24341. obj.roseAngle = this.roseAngle;
  24342. obj.startAngle = this.startAngle;
  24343. return obj;
  24344. }
  24345. /**
  24346. * @function SuperMap.ThemeGraph.fromObj
  24347. * @description 从传入对象获取统计专题图类。
  24348. * @param {Object} obj - 传入对象。
  24349. * @returns {SuperMap.ThemeGraph} ThemeGraph 对象。
  24350. */
  24351. static fromObj(obj) {
  24352. var res = new ThemeGraph_ThemeGraph();
  24353. var itemsG = obj.items;
  24354. var len = itemsG ? itemsG.length : 0;
  24355. Util_Util.copy(res, obj);
  24356. res.items = [];
  24357. res.flow = ThemeFlow_ThemeFlow.fromObj(obj);
  24358. res.graphAxes = ThemeGraphAxes_ThemeGraphAxes.fromObj(obj);
  24359. res.graphSize = ThemeGraphSize_ThemeGraphSize.fromObj(obj);
  24360. res.graphText = ThemeGraphText_ThemeGraphText.fromObj(obj);
  24361. res.offset = ThemeOffset_ThemeOffset.fromObj(obj);
  24362. for (var i = 0; i < len; i++) {
  24363. res.items.push(ThemeGraphItem_ThemeGraphItem.fromObj(itemsG[i]));
  24364. }
  24365. return res;
  24366. }
  24367. }
  24368. SuperMap.ThemeGraph = ThemeGraph_ThemeGraph;
  24369. // CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  24370. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24371. * This program are made available under the terms of the Apache License, Version 2.0
  24372. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24373. /**
  24374. * @class SuperMap.ThemeDotDensity
  24375. * @category iServer Map Theme
  24376. * @classdesc 点密度专题图。
  24377. * @description 点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  24378. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  24379. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  24380. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  24381. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  24382. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  24383. * @extends {SuperMap.Theme}
  24384. * @param {Object} options - 参数。
  24385. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  24386. * @param {SuperMap.ServerStyle} [options.style] - 点密度专题图中点的风格。
  24387. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  24388. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24389. */
  24390. class ThemeDotDensity_ThemeDotDensity extends Theme_Theme {
  24391. constructor(options) {
  24392. super("DOTDENSITY", options);
  24393. /**
  24394. * @member {string} SuperMap.ThemeDotDensity.prototype.dotExpression
  24395. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  24396. */
  24397. this.dotExpression = null;
  24398. /**
  24399. * @member {SuperMap.ServerStyle} SuperMap.ThemeDotDensity.prototype.style
  24400. * @description 点密度专题图中点的风格。
  24401. */
  24402. this.style = new ServerStyle_ServerStyle();
  24403. /**
  24404. * @member {number} SuperMap.ThemeDotDensity.prototype.value
  24405. * @description 专题图中每一个点所代表的数值。<br>
  24406. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  24407. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  24408. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  24409. */
  24410. this.value = null;
  24411. if (options) {
  24412. Util_Util.extend(this, options);
  24413. }
  24414. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  24415. }
  24416. /**
  24417. * @function SuperMap.ThemeDotDensity.prototype.destroy
  24418. * @description 释放资源,将引用资源的属性置空。
  24419. */
  24420. destroy() {
  24421. var me = this;
  24422. me.dotExpression = null;
  24423. me.value = null;
  24424. if (me.style) {
  24425. me.style.destroy();
  24426. me.style = null;
  24427. }
  24428. }
  24429. /**
  24430. * @function SuperMap.ThemeDotDensity.prototype.toServerJSONObject
  24431. * @description 转换成对应的 JSON 格式对象。
  24432. * @returns {Object} 对应的 JSON 格式对象。
  24433. */
  24434. toServerJSONObject() {
  24435. var obj = {};
  24436. obj = Util_Util.copyAttributes(obj, this);
  24437. if (obj.style) {
  24438. if (obj.style.toServerJSONObject) {
  24439. obj.style = obj.style.toServerJSONObject();
  24440. }
  24441. }
  24442. return obj;
  24443. }
  24444. /**
  24445. * @function SuperMap.ThemeDotDensity.fromObj
  24446. * @description 从传入对象获取点密度专题图中点的风格。
  24447. * @param {Object} obj - 传入对象。
  24448. * @returns {SuperMap.ThemeDotDensity} ThemeDotDensity 对象。
  24449. */
  24450. static fromObj(obj) {
  24451. if (!obj) {
  24452. return;
  24453. }
  24454. var res = new ThemeDotDensity_ThemeDotDensity();
  24455. Util_Util.copy(res, obj);
  24456. res.style = ServerStyle_ServerStyle.fromJson(obj.style);
  24457. return res;
  24458. }
  24459. }
  24460. SuperMap.ThemeDotDensity = ThemeDotDensity_ThemeDotDensity;
  24461. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  24462. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24463. * This program are made available under the terms of the Apache License, Version 2.0
  24464. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24465. /**
  24466. * @class SuperMap.ThemeGraduatedSymbolStyle
  24467. * @category iServer Map Theme
  24468. * @classdesc 等级符号专题图正负零值显示风格类。
  24469. * @param {Object} options - 参数。
  24470. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  24471. * @param {SuperMap.ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  24472. * @param {SuperMap.ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  24473. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  24474. * @param {SuperMap.ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  24475. */
  24476. class ThemeGraduatedSymbolStyle_ThemeGraduatedSymbolStyle {
  24477. constructor(options) {
  24478. /**
  24479. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  24480. * @description 是否显示负值。
  24481. */
  24482. this.negativeDisplayed = false;
  24483. /**
  24484. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  24485. * @description 负值的等级符号风格。
  24486. */
  24487. this.negativeStyle = new ServerStyle_ServerStyle();
  24488. /**
  24489. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  24490. * @description 正值的等级符号风格。
  24491. */
  24492. this.positiveStyle = new ServerStyle_ServerStyle();
  24493. /**
  24494. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  24495. * @description 是否显示 0 值。
  24496. */
  24497. this.zeroDisplayed = false;
  24498. /**
  24499. * @member {SuperMap.ServerStyle} SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroStyle
  24500. * @description 0 值的等级符号风格。
  24501. */
  24502. this.zeroStyle = new ServerStyle_ServerStyle();
  24503. if (options) {
  24504. Util_Util.extend(this, options);
  24505. }
  24506. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  24507. }
  24508. /**
  24509. * @function SuperMap.ThemeGraduatedSymbolStyle.prototype.destroy
  24510. * @description 释放资源,将引用资源的属性置空。
  24511. */
  24512. destroy() {
  24513. var me = this;
  24514. me.negativeDisplayed = null;
  24515. me.negativeStyle = null;
  24516. me.positiveStyle = null;
  24517. me.zeroDisplayed = null;
  24518. me.zeroStyle = null;
  24519. }
  24520. /**
  24521. * @function SuperMap.ThemeGraduatedSymbolStyle.fromObj
  24522. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  24523. * @param {Object} obj - 传入对象。
  24524. * @returns {SuperMap.ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  24525. */
  24526. static fromObj(obj) {
  24527. if (!obj) {
  24528. return;
  24529. }
  24530. var res = new ThemeGraduatedSymbolStyle_ThemeGraduatedSymbolStyle();
  24531. Util_Util.copy(res, obj);
  24532. res.negativeStyle = ServerStyle_ServerStyle.fromJson(obj.negativeStyle);
  24533. res.positiveStyle = ServerStyle_ServerStyle.fromJson(obj.positiveStyle);
  24534. res.zeroStyle = ServerStyle_ServerStyle.fromJson(obj.zeroStyle);
  24535. return res;
  24536. }
  24537. }
  24538. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle_ThemeGraduatedSymbolStyle;
  24539. // CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  24540. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24541. * This program are made available under the terms of the Apache License, Version 2.0
  24542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24543. /**
  24544. * @class SuperMap.ThemeGraduatedSymbol
  24545. * @category iServer Map Theme
  24546. * @classdesc 等级符号专题图。
  24547. * @extends {SuperMap.Theme}
  24548. * @param {Object} options - 参数。
  24549. * @param {SuperMap.ThemeGraduatedSymbolStyle} options.style - 用于设置等级符号图正负和零值显示风格。
  24550. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  24551. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  24552. * @param {SuperMap.ThemeFlow} [options.flow] - 等级符号专题图符号流动显示与牵引线设置类。
  24553. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  24554. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  24555. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24556. */
  24557. class ThemeGraduatedSymbol_ThemeGraduatedSymbol extends Theme_Theme {
  24558. constructor(options) {
  24559. super("GRADUATEDSYMBOL", options);
  24560. /**
  24561. * @member {number} [SuperMap.ThemeGraduatedSymbol.prototype.baseValue=0]
  24562. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  24563. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  24564. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  24565. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  24566. */
  24567. this.baseValue = 0;
  24568. /**
  24569. * @member {string} SuperMap.ThemeGraduatedSymbol.prototype.expression
  24570. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  24571. */
  24572. this.expression = null;
  24573. /**
  24574. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraduatedSymbol.prototype.flow
  24575. * @description 等级符号专题图符号流动显示与牵引线设置类。<br>
  24576. * 通过该字段可以设置等级符号是否流动显示和牵引线风格。
  24577. */
  24578. this.flow = new ThemeFlow_ThemeFlow();
  24579. /**
  24580. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraduatedSymbol.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  24581. * @description 等级符号专题图分级模式。<br>
  24582. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  24583. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  24584. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  24585. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  24586. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  24587. */
  24588. this.graduatedMode = SuperMap.GraduatedMode.CONSTAN;
  24589. /**
  24590. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeGraduatedSymbol.prototype.offset]
  24591. * @description 用于设置等级符号图相对于要素内点的偏移量。
  24592. */
  24593. this.offset = new ThemeOffset_ThemeOffset();
  24594. /**
  24595. * @member {SuperMap.ThemeGraduatedSymbolStyle} SuperMap.ThemeGraduatedSymbol.prototype.style
  24596. * @description 用于设置等级符号图正负和零值显示风格。
  24597. */
  24598. this.style = new ThemeGraduatedSymbolStyle_ThemeGraduatedSymbolStyle();
  24599. if (options) {
  24600. Util_Util.extend(this, options);
  24601. }
  24602. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  24603. }
  24604. /**
  24605. * @function SuperMap.ThemeGraduatedSymbol.prototype.destroy
  24606. * @description 释放资源,将引用资源的属性置空。
  24607. */
  24608. destroy() {
  24609. super.destroy();
  24610. var me = this;
  24611. me.expression = null;
  24612. if (me.flow) {
  24613. me.flow.destroy();
  24614. me.flow = null;
  24615. }
  24616. me.graduatedMode = GraduatedMode.CONSTANT;
  24617. if (me.offset) {
  24618. me.offset.destroy();
  24619. me.offset = null;
  24620. }
  24621. if (me.style) {
  24622. me.style.destroy();
  24623. me.style = null;
  24624. }
  24625. }
  24626. /**
  24627. * @function SuperMap.ThemeGraduatedSymbol.prototype.toJSON
  24628. * @description 将 themeLabel 对象转化为 JSON 字符串。
  24629. * @returns {string} 返回转换后的 JSON 字符串。
  24630. */
  24631. toJSON() {
  24632. return Util_Util.toJSON(this.toServerJSONObject());
  24633. }
  24634. /**
  24635. * @function SuperMap.ThemeGraduatedSymbol.prototype.toServerJSONObject
  24636. * @description 转换成对应的 JSON 格式对象。
  24637. * @returns {Object} 对应的 JSON 格式对象。
  24638. */
  24639. toServerJSONObject() {
  24640. var obj = {};
  24641. obj.type = this.type;
  24642. obj.memoryData = this.memoryData;
  24643. obj.baseValue = this.baseValue;
  24644. obj.expression = this.expression;
  24645. obj.graduatedMode = this.graduatedMode;
  24646. if (this.flow) {
  24647. obj.flowEnabled = this.flow.flowEnabled;
  24648. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  24649. obj.leaderLineStyle = this.flow.leaderLineStyle;
  24650. }
  24651. if (this.offset) {
  24652. obj.offsetFixed = this.offset.offsetFixed;
  24653. obj.offsetX = this.offset.offsetX;
  24654. obj.offsetY = this.offset.offsetY;
  24655. }
  24656. if (this.style) {
  24657. obj.negativeStyle = this.style.negativeStyle;
  24658. obj.negativeDisplayed = this.style.negativeDisplayed;
  24659. obj.positiveStyle = this.style.positiveStyle;
  24660. obj.zeroDisplayed = this.style.zeroDisplayed;
  24661. obj.zeroStyle = this.style.zeroStyle;
  24662. }
  24663. return obj;
  24664. }
  24665. /**
  24666. * @function SuperMap.ThemeGraduatedSymbol.fromObj
  24667. * @description 从传入对象获取等级符号专题图。
  24668. * @param {Object} obj - 传入对象。
  24669. * @returns {SuperMap.ThemeGraduatedSymbol} 等级符号专题图对象。
  24670. */
  24671. static fromObj(obj) {
  24672. if (!obj) {
  24673. return;
  24674. }
  24675. var res = new SuperMap.ThemeGraduatedSymbol();
  24676. Util_Util.copy(res, obj);
  24677. res.flow = ThemeFlow_ThemeFlow.fromObj(obj);
  24678. res.offset = ThemeOffset_ThemeOffset.fromObj(obj);
  24679. res.style = ThemeGraduatedSymbolStyle_ThemeGraduatedSymbolStyle.fromObj(obj);
  24680. return res;
  24681. }
  24682. }
  24683. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol_ThemeGraduatedSymbol;
  24684. // CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  24685. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24686. * This program are made available under the terms of the Apache License, Version 2.0
  24687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24688. /**
  24689. * @class SuperMap.ThemeRangeItem
  24690. * @category iServer Map Theme
  24691. * @classdesc 范围分段专题图子项类。
  24692. * @description 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  24693. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  24694. * @param {Object} options - 参数。
  24695. * @param {string} [options.caption] - 分段专题图子项的标题。
  24696. * @param {number} [options.end=0] - 分段专题图子项的终止值。
  24697. * @param {number} [options.start=0] - 分段专题图子项的起始值。
  24698. * @param {SuperMap.ServerStyle} options.style - 分段专题图子项的风格。
  24699. * @param {boolean} [options.visible=true] - 分段专题图子项是否可见。
  24700. */
  24701. class ThemeRangeItem_ThemeRangeItem {
  24702. constructor(options) {
  24703. /**
  24704. * @member {string} [SuperMap.ThemeRangeItem.prototype.caption]
  24705. * @description 分段专题图子项的标题。
  24706. */
  24707. this.caption = null;
  24708. /**
  24709. * @member {number} [SuperMap.ThemeRangeItem.prototype.end=0]
  24710. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  24711. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  24712. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  24713. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  24714. */
  24715. this.end = 0;
  24716. /**
  24717. * @member {number} [SuperMap.ThemeRangeItem.prototype.start=0]
  24718. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  24719. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  24720. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  24721. */
  24722. this.start = 0;
  24723. /**
  24724. * @member {SuperMap.ServerStyle} SuperMap.ThemeRangeItem.prototype.style
  24725. * @description 分段专题图子项的风格。
  24726. * 每一个分段专题图子项都对应一种显示风格。
  24727. */
  24728. this.style = new ServerStyle_ServerStyle();
  24729. /**
  24730. * @member {boolean} [SuperMap.ThemeRangeItem.prototype.visible=true]
  24731. * @description 分段专题图子项是否可见。
  24732. */
  24733. this.visible = true;
  24734. if (options) {
  24735. Util_Util.extend(this, options);
  24736. }
  24737. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  24738. }
  24739. /**
  24740. * @function SuperMap.ThemeRangeItem.prototype.destroy
  24741. * @description 释放资源,将引用资源的属性置空。
  24742. */
  24743. destroy() {
  24744. var me = this;
  24745. me.caption = null;
  24746. me.end = null;
  24747. me.start = null;
  24748. if (me.style) {
  24749. me.style.destroy();
  24750. me.style = null;
  24751. }
  24752. me.visible = null;
  24753. }
  24754. /**
  24755. * @function SuperMap.ThemeRangeItem.prototypetoServerJSONObject
  24756. * @description 转换成对应的 JSON 格式对象。
  24757. * @returns {Object} 对应的 JSON 格式对象。
  24758. */
  24759. toServerJSONObject() {
  24760. var obj = {};
  24761. obj = Util_Util.copyAttributes(obj, this);
  24762. if (obj.style) {
  24763. if (obj.style.toServerJSONObject) {
  24764. obj.style = obj.style.toServerJSONObject();
  24765. }
  24766. }
  24767. return obj;
  24768. }
  24769. /**
  24770. * @function SuperMap.ThemeRangeItem.fromObj
  24771. * @description 从传入对象获取范围分段专题图子项类。
  24772. * @param {Object} obj - 传入对象。
  24773. * @returns {SuperMap.ThemeRangeItem} ThemeRangeItem 对象。
  24774. */
  24775. static fromObj(obj) {
  24776. if (!obj) {
  24777. return;
  24778. }
  24779. var res = new ThemeRangeItem_ThemeRangeItem();
  24780. Util_Util.copy(res, obj);
  24781. res.style = ServerStyle_ServerStyle.fromJson(obj.style);
  24782. return res;
  24783. }
  24784. }
  24785. SuperMap.ThemeRangeItem = ThemeRangeItem_ThemeRangeItem;
  24786. // CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  24787. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24788. * This program are made available under the terms of the Apache License, Version 2.0
  24789. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24790. /**
  24791. * @class SuperMap.ThemeRange
  24792. * @category iServer Map Theme
  24793. * @classdesc 范围分段专题图。
  24794. * @description 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  24795. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  24796. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  24797. * @extends {SuperMap.Theme}
  24798. * @param {Object} options - 参数。
  24799. * @param {Array.<SuperMap.ThemeRangeItem>} options.items - 分段专题图子项数组。
  24800. * @param {string} options.rangeExpression - 分段字段表达式。
  24801. * @param {number} options.rangeParameter - 分段参数。
  24802. * @param {number} options.rangeParameter - 分段参数。
  24803. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  24804. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  24805. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24806. */
  24807. class ThemeRange_ThemeRange extends Theme_Theme {
  24808. constructor(options) {
  24809. super("RANGE", options);
  24810. /**
  24811. * @member {string} SuperMap.ThemeRange.prototype.precision
  24812. * @description 精准度
  24813. */
  24814. this.precision = '1.0E-12';
  24815. /**
  24816. * @member {Array.<SuperMap.ThemeRangeItem>} SuperMap.ThemeRange.prototype.items
  24817. * @description 分段专题图子项数组。<br>
  24818. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  24819. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  24820. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  24821. */
  24822. this.items = null;
  24823. /**
  24824. * @member {string} SuperMap.ThemeRange.prototype.rangeExpression
  24825. * @description 分段字段表达式。<br>
  24826. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  24827. */
  24828. this.rangeExpression = null;
  24829. /**
  24830. * @member {SuperMap.RangeMode} [SuperMap.ThemeRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  24831. * @description 分段专题图的分段模式。<br>
  24832. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  24833. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  24834. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  24835. */
  24836. this.rangeMode = RangeMode.EQUALINTERVAL;
  24837. /**
  24838. * @member {number} SuperMap.ThemeRange.prototype.rangeParameter
  24839. * @description 分段参数。
  24840. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  24841. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  24842. */
  24843. this.rangeParameter = 0;
  24844. /**
  24845. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  24846. * @description 渐变颜色枚举类。<br>
  24847. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  24848. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色
  24849. * 方案完成填*充。但如果为某几个子项的风格进行单独设置后(设置了 {@link SuperMap.ThemeUniqueItem} 或 {@link SuperMap.ThemeRangeItem} 类中Style属性),
  24850. * 该配色方案对于这几个子项将不起作用。
  24851. */
  24852. this.colorGradientType = ColorGradientType.YELLOW_RED;
  24853. if (options) {
  24854. Util_Util.extend(this, options);
  24855. }
  24856. this.CLASS_NAME = "SuperMap.ThemeRange";
  24857. }
  24858. /**
  24859. * @function SuperMap.ThemeRange.prototype.destroy
  24860. * @override
  24861. */
  24862. destroy() {
  24863. super.destroy();
  24864. var me = this;
  24865. if (me.items) {
  24866. if (me.items.length > 0) {
  24867. for (var item in me.items) {
  24868. me.items[item].destroy();
  24869. me.items[item] = null;
  24870. }
  24871. }
  24872. me.items = null;
  24873. }
  24874. me.rangeExpression = null;
  24875. me.rangeMode = null;
  24876. me.rangeParameter = null;
  24877. me.colorGradientType = null;
  24878. }
  24879. /**
  24880. * @function SuperMap.ThemeRange.fromObj
  24881. * @description 从传入对象获取范围分段专题图类。
  24882. * @param {Object} obj - 传入对象。
  24883. * @returns {SuperMap.ThemeRange} ThemeRange 对象。
  24884. */
  24885. static fromObj(obj) {
  24886. if (!obj) {
  24887. return;
  24888. }
  24889. var res = new ThemeRange_ThemeRange();
  24890. Util_Util.copy(res, obj);
  24891. var itemsR = obj.items;
  24892. var len = itemsR ? itemsR.length : 0;
  24893. res.items = [];
  24894. for (var i = 0; i < len; i++) {
  24895. res.items.push(ThemeRangeItem_ThemeRangeItem.fromObj(itemsR[i]));
  24896. }
  24897. return res;
  24898. }
  24899. }
  24900. SuperMap.ThemeRange = ThemeRange_ThemeRange;
  24901. // CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  24902. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  24903. * This program are made available under the terms of the Apache License, Version 2.0
  24904. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24905. /**
  24906. * @class SuperMap.UGCLayer
  24907. * @category iServer Map Layer
  24908. * @classdesc UGC 图层类。
  24909. * @param {Object} options - 参数。
  24910. * @param {SuperMap.Bounds} options.bounds - 图层范围。
  24911. * @param {string} options.name - 图层的名称。
  24912. * @param {SuperMap.UGCLayerType} options.type - 图层类型
  24913. * @param {string} [options.caption] - 图层的标题。
  24914. * @param {string} [options.description] - 图层的描述信息。
  24915. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  24916. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  24917. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  24918. */
  24919. class UGCLayer_UGCLayer {
  24920. constructor(options) {
  24921. options = options || {};
  24922. /**
  24923. * @member {SuperMap.Bounds} SuperMap.UGCLayer.prototype.bounds
  24924. * @description 图层范围。
  24925. */
  24926. this.bounds = null;
  24927. /**
  24928. * @member {string} [SuperMap.UGCLayer.prototype.caption]
  24929. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  24930. */
  24931. this.caption = null;
  24932. /**
  24933. * @member {string} SuperMap.UGCLayer.prototype.description
  24934. * @description 图层的描述信息。
  24935. */
  24936. this.description = null;
  24937. /**
  24938. * @member {string} SuperMap.UGCLayer.prototype.name
  24939. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  24940. */
  24941. this.name = null;
  24942. /**
  24943. * @member {boolean} SuperMap.UGCLayer.prototype.queryable
  24944. * @description 图层中的对象是否可以查询。
  24945. */
  24946. this.queryable = null;
  24947. /**
  24948. * @member {Array} SuperMap.UGCLayer.prototype.subLayers
  24949. * @description 子图层集。
  24950. */
  24951. this.subLayers = null;
  24952. /**
  24953. * @member {SuperMap.UGCLayerType} SuperMap.UGCLayer.prototype.type
  24954. * @description 图层类型。
  24955. */
  24956. this.type = null;
  24957. /**
  24958. * @member {boolean} SuperMap.UGCLayer.prototype.visible
  24959. * @description 地图对象在同一范围内时,是否重叠显示。
  24960. */
  24961. this.visible = null;
  24962. Util_Util.extend(this, options);
  24963. this.CLASS_NAME = "SuperMap.UGCLayer";
  24964. }
  24965. /**
  24966. * @function SuperMap.UGCLayer.prototype.destroy
  24967. * @description 释放资源,将引用资源的属性置空。
  24968. */
  24969. destroy() {
  24970. var me = this;
  24971. Util_Util.reset(me);
  24972. }
  24973. /**
  24974. * @function SuperMap.UGCLayer.prototype.fromJson
  24975. * @description 将服务端 JSON 对象转换成当前客户端对象。
  24976. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24977. */
  24978. fromJson(jsonObject) {
  24979. jsonObject = jsonObject ? jsonObject : {};
  24980. Util_Util.extend(this, jsonObject);
  24981. var b = this.bounds;
  24982. if (b) {
  24983. this.bounds = new Bounds_Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  24984. }
  24985. }
  24986. /**
  24987. * @function SuperMap.UGCLayer.prototype.toServerJSONObject
  24988. * @description 转换成对应的 JSON 格式对象。
  24989. * @returns {Object} 对应的 JSON 格式对象。
  24990. */
  24991. toServerJSONObject() {
  24992. var jsonObject = {};
  24993. jsonObject = Util_Util.copyAttributes(jsonObject, this);
  24994. if (jsonObject.bounds) {
  24995. if (jsonObject.bounds.toServerJSONObject) {
  24996. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  24997. }
  24998. }
  24999. return jsonObject;
  25000. }
  25001. }
  25002. SuperMap.UGCLayer = UGCLayer_UGCLayer;
  25003. // CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  25004. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25005. * This program are made available under the terms of the Apache License, Version 2.0
  25006. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25007. /**
  25008. * @class SuperMap.OverlapDisplayedOptions
  25009. * @category iServer Map Layer
  25010. * @classdesc 地图压盖过滤显示选项。
  25011. * @description 在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  25012. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  25013. * @param {Object} options - 参数。
  25014. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  25015. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  25016. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  25017. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  25018. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  25019. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  25020. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  25021. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  25022. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  25023. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  25024. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  25025. */
  25026. class OverlapDisplayedOptions_OverlapDisplayedOptions {
  25027. constructor(options) {
  25028. options = options || {};
  25029. /**
  25030. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  25031. * @description 点和点压盖时是否显示压盖的点对象。
  25032. */
  25033. this.allowPointOverlap = true;
  25034. /**
  25035. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  25036. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  25037. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  25038. */
  25039. this.allowPointWithTextDisplay = true;
  25040. /**
  25041. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  25042. * @description 文本压盖时是否显示压盖的文本对象。
  25043. */
  25044. this.allowTextOverlap = false;
  25045. /**
  25046. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  25047. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  25048. */
  25049. this.allowTextAndPointOverlap = true;
  25050. /**
  25051. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  25052. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  25053. */
  25054. this.allowThemeGraduatedSymbolOverlap = false;
  25055. /**
  25056. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  25057. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  25058. */
  25059. this.allowThemeGraphOverlap = false;
  25060. /**
  25061. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  25062. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  25063. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  25064. */
  25065. this.horizontalOverlappedSpaceSize = 0;
  25066. /**
  25067. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  25068. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  25069. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  25070. */
  25071. this.verticalOverlappedSpaceSize = 0;
  25072. Util_Util.extend(this, options);
  25073. this.ugcLayer = new UGCLayer_UGCLayer(options);
  25074. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  25075. }
  25076. /**
  25077. * @function SuperMap.OverlapDisplayedOptions.prototype.destroy
  25078. * @description 释放资源,将资源的属性置空。
  25079. */
  25080. destroy() {
  25081. Util_Util.reset(this);
  25082. }
  25083. /**
  25084. * @function SuperMap.OverlapDisplayedOptions.prototype.fromJson
  25085. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25086. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25087. */
  25088. fromJson(jsonObject) {
  25089. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  25090. }
  25091. /**
  25092. * @function SuperMap.OverlapDisplayedOptions.prototype.toServerJSONObject
  25093. * @description 转换成对应的 JSON 格式对象。
  25094. * @returns {Object} 对应的 JSON 格式对象。
  25095. */
  25096. toServerJSONObject() {
  25097. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  25098. return jsonObject;
  25099. }
  25100. /**
  25101. * @function SuperMap.OverlapDisplayedOptions.prototype.toString
  25102. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  25103. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  25104. */
  25105. toString() {
  25106. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  25107. var str = "{";
  25108. for (var attr in jsonObject) {
  25109. if (jsonObject.hasOwnProperty(attr)) {
  25110. str += "'" + attr + "':" + jsonObject[attr] + ",";
  25111. }
  25112. }
  25113. str = str.substr(0, str.length - 1);
  25114. str += "}";
  25115. return str;
  25116. }
  25117. }
  25118. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions_OverlapDisplayedOptions;
  25119. // CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  25120. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25121. * This program are made available under the terms of the Apache License, Version 2.0
  25122. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25123. /**
  25124. * @class SuperMap.UGCMapLayer
  25125. * @category iServer Map Layer
  25126. * @classdesc UGC 地图图层类。
  25127. * @extends {SuperMap.UGCLayer}
  25128. * @param {Object} options - 参数。
  25129. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  25130. * @param {number} [options.maxScale] - 地图最大比例尺。
  25131. * @param {number} [options.minScale] - 地图最小比例尺。
  25132. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  25133. * @param {number} [options.opaqueRate] - 图层的不透明度。
  25134. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  25135. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  25136. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  25137. * @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  25138. */
  25139. class UGCMapLayer_UGCMapLayer extends UGCLayer_UGCLayer {
  25140. constructor(options) {
  25141. options = options || {};
  25142. super(options);
  25143. /**
  25144. * @member {boolean} SuperMap.UGCMapLayer.prototype.completeLineSymbolDisplayed
  25145. * @description 是否显示完整线型。
  25146. */
  25147. this.completeLineSymbolDisplayed = null;
  25148. /**
  25149. * @member {number} SuperMap.UGCMapLayer.prototype.maxScale
  25150. * @description 地图最大比例尺。
  25151. */
  25152. this.maxScale = null;
  25153. /**
  25154. * @member {number} SuperMap.UGCMapLayer.prototype.minScale
  25155. * @description 地图最小比例尺。
  25156. */
  25157. this.minScale = null;
  25158. /**
  25159. * @member {number} SuperMap.UGCMapLayer.prototype.minVisibleGeometrySize
  25160. * @description 几何对象的最小可见大小,以像素为单位。
  25161. */
  25162. this.minVisibleGeometrySize = null;
  25163. /**
  25164. * @member {number} SuperMap.UGCMapLayer.prototype.opaqueRate
  25165. * @description 图层的不透明度。
  25166. */
  25167. this.opaqueRate = null;
  25168. /**
  25169. * @member {boolean} SuperMap.UGCMapLayer.prototype.symbolScalable
  25170. * @description 是否允许图层的符号大小随图缩放。
  25171. */
  25172. this.symbolScalable = null;
  25173. /**
  25174. * @member {number} SuperMap.UGCMapLayer.prototype.symbolScale
  25175. * @description 图层的符号缩放基准比例尺。
  25176. */
  25177. this.symbolScale = null;
  25178. /**
  25179. * @member {boolean} [SuperMap.UGCMapLayer.prototype.overlapDisplayed=false]
  25180. * @description 地图对象在同一范围内时,是否重叠显示。
  25181. */
  25182. this.overlapDisplayed = null;
  25183. /**
  25184. * @member {SuperMap.OverlapDisplayedOptions} SuperMap.UGCMapLayer.prototype.overlapDisplayedOptions
  25185. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  25186. */
  25187. this.overlapDisplayedOptions = null;
  25188. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  25189. }
  25190. /**
  25191. * @function SuperMap.UGCMapLayer.prototype.destroy
  25192. * @override
  25193. */
  25194. destroy() {
  25195. super.destroy();
  25196. Util_Util.reset(this);
  25197. }
  25198. /**
  25199. * @function SuperMap.UGCMapLayer.prototype.fromJson
  25200. * @description 将服务端 JSON 对象转换成当前客户端对象
  25201. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25202. */
  25203. fromJson(jsonObject) {
  25204. super.fromJson(jsonObject);
  25205. }
  25206. /**
  25207. * @function SuperMap.UGCMapLayer.prototype.toServerJSONObject
  25208. * @description 转换成对应的 JSON 格式对象。
  25209. * @returns {Object} 对应的 JSON 格式对象。
  25210. */
  25211. toServerJSONObject() {
  25212. return super.toServerJSONObject();
  25213. }
  25214. }
  25215. SuperMap.UGCMapLayer = UGCMapLayer_UGCMapLayer;
  25216. // CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  25217. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25218. * This program are made available under the terms of the Apache License, Version 2.0
  25219. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25220. /**
  25221. * @class SuperMap.UGCSubLayer
  25222. * @category iServer Map Layer
  25223. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  25224. * @extends {SuperMap.UGCMapLayer}
  25225. * @param {Object} options - 参数。
  25226. * @param {SuperMap.DatasetInfo} options.datasetInfo - 数据集信息。
  25227. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  25228. * @param {SuperMap.JoinItem} [options.joinItems] - 连接信息类。
  25229. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  25230. * @param {SuperMap.LayerType} [options.ugcLayerType] - 图层类型。
  25231. */
  25232. class UGCSubLayer_UGCSubLayer extends UGCMapLayer_UGCMapLayer {
  25233. constructor(options) {
  25234. options = options || {};
  25235. super(options);
  25236. /**
  25237. * @member {SuperMap.DatasetInfo} SuperMap.UGCSubLayer.prototype.datasetInfo
  25238. * @description 数据集信息。
  25239. */
  25240. this.datasetInfo = null;
  25241. /**
  25242. * @member {string} SuperMap.UGCSubLayer.prototype.displayFilter
  25243. * @description 图层显示过滤条件。
  25244. */
  25245. this.displayFilter = null;
  25246. /**
  25247. * @member {SuperMap.JoinItem} SuperMap.UGCSubLayer.prototype.joinItems
  25248. * @description 连接信息类。
  25249. */
  25250. this.joinItems = null;
  25251. /**
  25252. * @member {string} SuperMap.UGCSubLayer.prototype.representationField
  25253. * @description 存储制图表达信息的字段。
  25254. */
  25255. this.representationField = null;
  25256. /**
  25257. * @member {SuperMap.LayerType} SuperMap.UGCSubLayer.prototype.ugcLayerType
  25258. * @description 图层类型。
  25259. */
  25260. this.ugcLayerType = null;
  25261. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  25262. }
  25263. /**
  25264. * @function SuperMap.UGCSubLayer.prototype.fromJson
  25265. * @description 将服务端 JSON 对象转换成当前客户端对象
  25266. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25267. */
  25268. fromJson(jsonObject) {
  25269. super.fromJson(jsonObject);
  25270. if (this.datasetInfo) {
  25271. this.datasetInfo = new DatasetInfo_DatasetInfo(this.datasetInfo);
  25272. }
  25273. if (this.joinItems && this.joinItems.length) {
  25274. var newJoinItems = [];
  25275. for (var i = 0; i < this.joinItems.length; i++) {
  25276. newJoinItems[i] = new JoinItem_JoinItem(this.joinItems[i]);
  25277. }
  25278. this.joinItems = newJoinItems;
  25279. }
  25280. }
  25281. /**
  25282. * @function SuperMap.UGCSubLayer.prototype.destroy
  25283. * @override
  25284. */
  25285. destroy() {
  25286. super.destroy();
  25287. Util_Util.reset(this);
  25288. }
  25289. /**
  25290. * @function SuperMap.UGCSubLayer.prototype.toServerJSONObject
  25291. * @description 转换成对应的 JSON 格式对象。
  25292. * @returns {Object} 对应的 JSON 格式对象。
  25293. */
  25294. toServerJSONObject() {
  25295. var jsonObject = super.toServerJSONObject();
  25296. if (jsonObject.joinItems) {
  25297. var joinItems = [];
  25298. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  25299. if (jsonObject.joinItems[i].toServerJSONObject) {
  25300. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  25301. }
  25302. }
  25303. jsonObject.joinItems = joinItems;
  25304. }
  25305. if (jsonObject.datasetInfo) {
  25306. if (jsonObject.datasetInfo.toServerJSONObject) {
  25307. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  25308. }
  25309. }
  25310. return jsonObject;
  25311. }
  25312. }
  25313. SuperMap.UGCSubLayer = UGCSubLayer_UGCSubLayer;
  25314. // CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  25315. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25316. * This program are made available under the terms of the Apache License, Version 2.0
  25317. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25318. /**
  25319. * @class SuperMap.ServerTheme
  25320. * @category iServer Map Theme
  25321. * @classdesc UGC 专题图图层类。
  25322. * @extends {SuperMap.UGCSubLayer}
  25323. * @param {SuperMap.Theme} theme - 专题图对象。
  25324. * @param {SuperMap.LonLat} themeElementPosition - 专题图元素位置。
  25325. */
  25326. class ServerTheme_ServerTheme extends UGCSubLayer_UGCSubLayer {
  25327. constructor(options) {
  25328. options = options || {};
  25329. super(options);
  25330. /**
  25331. * @member {SuperMap.Theme} SuperMap.ServerTheme.prototype.theme
  25332. * @description 专题图对象。
  25333. */
  25334. this.theme = null;
  25335. /**
  25336. * @member {SuperMap.LonLat} SuperMap.ServerTheme.prototype.themeElementPosition
  25337. * @description 专题图元素位置。
  25338. */
  25339. this.themeElementPosition = null;
  25340. this.CLASS_NAME = "SuperMap.ServerTheme";
  25341. }
  25342. /**
  25343. * @function SuperMap.ServerTheme.prototype.destroy
  25344. * @override
  25345. */
  25346. destroy() {
  25347. super.destroy();
  25348. Util_Util.reset(this);
  25349. }
  25350. /**
  25351. * @function SuperMap.ServerTheme.prototype.fromJson
  25352. * @description 将服务端 JSON 对象转换成当前客户端对象
  25353. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25354. */
  25355. fromJson(jsonObject) {
  25356. super.fromJson(jsonObject);
  25357. var themeObj = this.theme;
  25358. var themeT = themeObj && themeObj.type;
  25359. switch (themeT) {
  25360. case 'LABEL':
  25361. this.theme = ThemeLabel_ThemeLabel.fromObj(themeObj);
  25362. break;
  25363. case 'UNIQUE':
  25364. this.theme = ThemeUnique_ThemeUnique.fromObj(themeObj);
  25365. break;
  25366. case 'GRAPH':
  25367. this.theme = ThemeGraph_ThemeGraph.fromObj(themeObj);
  25368. break;
  25369. case 'DOTDENSITY':
  25370. this.theme = ThemeDotDensity_ThemeDotDensity.fromObj(themeObj);
  25371. break;
  25372. case 'GRADUATEDSYMBOL':
  25373. this.theme = ThemeGraduatedSymbol_ThemeGraduatedSymbol.fromObj(themeObj);
  25374. break;
  25375. case 'RANGE':
  25376. this.theme = ThemeRange_ThemeRange.fromObj(themeObj);
  25377. break;
  25378. default:
  25379. break;
  25380. }
  25381. if (this.themeElementPosition) {
  25382. //待测试
  25383. this.themeElementPosition = new LonLat_LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  25384. }
  25385. }
  25386. /**
  25387. * @function SuperMap.ServerTheme.prototype.toServerJSONObject
  25388. * @description 转换成对应的 JSON 格式对象。
  25389. */
  25390. toServerJSONObject() {
  25391. //普通属性直接赋值
  25392. var jsonObject = super.toServerJSONObject();
  25393. if (jsonObject.themeElementPosition) {
  25394. if (jsonObject.themeElementPosition.toServerJSONObject) {
  25395. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  25396. }
  25397. }
  25398. if (jsonObject.theme) {
  25399. if (jsonObject.theme.toServerJSONObject) {
  25400. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  25401. }
  25402. }
  25403. return jsonObject;
  25404. }
  25405. }
  25406. SuperMap.ServerTheme = ServerTheme_ServerTheme;
  25407. // CONCATENATED MODULE: ./src/common/iServer/Grid.js
  25408. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25409. * This program are made available under the terms of the Apache License, Version 2.0
  25410. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25411. /**
  25412. * @class SuperMap.Grid
  25413. * @category iServer Map Layer
  25414. * @classdesc UGC 栅格图层类。
  25415. * @extends {SuperMap.UGCSubLayer}
  25416. * @param {Object} options - 参数。
  25417. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  25418. * @param {number} [options.brightness] - Grid 图层的亮度。
  25419. * @param {SuperMap.ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  25420. * @param {SuperMap.ServerColor} [options.colors] - 颜色表对象。
  25421. * @param {number} [options.contrast] - Grid 图层的对比度。
  25422. * @param {SuperMap.GridType} [options.gridType] - 格网类型。
  25423. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  25424. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  25425. * @param {SuperMap.ServerStyle} [options.solidStyle] - 格网实线的样式。
  25426. * @param {SuperMap.ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  25427. * @param {number} [options.specialValue] - 图层的特殊值。
  25428. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  25429. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  25430. */
  25431. class Grid_Grid extends UGCSubLayer_UGCSubLayer {
  25432. constructor(options) {
  25433. options = options || {};
  25434. super(options);
  25435. /**
  25436. * @member {Array.<SuperMap.ColorDictionary>} SuperMap.Grid.prototype.colorDictionarys
  25437. * @description 颜色对照表对象。
  25438. */
  25439. this.colorDictionarys = null;
  25440. /**
  25441. * @member {number} SuperMap.Grid.prototype.brightness
  25442. * @description Grid 图层的亮度。
  25443. */
  25444. this.brightness = null;
  25445. /**
  25446. * @member {SuperMap.ColorGradientType} SuperMap.Grid.prototype.colorGradientType
  25447. * @description 渐变颜色枚举值。
  25448. */
  25449. this.colorGradientType = null;
  25450. /**
  25451. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.colors
  25452. * @description 颜色表对象。
  25453. */
  25454. this.colors = null;
  25455. /**
  25456. * @member {number} SuperMap.Grid.prototype.contrast
  25457. * @description Grid 图层的对比度。
  25458. */
  25459. this.contrast = null;
  25460. /**
  25461. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.dashStyle
  25462. * @description 栅格数据集特殊值数据的颜色。
  25463. */
  25464. this.dashStyle = null;
  25465. /**
  25466. * @member {SuperMap.GridType} SuperMap.Grid.prototype.gridType
  25467. * @description 格网类型。
  25468. */
  25469. this.gridType = null;
  25470. /**
  25471. * @member {number} SuperMap.Grid.prototype.horizontalSpacing
  25472. * @description 格网水平间隔大小。
  25473. */
  25474. this.horizontalSpacing = null;
  25475. /**
  25476. * @member {boolean} SuperMap.Grid.prototype.sizeFixed
  25477. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  25478. */
  25479. this.sizeFixed = null;
  25480. /**
  25481. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.solidStyle
  25482. * @description 格网实线的样式。
  25483. */
  25484. this.solidStyle = null;
  25485. /**
  25486. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.specialColor
  25487. * @description 栅格数据集无值数据的颜色。
  25488. */
  25489. this.specialColor = null;
  25490. /**
  25491. * @member {number} SuperMap.Grid.prototype.specialValue
  25492. * @description 图层的特殊值。
  25493. */
  25494. this.specialValue = null;
  25495. /**
  25496. * @member {boolean} SuperMap.Grid.prototype.specialValueTransparent
  25497. * @description 图层的特殊值(specialValue)所处区域是否透明。
  25498. */
  25499. this.specialValueTransparent = null;
  25500. /**
  25501. * @member {number} SuperMap.Grid.prototype.verticalSpacing
  25502. * @description 格网垂直间隔大小。
  25503. */
  25504. this.verticalSpacing = null;
  25505. this.CLASS_NAME = "SuperMap.Grid";
  25506. }
  25507. /**
  25508. * @function SuperMap.Grid.prototype.destroy
  25509. * @description 释放资源,将引用资源的属性置空。
  25510. */
  25511. destroy() {
  25512. super.destroy();
  25513. Util_Util.reset(this);
  25514. }
  25515. /**
  25516. * @function SuperMap.Grid.prototype.fromJson
  25517. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25518. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25519. */
  25520. fromJson(jsonObject) {
  25521. super.fromJson(jsonObject);
  25522. if (this.specialColor) {
  25523. this.specialColor = new ServerColor(this.specialColor.red,
  25524. this.specialColor.green,
  25525. this.specialColor.blue);
  25526. }
  25527. if (this.colors) {
  25528. var colors = [],
  25529. color;
  25530. for (var i in this.colors) {
  25531. color = this.colors[i];
  25532. colors.push(new ServerColor(color.red, color.green, color.blue));
  25533. }
  25534. this.colors = colors;
  25535. }
  25536. if (this.dashStyle) {
  25537. this.dashStyle = new ServerStyle_ServerStyle(this.dashStyle);
  25538. }
  25539. if (this.solidStyle) {
  25540. this.solidStyle = new ServerStyle_ServerStyle(this.solidStyle);
  25541. }
  25542. if (this.colorDictionary) {
  25543. var colorDics = [],
  25544. colorDic;
  25545. for (var key in this.colorDictionary) {
  25546. colorDic = this.colorDictionary[key];
  25547. colorDics.push(new ColorDictionary_ColorDictionary({elevation: key, color: colorDic}));
  25548. }
  25549. this.colorDictionarys = colorDics;
  25550. }
  25551. delete this.colorDictionary;
  25552. }
  25553. /**
  25554. * @function SuperMap.Grid.prototype.toServerJSONObject
  25555. * @description 转换成对应的 JSON 对象。
  25556. * @returns JSON 对象。
  25557. */
  25558. toServerJSONObject() {
  25559. var jsonObject = super.toServerJSONObject();
  25560. if (jsonObject.dashStyle) {
  25561. if (jsonObject.dashStyle.toServerJSONObject) {
  25562. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  25563. }
  25564. }
  25565. if (jsonObject.solidStyle) {
  25566. if (jsonObject.solidStyle.toServerJSONObject) {
  25567. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  25568. }
  25569. }
  25570. return jsonObject;
  25571. }
  25572. }
  25573. SuperMap.Grid = Grid_Grid;
  25574. // CONCATENATED MODULE: ./src/common/iServer/Image.js
  25575. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25576. * This program are made available under the terms of the Apache License, Version 2.0
  25577. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25578. /**
  25579. * @class SuperMap.Image
  25580. * @category iServer Map Layer
  25581. * @classdesc UGC 影像图层类
  25582. * @extends {SuperMap.UGCSubLayer}
  25583. * @param {Object} options - 参数。
  25584. * @param {SuperMap.ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  25585. * @param {number} [options.brightness] - 影像图层的亮度。
  25586. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  25587. * @param {number} [options.contrast] - 影像图层的对比度。
  25588. * @param {boolean} [options.transparent] - 是否背景透明。
  25589. * @param {SuperMap.ServerColor} [options.transparentColor] - 返回背景透明色。
  25590. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  25591. */
  25592. class Image_UGCImage extends UGCSubLayer_UGCSubLayer {
  25593. constructor(options) {
  25594. options = options || {};
  25595. super(options);
  25596. /**
  25597. * @member {number} SuperMap.Image.prototype.brightness
  25598. * @description 影像图层的亮度。
  25599. */
  25600. this.brightness = null;
  25601. /**
  25602. * @member {SuperMap.ColorSpaceType} SuperMap.Image.prototype.colorSpaceType
  25603. * @description 返回影像图层的色彩显示模式。
  25604. */
  25605. this.colorSpaceType = null;
  25606. /**
  25607. * @member {number} SuperMap.Image.prototype.contrast
  25608. * @description 影像图层的对比度。
  25609. */
  25610. this.contrast = null;
  25611. /**
  25612. * @member {Array.<number>} SuperMap.Image.prototype.displayBandIndexes
  25613. * @description 返回当前影像图层显示的波段索引。
  25614. */
  25615. this.displayBandIndexes = null;
  25616. /**
  25617. * @member {boolean} SuperMap.Image.prototype.transparent
  25618. * @description 是否背景透明。
  25619. */
  25620. this.transparent = null;
  25621. /**
  25622. * @member {SuperMap.ServerColor} SuperMap.Image.prototype.transparentColor
  25623. * @description 返回背景透明色。
  25624. */
  25625. this.transparentColor = null;
  25626. /**
  25627. * @member {number} SuperMap.Image.prototype.transparentColorTolerance
  25628. * @description 背景透明色容限。
  25629. */
  25630. this.transparentColorTolerance = null;
  25631. this.CLASS_NAME = "SuperMap.Image";
  25632. }
  25633. /**
  25634. * @function SuperMap.Image.prototype.destroy
  25635. * @override
  25636. */
  25637. destroy() {
  25638. super.destroy();
  25639. Util_Util.reset(this);
  25640. }
  25641. /**
  25642. * @function SuperMap.Image.prototype.fromJson
  25643. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25644. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25645. */
  25646. fromJson(jsonObject) {
  25647. super.fromJson(jsonObject);
  25648. if (this.transparentColor) {
  25649. this.transparentColor = new ServerColor(this.transparentColor.red,
  25650. this.transparentColor.green,
  25651. this.transparentColor.blue);
  25652. }
  25653. }
  25654. /**
  25655. * @function SuperMap.Image.prototype.toServerJSONObject
  25656. * @description 转换成对应的 JSON 格式对象。
  25657. */
  25658. toServerJSONObject() {
  25659. return super.toServerJSONObject();
  25660. }
  25661. }
  25662. SuperMap.Image = Image_UGCImage;
  25663. // CONCATENATED MODULE: ./src/common/iServer/Vector.js
  25664. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25665. * This program are made available under the terms of the Apache License, Version 2.0
  25666. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25667. /**
  25668. * @class SuperMap.Vector
  25669. * @category iServer Map TileFeature
  25670. * @classdesc UGC 矢量图层类。
  25671. * @extends {SuperMap.UGCSubLayer}
  25672. * @param {Object} options - 参数。
  25673. * @param {SuperMap.ServerStyle} [options.style] - 矢量图层的风格。
  25674. */
  25675. class iServer_Vector_Vector extends UGCSubLayer_UGCSubLayer {
  25676. constructor(options) {
  25677. options = options || {};
  25678. super(options);
  25679. /**
  25680. * @member {SuperMap.ServerStyle} SuperMap.Vector.prototype.style
  25681. * @description 矢量图层的风格。
  25682. */
  25683. this.style = null;
  25684. this.CLASS_NAME = "SuperMap.Vector";
  25685. }
  25686. /**
  25687. * @function SuperMap.Vector.prototype.destroy
  25688. * @override
  25689. */
  25690. destroy() {
  25691. super.destroy();
  25692. Util_Util.reset(this);
  25693. }
  25694. /**
  25695. * @function SuperMap.Vector.prototype.fromJson
  25696. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25697. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25698. */
  25699. fromJson(jsonObject) {
  25700. super.fromJson(jsonObject);
  25701. var sty = this.style;
  25702. if (sty) {
  25703. this.style = new ServerStyle_ServerStyle(sty);
  25704. }
  25705. }
  25706. /**
  25707. * @function SuperMap.Vector.prototype.toServerJSONObject
  25708. * @description 转换成对应的 JSON 格式对象。
  25709. * @returns {Object} 对应的 JSON 格式对象
  25710. */
  25711. toServerJSONObject() {
  25712. var jsonObject = SuperMap.toServerJSONObject();
  25713. if (jsonObject.style) {
  25714. if (jsonObject.style.toServerJSONObject) {
  25715. jsonObject.style = jsonObject.style.toServerJSONObject();
  25716. }
  25717. }
  25718. return jsonObject;
  25719. }
  25720. }
  25721. SuperMap.Vector = iServer_Vector_Vector;
  25722. // CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  25723. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25724. * This program are made available under the terms of the Apache License, Version 2.0
  25725. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25726. /**
  25727. * @class SuperMap.GetLayersInfoService
  25728. * @category iServer Map Layer
  25729. * @classdesc 获取图层信息服务类构造函数。
  25730. * @extends {SuperMap.CommonServiceBase}
  25731. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  25732. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  25733. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  25734. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  25735. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  25736. * @param {Object} options - 参数。
  25737. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  25738. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  25739. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  25740. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  25741. * @param {Object} [options.headers] - 请求头。
  25742. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  25743. */
  25744. class GetLayersInfoService_GetLayersInfoService extends CommonServiceBase_CommonServiceBase {
  25745. constructor(url, options) {
  25746. super(url, options);
  25747. /**
  25748. * @member {boolean} SuperMap.GetLayersInfoService.prototype.isTempLayers
  25749. * @description 当前url对应的图层是否是临时图层。
  25750. */
  25751. this.isTempLayers = false;
  25752. if (options) {
  25753. Util_Util.extend(this, options);
  25754. }
  25755. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  25756. }
  25757. /**
  25758. * @function SuperMap.GetLayersInfoService.prototype.destroy
  25759. * @override
  25760. */
  25761. destroy() {
  25762. super.destroy();
  25763. Util_Util.reset(this);
  25764. }
  25765. /**
  25766. * @function SuperMap.GetLayersInfoService.prototype.processAsync
  25767. * @description 负责将客户端的更新参数传递到服务端。
  25768. */
  25769. processAsync() {
  25770. var me = this,
  25771. method = "GET";
  25772. if (!me.isTempLayers) {
  25773. me.url = Util_Util.urlPathAppend(me.url, 'layers');
  25774. }
  25775. me.request({
  25776. method: method,
  25777. params: null,
  25778. scope: me,
  25779. success: me.serviceProcessCompleted,
  25780. failure: me.serviceProcessFailed
  25781. });
  25782. }
  25783. /**
  25784. * @function SuperMap.GetLayersInfoService.prototype.serviceProcessCompleted
  25785. * @description 编辑完成,执行此方法。
  25786. * @param {Object} result - 服务器返回的结果对象。
  25787. */
  25788. serviceProcessCompleted(result) {
  25789. var me = this, existRes, layers, len;
  25790. result = Util_Util.transformResult(result);
  25791. existRes = !!result && result.length > 0;
  25792. layers = existRes ? result[0].subLayers.layers : null;
  25793. len = layers ? layers.length : 0;
  25794. me.handleLayers(len, layers);
  25795. me.events.triggerEvent("processCompleted", {result: result[0]});
  25796. }
  25797. /**
  25798. * TODO 专题图时候可能会用到
  25799. * @function SuperMap.GetLayersInfoService.prototype.handleLayers
  25800. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  25801. * @param {number} len - subLayers.layers的长度
  25802. * @param {Array.<number>} layers - subLayers.layers的长度数组
  25803. */
  25804. handleLayers(len, layers) {
  25805. var me = this, tempLayer;
  25806. if (len) {
  25807. for (var i = 0; i < len; i++) {
  25808. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  25809. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  25810. } else {
  25811. var type = layers[i].ugcLayerType;
  25812. switch (type) {
  25813. case 'THEME':
  25814. tempLayer = new ServerTheme_ServerTheme();
  25815. tempLayer.fromJson(layers[i]);
  25816. layers[i] = tempLayer;
  25817. break;
  25818. case 'GRID':
  25819. tempLayer = new Grid_Grid();
  25820. tempLayer.fromJson(layers[i]);
  25821. layers[i] = tempLayer;
  25822. break;
  25823. case 'IMAGE':
  25824. tempLayer = new Image_UGCImage();
  25825. tempLayer.fromJson(layers[i]);
  25826. layers[i] = tempLayer;
  25827. break;
  25828. case 'VECTOR':
  25829. tempLayer = new iServer_Vector_Vector();
  25830. tempLayer.fromJson(layers[i]);
  25831. layers[i] = tempLayer;
  25832. break;
  25833. default:
  25834. break;
  25835. }
  25836. }
  25837. }
  25838. }
  25839. }
  25840. }
  25841. SuperMap.GetLayersInfoService = GetLayersInfoService_GetLayersInfoService;
  25842. // CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  25843. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25844. * This program are made available under the terms of the Apache License, Version 2.0
  25845. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25846. /**
  25847. * @class SuperMap.InterpolationAnalystParameters
  25848. * @category iServer SpatialAnalyst InterpolationAnalyst
  25849. * @classdesc 插值分析参数类。
  25850. * @param {Object} options - 参数。
  25851. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  25852. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  25853. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  25854. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。
  25855. * @param {string} [options.dataset] - 用于做插值分析的数据源中数据集的名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  25856. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  25857. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  25858. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  25859. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25860. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  25861. * @param {SuperMap.PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  25862. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  25863. */
  25864. class InterpolationAnalystParameters_InterpolationAnalystParameters {
  25865. constructor(options) {
  25866. if (!options) {
  25867. return;
  25868. }
  25869. /**
  25870. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.InterpolationAnalystParameters.prototype.bounds
  25871. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  25872. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  25873. * 因此建议此参数不大于原数据集范围。
  25874. */
  25875. this.bounds = null;
  25876. /**
  25877. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.searchRadius=0]
  25878. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  25879. * 计算某个位置的Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  25880. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  25881. */
  25882. this.searchRadius = 0;
  25883. /**
  25884. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.zValueFieldName
  25885. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  25886. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  25887. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  25888. */
  25889. this.zValueFieldName = null;
  25890. /**
  25891. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.zValueScale=1]
  25892. * @description 用于进行插值分析值的缩放比率。
  25893. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  25894. */
  25895. this.zValueScale = 1;
  25896. /**
  25897. * @member {number} SuperMap.InterpolationAnalystParameters.prototype.resolution
  25898. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25899. * 该值不能超过待分析数据集的范围边长。
  25900. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  25901. */
  25902. this.resolution = null;
  25903. /**
  25904. * @member {SuperMap.FilterParameter} [SuperMap.InterpolationAnalystParameters.prototype.filterQueryParameter]
  25905. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  25906. */
  25907. this.filterQueryParameter = null;
  25908. /**
  25909. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasetName
  25910. * @description 插值分析结果数据集的名称。
  25911. */
  25912. this.outputDatasetName = null;
  25913. /**
  25914. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasourceName
  25915. * @description 插值分析结果数据源的名称。
  25916. */
  25917. this.outputDatasourceName = null;
  25918. /**
  25919. * @member {SuperMap.PixelFormat} [SuperMap.InterpolationAnalystParameters.prototype.pixelFormat]
  25920. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  25921. */
  25922. this.pixelFormat = null;
  25923. /**
  25924. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.dataset]
  25925. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  25926. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  25927. */
  25928. this.dataset = null;
  25929. /**
  25930. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [SuperMap.InterpolationAnalystParameters.prototype.inputPoints]
  25931. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  25932. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  25933. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  25934. */
  25935. this.inputPoints = null;
  25936. /**
  25937. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  25938. * @description 插值分析类型。差值分析包括数据集插值分析和几何插值分析两类,
  25939. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  25940. */
  25941. this.InterpolationAnalystType = "dataset";
  25942. /**
  25943. * @member {Object} SuperMap.InterpolationAnalystParameters.prototype.clipParam
  25944. * @description 对插值分析结果进行裁剪的参数。
  25945. */
  25946. this.clipParam = null;
  25947. Util_Util.extend(this, options);
  25948. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  25949. }
  25950. /**
  25951. * @function SuperMap.InterpolationAnalystParameters.prototype.destroy
  25952. * @description 释放资源,将引用资源的属性置空。
  25953. */
  25954. destroy() {
  25955. var me = this;
  25956. me.bounds = null;
  25957. me.searchRadius = null;
  25958. me.zValueFieldName = null;
  25959. me.zValueScale = null;
  25960. me.resolution = null;
  25961. me.filterQueryParameter = null;
  25962. me.outputDatasetName = null;
  25963. me.pixelFormat = null;
  25964. }
  25965. /**
  25966. * @function SuperMap.InterpolationAnalystParameters.toObject
  25967. * @param {SuperMap.InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  25968. * @param {SuperMap.InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  25969. * @description 将插值分析参数对象转换成 JSON 对象。
  25970. * @returns JSON 对象。
  25971. */
  25972. static toObject(interpolationAnalystParameters, tempObj) {
  25973. for (var name in interpolationAnalystParameters) {
  25974. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  25975. var objs = [];
  25976. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  25977. var item = interpolationAnalystParameters.inputPoints[i];
  25978. var obj = {
  25979. x: item.x,
  25980. y: item.y,
  25981. z: item.tag
  25982. };
  25983. objs.push(obj);
  25984. }
  25985. tempObj[name] = objs;
  25986. } else {
  25987. tempObj[name] = interpolationAnalystParameters[name];
  25988. }
  25989. }
  25990. }
  25991. }
  25992. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters_InterpolationAnalystParameters;
  25993. // CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  25994. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  25995. * This program are made available under the terms of the Apache License, Version 2.0
  25996. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25997. /**
  25998. * @class SuperMap.InterpolationRBFAnalystParameters
  25999. * @category iServer SpatialAnalyst InterpolationAnalyst
  26000. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  26001. * @extends {SuperMap.InterpolationAnalystParameters}
  26002. * @param {Object} options - 参数。
  26003. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26004. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  26005. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26006. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26007. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  26008. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  26009. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  26010. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与差值运算的点数。
  26011. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  26012. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  26013. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  26014. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26015. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26016. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26017. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26018. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此参数为必选。
  26019. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此参数为必选。
  26020. * @example
  26021. * var myInterpolationRBFAnalystParameters = new SuperMap.InterpolationRBFAnalystParameters({
  26022. * dataset:"SamplesP@Interpolation",
  26023. * smooth: 0.1,
  26024. * tension: 40,
  26025. * searchMode: "QUADTREE",
  26026. * maxPointCountForInterpolation: 20,
  26027. * maxPointCountInNode: 5,
  26028. * pixelFormat: "BIT16",
  26029. * zValueFieldName: "AVG_TMP",
  26030. * resolution: 3000,
  26031. * filterQueryParameter: {
  26032. * attributeFilter: ""
  26033. * },
  26034. * outputDatasetName: "myRBF"
  26035. * });
  26036. */
  26037. class InterpolationRBFAnalystParameters_InterpolationRBFAnalystParameters extends InterpolationAnalystParameters_InterpolationAnalystParameters {
  26038. constructor(options) {
  26039. super(options);
  26040. /**
  26041. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  26042. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  26043. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  26044. */
  26045. this.smooth = 0.1;
  26046. /**
  26047. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.tension=40]
  26048. * @description 张力系数,常用取值如 0、1、5 和 10。
  26049. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  26050. */
  26051. this.tension = 40;
  26052. /**
  26053. * @member {SuperMap.SearchMode} SuperMap.InterpolationRBFAnalystParameters.prototype.searchMode
  26054. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  26055. * 具体如下:
  26056. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  26057. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  26058. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  26059. */
  26060. this.searchMode = null;
  26061. /**
  26062. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  26063. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  26064. */
  26065. this.expectedCount = 12;
  26066. /**
  26067. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  26068. * @description 【块查找】方式下,最多参与插值的点数。
  26069. */
  26070. this.maxPointCountForInterpolation = 200;
  26071. /**
  26072. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  26073. * @description 【块查找】方式下,单个块内最多参与运算点数。
  26074. */
  26075. this.maxPointCountInNode = 50;
  26076. if (options) {
  26077. Util_Util.extend(this, options);
  26078. }
  26079. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  26080. }
  26081. /**
  26082. * @function SuperMap.InterpolationRBFAnalystParameters.prototype.destroy
  26083. * @description 释放资源,将引用资源的属性置空。
  26084. */
  26085. destroy() {
  26086. super.destroy();
  26087. var me = this;
  26088. me.smooth = null;
  26089. me.tension = null;
  26090. me.searchMode = null;
  26091. me.expectedCount = null;
  26092. me.maxPointCountForInterpolation = null;
  26093. me.maxPointCountInNode = null;
  26094. }
  26095. /**
  26096. * @function SuperMap.InterpolationRBFAnalystParameters.toObject
  26097. * @param {SuperMap.InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类
  26098. * @param {SuperMap.InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象
  26099. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  26100. * @returns JSON 对象。
  26101. */
  26102. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  26103. for (var name in datasetInterpolationRBFAnalystParameters) {
  26104. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  26105. }
  26106. }
  26107. }
  26108. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters_InterpolationRBFAnalystParameters;
  26109. // CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  26110. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26111. * This program are made available under the terms of the Apache License, Version 2.0
  26112. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26113. /**
  26114. * @class SuperMap.InterpolationDensityAnalystParameters
  26115. * @category iServer SpatialAnalyst InterpolationAnalyst
  26116. * @classdesc 点密度差值分析参数类。
  26117. * @param {Object} options - 参数。
  26118. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26119. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26120. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26121. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  26122. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型( SuperMap.InterpolationAnalystType)为 dataset 时。此为必选参数。
  26123. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26124. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26125. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26126. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26127. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  26128. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  26129. * @extends {SuperMap.InterpolationAnalystParameters}
  26130. * @example
  26131. * var myInterpolationDensityAnalystParameters = new SuperMap.InterpolationDensityAnalystParameters({
  26132. * dataset: "SamplesP@Interpolation",
  26133. * searchRadius: "100000",
  26134. * pixelFormat: "BIT16",
  26135. * zValueFieldName: "AVG_TMP",
  26136. * resolution: 3000,
  26137. * filterQueryParameter: {
  26138. * attributeFilter: ""
  26139. * },
  26140. * outputDatasetName: "myDensity"
  26141. * });
  26142. */
  26143. class InterpolationDensityAnalystParameters_InterpolationDensityAnalystParameters extends InterpolationAnalystParameters_InterpolationAnalystParameters {
  26144. constructor(options) {
  26145. super(options);
  26146. if (options) {
  26147. Util_Util.extend(this, options);
  26148. }
  26149. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  26150. }
  26151. /**
  26152. * @function SuperMap.InterpolationDensityAnalystParameters.prototype.destroy
  26153. * @description 释放资源,将引用资源的属性置空。
  26154. */
  26155. destroy() {
  26156. super.destroy();
  26157. }
  26158. }
  26159. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters_InterpolationDensityAnalystParameters;
  26160. // CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  26161. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26162. * This program are made available under the terms of the Apache License, Version 2.0
  26163. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26164. /**
  26165. * @class SuperMap.InterpolationIDWAnalystParameters
  26166. * @category iServer SpatialAnalyst InterpolationAnalyst
  26167. * @classdesc 反距离加权插值(IDW)分析参数类。
  26168. * @param {Object} options - 参数。
  26169. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26170. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  26171. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26172. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26173. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  26174. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  26175. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  26176. * @param {number} [options.power=2] - 距离权重计算的幂次。
  26177. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26178. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26179. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26180. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26181. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  26182. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  26183. * @extends {SuperMap.InterpolationAnalystParameters}
  26184. * @example 例如:
  26185. * var myInterpolationIDWAnalystParameters = new SuperMap.InterpolationIDWAnalystParameters({
  26186. * dataset:"SamplesP@Interpolation",
  26187. * power: 2,
  26188. * searchMode: "KDTREE_FIXED_COUNT",
  26189. * expectedCount: 12,
  26190. * pixelFormat: "BIT16",
  26191. * zValueFieldName: "AVG_TMP",
  26192. * resolution: 3000,
  26193. * filterQueryParameter: {
  26194. * attributeFilter: ""
  26195. * },
  26196. * outputDatasetName: "myIDW"
  26197. * });
  26198. *
  26199. */
  26200. class InterpolationIDWAnalystParameters_InterpolationIDWAnalystParameters extends InterpolationAnalystParameters_InterpolationAnalystParameters {
  26201. constructor(options) {
  26202. super(options);
  26203. /**
  26204. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.power=2]
  26205. * @description 距离权重计算的幂次。
  26206. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  26207. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  26208. */
  26209. this.power = 2;
  26210. /**
  26211. * @member {SuperMap.SearchMode} SuperMap.InterpolationIDWAnalystParameters.prototype.searchMode
  26212. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  26213. * 具体如下:
  26214. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  26215. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  26216. */
  26217. this.searchMode = null;
  26218. /**
  26219. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  26220. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  26221. */
  26222. this.expectedCount = 12;
  26223. if (options) {
  26224. Util_Util.extend(this, options);
  26225. }
  26226. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  26227. }
  26228. /**
  26229. * @function SuperMap.InterpolationIDWAnalystParameters.prototype.destroy
  26230. * @description 释放资源,将引用资源的属性置空。
  26231. */
  26232. destroy() {
  26233. super.destroy();
  26234. var me = this;
  26235. me.power = null;
  26236. me.searchMode = null;
  26237. me.expectedCount = null;
  26238. }
  26239. }
  26240. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters_InterpolationIDWAnalystParameters;
  26241. // CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  26242. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26243. * This program are made available under the terms of the Apache License, Version 2.0
  26244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26245. /**
  26246. * @class SuperMap.InterpolationKrigingAnalystParameters
  26247. * @category iServer SpatialAnalyst InterpolationAnalyst
  26248. * @classdesc 克吕金插值分析参数类。
  26249. * @description 通过该类可以设置克吕金插值分析所需的参数。
  26250. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  26251. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确的指出误差值的大小。
  26252. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  26253. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  26254. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数。
  26255. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。<br>
  26256. *
  26257. * · 块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了上图所示的块金效应,
  26258. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  26259. *
  26260. * · 基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  26261. * 即大于此间距的采样点不再具有空间相关性。<br>
  26262. *
  26263. * · 偏基台值:基台值与块金值的差值。<br>
  26264. *
  26265. * · 自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  26266. *
  26267. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  26268. *
  26269. * · 指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加成指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  26270. *
  26271. * · 球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  26272. *
  26273. * · 高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  26274. *
  26275. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的差值功能基于以下三种常用 Kriging 算法:<br>
  26276. *
  26277. * 1. 简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)已知的某一常数。<br>
  26278. *
  26279. * 2. 普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,<br>
  26280. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。
  26281. *
  26282. * 3. 泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定<br>
  26283. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。
  26284. *
  26285. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  26286. * 计算量大,且变异函数有时需要根据经验人为选定。
  26287. * @param {Object} options - 参数。
  26288. * @param {string} options.type - 克吕金插值的类型。
  26289. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26290. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  26291. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26292. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26293. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  26294. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  26295. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  26296. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  26297. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  26298. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  26299. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  26300. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  26301. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  26302. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  26303. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  26304. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  26305. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26306. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26307. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26308. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26309. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时。
  26310. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。
  26311. * @extends {SuperMap.InterpolationAnalystParameters}
  26312. * @example 例如:
  26313. * var myInterpolationKrigingAnalystParameters = new SuperMap.InterpolationKrigingAnalystParameters({
  26314. * dataset:"SamplesP@Interpolation",
  26315. * type: "KRIGING",
  26316. * angle: 0,
  26317. * mean: 5,
  26318. * nugget: 30,
  26319. * range: 50,
  26320. * sill: 300,
  26321. * variogramMode: "EXPONENTIAL",
  26322. * searchMode: "QUADTREE",
  26323. * maxPointCountForInterpolation: 20,
  26324. * maxPointCountInNode: 5,
  26325. * pixelFormat: "BIT16",
  26326. * zValueFieldName: "AVG_TMP",
  26327. * resolution: 30000,
  26328. * filterQueryParameter: {
  26329. * attributeFilter: ""
  26330. * },
  26331. * outputDatasetName: "myKriging"
  26332. * });
  26333. *
  26334. */
  26335. class InterpolationKrigingAnalystParameters_InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters_InterpolationAnalystParameters {
  26336. constructor(options) {
  26337. super(options);
  26338. /**
  26339. * @member {SuperMap.InterpolationAlgorithmType} SuperMap.InterpolationKrigingAnalystParameters.prototype.type
  26340. * @description 克吕金插值的类型。
  26341. * 具体如下:<br>
  26342. * {KRIGING} 普通克吕金插值法。
  26343. * {SimpleKriging} 简单克吕金插值法。
  26344. * {UniversalKriging} 泛克吕金插值法。
  26345. */
  26346. this.type = null;
  26347. /**
  26348. * @member {number} SuperMap.InterpolationKrigingAnalystParameters.prototype.mean
  26349. * @description 【简单克吕金】方式下,插值字段的平均值。
  26350. * 即采样点插值字段值总和除以采样点数目。
  26351. */
  26352. this.mean = null;
  26353. /**
  26354. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.angle=0]
  26355. * @description 克吕金算法中旋转角度值。
  26356. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  26357. */
  26358. this.angle = 0;
  26359. /**
  26360. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.nugget=0]
  26361. * @description 克吕金算法中块金效应值。
  26362. */
  26363. this.nugget = 0;
  26364. /**
  26365. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.range=0]
  26366. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  26367. */
  26368. this.range = 0;
  26369. /**
  26370. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.sill=0]
  26371. * @description 克吕金算法中基台值。
  26372. */
  26373. this.sill = 0;
  26374. /**
  26375. * @member {SuperMap.VariogramMode} [SuperMap.InterpolationKrigingAnalystParameters.prototype.variogramMode=SuperMap.VariogramMode.SPHERICAL]
  26376. * @description 克吕金插值时的半变函数类型。
  26377. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  26378. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  26379. */
  26380. this.variogramMode = VariogramMode.SPHERICAL;
  26381. /**
  26382. * @member {SuperMap.Exponent} [SuperMap.InterpolationKrigingAnalystParameters.prototype.exponent=SuperMap.Exponent.EXP1]
  26383. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  26384. */
  26385. this.exponent = Exponent.EXP1;
  26386. /**
  26387. * @member {SuperMap.SearchMode} SuperMap.InterpolationKrigingAnalystParameters.prototype.searchMode
  26388. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  26389. * 简单克吕金和泛克吕金不支持块查找。
  26390. * 具体如下:<br>
  26391. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  26392. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  26393. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  26394. */
  26395. this.searchMode = null;
  26396. /**
  26397. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  26398. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数,默认值为12。
  26399. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  26400. */
  26401. this.expectedCount = 12;
  26402. /**
  26403. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  26404. * @description 【块查找】方式下,最多参与插值的点数。
  26405. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  26406. */
  26407. this.maxPointCountForInterpolation = 200;
  26408. /**
  26409. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=50]
  26410. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  26411. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  26412. */
  26413. this.maxPointCountInNode = 50;
  26414. if (options) {
  26415. Util_Util.extend(this, options);
  26416. }
  26417. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  26418. }
  26419. /**
  26420. * @function SuperMap.InterpolationKrigingAnalystParameters.prototype.destroy
  26421. * @description 释放资源,将引用资源的属性置空。
  26422. */
  26423. destroy() {
  26424. super.destroy();
  26425. var me = this;
  26426. me.type = null;
  26427. me.mean = null;
  26428. me.angle = null;
  26429. me.nugget = null;
  26430. me.range = null;
  26431. me.sill = null;
  26432. me.variogramMode = null;
  26433. me.exponent = null;
  26434. me.searchMode = null;
  26435. me.expectedCount = null;
  26436. me.maxPointCountForInterpolation = null;
  26437. me.maxPointCountInNode = null;
  26438. }
  26439. }
  26440. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters_InterpolationKrigingAnalystParameters;
  26441. // CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  26442. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26443. * This program are made available under the terms of the Apache License, Version 2.0
  26444. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26445. /**
  26446. * @class SuperMap.InterpolationAnalystService
  26447. * @category iServer SpatialAnalyst InterpolationAnalyst
  26448. * @classdesc 插值分析服务类。
  26449. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  26450. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  26451. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  26452. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  26453. * @param {Object} options - 参数。</br>
  26454. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  26455. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26456. * @param {Object} [options.headers] - 请求头。
  26457. * @extends {SuperMap.SpatialAnalystBase}
  26458. * @example 例如:
  26459. * (start code)
  26460. * var myTInterpolationAnalystService = new SuperMap.InterpolationAnalystService(url);
  26461. * myTInterpolationAnalystService.events.on({
  26462. * "processCompleted": processCompleted,
  26463. * "processFailed": processFailed
  26464. * }
  26465. * );
  26466. * (end)
  26467. *
  26468. */
  26469. class InterpolationAnalystService_InterpolationAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  26470. constructor(url, options) {
  26471. super(url, options);
  26472. /**
  26473. * @member {string} SuperMap.InterpolationAnalystService.prototype.mode
  26474. * @description 插值分析类型。
  26475. */
  26476. this.mode = null;
  26477. if (options) {
  26478. Util_Util.extend(this, options);
  26479. }
  26480. }
  26481. /**
  26482. * @function SuperMap.InterpolationAnalystService.prototype.destroy
  26483. * @description 释放资源,将引用资源的属性置空。
  26484. */
  26485. destroy() {
  26486. super.destroy();
  26487. this.mode = null;
  26488. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  26489. }
  26490. /**
  26491. * @function SuperMap.InterpolationAnalystService.prototype.processAsync
  26492. * @description 负责将客户端的查询参数传递到服务端。
  26493. * @param {SuperMap.InterpolationAnalystParameters} parameter - 插值分析参数类。
  26494. */
  26495. processAsync(parameter) {
  26496. var parameterObject = {};
  26497. var me = this;
  26498. if (parameter instanceof InterpolationDensityAnalystParameters_InterpolationDensityAnalystParameters) {
  26499. me.mode = 'Density';
  26500. if (parameter.InterpolationAnalystType === 'geometry') {
  26501. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  26502. } else {
  26503. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  26504. }
  26505. } else if (parameter instanceof InterpolationIDWAnalystParameters_InterpolationIDWAnalystParameters) {
  26506. me.mode = 'IDW';
  26507. if (parameter.InterpolationAnalystType === 'geometry') {
  26508. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  26509. } else {
  26510. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  26511. }
  26512. } else if (parameter instanceof InterpolationRBFAnalystParameters_InterpolationRBFAnalystParameters) {
  26513. me.mode = 'RBF';
  26514. if (parameter.InterpolationAnalystType === 'geometry') {
  26515. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  26516. } else {
  26517. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  26518. }
  26519. } else if (parameter instanceof InterpolationKrigingAnalystParameters_InterpolationKrigingAnalystParameters) {
  26520. me.mode = 'Kriging';
  26521. if (parameter.InterpolationAnalystType === 'geometry') {
  26522. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  26523. } else {
  26524. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  26525. }
  26526. }
  26527. InterpolationAnalystParameters_InterpolationAnalystParameters.toObject(parameter, parameterObject);
  26528. var jsonParameters = Util_Util.toJSON(parameterObject);
  26529. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  26530. me.request({
  26531. method: "POST",
  26532. data: jsonParameters,
  26533. scope: me,
  26534. success: me.serviceProcessCompleted,
  26535. failure: me.serviceProcessFailed
  26536. });
  26537. }
  26538. }
  26539. SuperMap.InterpolationAnalystService = InterpolationAnalystService_InterpolationAnalystService;
  26540. // CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  26541. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26542. * This program are made available under the terms of the Apache License, Version 2.0
  26543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26544. /**
  26545. * @class SuperMap.KernelDensityJobParameter
  26546. * @category iServer ProcessingService DensityAnalyst
  26547. * @classdesc 密度分析任务参数类。
  26548. * @param {Object} options - 参数。
  26549. * @param {string} options.datasetName - 数据集名。
  26550. * @param {string} options.fields - 权重索引。
  26551. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  26552. * @param {number} [options.resolution=80] - 分辨率。
  26553. * @param {number} [options.method=0] - 分析方法。
  26554. * @param {number} [options.meshType=0] - 分析类型。
  26555. * @param {number} [options.radius=300] - 分析的影响半径。
  26556. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  26557. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  26558. */
  26559. class KernelDensityJobParameter_KernelDensityJobParameter {
  26560. constructor(options) {
  26561. if (!options) {
  26562. return;
  26563. }
  26564. /**
  26565. * @member {string} SuperMap.KernelDensityJobParameter.prototype.datasetName
  26566. * @description 数据集名。
  26567. */
  26568. this.datasetName = "";
  26569. /**
  26570. * @member {SuperMap.Bounds|L.Bounds|ol.extent} [SuperMap.KernelDensityJobParameter.prototype.query]
  26571. * @description 分析范围。
  26572. */
  26573. this.query = "";
  26574. /**
  26575. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.resolution=80]
  26576. * @description 网格大小。
  26577. */
  26578. this.resolution = 80;
  26579. /**
  26580. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.method=0]
  26581. * @description 分析方法。
  26582. */
  26583. this.method = 0;
  26584. /**
  26585. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.meshType=0]
  26586. * @description 分析类型。
  26587. */
  26588. this.meshType = 0;
  26589. /**
  26590. * @member {string} SuperMap.KernelDensityJobParameter.prototype.fields
  26591. * @description 权重索引。
  26592. */
  26593. this.fields = "";
  26594. /**
  26595. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.radius=300]
  26596. * @description 分析的影响半径。
  26597. */
  26598. this.radius = 300;
  26599. /**
  26600. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  26601. * @description 网格大小单位。
  26602. */
  26603. this.meshSizeUnit = AnalystSizeUnit.METER;
  26604. /**
  26605. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.radiusUnit=SuperMap.AnalystSizeUnit.METER]
  26606. * @description 搜索半径单位。
  26607. */
  26608. this.radiusUnit = AnalystSizeUnit.METER;
  26609. /**
  26610. * @member {SuperMap.AnalystAreaUnit} [SuperMap.KernelDensityJobParameter.prototype.areaUnit=SuperMap.AnalystAreaUnit.SQUAREMILE]
  26611. * @description 面积单位。
  26612. */
  26613. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  26614. /**
  26615. * @member {SuperMap.OutputSetting} SuperMap.KernelDensityJobParameter.prototype.output
  26616. * @description 输出参数设置类
  26617. */
  26618. this.output = null;
  26619. /**
  26620. * @member {SuperMap.MappingParameters} [SuperMap.KernelDensityJobParameter.prototype.mappingParameters]
  26621. * @description 分析后结果可视化的参数类。
  26622. */
  26623. this.mappingParameters = null;
  26624. Util_Util.extend(this, options);
  26625. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  26626. }
  26627. /**
  26628. * @function SuperMap.KernelDensityJobParameter.prototype.destroy
  26629. * @description 释放资源,将引用资源的属性置空。
  26630. */
  26631. destroy() {
  26632. this.datasetName = null;
  26633. this.query = null;
  26634. this.resolution = null;
  26635. this.method = null;
  26636. this.radius = null;
  26637. this.meshType = null;
  26638. this.fields = null;
  26639. this.meshSizeUnit = null;
  26640. this.radiusUnit = null;
  26641. this.areaUnit = null;
  26642. if (this.output instanceof OutputSetting_OutputSetting) {
  26643. this.output.destroy();
  26644. this.output = null;
  26645. }
  26646. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  26647. this.mappingParameters.destroy();
  26648. this.mappingParameters = null;
  26649. }
  26650. }
  26651. /**
  26652. * @function SuperMap.KernelDensityJobParameter.toObject
  26653. * @param {SuperMap.KernelDensityJobParameter} kernelDensityJobParameter - 密度分析任务参数类。
  26654. * @param {SuperMap.KernelDensityJobParameter} tempObj - 密度分析任务参数对象。
  26655. * @description 将密度分析任务参数对象转换为 JSON 对象。
  26656. * @returns JSON 对象。
  26657. */
  26658. static toObject(kernelDensityJobParameter, tempObj) {
  26659. for (var name in kernelDensityJobParameter) {
  26660. if (name === "datasetName") {
  26661. tempObj['input'] = tempObj['input'] || {};
  26662. tempObj['input'][name] = kernelDensityJobParameter[name];
  26663. continue;
  26664. }
  26665. if (name === "output") {
  26666. tempObj['output'] = tempObj['output'] || {};
  26667. tempObj['output'] = kernelDensityJobParameter[name];
  26668. continue;
  26669. }
  26670. tempObj['analyst'] = tempObj['analyst'] || {};
  26671. if (name === 'query' && kernelDensityJobParameter[name]) {
  26672. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  26673. } else {
  26674. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  26675. }
  26676. if (name === 'mappingParameters') {
  26677. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  26678. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  26679. }
  26680. }
  26681. }
  26682. }
  26683. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter_KernelDensityJobParameter;
  26684. // CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  26685. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26686. * This program are made available under the terms of the Apache License, Version 2.0
  26687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26688. /**
  26689. * @class SuperMap.KernelDensityJobsService
  26690. * @category iServer ProcessingService DensityAnalyst
  26691. * @classdesc 核密度分析服务类
  26692. * @extends {SuperMap.ProcessingServiceBase}
  26693. * @param {string} url -核密度分析服务地址。
  26694. * @param {Object} options - 交互服务时所需可选参数。
  26695. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26696. * @param {Object} [options.headers] - 请求头。
  26697. */
  26698. class KernelDensityJobsService_KernelDensityJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  26699. constructor(url, options) {
  26700. super(url, options);
  26701. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/density');
  26702. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  26703. }
  26704. /**
  26705. * @function SuperMap.KernelDensityJobsService.prototype.destroy
  26706. * @override
  26707. */
  26708. destroy() {
  26709. super.destroy();
  26710. }
  26711. /**
  26712. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  26713. * @description 获取核密度分析任务
  26714. */
  26715. getKernelDensityJobs() {
  26716. super.getJobs(this.url);
  26717. }
  26718. /**
  26719. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  26720. * @description 获取指定id的核密度分析服务
  26721. * @param {string} id - 指定要获取数据的id
  26722. */
  26723. getKernelDensityJob(id) {
  26724. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  26725. }
  26726. /**
  26727. * @function SuperMap.KernelDensityJobsService.prototype.addKernelDensityJob
  26728. * @description 新建核密度分析服务
  26729. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  26730. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  26731. */
  26732. addKernelDensityJob(params, seconds) {
  26733. super.addJob(this.url, params, KernelDensityJobParameter_KernelDensityJobParameter, seconds);
  26734. }
  26735. }
  26736. SuperMap.KernelDensityJobsService = KernelDensityJobsService_KernelDensityJobsService;
  26737. // CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  26738. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26739. * This program are made available under the terms of the Apache License, Version 2.0
  26740. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26741. /**
  26742. * @class SuperMap.LabelMatrixCell
  26743. * @category iServer Map Theme
  26744. * @classdesc 矩阵标签元素抽象类。
  26745. * @description 该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  26746. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  26747. */
  26748. class LabelMatrixCell {
  26749. constructor() {
  26750. this.CLASS_NAME = "LabelMatrixCell";
  26751. }
  26752. }
  26753. SuperMap.LabelMatrixCell = LabelMatrixCell;
  26754. // CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  26755. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26756. * This program are made available under the terms of the Apache License, Version 2.0
  26757. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26758. /**
  26759. * @class SuperMap.LabelImageCell
  26760. * @category iServer Map Theme
  26761. * @classdesc 图片类型的矩阵标签元素类。
  26762. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  26763. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  26764. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  26765. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  26766. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 是一个二维数组,
  26767. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  26768. * @extends {SuperMap.LabelMatrixCell}
  26769. * @param {Object} options - 参数。
  26770. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  26771. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  26772. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  26773. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  26774. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  26775. */
  26776. class LabelImageCell_LabelImageCell extends LabelMatrixCell {
  26777. constructor(options) {
  26778. super(options);
  26779. /**
  26780. * @member {number} SuperMap.LabelImageCell.prototype.height
  26781. * @description 设置图片的高度,单位为毫米。
  26782. */
  26783. this.height = 0;
  26784. /**
  26785. * @member {string} SuperMap.LabelImageCell.prototype.pathField
  26786. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  26787. */
  26788. this.pathField = null;
  26789. /**
  26790. * @member {number} [SuperMap.LabelImageCell.prototype.rotation=0.0]
  26791. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  26792. */
  26793. this.rotation = 0.0;
  26794. /**
  26795. * @member {number} SuperMap.LabelImageCell.prototype.width
  26796. * @description 设置图片的宽度,单位为毫米。
  26797. */
  26798. this.width = 0;
  26799. /**
  26800. * @member {boolean} [SuperMap.LabelImageCell.prototype.sizeFixed=false]
  26801. * @description 是否固定图片的大小。
  26802. */
  26803. this.sizeFixed = false;
  26804. /**
  26805. * @member {string} SuperMap.LabelImageCell.prototype.type
  26806. * @description 制作矩阵专题图时是必须的。
  26807. */
  26808. this.type = "IMAGE";
  26809. if (options) {
  26810. Util_Util.extend(this, options);
  26811. }
  26812. this.CLASS_NAME = "SuperMap.LabelImageCell";
  26813. }
  26814. /**
  26815. * @function SuperMap.LabelImageCell.prototype.destroy
  26816. * @description 释放资源,将引用资源的属性置空。
  26817. */
  26818. destroy() {
  26819. var me = this;
  26820. me.height = null;
  26821. me.pathField = null;
  26822. me.rotation = null;
  26823. me.width = null;
  26824. me.sizeFixed = null;
  26825. }
  26826. }
  26827. SuperMap.LabelImageCell = LabelImageCell_LabelImageCell;
  26828. // CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  26829. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26830. * This program are made available under the terms of the Apache License, Version 2.0
  26831. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26832. /**
  26833. * @class SuperMap.LabelSymbolCell
  26834. * @category iServer Map Theme
  26835. * @classdesc 符号类型的矩阵标签元素类。
  26836. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  26837. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  26838. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  26839. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  26840. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  26841. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  26842. * @extends {SuperMap.LabelMatrixCell}
  26843. * @param {Object} options - 参数。
  26844. * @param {SuperMap.ServerStyle} options.style - 获取或设置符号样式。
  26845. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  26846. */
  26847. class LabelSymbolCell_LabelSymbolCell extends LabelMatrixCell {
  26848. constructor(options) {
  26849. super(options);
  26850. /**
  26851. * @member {SuperMap.ServerStyle} SuperMap.LabelSymbolCell.prototype.style
  26852. * @description 获取或设置符号样式—— {@link SuperMap.ServerStyle} 对象,包括符号大小({@link SuperMap.ServerStyle.markerSize})
  26853. * 和符号旋转({@link SuperMap.ServerStyle.markerAngle})角度,其中用于设置符号 ID 的属性({@link SuperMap.ServerStyle.markerSymbolID})在此处不起作用。
  26854. */
  26855. this.style = new ServerStyle_ServerStyle();
  26856. /**
  26857. * @member {string} SuperMap.LabelSymbolCell.prototype.symbolIDField
  26858. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  26859. */
  26860. this.symbolIDField = null;
  26861. /**
  26862. * @member {string} SuperMap.LabelSymbolCell.prototype.type
  26863. * @description 制作矩阵专题图时是必须的。
  26864. */
  26865. this.type = "SYMBOL";
  26866. if (options) {
  26867. Util_Util.extend(this, options);
  26868. }
  26869. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  26870. }
  26871. /**
  26872. * @function SuperMap.LabelSymbolCell.prototype.destroy
  26873. * @description 释放资源,将引用资源的属性置空。
  26874. */
  26875. destroy() {
  26876. var me = this;
  26877. if (me.style) {
  26878. me.style.destroy();
  26879. me.style = null;
  26880. }
  26881. me.symbolIDField = null;
  26882. }
  26883. }
  26884. SuperMap.LabelSymbolCell = LabelSymbolCell_LabelSymbolCell;
  26885. // CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  26886. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26887. * This program are made available under the terms of the Apache License, Version 2.0
  26888. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26889. /**
  26890. * @class SuperMap.LabelThemeCell
  26891. * @category iServer Map Theme
  26892. * @classdesc 专题图类型的矩阵标签元素类。
  26893. * @description 该类继承自 {@link SuperMap.LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  26894. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  26895. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  26896. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  26897. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  26898. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  26899. * @extends {SuperMap.LabelMatrixCell}
  26900. * @param {Object} options -参数。
  26901. * @param {SuperMap.ThemeLabel} options.themeLabel - 使用专题图对象作为矩阵标签的一个元素。
  26902. */
  26903. class LabelThemeCell_LabelThemeCell extends LabelMatrixCell {
  26904. constructor(options) {
  26905. super(options);
  26906. /**
  26907. * @member {SuperMap.ThemeLabel} SuperMap.LabelThemeCell.prototype.themeLabel
  26908. * @description 使用专题图对象作为矩阵标签的一个元素。
  26909. */
  26910. this.themeLabel = new ThemeLabel_ThemeLabel();
  26911. /**
  26912. * @member {string} SuperMap.LabelThemeCell.prototype.type
  26913. * @description 制作矩阵专题图时是必须的。
  26914. */
  26915. this.type = "THEME";
  26916. if (options) {
  26917. Util_Util.extend(this, options);
  26918. }
  26919. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  26920. }
  26921. /**
  26922. * @function SuperMap.LabelThemeCell.prototype.destroy
  26923. * @description 释放资源,将引用资源的属性置空。
  26924. */
  26925. destroy() {
  26926. var me = this;
  26927. if (me.themeLabel) {
  26928. me.themeLabel.destroy();
  26929. me.themeLabel = null;
  26930. }
  26931. }
  26932. }
  26933. SuperMap.LabelThemeCell = LabelThemeCell_LabelThemeCell;
  26934. // CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  26935. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  26936. * This program are made available under the terms of the Apache License, Version 2.0
  26937. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26938. /**
  26939. * @class SuperMap.LayerStatus
  26940. * @category iServer Map Theme
  26941. * @classdesc 子图层显示参数类。
  26942. * @description 该类存储了各个子图层的名字和是否可见的状态。
  26943. * @param {Object} options - 参数。
  26944. * @param {string} options.layerName - 获取或设置图层名称。
  26945. * @param {boolean} [options.isVisible=true] - 获取或设置图层是否可见,true 表示可见。
  26946. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  26947. */
  26948. class LayerStatus_LayerStatus {
  26949. constructor(options) {
  26950. /**
  26951. * @member {string} SuperMap.LayerStatus.prototype.layerName
  26952. * @description 获取或设置图层名称。
  26953. */
  26954. this.layerName = null;
  26955. /**
  26956. * @member {boolean} SuperMap.LayerStatus.prototype.isVisible
  26957. * @description 获取或设置图层是否可见,true 表示可见。
  26958. */
  26959. this.isVisible = null;
  26960. /**
  26961. * @member {string} [SuperMap.LayerStatus.prototype.displayFilter]
  26962. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  26963. */
  26964. this.displayFilter = null;
  26965. /**
  26966. * @member {Object} [SuperMap.LayerStatus.prototype.fieldValuesDisplayFilter]
  26967. * @property {Array.<number>} values - 要过滤的值。
  26968. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  26969. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  26970. */
  26971. this.fieldValuesDisplayFilter = null;
  26972. if (options) {
  26973. Util_Util.extend(this, options);
  26974. }
  26975. this.CLASS_NAME = "SuperMap.LayerStatus";
  26976. }
  26977. /**
  26978. * @function SuperMap.LayerStatus.prototype.destroy
  26979. * @description 释放资源,将引用资源的属性置空。
  26980. */
  26981. destroy() {
  26982. var me = this;
  26983. me.layerName = null;
  26984. me.isVisible = null;
  26985. me.displayFilter = null;
  26986. }
  26987. /**
  26988. * @function SuperMap.LayerStatus.prototype.toJSON
  26989. * @description 生成对应的 JSON。
  26990. * @returns {Object} 对应的 JSON。
  26991. */
  26992. toJSON() {
  26993. var json = '{';
  26994. json += '"type":"UGC",';
  26995. var v = [];
  26996. if (this.layerName) {
  26997. v.push('"name":"' + this.layerName + '"');
  26998. v.push('"visible":' + this.isVisible);
  26999. }
  27000. if (this.displayFilter) {
  27001. v.push('"displayFilter":"' + this.displayFilter + '"');
  27002. }
  27003. if (this.minScale || this.minScale == 0) {
  27004. v.push('"minScale":' + this.minScale);
  27005. }
  27006. if (this.maxScale || this.maxScale == 0) {
  27007. v.push('"maxScale":' + this.maxScale);
  27008. }
  27009. if (this.fieldValuesDisplayFilter) {
  27010. v.push('"fieldValuesDisplayFilter":' + Util_Util.toJSON(this.fieldValuesDisplayFilter));
  27011. }
  27012. json += v;
  27013. json += '}';
  27014. return json;
  27015. }
  27016. }
  27017. SuperMap.LayerStatus = LayerStatus_LayerStatus;
  27018. // CONCATENATED MODULE: ./src/common/iServer/MapService.js
  27019. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27020. * This program are made available under the terms of the Apache License, Version 2.0
  27021. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27022. /**
  27023. * @class SuperMap.MapService
  27024. * @category iServer Map
  27025. * @classdesc 地图信息服务类。
  27026. * @extends {SuperMap.CommonServiceBase}
  27027. * @example
  27028. * var myMapService = new SuperMap.MapService(url, {
  27029. * eventListeners:{
  27030. * "processCompleted": MapServiceCompleted,
  27031. * "processFailed": MapServiceFailed
  27032. * }
  27033. * });
  27034. *
  27035. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  27036. * @param {Object} options - 参数。
  27037. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27038. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27039. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27040. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27041. * @param {Object} [options.headers] - 请求头。
  27042. */
  27043. class MapService_MapService extends CommonServiceBase_CommonServiceBase {
  27044. constructor(url, options) {
  27045. super(url, options);
  27046. /**
  27047. * @member {string} SuperMap.MapService.prototype.projection
  27048. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  27049. */
  27050. this.projection = null;
  27051. this.CLASS_NAME = "SuperMap.MapService";
  27052. if (options) {
  27053. Util_Util.extend(this, options);
  27054. }
  27055. var me = this;
  27056. if (me.projection) {
  27057. var arr = me.projection.split(":");
  27058. if (arr instanceof Array) {
  27059. if (arr.length === 2) {
  27060. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  27061. }
  27062. if (arr.length === 1) {
  27063. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  27064. }
  27065. }
  27066. }
  27067. }
  27068. /**
  27069. * @function destroy
  27070. * @description 释放资源,将引用的资源属性置空。
  27071. */
  27072. destroy() {
  27073. super.destroy();
  27074. var me = this;
  27075. if (me.events) {
  27076. me.events.un(me.eventListeners);
  27077. me.events.listeners = null;
  27078. me.events.destroy();
  27079. me.events = null;
  27080. me.eventListeners = null;
  27081. }
  27082. }
  27083. /**
  27084. * @function SuperMap.MapService.prototype.processAsync
  27085. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  27086. */
  27087. processAsync() {
  27088. var me = this;
  27089. me.request({
  27090. method: "GET",
  27091. scope: me,
  27092. success: me.serviceProcessCompleted,
  27093. failure: me.serviceProcessFailed
  27094. });
  27095. }
  27096. /*
  27097. * Method: getMapStatusCompleted
  27098. * 获取地图状态完成,执行此方法。
  27099. *
  27100. * Parameters:
  27101. * {Object} result - 服务器返回的结果对象。
  27102. */
  27103. serviceProcessCompleted(result) {
  27104. var me = this;
  27105. result = Util_Util.transformResult(result);
  27106. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  27107. var isCodeValid = result.code && codeStatus;
  27108. if (!result.code || isCodeValid) {
  27109. me.events && me.events.triggerEvent("processCompleted", {result: result});
  27110. } else {
  27111. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  27112. me.events.triggerEvent("processFailed", {error: result});
  27113. }
  27114. }
  27115. }
  27116. SuperMap.MapService = MapService_MapService;
  27117. // CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  27118. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27119. * This program are made available under the terms of the Apache License, Version 2.0
  27120. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27121. /**
  27122. * @class SuperMap.MathExpressionAnalysisParameters
  27123. * @category iServer SpatialAnalyst GridMathAnalyst
  27124. * @classdesc 栅格代数运算参数类。
  27125. * @param {Object} options - 参数。
  27126. * @param {string} options.dataset - 要用来做栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  27127. * @param {string} options.resultGridName - 指定结果数据集名称。
  27128. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  27129. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  27130. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  27131. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  27132. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  27133. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  27134. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  27135. */
  27136. class MathExpressionAnalysisParameters_MathExpressionAnalysisParameters {
  27137. constructor(options) {
  27138. if (!options) {
  27139. return;
  27140. }
  27141. /**
  27142. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.dataset
  27143. * @description 要用来做栅格代数运算数据源中数据集的名称。
  27144. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  27145. *
  27146. */
  27147. this.dataset = null;
  27148. /**
  27149. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.MathExpressionAnalysisParameters.prototype.extractRegion]
  27150. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  27151. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  27152. */
  27153. this.extractRegion = null;
  27154. /**
  27155. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.expression
  27156. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  27157. */
  27158. this.expression = null;
  27159. /**
  27160. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.isZip=false]
  27161. * @description 是否对结果数据集进行压缩处理。
  27162. */
  27163. this.isZip = false;
  27164. /**
  27165. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  27166. * @description 是否忽略无值栅格数据。
  27167. */
  27168. this.ignoreNoValue = false;
  27169. /**
  27170. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.targetDatasource
  27171. * @description 指定存储结果数据集的数据源。
  27172. */
  27173. this.targetDatasource = null;
  27174. /**
  27175. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.resultGridName
  27176. * @description 指定结果数据集名称。
  27177. */
  27178. this.resultGridName = null;
  27179. /**
  27180. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  27181. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  27182. */
  27183. this.deleteExistResultDataset = false;
  27184. Util_Util.extend(this, options);
  27185. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  27186. }
  27187. /**
  27188. * @function SuperMap.MathExpressionAnalysisParameters.prototype.destroy
  27189. * @description 释放资源,将引用资源的属性置空。
  27190. */
  27191. destroy() {
  27192. var me = this;
  27193. me.dataset = null;
  27194. me.bounds = null;
  27195. me.expression = null;
  27196. me.isZip = true;
  27197. me.ignoreNoValue = true;
  27198. me.targetDatasource = null;
  27199. me.resultGridName = null;
  27200. me.deleteExistResultDataset = null;
  27201. }
  27202. /**
  27203. * @function SuperMap.MathExpressionAnalysisParameters.toObject
  27204. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  27205. * @param {Object} tempObj - 目标对象。
  27206. * @description 生成栅格代数运算对象。
  27207. */
  27208. static toObject(mathExpressionAnalysisParameters, tempObj) {
  27209. for (var name in mathExpressionAnalysisParameters) {
  27210. if (name !== "dataset") {
  27211. tempObj[name] = mathExpressionAnalysisParameters[name];
  27212. }
  27213. if (name === "extractRegion") {
  27214. if (mathExpressionAnalysisParameters[name]) {
  27215. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  27216. var region = {},
  27217. points = [],
  27218. type = "REGION";
  27219. var len = bs.length;
  27220. for (var i = 0; i < len - 1; i++) {
  27221. var poi = {};
  27222. poi["x"] = bs[i].x;
  27223. poi["y"] = bs[i].y;
  27224. points.push(poi);
  27225. }
  27226. region["points"] = points;
  27227. region["type"] = type;
  27228. tempObj[name] = region;
  27229. }
  27230. }
  27231. }
  27232. }
  27233. }
  27234. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters_MathExpressionAnalysisParameters;
  27235. // CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  27236. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27237. * This program are made available under the terms of the Apache License, Version 2.0
  27238. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27239. /**
  27240. * @class SuperMap.MathExpressionAnalysisService
  27241. * @category iServer SpatialAnalyst GridMathAnalyst
  27242. * @classdesc 栅格代数运算服务类。
  27243. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  27244. * @param {Object} options - 参数。</br>
  27245. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27246. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27247. * @param {Object} [options.headers] - 请求头。
  27248. * @extends {SuperMap.SpatialAnalystBase}
  27249. * @example 例如:
  27250. * (start code)
  27251. * var myMathExpressionAnalysisService = new SuperMap.MathExpressionAnalysisService(url);
  27252. * myMathExpressionAnalysisService.on({
  27253. * "processCompleted": processCompleted,
  27254. * "processFailed": processFailed
  27255. * }
  27256. * );
  27257. * (end)
  27258. *
  27259. */
  27260. class MathExpressionAnalysisService_MathExpressionAnalysisService extends SpatialAnalystBase_SpatialAnalystBase {
  27261. constructor(url, options) {
  27262. super(url, options);
  27263. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  27264. }
  27265. /**
  27266. * @override
  27267. */
  27268. destroy() {
  27269. super.destroy();
  27270. }
  27271. /**
  27272. * @function SuperMap.MathExpressionAnalysisService.prototype.processAsync
  27273. * @description 负责将客户端的查询参数传递到服务端。
  27274. * @param {SuperMap.MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  27275. */
  27276. processAsync(parameter) {
  27277. var me = this;
  27278. var parameterObject = {};
  27279. if (parameter instanceof MathExpressionAnalysisParameters_MathExpressionAnalysisParameters) {
  27280. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  27281. }
  27282. MathExpressionAnalysisParameters_MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  27283. var jsonParameters = Util_Util.toJSON(parameterObject);
  27284. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  27285. me.request({
  27286. method: "POST",
  27287. data: jsonParameters,
  27288. scope: me,
  27289. success: me.serviceProcessCompleted,
  27290. failure: me.serviceProcessFailed
  27291. });
  27292. }
  27293. }
  27294. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService_MathExpressionAnalysisService;
  27295. // CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  27296. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27297. * This program are made available under the terms of the Apache License, Version 2.0
  27298. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27299. /**
  27300. * @class SuperMap.MeasureParameters
  27301. * @category iServer Map Measure
  27302. * @classdesc 量算参数类。
  27303. * @param {Object} geometry - 要量算的几何对象。
  27304. * @param {Object} options - 参数。
  27305. * @param {SuperMap.Unit} [options.unit=SuperMap.Unit.METER] - 量算单位。
  27306. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  27307. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  27308. */
  27309. class MeasureParameters_MeasureParameters {
  27310. constructor(geometry, options) {
  27311. if (!geometry) {
  27312. return;
  27313. }
  27314. /**
  27315. * @member {Object} SuperMap.MeasureParameters.prototype.geometry
  27316. * @description 要量算的几何对象。<br>
  27317. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。<br>
  27318. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  27319. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  27320. */
  27321. this.geometry = geometry;
  27322. /**
  27323. * @member {SuperMap.Unit} [SuperMap.MeasureParameters.prototype.unit=SuperMap.Unit.METER]
  27324. * @description 量算单位。即量算结果以米为单位。
  27325. */
  27326. this.unit = Unit.METER;
  27327. /**
  27328. * @member {string} [SuperMap.MeasureParameters.prototype.prjCoordSys]
  27329. * @description 用来指定该量算操作所使用的投影。
  27330. */
  27331. this.prjCoordSys = null;
  27332. /**
  27333. * @member {string} [SuperMap.MeasureParameters.prototype.distanceMode="Geodesic"]
  27334. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  27335. * @example
  27336. * var param = new SuperMap.MeasureParameters(getmetry,{distanceMode:'Planar'});
  27337. */
  27338. this.distanceMode = null;
  27339. if (options) {
  27340. Util_Util.extend(this, options);
  27341. }
  27342. this.CLASS_NAME = "SuperMap.MeasureParameters";
  27343. }
  27344. /**
  27345. * @function SuperMap.MeasureParameters.prototype.destroy
  27346. * @description 释放资源,将引用资源的属性置空。
  27347. */
  27348. destroy() {
  27349. var me = this;
  27350. me.geometry = null;
  27351. me.unit = null;
  27352. me.prjCoordSys = null;
  27353. }
  27354. }
  27355. SuperMap.MeasureParameters = MeasureParameters_MeasureParameters;
  27356. // CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  27357. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27358. * This program are made available under the terms of the Apache License, Version 2.0
  27359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27360. /**
  27361. * @class SuperMap.MeasureService
  27362. * @category iServer Map Measure
  27363. * @classdesc 量算服务类。
  27364. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  27365. * @extends {SuperMap.CommonServiceBase}
  27366. * @example
  27367. * var myMeasuerService = new SuperMap.MeasureService(url, {
  27368. * measureMode: SuperMap.MeasureMode.DISTANCE,
  27369. * eventListeners:{
  27370. * "processCompleted": measureCompleted
  27371. * }
  27372. * });
  27373. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  27374. * @param {Object} options - 参数。
  27375. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27376. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27377. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27378. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27379. * @param {Object} [options.headers] - 请求头。
  27380. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  27381. */
  27382. class MeasureService_MeasureService extends CommonServiceBase_CommonServiceBase {
  27383. constructor(url, options) {
  27384. super(url, options);
  27385. /**
  27386. * @member {SuperMap.MeasureMode} [SuperMap.MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  27387. * @description 量算模式,包括距离量算模式和面积量算模式。
  27388. */
  27389. this.measureMode = MeasureMode.DISTANCE;
  27390. if (options) {
  27391. Util_Util.extend(this, options);
  27392. }
  27393. this.CLASS_NAME = "SuperMap.MeasureService";
  27394. }
  27395. /**
  27396. * @override
  27397. */
  27398. destroy() {
  27399. super.destroy();
  27400. var me = this;
  27401. me.measureMode = null;
  27402. }
  27403. /**
  27404. * @function SuperMap.MeasureService.prototype.processAsync
  27405. * @description 负责将客户端的量算参数传递到服务端。
  27406. * @param {SuperMap.MeasureParameters} params - 量算参数。
  27407. */
  27408. processAsync(params) {
  27409. if (!(params instanceof MeasureParameters_MeasureParameters)) {
  27410. return;
  27411. }
  27412. var me = this,
  27413. geometry = params.geometry,
  27414. pointsCount = 0,
  27415. point2ds = null;
  27416. if (!geometry) {
  27417. return;
  27418. }
  27419. me.url = Util_Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  27420. var serverGeometry = ServerGeometry_ServerGeometry.fromGeometry(geometry);
  27421. if (!serverGeometry) {
  27422. return;
  27423. }
  27424. pointsCount = serverGeometry.parts[0];
  27425. point2ds = serverGeometry.points.splice(0, pointsCount);
  27426. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  27427. if (params.prjCoordSys) {
  27428. if (typeof (params.prjCoordSys) === "object") {
  27429. prjCodeTemp = params.prjCoordSys.projCode;
  27430. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  27431. } else if (typeof (params.prjCoordSys) === "string") {
  27432. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  27433. }
  27434. paramsTemp = {
  27435. "point2Ds": Util_Util.toJSON(point2ds),
  27436. "unit": params.unit,
  27437. "prjCoordSys": prjCoordSysTemp
  27438. };
  27439. } else {
  27440. paramsTemp = {"point2Ds": Util_Util.toJSON(point2ds), "unit": params.unit};
  27441. }
  27442. me.request({
  27443. method: "GET",
  27444. params: paramsTemp,
  27445. scope: me,
  27446. success: me.serviceProcessCompleted,
  27447. failure: me.serviceProcessFailed
  27448. });
  27449. }
  27450. }
  27451. SuperMap.MeasureService = MeasureService_MeasureService;
  27452. // CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  27453. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27454. * This program are made available under the terms of the Apache License, Version 2.0
  27455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27456. /**
  27457. * @class SuperMap.OverlayAnalystService
  27458. * @category iServer SpatialAnalyst OverlayAnalyst
  27459. * @classdesc 叠加分析服务类。
  27460. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  27461. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  27462. * @param {string} url - 服务的访问地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  27463. * @param {Object} options - 参数。</br>
  27464. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27465. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27466. * @param {Object} [options.headers] - 请求头。
  27467. * @extends {SuperMap.CommonServiceBase}
  27468. * @example 例如:
  27469. * (start code)
  27470. * var myOverlayAnalystService = new SuperMap.OverlayAnalystService(url, {
  27471. * eventListeners: {
  27472. * "processCompleted": OverlayCompleted,
  27473. * "processFailed": OverlayFailed
  27474. * }
  27475. * });
  27476. * (end)
  27477. */
  27478. class OverlayAnalystService_OverlayAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  27479. constructor(url, options) {
  27480. super(url, options);
  27481. /**
  27482. * @member {string} SuperMap.OverlayAnalystService.prototype.mode
  27483. * @description 叠加分析类型
  27484. */
  27485. this.mode = null;
  27486. if (options) {
  27487. Util_Util.extend(this, options);
  27488. }
  27489. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  27490. }
  27491. /**
  27492. * @override
  27493. */
  27494. destroy() {
  27495. super.destroy();
  27496. this.mode = null;
  27497. }
  27498. /**
  27499. * @function SuperMap.OverlayAnalystService.prototype.processAsync
  27500. * @description 负责将客户端的查询参数传递到服务端。
  27501. * @param {SuperMap.OverlayAnalystParameters} parameter - 叠加分析参数类。
  27502. */
  27503. processAsync(parameter) {
  27504. var parameterObject = {};
  27505. var me = this;
  27506. if (parameter instanceof DatasetOverlayAnalystParameters_DatasetOverlayAnalystParameters) {
  27507. me.mode = "datasets";
  27508. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  27509. DatasetOverlayAnalystParameters_DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  27510. } else if (parameter instanceof GeometryOverlayAnalystParameters_GeometryOverlayAnalystParameters) {
  27511. me.mode = "geometry";
  27512. //支持传入多个几何要素进行叠加分析
  27513. if(parameter.operateGeometries && parameter.sourceGeometries){
  27514. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  27515. me.url = Util_Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  27516. }else {
  27517. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay');
  27518. }
  27519. GeometryOverlayAnalystParameters_GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  27520. }
  27521. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  27522. var jsonParameters = Util_Util.toJSON(parameterObject);
  27523. me.request({
  27524. method: "POST",
  27525. data: jsonParameters,
  27526. scope: me,
  27527. success: me.serviceProcessCompleted,
  27528. failure: me.serviceProcessFailed
  27529. });
  27530. }
  27531. }
  27532. SuperMap.OverlayAnalystService = OverlayAnalystService_OverlayAnalystService;
  27533. // CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  27534. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27535. * This program are made available under the terms of the Apache License, Version 2.0
  27536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27537. /**
  27538. * @class SuperMap.OverlayGeoJobParameter
  27539. * @category iServer ProcessingService OverlayAnalyst
  27540. * @classdesc 叠加分析任务参数类。
  27541. * @param {Object} options - 参数。
  27542. * @param {string} options.datasetName - 数据集名。
  27543. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  27544. * @param {string} options.srcFields - 输入数据需要保留的字段。
  27545. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  27546. * @param {string} [options.mode] - 叠加分析模式。
  27547. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  27548. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  27549. */
  27550. class OverlayGeoJobParameter_OverlayGeoJobParameter {
  27551. constructor(options) {
  27552. if (!options) {
  27553. return;
  27554. }
  27555. /**
  27556. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetName
  27557. * @description 数据集名。
  27558. */
  27559. this.datasetName = "";
  27560. /**
  27561. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetOverlay
  27562. * @description 叠加对象所在的数据集名称。
  27563. */
  27564. this.datasetOverlay = "";
  27565. /**
  27566. * @member {string} [SuperMap.OverlayGeoJobParameter.prototype.mode]
  27567. * @description 叠加分析模式。
  27568. */
  27569. this.mode = "";
  27570. /**
  27571. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.srcFields
  27572. * @description 输入数据需要保留的字段。
  27573. */
  27574. this.srcFields = "";
  27575. /**
  27576. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.overlayFields
  27577. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  27578. */
  27579. this.overlayFields = "";
  27580. /**
  27581. * @member {SuperMap.OutputSetting} [SuperMap.OverlayGeoJobParameter.prototype.output]
  27582. * @description 输出参数设置类。
  27583. */
  27584. this.output = null;
  27585. /**
  27586. * @member {SuperMap.MappingParameters} [SuperMap.OverlayGeoJobParameter.prototype.mappingParameters]
  27587. * @description 分析后结果可视化的参数类。
  27588. */
  27589. this.mappingParameters = null;
  27590. Util_Util.extend(this, options);
  27591. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  27592. }
  27593. /**
  27594. * @function SuperMap.OverlayGeoJobParameter.destroy
  27595. * @override
  27596. */
  27597. destroy() {
  27598. this.datasetName = null;
  27599. this.datasetOverlay = null;
  27600. this.mode = null;
  27601. this.srcFields = null;
  27602. this.overlayFields = null;
  27603. if (this.output instanceof OutputSetting_OutputSetting) {
  27604. this.output.destroy();
  27605. this.output = null;
  27606. }
  27607. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  27608. this.mappingParameters.destroy();
  27609. this.mappingParameters = null;
  27610. }
  27611. }
  27612. /**
  27613. * @function SuperMap.OverlayGeoJobParameter.toObject
  27614. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  27615. * @param {Object} tempObj - 目标对象。
  27616. * @description 生成点聚合分析任务对象。
  27617. */
  27618. static toObject(OverlayGeoJobParameter, tempObj) {
  27619. for (var name in OverlayGeoJobParameter) {
  27620. if (name == "datasetName") {
  27621. tempObj['input'] = tempObj['input'] || {};
  27622. tempObj['input'][name] = OverlayGeoJobParameter[name];
  27623. continue;
  27624. }
  27625. if (name === "output") {
  27626. tempObj['output'] = tempObj['output'] || {};
  27627. tempObj['output'] = OverlayGeoJobParameter[name];
  27628. continue;
  27629. }
  27630. tempObj['analyst'] = tempObj['analyst'] || {};
  27631. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  27632. if(name === 'mappingParameters'){
  27633. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  27634. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  27635. }
  27636. }
  27637. }
  27638. }
  27639. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter_OverlayGeoJobParameter;
  27640. // CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  27641. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27642. * This program are made available under the terms of the Apache License, Version 2.0
  27643. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27644. /**
  27645. * @class SuperMap.OverlayGeoJobsService
  27646. * @category iServer ProcessingService OverlayAnalyst
  27647. * @classdesc 叠加分析任务类。
  27648. * @param {string} url - 叠加分析任务地址。
  27649. * @param {Object} options - 参数。
  27650. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  27651. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27652. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27653. * @param {number} options.index - 服务访问地址在数组中的位置。
  27654. * @param {number} options.length - 服务访问地址数组长度。
  27655. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27656. * @param {Object} [options.headers] - 请求头。
  27657. */
  27658. class OverlayGeoJobsService_OverlayGeoJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  27659. constructor(url, options) {
  27660. super(url, options);
  27661. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  27662. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  27663. }
  27664. /**
  27665. * @override
  27666. */
  27667. destroy() {
  27668. super.destroy();
  27669. }
  27670. /**
  27671. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJobs
  27672. * @description 获取叠加分析任务
  27673. */
  27674. getOverlayGeoJobs() {
  27675. super.getJobs(this.url);
  27676. }
  27677. /**
  27678. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJob
  27679. * @description 获取指定id的叠加分析任务
  27680. * @param {string} id - 指定要获取数据的id
  27681. */
  27682. getOverlayGeoJob(id) {
  27683. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  27684. }
  27685. /**
  27686. * @function SuperMap.OverlayGeoJobsService.prototype.addOverlayGeoJob
  27687. * @description 新建点叠加析服务
  27688. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  27689. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  27690. */
  27691. addOverlayGeoJob(params, seconds) {
  27692. super.addJob(this.url, params, OverlayGeoJobParameter_OverlayGeoJobParameter, seconds);
  27693. }
  27694. }
  27695. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService_OverlayGeoJobsService;
  27696. // CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  27697. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27698. * This program are made available under the terms of the Apache License, Version 2.0
  27699. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27700. /**
  27701. * @class SuperMap.QueryByBoundsParameters
  27702. * @category iServer Map QueryResults
  27703. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  27704. * @extends {SuperMap.QueryParameters}
  27705. * @param {Object} options - 参数。
  27706. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 指定的查询范围。
  27707. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  27708. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  27709. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  27710. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  27711. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  27712. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  27713. * @param {number} [options.startRecord=0] - 查询起始记录号。
  27714. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  27715. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  27716. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27717. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  27718. */
  27719. class QueryByBoundsParameters_QueryByBoundsParameters extends QueryParameters_QueryParameters {
  27720. constructor(options) {
  27721. if (!options) {
  27722. return;
  27723. }
  27724. super(options);
  27725. /**
  27726. * @member {boolean} [SuperMap.QueryByBoundsParameters.prototype.returnContent=true]
  27727. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27728. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  27729. * 为 false,则返回的是查询结果资源的 URI。
  27730. */
  27731. this.returnContent = true;
  27732. /**
  27733. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.QueryByBoundsParameters.prototype.bounds
  27734. * @description 指定的查询范围。
  27735. */
  27736. this.bounds = null;
  27737. Util_Util.extend(this, options);
  27738. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  27739. }
  27740. /**
  27741. * @function SuperMap.QueryByBoundsParameters.prototype.destroy
  27742. * @description 释放资源,将引用资源的属性置空。
  27743. */
  27744. destroy() {
  27745. super.destroy();
  27746. var me = this;
  27747. me.returnContent = null;
  27748. if (me.bounds) {
  27749. me.bounds = null;
  27750. }
  27751. }
  27752. }
  27753. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters_QueryByBoundsParameters;
  27754. // CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  27755. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27756. * This program are made available under the terms of the Apache License, Version 2.0
  27757. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27758. /**
  27759. * @class SuperMap.QueryService
  27760. * @category iServer Map QueryResults
  27761. * @classdesc 查询服务基类。
  27762. * @extends {SuperMap.CommonServiceBase}
  27763. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  27764. * @param {Object} options - 参数。
  27765. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27766. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27767. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27768. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27769. * @param {Object} [options.headers] - 请求头。
  27770. * @example
  27771. * var myService = new SuperMap.QueryService(url, {
  27772. * eventListeners: {
  27773. * "processCompleted": queryCompleted,
  27774. * "processFailed": queryError
  27775. * }
  27776. * };
  27777. */
  27778. class QueryService_QueryService extends CommonServiceBase_CommonServiceBase {
  27779. /**
  27780. * @function SuperMap.QueryService.prototype.constructor
  27781. * @description 查询服务基类构造函数。
  27782. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  27783. * @param {Object} options -参数。
  27784. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27785. */
  27786. constructor(url, options) {
  27787. super(url, options);
  27788. /**
  27789. * @member {boolean} SuperMap.QueryService.prototype.returnContent
  27790. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  27791. */
  27792. this.returnContent = false;
  27793. /**
  27794. * @member {string} SuperMap.QueryService.prototype.format
  27795. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  27796. */
  27797. this.format = DataFormat.GEOJSON;
  27798. this.returnFeatureWithFieldCaption = false;
  27799. if (options) {
  27800. Util_Util.extend(this, options);
  27801. }
  27802. this.CLASS_NAME = "SuperMap.QueryService";
  27803. if (!this.url) {
  27804. return;
  27805. }
  27806. if (options && options.format) {
  27807. this.format = options.format.toUpperCase();
  27808. }
  27809. this.url = Util_Util.urlPathAppend(this.url,'queryResults');
  27810. }
  27811. /**
  27812. * @function SuperMap.QueryService.prototype.destroy
  27813. * @description 释放资源,将引用资源的属性置空。
  27814. */
  27815. destroy() {
  27816. super.destroy();
  27817. var me = this;
  27818. me.returnContent = null;
  27819. me.format = null;
  27820. }
  27821. /**
  27822. * @function SuperMap.QueryService.prototype.processAsync
  27823. * @description 负责将客户端的查询参数传递到服务端。
  27824. * @param {SuperMap.QueryParameters} params - 查询参数。
  27825. */
  27826. processAsync(params) {
  27827. if (!(params instanceof QueryParameters_QueryParameters)) {
  27828. return;
  27829. }
  27830. var me = this,
  27831. returnCustomResult = null,
  27832. jsonParameters = null;
  27833. me.returnContent = params.returnContent;
  27834. jsonParameters = me.getJsonParameters(params);
  27835. if (me.returnContent) {
  27836. me.url = Util_Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  27837. } else {
  27838. //仅供三维使用 获取高亮图片的bounds
  27839. returnCustomResult = params.returnCustomResult;
  27840. if (returnCustomResult) {
  27841. me.url = Util_Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  27842. }
  27843. }
  27844. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  27845. me.request({
  27846. method: "POST",
  27847. data: jsonParameters,
  27848. scope: me,
  27849. success: me.serviceProcessCompleted,
  27850. failure: me.serviceProcessFailed
  27851. });
  27852. }
  27853. /**
  27854. * @function SuperMap.QueryService.prototype.serviceProcessCompleted
  27855. * @description 查询完成,执行此方法。
  27856. * @param {Object} result - 服务器返回的结果对象。
  27857. */
  27858. serviceProcessCompleted(result) {
  27859. var me = this;
  27860. result = Util_Util.transformResult(result);
  27861. var geoJSONFormat = new GeoJSON_GeoJSON();
  27862. if (result && result.recordsets) {
  27863. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  27864. if (recordsets[i].features) {
  27865. if (me.returnFeatureWithFieldCaption === true) {
  27866. recordsets[i].features.map((feature) => {
  27867. feature.fieldNames = recordsets[i].fieldCaptions;
  27868. return feature;
  27869. })
  27870. }
  27871. if (me.format === DataFormat.GEOJSON) {
  27872. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  27873. }
  27874. }
  27875. }
  27876. }
  27877. me.events.triggerEvent("processCompleted", {
  27878. result: result
  27879. });
  27880. }
  27881. /**
  27882. * @function SuperMap.QueryService.prototype.getQueryParameters
  27883. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  27884. * @param {Object} params - JSON 字符串表示的查询参数。
  27885. * @returns {SuperMap.QueryParameters} 返回转化后的 QueryParameters 对象。
  27886. */
  27887. getQueryParameters(params) {
  27888. return new QueryParameters_QueryParameters({
  27889. customParams: params.customParams,
  27890. expectCount: params.expectCount,
  27891. networkType: params.networkType,
  27892. queryOption: params.queryOption,
  27893. queryParams: params.queryParams,
  27894. startRecord: params.startRecord,
  27895. prjCoordSys: params.prjCoordSys,
  27896. holdTime: params.holdTime
  27897. });
  27898. }
  27899. }
  27900. SuperMap.QueryService = QueryService_QueryService;
  27901. // CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  27902. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27903. * This program are made available under the terms of the Apache License, Version 2.0
  27904. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27905. /**
  27906. * @class SuperMap.QueryByBoundsService
  27907. * @category iServer Map QueryResults
  27908. * @classdesc Bounds 查询服务类。
  27909. * @augments {SuperMap.QueryService}
  27910. * @example
  27911. * (start end)
  27912. * var myQueryByBoundsService = new SuperMap.QueryByBoundsService(url, {
  27913. * eventListeners: {
  27914. * "processCompleted": queryCompleted,
  27915. * "processFailed": queryError
  27916. * }
  27917. * });
  27918. * function queryCompleted(object){//todo};
  27919. * function queryError(object){//todo};
  27920. * (end)
  27921. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27922. * @param {Object} options - 参数。<br>
  27923. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  27924. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27925. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27926. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27927. * @param {Object} [options.headers] - 请求头。
  27928. */
  27929. class QueryByBoundsService_QueryByBoundsService extends QueryService_QueryService {
  27930. constructor(url, options) {
  27931. super(url, options);
  27932. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  27933. }
  27934. /**
  27935. * @override
  27936. */
  27937. destroy() {
  27938. super.destroy();
  27939. }
  27940. /**
  27941. * @function SuperMap.QueryByBoundsService.prototype.getJsonParameters
  27942. * @description 将查询参数转化为 JSON 字符串。
  27943. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  27944. * @param {SuperMap.QueryByBoundsParameters} params - Bounds 查询参数。
  27945. * @returns {Object} 转化后的 JSON 字符串。
  27946. */
  27947. getJsonParameters(params) {
  27948. if (!(params instanceof QueryByBoundsParameters_QueryByBoundsParameters)) {
  27949. return null;
  27950. }
  27951. var me = this,
  27952. jsonParameters = "",
  27953. qp = null,
  27954. bounds = params.bounds;
  27955. qp = me.getQueryParameters(params);
  27956. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  27957. jsonParameters += Util_Util.toJSON(qp);
  27958. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  27959. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  27960. jsonParameters = "{" + jsonParameters + "}";
  27961. return jsonParameters;
  27962. }
  27963. }
  27964. SuperMap.QueryByBoundsService = QueryByBoundsService_QueryByBoundsService;
  27965. // CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  27966. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  27967. * This program are made available under the terms of the Apache License, Version 2.0
  27968. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27969. /**
  27970. * @class SuperMap.QueryByDistanceParameters
  27971. * @category iServer Map QueryResults
  27972. * @classdesc Distance 查询参数类。
  27973. * 该类用于设置 Distance 查询的相关参数。
  27974. * @extends {SuperMap.QueryParameters}
  27975. * @param {Object} options - 参数。
  27976. * @param {Object} options.geometry - 用于查询的几何对象。
  27977. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  27978. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  27979. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  27980. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  27981. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  27982. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  27983. * @param {number} [options.startRecord=0] - 查询起始记录号。
  27984. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  27985. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  27986. * @param {number} [options.distance=0] - 查询距离。
  27987. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  27988. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27989. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  27990. */
  27991. class QueryByDistanceParameters_QueryByDistanceParameters extends QueryParameters_QueryParameters {
  27992. constructor(options) {
  27993. if (!options) {
  27994. return;
  27995. }
  27996. super(options);
  27997. /**
  27998. * @member {number} [SuperMap.QueryByDistanceParameters.prototype.distance=0]
  27999. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  28000. * 当查找最近地物时,该属性无效。
  28001. */
  28002. this.distance = 0;
  28003. /**
  28004. * @member SuperMap.QueryByDistanceParameters.prototype.geometry
  28005. * @description 用于查询的地理对象。<br>
  28006. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。<br>
  28007. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  28008. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  28009. */
  28010. this.geometry = null;
  28011. /**
  28012. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.isNearest=false]
  28013. * @description 是否为最近距离查询。<br>
  28014. * 建议该属性与 expectCount(继承自 {@link SuperMap.QueryParameters})属性联合使用。
  28015. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  28016. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  28017. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  28018. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  28019. * 目前查询结果不支持按远近距离排序。
  28020. */
  28021. this.isNearest = null;
  28022. /**
  28023. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.returnContent=true]
  28024. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28025. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  28026. * 为 false,则返回的是查询结果资源的 URI。
  28027. */
  28028. this.returnContent = true;
  28029. Util_Util.extend(this, options);
  28030. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  28031. }
  28032. /**
  28033. * @function SuperMap.QueryByDistanceParameters.prototype.destroy
  28034. * @description 释放资源,将引用资源的属性置空。
  28035. */
  28036. destroy() {
  28037. super.destroy();
  28038. var me = this;
  28039. me.returnContent = null;
  28040. me.distance = null;
  28041. me.isNearest = null;
  28042. if (me.geometry) {
  28043. me.geometry.destroy();
  28044. me.geometry = null;
  28045. }
  28046. }
  28047. }
  28048. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters_QueryByDistanceParameters;
  28049. // CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  28050. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28051. * This program are made available under the terms of the Apache License, Version 2.0
  28052. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28053. /**
  28054. * @class SuperMap.QueryByDistanceService
  28055. * @category iServer Map QueryResults
  28056. * @classdesc Distance查询服务类。
  28057. * @extends {SuperMap.QueryService}
  28058. * @example
  28059. * var myQueryByDistService = new SuperMap.QueryByDistanceService(url, {
  28060. * eventListeners: {
  28061. * "processCompleted": queryCompleted,
  28062. * "processFailed": queryError
  28063. * }
  28064. * });
  28065. * function queryCompleted(object){//todo};
  28066. * function queryError(object){//todo};
  28067. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28068. * @param {Object} options - 参数。
  28069. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28070. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28071. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28072. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28073. * @param {Object} [options.headers] - 请求头。
  28074. */
  28075. class QueryByDistanceService_QueryByDistanceService extends QueryService_QueryService {
  28076. constructor(url, options) {
  28077. super(url, options);
  28078. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  28079. }
  28080. /**
  28081. * @override
  28082. */
  28083. destroy() {
  28084. super.destroy();
  28085. }
  28086. /**
  28087. * @function SuperMap.QueryByDistanceService.prototype.getJsonParameters
  28088. * @description 将查询参数转化为 JSON 字符串。
  28089. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  28090. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询参数类。
  28091. * @returns {Object} 转化后的 JSON 字符串。
  28092. */
  28093. getJsonParameters(params) {
  28094. if (!(params instanceof QueryByDistanceParameters_QueryByDistanceParameters)) {
  28095. return;
  28096. }
  28097. var me = this,
  28098. jsonParameters = "",
  28099. qp = me.getQueryParameters(params);
  28100. var sg = ServerGeometry_ServerGeometry.fromGeometry(params.geometry);
  28101. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  28102. jsonParameters += Util_Util.toJSON(qp);
  28103. jsonParameters += ",'geometry':" + Util_Util.toJSON(sg) + ",'distance':" + params.distance;
  28104. jsonParameters = "{" + jsonParameters + "}";
  28105. return jsonParameters;
  28106. }
  28107. }
  28108. SuperMap.QueryByDistanceService = QueryByDistanceService_QueryByDistanceService;
  28109. // CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  28110. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28111. * This program are made available under the terms of the Apache License, Version 2.0
  28112. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28113. /**
  28114. * @class SuperMap.QueryByGeometryParameters
  28115. * @category iServer Map QueryResults
  28116. * @classdesc Geometry 查询参数类。
  28117. * 该类用于设置 Geometry查询的相关参数。
  28118. * @extends {SuperMap.QueryParameters}
  28119. * @param {Object} options - 参数。
  28120. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  28121. * @param {Object} options.geometry - 用于查询的几何对象。
  28122. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  28123. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  28124. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  28125. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  28126. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  28127. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  28128. * @param {number} [options.startRecord=0] - 查询起始记录号。
  28129. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  28130. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28131. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  28132. * @param {SuperMap.SpatialQueryMode} [spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT] - 空间查询模式。
  28133. */
  28134. class QueryByGeometryParameters_QueryByGeometryParameters extends QueryParameters_QueryParameters {
  28135. constructor(options) {
  28136. if (!options) {
  28137. return;
  28138. }
  28139. super(options);
  28140. /**
  28141. * @member {boolean} [SuperMap.QueryByGeometryParameters.prototype.returnContent=true]
  28142. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  28143. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  28144. * 为 false,则返回的是查询结果资源的 URI。
  28145. */
  28146. this.returnContent = true;
  28147. /**
  28148. * @member {Object} SuperMap.QueryByGeometryParameters.prototype.geometry
  28149. * @description 用于查询的几何对象。<br>
  28150. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。<br>
  28151. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  28152. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  28153. */
  28154. this.geometry = null;
  28155. /**
  28156. * @member {SuperMap.SpatialQueryMode} [SuperMap.QueryByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT]
  28157. * @description 空间查询模式。
  28158. */
  28159. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  28160. Util_Util.extend(this, options);
  28161. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  28162. }
  28163. /**
  28164. * @function SuperMap.QueryByGeometryParameters.prototype.destroy
  28165. * @description 释放资源,将引用资源的属性置空。
  28166. */
  28167. destroy() {
  28168. super.destroy();
  28169. var me = this;
  28170. me.returnContent = null;
  28171. me.geometry = null;
  28172. me.spatialQueryMode = null;
  28173. }
  28174. }
  28175. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters_QueryByGeometryParameters;
  28176. // CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  28177. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28178. * This program are made available under the terms of the Apache License, Version 2.0
  28179. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28180. /**
  28181. * @class SuperMap.QueryByGeometryService
  28182. * @category iServer Map QueryResults
  28183. * @classdesc Geometry查询服务类。
  28184. * @extends {SuperMap.QueryService}
  28185. * @example
  28186. * var myQueryByGeometryService = new SuperMap.QueryByGeometryService(url, {
  28187. * eventListeners: {
  28188. * "processCompleted": queryCompleted,
  28189. * "processFailed": queryError
  28190. * }
  28191. * });
  28192. * function queryCompleted(object){//todo};
  28193. * function queryError(object){//todo};
  28194. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28195. * @param {Object} options - 参数。
  28196. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28197. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28198. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28199. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28200. * @param {Object} [options.headers] - 请求头。
  28201. */
  28202. class QueryByGeometryService_QueryByGeometryService extends QueryService_QueryService {
  28203. /**
  28204. * @function SuperMap.QueryByGeometryService.prototype.constructor
  28205. * @description Geometry 查询服务类构造函数。
  28206. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28207. * @param {Object} options - 参数。
  28208. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28209. */
  28210. constructor(url, options) {
  28211. super(url, options);
  28212. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  28213. }
  28214. /**
  28215. * @override
  28216. */
  28217. destroy() {
  28218. super.destroy();
  28219. }
  28220. /**
  28221. * @function SuperMap.QueryByGeometryService.prototype.getJsonParameters
  28222. * @description 将查询参数转化为 JSON 字符串。
  28223. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  28224. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询参数类。
  28225. * @returns {Object} 转化后的 JSON 字符串。
  28226. */
  28227. getJsonParameters(params) {
  28228. if (!(params instanceof QueryByGeometryParameters_QueryByGeometryParameters)) {
  28229. return;
  28230. }
  28231. var me = this,
  28232. jsonParameters = "",
  28233. qp = null,
  28234. geometry = params.geometry,
  28235. sg = ServerGeometry_ServerGeometry.fromGeometry(geometry);
  28236. qp = me.getQueryParameters(params);
  28237. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  28238. jsonParameters += Util_Util.toJSON(qp) + ",'geometry':" + Util_Util.toJSON(sg)
  28239. + ",'spatialQueryMode':" + Util_Util.toJSON(params.spatialQueryMode);
  28240. jsonParameters = "{" + jsonParameters + "}";
  28241. return jsonParameters;
  28242. }
  28243. }
  28244. SuperMap.QueryByGeometryService = QueryByGeometryService_QueryByGeometryService;
  28245. // CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  28246. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28247. * This program are made available under the terms of the Apache License, Version 2.0
  28248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28249. /**
  28250. * @class SuperMap.QueryBySQLParameters
  28251. * @category iServer Map QueryResults
  28252. * @classdesc SQL 查询参数类。
  28253. * 该类用于设置 SQL 查询的相关参数。
  28254. * @extends {SuperMap.QueryParameters}
  28255. * @param {Object} options - 参数。
  28256. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  28257. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  28258. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  28259. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  28260. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  28261. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  28262. * @param {number} [options.startRecord=0] - 查询起始记录号。
  28263. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  28264. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  28265. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28266. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  28267. */
  28268. class QueryBySQLParameters_QueryBySQLParameters extends QueryParameters_QueryParameters {
  28269. constructor(options) {
  28270. if (!options) {
  28271. return;
  28272. }
  28273. super(options);
  28274. /**
  28275. * @member {boolean} [SuperMap.QueryBySQLParameters.prototype.returnContent=true]
  28276. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28277. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  28278. * 为 false,则返回的是查询结果资源的 URI。
  28279. */
  28280. this.returnContent = true;
  28281. Util_Util.extend(this, options);
  28282. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  28283. }
  28284. /**
  28285. * @function SuperMap.QueryBySQLParameters.prototype.destroy
  28286. * @description 释放资源,将引用资源的属性置空。
  28287. */
  28288. destroy() {
  28289. super.destroy();
  28290. var me = this;
  28291. me.returnContent = null;
  28292. }
  28293. }
  28294. SuperMap.QueryBySQLParameters = QueryBySQLParameters_QueryBySQLParameters;
  28295. // CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  28296. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28297. * This program are made available under the terms of the Apache License, Version 2.0
  28298. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28299. /**
  28300. * @class SuperMap.QueryBySQLService
  28301. * @category iServer Map QueryResults
  28302. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  28303. * @extends {SuperMap.QueryService}
  28304. * @example
  28305. * var queryParam = new SuperMap.FilterParameter({
  28306. * name: "Countries@World.1",
  28307. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  28308. * });
  28309. * var queryBySQLParams = new SuperMap.QueryBySQLParameters({
  28310. * queryParams: [queryParam]
  28311. * });
  28312. * var myQueryBySQLService = new SuperMap.QueryBySQLService(url, {eventListeners: {
  28313. * "processCompleted": queryCompleted,
  28314. * "processFailed": queryError
  28315. * }
  28316. * });
  28317. * queryBySQLService.processAsync(queryBySQLParams);
  28318. * function queryCompleted(object){//todo};
  28319. * function queryError(object){//todo};
  28320. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28321. * @param {Object} options - 参数。
  28322. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28323. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28324. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28325. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28326. * @param {Object} [options.headers] - 请求头。
  28327. */
  28328. class QueryBySQLService_QueryBySQLService extends QueryService_QueryService {
  28329. /**
  28330. * @function SuperMap.QueryBySQLService.prototype.constructor
  28331. * @description SQL 查询服务类构造函数。
  28332. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28333. * @param {Object} options - 参数。
  28334. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28335. */
  28336. constructor(url, options) {
  28337. super(url, options);
  28338. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  28339. }
  28340. /**
  28341. * @override
  28342. */
  28343. destroy() {
  28344. super.destroy();
  28345. }
  28346. /**
  28347. * @function SuperMap.QueryBySQLService.prototype.getJsonParameters
  28348. * @description 将查询参数转化为 JSON 字符串。
  28349. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  28350. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询参数类。
  28351. * @returns {Object} 转化后的 JSON 字符串。
  28352. */
  28353. getJsonParameters(params) {
  28354. if (!(params instanceof QueryBySQLParameters_QueryBySQLParameters)) {
  28355. return;
  28356. }
  28357. var me = this,
  28358. jsonParameters = "",
  28359. qp = null;
  28360. qp = me.getQueryParameters(params);
  28361. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  28362. jsonParameters += Util_Util.toJSON(qp);
  28363. jsonParameters = "{" + jsonParameters + "}";
  28364. return jsonParameters;
  28365. }
  28366. }
  28367. SuperMap.QueryBySQLService = QueryBySQLService_QueryBySQLService;
  28368. // CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  28369. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28370. * This program are made available under the terms of the Apache License, Version 2.0
  28371. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28372. /**
  28373. * @class SuperMap.RouteCalculateMeasureParameters
  28374. * @category iServer SpatialAnalyst RouteCalculateMeasure
  28375. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  28376. * @param {Object} options - 参数。
  28377. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  28378. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  28379. * @param {float} [options.tolerance] - 容限值。
  28380. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  28381. */
  28382. class RouteCalculateMeasureParameters_RouteCalculateMeasureParameters {
  28383. constructor(options) {
  28384. if (!options) {
  28385. return this;
  28386. }
  28387. /**
  28388. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteCalculateMeasureParameters.prototype.sourceRoute
  28389. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  28390. */
  28391. this.sourceRoute = null;
  28392. /**
  28393. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} SuperMap.RouteCalculateMeasureParameters.prototype.point
  28394. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  28395. */
  28396. this.point = null;
  28397. /**
  28398. * @member {float} [SuperMap.RouteCalculateMeasureParameters.prototype.tolerance]
  28399. * @description 容限值。
  28400. */
  28401. this.tolerance = null;
  28402. /**
  28403. * @member {boolean} [SuperMap.RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  28404. * @description 是否忽略子对象之间的距离。
  28405. */
  28406. this.isIgnoreGap = false;
  28407. Util_Util.extend(this, options);
  28408. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  28409. }
  28410. /**
  28411. * @function SuperMap.RouteCalculateMeasureParameters.prototype.destroy
  28412. * @description 释放资源,将引用资源的属性置空。
  28413. */
  28414. destroy() {
  28415. var me = this;
  28416. me.sourceRoute = null;
  28417. me.point = null;
  28418. if (me.tolerance) {
  28419. me.tolerance = null;
  28420. }
  28421. if (me.isIgnoreGap) {
  28422. me.isIgnoreGap = false;
  28423. }
  28424. }
  28425. }
  28426. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters_RouteCalculateMeasureParameters;
  28427. // CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  28428. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28429. * This program are made available under the terms of the Apache License, Version 2.0
  28430. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28431. /**
  28432. * @class SuperMap.RouteCalculateMeasureService
  28433. * @category iServer SpatialAnalyst RouteCalculateMeasure
  28434. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  28435. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  28436. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  28437. * @extends {SuperMap.SpatialAnalystBase}
  28438. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  28439. * @param {Object} options - 参数。
  28440. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28441. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28442. * @param {Object} [options.headers] - 请求头。
  28443. * @example 实例化该类如下例所示:
  28444. * (start code)
  28445. * var parameters = new SuperMap.RouteCalculateMeasureParameters({
  28446. * "sourceRoute":{
  28447. * "type":"LINEM",
  28448. * "parts":[4],
  28449. * "points":[
  28450. * {
  28451. * "measure":0,
  28452. * "y":-6674.466867067764,
  28453. * "x":3817.3527876130133
  28454. * },
  28455. * {
  28456. * "measure":199.57954019411724,
  28457. * "y":-6670.830929417594,
  28458. * "x":3617.806369901496
  28459. * },
  28460. * {
  28461. * "measure":609.3656478634477,
  28462. * "y":-6877.837541432356,
  28463. * "x":3264.1498746678444
  28464. * },
  28465. * {
  28466. * "measure":936.0174126282958,
  28467. * "y":-7038.687780615184,
  28468. * "x":2979.846206068903
  28469. * }
  28470. * ]
  28471. * },
  28472. * "tolerance":1,
  28473. * "point":{
  28474. * "x":3330.7754269417,
  28475. * "y":-6838.8394457216
  28476. * },
  28477. * "isIgnoreGap":false
  28478. * });
  28479. *
  28480. * var routeCalculateMeasureService = new SuperMap.RouteCalculateMeasureService(spatialAnalystURL, {
  28481. * eventListeners:{
  28482. * processCompleted:calculateCompleted,
  28483. * processFailed:calculateFailded
  28484. * }
  28485. * );
  28486. * routeCalculateMeasureService.processAsync(parameters);
  28487. *
  28488. * //执行
  28489. * function calculateCompleted(){todo}
  28490. * function calculateFailded(){todo}
  28491. * (end)
  28492. *
  28493. */
  28494. class RouteCalculateMeasureService_RouteCalculateMeasureService extends SpatialAnalystBase_SpatialAnalystBase {
  28495. constructor(url, options) {
  28496. super(url, options);
  28497. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  28498. }
  28499. /**
  28500. * @override
  28501. */
  28502. destroy() {
  28503. super.destroy();
  28504. }
  28505. /**
  28506. * @function SuperMap.RouteCalculateMeasureService.prototype.processAsync
  28507. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  28508. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  28509. */
  28510. processAsync(params) {
  28511. if (!(params instanceof RouteCalculateMeasureParameters_RouteCalculateMeasureParameters)) {
  28512. return;
  28513. }
  28514. var me = this, jsonParameters;
  28515. jsonParameters = me.getJsonParameters(params);
  28516. me.request({
  28517. method: "POST",
  28518. data: jsonParameters,
  28519. scope: me,
  28520. success: me.serviceProcessCompleted,
  28521. failure: me.serviceProcessFailed
  28522. });
  28523. }
  28524. /**
  28525. * @function SuperMap.RouteCalculateMeasureService.prototype.getJsonParameters
  28526. * @description 将参数转化为 JSON 字符串。
  28527. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  28528. * @returns {Object} 转化后的 JSON 字符串。
  28529. */
  28530. getJsonParameters(params) {
  28531. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  28532. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  28533. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  28534. jsonParameters = Util_Util.toJSON(params);
  28535. return jsonParameters;
  28536. }
  28537. }
  28538. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService_RouteCalculateMeasureService;
  28539. // CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  28540. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28541. * This program are made available under the terms of the Apache License, Version 2.0
  28542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28543. /**
  28544. * @class SuperMap.RouteLocatorParameters
  28545. * @category iServer SpatialAnalyst RouteLocator
  28546. * @classdesc 路由对象定位空间对象的参数类。
  28547. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数
  28548. * 如果用户两种参数均设置,优先选择 Dataset 方式。
  28549. * @param {Object} options - 参数。
  28550. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。
  28551. * @param {float} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  28552. * @param {string} [options.type] - 类型:点 or 线。
  28553. * @param {float} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  28554. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  28555. * @param {float} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  28556. * @param {float} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  28557. */
  28558. class RouteLocatorParameters_RouteLocatorParameters {
  28559. constructor(options) {
  28560. if (!options) {
  28561. return this;
  28562. }
  28563. /**
  28564. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteLocatorParameters.prototype.sourceRoute
  28565. * @description 路由对象。
  28566. */
  28567. this.sourceRoute = null;
  28568. /**
  28569. * @member {string} SuperMap.RouteLocatorParameters.prototype.dataset
  28570. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  28571. */
  28572. this.dataset = null;
  28573. /**
  28574. * @member {string} SuperMap.RouteLocatorParameters.prototype.routeIDField
  28575. * @description 路由对象所在的字段名称。
  28576. *
  28577. */
  28578. this.routeIDField = null;
  28579. /**
  28580. * @member {number} SuperMap.RouteLocatorParameters.prototype.routeID
  28581. * @description 路由对象标识。
  28582. *
  28583. */
  28584. this.routeID = null;
  28585. /**
  28586. * @member {string} [SuperMap.RouteLocatorParameters.prototype.type]
  28587. * @description 类型:点 or 线。
  28588. * 可选值为:
  28589. * LINE :根据起始 M 值及终止 M 值定位线对象。
  28590. * POINT : 根据 M 值定位点对象。
  28591. */
  28592. this.type = null;
  28593. /**
  28594. * @member {float} SuperMap.RouteLocatorParameters.prototype.measure
  28595. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  28596. */
  28597. this.measure = null;
  28598. /**
  28599. * @member {float} [SuperMap.RouteLocatorParameters.prototype.offset=0]
  28600. * @description 定位点偏移量。只当路由对象定位点时有意义。
  28601. */
  28602. this.offset = 0;
  28603. /**
  28604. * @member {boolean} [SuperMap.RouteLocatorParameters.prototype.isIgnoreGap=false]
  28605. * @description 是否忽略子对象之间的距离。
  28606. */
  28607. this.isIgnoreGap = false;
  28608. /**
  28609. * @member {float} [SuperMap.RouteLocatorParameters.prototype.startMeasure]
  28610. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  28611. */
  28612. this.startMeasure = null;
  28613. /**
  28614. * @member {float} [SuperMap.RouteLocatorParameters.prototype.endMeasure]
  28615. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  28616. */
  28617. this.endMeasure = null;
  28618. var routeFromClient = options.sourceRoute;
  28619. var routeHandle = {};
  28620. if (routeFromClient && routeFromClient instanceof Geometry_Geometry && routeFromClient.components) {
  28621. routeHandle.type = routeFromClient.type;
  28622. routeHandle.parts = routeFromClient.parts;
  28623. var parts = [];
  28624. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  28625. parts = parts.concat(routeFromClient.components[i].components);
  28626. }
  28627. routeHandle.points = parts;
  28628. options.sourceRoute = routeHandle;
  28629. }
  28630. Util_Util.extend(this, options);
  28631. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  28632. }
  28633. /**
  28634. * @function SuperMap.RouteLocatorParameters.prototype.destroy
  28635. * @description 释放资源,将引用资源的属性置空。
  28636. */
  28637. destroy() {
  28638. var me = this;
  28639. me.sourceRoute = null;
  28640. me.type = null;
  28641. me.measure = null;
  28642. me.offset = 0;
  28643. me.isIgnoreGap = false;
  28644. me.startMeasure = null;
  28645. me.endMeasure = null;
  28646. me.dataset = null;
  28647. me.routeID = null;
  28648. me.routeIDField = null;
  28649. }
  28650. }
  28651. SuperMap.RouteLocatorParameters = RouteLocatorParameters_RouteLocatorParameters;
  28652. // CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  28653. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28654. * This program are made available under the terms of the Apache License, Version 2.0
  28655. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28656. /**
  28657. * @class SuperMap.RouteLocatorService
  28658. * @category iServer SpatialAnalyst RouteLocator
  28659. * @classdesc 路由对象定位空间对象的服务类。
  28660. * @extends {SuperMap.SpatialAnalystBase}
  28661. * @param {string} url -服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  28662. * @param {Object} options - 参数。</br>
  28663. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28664. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28665. * @param {Object} [options.headers] - 请求头。
  28666. * @example 实例化该类如下例所示:
  28667. * (start code)
  28668. * var routeLocatorParameters_point = new SuperMap.RouteLocatorParameters({
  28669. * "sourceRoute":{
  28670. * "type":"LINEM",
  28671. * "parts":[4],
  28672. * "points":[
  28673. * {
  28674. * "measure":0,
  28675. * "y":-6674.466867067764,
  28676. * "x":3817.3527876130133
  28677. * },
  28678. * {
  28679. * "measure":199.57954019411724,
  28680. * "y":-6670.830929417594,
  28681. * "x":3617.806369901496
  28682. * },
  28683. * {
  28684. * "measure":609.3656478634477,
  28685. * "y":-6877.837541432356,
  28686. * "x":3264.1498746678444
  28687. * },
  28688. * {
  28689. * "measure":936.0174126282958,
  28690. * "y":-7038.687780615184,
  28691. * "x":2979.846206068903
  28692. * }
  28693. * ]
  28694. * },
  28695. * "type":"POINT",
  28696. * "measure":10,
  28697. * "offset":3,
  28698. * "isIgnoreGap":true
  28699. * });
  28700. * var routeLocatorService = new SuperMap.RouteLocatorService(spatialAnalystURL, {
  28701. * eventListeners:{
  28702. * processCompleted:routeLocatorCompleted,
  28703. * processFailed:routeLocatorFailded
  28704. * }
  28705. * );
  28706. * routeLocatorService.processAsync(routeLocatorParameters_point);
  28707. *
  28708. * //执行
  28709. * function routeLocatorCompleted(){todo}
  28710. * function routeLocatorFailded(){todo}
  28711. * (end)
  28712. *
  28713. */
  28714. class RouteLocatorService_RouteLocatorService extends SpatialAnalystBase_SpatialAnalystBase {
  28715. constructor(url, options) {
  28716. super(url, options);
  28717. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  28718. }
  28719. /**
  28720. * @override
  28721. */
  28722. destroy() {
  28723. super.destroy();
  28724. }
  28725. /**
  28726. * @function SuperMap.RouteLocatorService.prototype.processAsync
  28727. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  28728. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  28729. */
  28730. processAsync(params) {
  28731. if (!(params instanceof RouteLocatorParameters_RouteLocatorParameters)) {
  28732. return;
  28733. }
  28734. var me = this, jsonParameters;
  28735. jsonParameters = me.getJsonParameters(params);
  28736. me.request({
  28737. method: "POST",
  28738. data: jsonParameters,
  28739. scope: me,
  28740. success: me.serviceProcessCompleted,
  28741. failure: me.serviceProcessFailed
  28742. });
  28743. }
  28744. /**
  28745. * @function SuperMap.RouteLocatorService.prototype.processAsync
  28746. * @description 将参数转化为 JSON 字符串。
  28747. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  28748. * @returns {Object} 转化后的JSON字符串。
  28749. */
  28750. getJsonParameters(params) {
  28751. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  28752. if (params.dataset) {
  28753. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  28754. params.sourceRoute = null;
  28755. }
  28756. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  28757. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  28758. jsonParameters = Util_Util.toJSON(params);
  28759. return jsonParameters;
  28760. }
  28761. }
  28762. SuperMap.RouteLocatorService = RouteLocatorService_RouteLocatorService;
  28763. // CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  28764. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28765. * This program are made available under the terms of the Apache License, Version 2.0
  28766. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28767. /**
  28768. * @class SuperMap.ServerFeature
  28769. * @category iServer
  28770. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  28771. * @param {Object} options - 参数。
  28772. * @param {SuperMap.ServerGeometry} geometry - 矢量要素的几何信息。
  28773. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  28774. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  28775. */
  28776. class ServerFeature_ServerFeature {
  28777. constructor(options) {
  28778. /**
  28779. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldNames]
  28780. * @description 矢量要素的属性字段名集合。
  28781. */
  28782. this.fieldNames = null;
  28783. /**
  28784. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldValues]
  28785. * @description 矢量要素的属性字段值集合。
  28786. */
  28787. this.fieldValues = null;
  28788. /**
  28789. * @member {SuperMap.ServerGeometry} SuperMap.ServerFeature.prototype.geometry
  28790. * @description 矢量要素的几何信息。
  28791. */
  28792. this.geometry = null;
  28793. if (options) {
  28794. Util_Util.extend(this, options);
  28795. }
  28796. this.CLASS_NAME = "SuperMap.ServerFeature";
  28797. }
  28798. /**
  28799. * @function SuperMap.ServerFeature.prototype.destroy
  28800. * @description 释放资源,将引用资源的属性置空。
  28801. */
  28802. destroy() {
  28803. var me = this;
  28804. me.fieldNames = null;
  28805. me.fieldValues = null;
  28806. if (me.geometry) {
  28807. me.geometry.destroy();
  28808. me.geometry = null;
  28809. }
  28810. }
  28811. /**
  28812. * @function SuperMap.ServerFeature.prototype.toFeature
  28813. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  28814. * @returns {SuperMap.Vector} 转换后的客户端矢量要素。
  28815. */
  28816. toFeature() {
  28817. var names, values, geo,
  28818. attr = {},
  28819. me = this,
  28820. feature;
  28821. names = me.fieldNames;
  28822. values = me.fieldValues;
  28823. for (var i in names) {
  28824. attr[names[i]] = values[i];
  28825. }
  28826. if (me.geometry) {
  28827. geo = me.geometry.toGeometry();
  28828. }
  28829. feature = new Vector_Vector(geo, attr);
  28830. if (me.geometry && me.geometry.id) {
  28831. feature.fid = me.geometry.id;
  28832. }
  28833. return feature;
  28834. }
  28835. /**
  28836. * @function SuperMap.ServerFeature.prototype.fromJson
  28837. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  28838. * @param {Object} jsonObject - 要转换的 JSON 对象。
  28839. * @returns {SuperMap.ServerFeature} 转化后的 ServerFeature 对象。
  28840. */
  28841. static fromJson(jsonObject) {
  28842. var geo = null;
  28843. if (!jsonObject) {
  28844. return;
  28845. }
  28846. geo = jsonObject.geometry;
  28847. if (geo) {
  28848. geo = ServerGeometry_ServerGeometry.fromJson(geo);
  28849. }
  28850. return new ServerFeature_ServerFeature({
  28851. fieldNames: jsonObject.fieldNames,
  28852. fieldValues: jsonObject.fieldValues,
  28853. geometry: geo
  28854. });
  28855. }
  28856. }
  28857. SuperMap.ServerFeature = ServerFeature_ServerFeature;
  28858. // CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  28859. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28860. * This program are made available under the terms of the Apache License, Version 2.0
  28861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28862. /**
  28863. * @class SuperMap.SetLayerInfoParameters
  28864. * @category iServer Map TempLayersSet
  28865. * @classdesc 设置图层信息参数类.
  28866. * @param {Object} options - 参数。
  28867. * @param {string} options.resourceID - 临时图层的资源 ID。
  28868. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  28869. * @param {string} options.layerInfo - 要更新的图层信息。
  28870. */
  28871. class SetLayerInfoParameters_SetLayerInfoParameters {
  28872. constructor(options) {
  28873. options = options || {};
  28874. /**
  28875. * @member {string} SuperMap.SetLayerInfoParameters.prototype.resourceID
  28876. * @description 临时图层的资源 ID。
  28877. */
  28878. this.resourceID = null;
  28879. /**
  28880. * @member {string} SuperMap.SetLayerInfoParameters.prototype.tempLayerName
  28881. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  28882. */
  28883. this.tempLayerName = null;
  28884. /**
  28885. * @member {Object} SuperMap.SetLayerInfoParameters.prototype.layerInfo
  28886. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  28887. */
  28888. this.layerInfo = null;
  28889. Util_Util.extend(this, options);
  28890. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  28891. }
  28892. /**
  28893. * @function SuperMap.SetLayerInfoParameters.prototype.destroy
  28894. * @description 释放资源,将引用资源的属性置空。
  28895. */
  28896. destroy() {
  28897. var me = this;
  28898. me.resourceID = null;
  28899. me.tempLayerName = null;
  28900. me.layerInfo = null;
  28901. }
  28902. }
  28903. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters_SetLayerInfoParameters;
  28904. // CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  28905. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28906. * This program are made available under the terms of the Apache License, Version 2.0
  28907. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28908. /**
  28909. * @class SuperMap.SetLayerInfoService
  28910. * @category iServer Map TempLayersSet
  28911. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  28912. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  28913. * @extends {SuperMap.CommonServiceBase}
  28914. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  28915. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  28916. * @param {Object} options - 参数。
  28917. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28918. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28919. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28920. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28921. * @param {Object} [options.headers] - 请求头。
  28922. */
  28923. class SetLayerInfoService_SetLayerInfoService extends CommonServiceBase_CommonServiceBase {
  28924. constructor(url, options) {
  28925. super(url, options);
  28926. if (options) {
  28927. Util_Util.extend(this, options);
  28928. }
  28929. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  28930. }
  28931. /**
  28932. * @override
  28933. */
  28934. destroy() {
  28935. super.destroy();
  28936. Util_Util.reset(this);
  28937. }
  28938. /**
  28939. * @function SuperMap.SetLayerInfoService.prototype.processAsync
  28940. * @description 负责将客户端的更新参数传递到服务端。
  28941. * @param {Object} params - 修改后的图层资源信息。
  28942. * 该参数可以使用获取图层信息服务<{@link SuperMap.GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  28943. */
  28944. processAsync(params) {
  28945. if (!params) {
  28946. return;
  28947. }
  28948. var me = this;
  28949. var jsonParamsStr = Util_Util.toJSON(params);
  28950. me.request({
  28951. method: "PUT",
  28952. data: jsonParamsStr,
  28953. scope: me,
  28954. success: me.serviceProcessCompleted,
  28955. failure: me.serviceProcessFailed
  28956. });
  28957. }
  28958. }
  28959. SuperMap.SetLayerInfoService = SetLayerInfoService_SetLayerInfoService;
  28960. // CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  28961. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  28962. * This program are made available under the terms of the Apache License, Version 2.0
  28963. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28964. /**
  28965. * @class SuperMap.SetLayersInfoParameters
  28966. * @category iServer Map TempLayersSet
  28967. * @classdesc 设置图层信息参数类。
  28968. * @param {Object} options - 参数。
  28969. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  28970. * @param {string} options.resourceID - 临时图层资源 ID。
  28971. * @param {string} options.layersInfo - 要更新的图层信息。
  28972. */
  28973. class SetLayersInfoParameters_SetLayersInfoParameters {
  28974. constructor(options) {
  28975. options = options || {};
  28976. /**
  28977. * @member {boolean} [SuperMap.SetLayersInfoParameters.prototype.isTempLayers=false]
  28978. * @description 是否是临时图层。
  28979. */
  28980. this.isTempLayers = null;
  28981. /**
  28982. * @member {string} SuperMap.SetLayersInfoParameters.prototype.resourceID
  28983. * @description 临时图层资源 ID,
  28984. */
  28985. this.resourceID = null;
  28986. /**
  28987. * @member {Object} SuperMap.SetLayersInfoParameters.prototype.layersInfo
  28988. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  28989. */
  28990. this.layersInfo = null;
  28991. Util_Util.extend(this, options);
  28992. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  28993. }
  28994. /**
  28995. * @function SuperMap.SetLayersInfoParameters.prototype.destroy
  28996. * @description 释放资源,将引用资源的属性置空。
  28997. */
  28998. destroy() {
  28999. var me = this;
  29000. me.isTempLayers = null;
  29001. me.resourceID = null;
  29002. me.layersInfo = null;
  29003. }
  29004. }
  29005. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters_SetLayersInfoParameters;
  29006. // CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  29007. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29008. * This program are made available under the terms of the Apache License, Version 2.0
  29009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29010. /**
  29011. * @class SuperMap.SetLayersInfoService
  29012. * @category iServer Map TempLayersSet
  29013. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  29014. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  29015. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  29016. * @extends {SuperMap.CommonServiceBase}
  29017. * @param url - {string} 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  29018. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  29019. * @param {Object} options - 参数。
  29020. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  29021. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  29022. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29023. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29024. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29025. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29026. * @param {Object} [options.headers] - 请求头。
  29027. */
  29028. class SetLayersInfoService_SetLayersInfoService extends CommonServiceBase_CommonServiceBase {
  29029. constructor(url, options) {
  29030. super(url, options);
  29031. /**
  29032. * @member {string} SuperMap.SetLayersInfoService.prototype.resourceID
  29033. * @description 图层资源ID,临时图层的资源ID标记。
  29034. */
  29035. this.resourceID = null;
  29036. /**
  29037. * @function {boolean} SuperMap.SetLayersInfoService.prototype.isTempLayers
  29038. * @description 当前url对应的图层是否是临时图层。
  29039. */
  29040. this.isTempLayers = false;
  29041. if (options) {
  29042. SuperMap.Util.extend(this, options);
  29043. }
  29044. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  29045. }
  29046. /**
  29047. * @override
  29048. */
  29049. destroy() {
  29050. super.destroy();
  29051. Util_Util.reset(this);
  29052. }
  29053. /**
  29054. * @function SuperMap.SetLayersInfoService.prototype.processAsync
  29055. * @description 负责将客户端的更新参数传递到服务端。
  29056. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link SuperMap.GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  29057. */
  29058. processAsync(params) {
  29059. if (!params) {
  29060. return;
  29061. }
  29062. var jsonParams,
  29063. subLayers = [],
  29064. me = this,
  29065. method = "";
  29066. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  29067. if (me.isTempLayers) {
  29068. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  29069. method = "PUT";
  29070. } else {
  29071. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet");
  29072. method = "POST";
  29073. }
  29074. if (!params.subLayers) {
  29075. params.subLayers = {layers: []}
  29076. }
  29077. if (!params.subLayers.layers) {
  29078. params.subLayers.layers = [];
  29079. }
  29080. var layers = params.subLayers.layers,
  29081. len = layers.length;
  29082. for (let i in layers) {
  29083. if (layers[i].ugcLayerType === "GRID") {
  29084. var colorDictionary = {};
  29085. var colorDics = layers[i].colorDictionarys;
  29086. for (var j in colorDics) {
  29087. var key = colorDics[j].elevation;
  29088. colorDictionary[key] = colorDics[j].color;
  29089. }
  29090. }
  29091. layers[i].colorDictionary = colorDictionary;
  29092. delete layers[i].colorDictionarys;
  29093. }
  29094. for (let i = 0; i < len; i++) {
  29095. if (layers[i].toJsonObject) {
  29096. //将图层信息转换成服务端能识别的简单json对象
  29097. subLayers.push(layers[i].toJsonObject());
  29098. } else {
  29099. subLayers.push(layers[i]);
  29100. }
  29101. }
  29102. jsonParams = Util_Util.extend(jsonParams, params);
  29103. jsonParams.subLayers = {"layers": subLayers};
  29104. jsonParams.object = null;
  29105. var jsonParamsStr = Util_Util.toJSON([jsonParams]);
  29106. me.request({
  29107. method: method,
  29108. data: jsonParamsStr,
  29109. scope: me,
  29110. success: me.serviceProcessCompleted,
  29111. failure: me.serviceProcessFailed
  29112. });
  29113. }
  29114. }
  29115. SuperMap.SetLayersInfoService = SetLayersInfoService_SetLayersInfoService;
  29116. // CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  29117. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29118. * This program are made available under the terms of the Apache License, Version 2.0
  29119. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29120. /**
  29121. * @class SuperMap.SetLayerStatusParameters
  29122. * @category iServer Map TempLayersSet
  29123. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  29124. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  29125. * @param {Object} options - 参数。
  29126. * @param {Array.<SuperMap.LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,
  29127. * 集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  29128. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  29129. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  29130. */
  29131. class SetLayerStatusParameters_SetLayerStatusParameters {
  29132. constructor(options) {
  29133. /**
  29134. * @member {Array.<SuperMap.LayerStatus>} SuperMap.SetLayerStatusParameters.prototype.layerStatusList
  29135. * @description 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  29136. */
  29137. this.layerStatusList = [];
  29138. /**
  29139. * @member {number} [SuperMap.SetLayerStatusParameters.prototype.holdTime=15]
  29140. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  29141. */
  29142. this.holdTime = 15;
  29143. /**
  29144. * @member {string} SuperMap.SetLayerStatusParameters.prototype.resourceID
  29145. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 进行图层的显示控制;
  29146. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 进行图层的显示控制。
  29147. */
  29148. this.resourceID = null;
  29149. if (options) {
  29150. Util_Util.extend(this, options);
  29151. }
  29152. }
  29153. /**
  29154. * @function SuperMap.SetLayerStatusParameters.prototype.destroy
  29155. * @description 释放资源,将引用资源的属性置空。
  29156. */
  29157. destroy() {
  29158. var me = this;
  29159. me.layerStatusList = null;
  29160. me.holdTime = null;
  29161. me.resourceID = null;
  29162. }
  29163. /**
  29164. * @function SuperMap.SetLayerStatusParameters.prototype.toJSON
  29165. * @description 生成 JSON。
  29166. * @returns {Object} 对应的 JSON 对象。
  29167. */
  29168. toJSON() {
  29169. var json = '{';
  29170. json += '"layers":[';
  29171. var v = [];
  29172. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  29173. v.push(this.layerStatusList[i].toJSON());
  29174. }
  29175. json += v;
  29176. json += ']';
  29177. json += '}';
  29178. return json;
  29179. }
  29180. }
  29181. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters_SetLayerStatusParameters;
  29182. // CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  29183. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29184. * This program are made available under the terms of the Apache License, Version 2.0
  29185. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29186. /**
  29187. * @class SuperMap.SetLayerStatusService
  29188. * @category iServer Map TempLayersSet
  29189. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  29190. * 用户获取服务端返回的各子图层显示状态有两种方式:
  29191. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  29192. * 一种是使用 AsyncResponder 类实现异步处理。
  29193. * @extends {SuperMap.CommonServiceBase}
  29194. * @param {string} url - 地图服务访问地址。请求地图服务,URL 应为:
  29195. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  29196. * @param {Object} options - 参数。
  29197. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29198. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29199. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29200. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29201. * @param {Object} [options.headers] - 请求头。
  29202. */
  29203. class SetLayerStatusService_SetLayerStatusService extends CommonServiceBase_CommonServiceBase {
  29204. constructor(url, options) {
  29205. super(url, options);
  29206. this.lastparams = null;
  29207. this.mapUrl = url;
  29208. if (options) {
  29209. Util_Util.extend(this, options);
  29210. }
  29211. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  29212. }
  29213. /**
  29214. * @override
  29215. */
  29216. destroy() {
  29217. super.destroy();
  29218. Util_Util.reset(this);
  29219. }
  29220. /**
  29221. * @function SuperMap.SetLayerStatusService.prototype.processAsync
  29222. * @description 负责将客户端的更新参数传递到服务端。
  29223. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SuperMap.SetLayerStatusParameters}
  29224. * 返回图层信息,然后对其属性进行修改来获取。
  29225. */
  29226. processAsync(params) {
  29227. if (!(params instanceof SetLayerStatusParameters_SetLayerStatusParameters)) {
  29228. return;
  29229. }
  29230. var me = this,
  29231. method = "POST";
  29232. me.url = me.mapUrl;
  29233. if (params.resourceID == null) {
  29234. me.url = Util_Util.urlPathAppend(me.url, 'tempLayersSet');
  29235. me.lastparams = params;
  29236. me.request({
  29237. method: method,
  29238. scope: me,
  29239. success: me.createTempLayerComplete,
  29240. failure: me.serviceProcessFailed
  29241. });
  29242. } else {
  29243. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  29244. me.url = Util_Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  29245. var jsonParameters = '[{';
  29246. jsonParameters += '"type":"UGC",';
  29247. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  29248. jsonParameters += '"subLayers":' + params.toJSON();
  29249. }
  29250. jsonParameters += ',"visible":' + true + ',';
  29251. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  29252. jsonParameters += '}]';
  29253. me.request({
  29254. method: "PUT",
  29255. data: jsonParameters,
  29256. scope: me,
  29257. success: me.serviceProcessCompleted,
  29258. failure: me.serviceProcessFailed
  29259. });
  29260. }
  29261. }
  29262. /**
  29263. * @function SuperMap.SetLayerStatusService.prototype.createTempLayerComplete
  29264. * @description 设置完成,执行此方法。
  29265. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  29266. */
  29267. createTempLayerComplete(result) {
  29268. var me = this;
  29269. result = Util_Util.transformResult(result);
  29270. if (result.succeed) {
  29271. me.lastparams.resourceID = result.newResourceID;
  29272. }
  29273. me.processAsync(me.lastparams);
  29274. }
  29275. /**
  29276. * @function SuperMap.SetLayerStatusService.prototype.getMapName
  29277. * @description 获取地图名称。
  29278. * @param {Object} url - 服务地址。
  29279. */
  29280. getMapName(url) {
  29281. var mapUrl = url;
  29282. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  29283. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  29284. }
  29285. var index = mapUrl.lastIndexOf("/");
  29286. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  29287. return mapName;
  29288. }
  29289. /**
  29290. * @function SuperMap.SetLayerStatusService.prototype.setLayerCompleted
  29291. * @description 设置完成,执行此方法。
  29292. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  29293. */
  29294. serviceProcessCompleted(result) {
  29295. var me = this;
  29296. result = Util_Util.transformResult(result);
  29297. if (result != null && me.lastparams != null) {
  29298. result.newResourceID = me.lastparams.resourceID;
  29299. }
  29300. me.events.triggerEvent("processCompleted", {result: result});
  29301. }
  29302. }
  29303. SuperMap.SetLayerStatusService = SetLayerStatusService_SetLayerStatusService;
  29304. // CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  29305. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29306. * This program are made available under the terms of the Apache License, Version 2.0
  29307. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29308. /**
  29309. * @class SuperMap.SingleObjectQueryJobsParameter
  29310. * @category iServer ProcessingService Query
  29311. * @classdesc 单对象空间查询分析任务参数类。
  29312. * @param {Object} options - 参数。
  29313. * @param {string} options.datasetName - 数据集名。
  29314. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  29315. * @param {SuperMap.SpatialQueryMode} [options.mode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式。
  29316. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  29317. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  29318. */
  29319. class SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter {
  29320. constructor(options) {
  29321. if (!options) {
  29322. return;
  29323. }
  29324. /**
  29325. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetName
  29326. * @description 数据集名。
  29327. */
  29328. this.datasetName = "";
  29329. /**
  29330. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetQuery
  29331. * @description 查询对象所在的数据集名称。
  29332. */
  29333. this.datasetQuery = "";
  29334. /**
  29335. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.geometryQuery
  29336. * @description 查询对象所在的几何对象。
  29337. */
  29338. this.geometryQuery = "";
  29339. /**
  29340. * @member {SuperMap.SpatialQueryMode} [SuperMap.SingleObjectQueryJobsParameter.prototype.mode=SuperMap.SpatialQueryMode.CONTAIN]
  29341. * @description 空间查询模式 。
  29342. */
  29343. this.mode = SpatialQueryMode.CONTAIN;
  29344. /**
  29345. * @member {SuperMap.OutputSetting} [SuperMap.SingleObjectQueryJobsParameter.prototype.output]
  29346. * @description 输出参数设置类。
  29347. */
  29348. this.output = null;
  29349. /**
  29350. * @member {SuperMap.MappingParameters} [SuperMap.SingleObjectQueryJobsParameter.prototype.mappingParameters]
  29351. * @description 分析后结果可视化的参数类。
  29352. */
  29353. this.mappingParameters = null;
  29354. Util_Util.extend(this, options);
  29355. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  29356. }
  29357. /**
  29358. * @function SuperMap.SingleObjectQueryJobsParameter.prototype.destroy
  29359. * @description 释放资源,将引用资源的属性置空。
  29360. */
  29361. destroy() {
  29362. this.datasetName = null;
  29363. this.datasetQuery = null;
  29364. this.geometryQuery = null;
  29365. this.mode = null;
  29366. if (this.output instanceof OutputSetting_OutputSetting) {
  29367. this.output.destroy();
  29368. this.output = null;
  29369. }
  29370. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  29371. this.mappingParameters.destroy();
  29372. this.mappingParameters = null;
  29373. }
  29374. }
  29375. /**
  29376. * @function SuperMap.SingleObjectQueryJobsParameter.toObject
  29377. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  29378. * @param {Object} tempObj - 目标对象。
  29379. * @description 生成单对象空间查询分析任务对象。
  29380. */
  29381. static toObject(singleObjectQueryJobsParameter, tempObj) {
  29382. for (var name in singleObjectQueryJobsParameter) {
  29383. if (name === "datasetName") {
  29384. tempObj['input'] = tempObj['input'] || {};
  29385. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  29386. continue;
  29387. }
  29388. if (name === "output"){
  29389. tempObj['output'] = tempObj['output'] || {};
  29390. tempObj['output'] = singleObjectQueryJobsParameter[name];
  29391. continue;
  29392. }
  29393. tempObj['analyst'] = tempObj['analyst'] || {};
  29394. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  29395. if(name === 'mappingParameters'){
  29396. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  29397. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  29398. }
  29399. }
  29400. }
  29401. }
  29402. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter;
  29403. // CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  29404. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29405. * This program are made available under the terms of the Apache License, Version 2.0
  29406. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29407. /**
  29408. * @class SuperMap.SingleObjectQueryJobsService
  29409. * @category iServer ProcessingService Query
  29410. * @classdesc 单对象查询分析服务类
  29411. * @extends {SuperMap.ProcessingServiceBase}
  29412. * @param {string} url - 单对象空间查询分析服务地址。
  29413. * @param {Object} options - 参数。
  29414. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29415. * @param {Object} [options.headers] - 请求头。
  29416. */
  29417. class SingleObjectQueryJobsService_SingleObjectQueryJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  29418. constructor(url, options) {
  29419. super(url, options);
  29420. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/query');
  29421. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  29422. }
  29423. /**
  29424. *@override
  29425. */
  29426. destroy() {
  29427. super.destroy();
  29428. }
  29429. /**
  29430. * @function SuperMap.SingleObjectQueryJobsService.protitype.getQueryJobs
  29431. * @description 获取单对象空间查询分析所有任务
  29432. */
  29433. getQueryJobs() {
  29434. super.getJobs(this.url);
  29435. }
  29436. /**
  29437. * @function SuperMap.KernelDensityJobsService.protitype.getQueryJob
  29438. * @description 获取指定id的单对象空间查询分析服务
  29439. * @param {string} id - 指定要获取数据的id
  29440. */
  29441. getQueryJob(id) {
  29442. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  29443. }
  29444. /**
  29445. * @function SuperMap.SingleObjectQueryJobsService.protitype.addQueryJob
  29446. * @description 新建单对象空间查询分析服务
  29447. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  29448. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  29449. */
  29450. addQueryJob(params, seconds) {
  29451. super.addJob(this.url, params, SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter, seconds);
  29452. }
  29453. }
  29454. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService_SingleObjectQueryJobsService;
  29455. // CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  29456. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29457. * This program are made available under the terms of the Apache License, Version 2.0
  29458. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29459. /**
  29460. * @class SuperMap.StopQueryParameters
  29461. * @category iServer TrafficTransferAnalyst TransferStops
  29462. * @classdesc 站点查询参数类。
  29463. * @param {Object} options - 参数。
  29464. * @param {string} options.keyWord - 站点名称关键字。
  29465. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  29466. */
  29467. class StopQueryParameters_StopQueryParameters {
  29468. constructor(options) {
  29469. options = options || {};
  29470. /**
  29471. * @member {string} SuperMap.StopQueryParameters.prototype.keyWord
  29472. * @description 站点名称关键字。
  29473. */
  29474. this.keyWord = null;
  29475. /**
  29476. * @member {boolean} [SuperMap.StopQueryParameters.prototype.returnPosition=false]
  29477. * @description 是否返回站点坐标信息。
  29478. */
  29479. this.returnPosition = false;
  29480. Util_Util.extend(this, options);
  29481. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  29482. }
  29483. /**
  29484. * @function SuperMap.StopQueryParameters.prototype.destroy
  29485. * @description 释放资源,将引用资源的属性置空。
  29486. */
  29487. destroy() {
  29488. Util_Util.reset(this);
  29489. }
  29490. }
  29491. SuperMap.StopQueryParameters = StopQueryParameters_StopQueryParameters;
  29492. // CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  29493. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29494. * This program are made available under the terms of the Apache License, Version 2.0
  29495. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29496. /**
  29497. * @class SuperMap.StopQueryService
  29498. * @category iServer TrafficTransferAnalyst TransferStops
  29499. * @classdesc 站点查询服务类。
  29500. * 返回结果通过该类支持的事件的监听函数参数获取
  29501. * @extends {SuperMap.CommonServiceBase}
  29502. * @param {string} url - 与客户端交互的站点查询服务地址。
  29503. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  29504. * @param {Object} options - 参数。</br>
  29505. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29506. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29507. * @param {Object} [options.headers] - 请求头。
  29508. * @example 例如:
  29509. * (start code)
  29510. * var myService = new SuperMap.StopQueryService(url, {eventListeners: {
  29511. * "processCompleted": StopQueryCompleted,
  29512. * "processFailed": StopQueryError
  29513. * }
  29514. * };
  29515. * (end)
  29516. *
  29517. *
  29518. */
  29519. class StopQueryService_StopQueryService extends CommonServiceBase_CommonServiceBase {
  29520. constructor(url, options) {
  29521. super(url, options);
  29522. options = options || {};
  29523. Util_Util.extend(this, options);
  29524. this.CLASS_NAME = "SuperMap.StopQueryService";
  29525. }
  29526. /**
  29527. *@override
  29528. */
  29529. destroy() {
  29530. super.destroy();
  29531. Util_Util.reset(this);
  29532. }
  29533. /**
  29534. * @function SuperMap.StopQueryService.prototype.processAsync
  29535. * @description 负责将客户端的更新参数传递到服务端。
  29536. * @param {SuperMap.StopQueryParameters} params - 交通换乘参数。
  29537. */
  29538. processAsync(params) {
  29539. if (!(params instanceof StopQueryParameters_StopQueryParameters)) {
  29540. return;
  29541. }
  29542. var me = this;
  29543. me.url = Util_Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  29544. me.request({
  29545. method: "GET",
  29546. params: {returnPosition: params.returnPosition},
  29547. scope: me,
  29548. success: me.serviceProcessCompleted,
  29549. failure: me.serviceProcessFailed
  29550. });
  29551. }
  29552. }
  29553. SuperMap.StopQueryService = StopQueryService_StopQueryService;
  29554. // CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  29555. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29556. * This program are made available under the terms of the Apache License, Version 2.0
  29557. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29558. /**
  29559. * @class SuperMap.SummaryAttributesJobsParameter
  29560. * @category iServer ProcessingService SummaryAttributes
  29561. * @classdesc 属性汇总分析任务参数类
  29562. * @param {Object} options - 参数。
  29563. * @param {string} options.datasetName - 数据集名。
  29564. * @param {string} options.groupField - 分组字段。
  29565. * @param {string} options.attributeField - 属性字段。
  29566. * @param {string} options.statisticModes - 统计模式。
  29567. * @param {SuperMap.OutputSetting} [options.output] -输出参数设置。
  29568. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  29569. */
  29570. class SummaryAttributesJobsParameter_SummaryAttributesJobsParameter {
  29571. constructor(options) {
  29572. if (!options) {
  29573. return;
  29574. }
  29575. /**
  29576. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.datasetName
  29577. * @description 汇总数据集名称。
  29578. */
  29579. this.datasetName = "";
  29580. /**
  29581. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.groupField
  29582. * @description 分组字段。
  29583. */
  29584. this.groupField = "";
  29585. /**
  29586. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.attributeField
  29587. * @description 属性字段。
  29588. */
  29589. this.attributeField = "";
  29590. /**
  29591. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.statisticModes
  29592. * @description 属性汇总统计模式。
  29593. */
  29594. this.statisticModes = "";
  29595. /**
  29596. * @member {SuperMap.OutputSetting} SuperMap.SummaryAttributesJobsParameter.prototype.output
  29597. * @description 输出参数设置类。
  29598. */
  29599. this.output = null;
  29600. /**
  29601. * @member {SuperMap.MappingParameters} [SuperMap.SummaryAttributesJobsParameter.prototype.mappingParameters]
  29602. * @description 分析后结果可视化的参数类。
  29603. */
  29604. this.mappingParameters = null;
  29605. Util_Util.extend(this, options);
  29606. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  29607. }
  29608. /**
  29609. * @function SuperMap.SummaryAttributesJobsParameter.destroy
  29610. * @override
  29611. */
  29612. destroy() {
  29613. this.datasetName = null;
  29614. this.groupField = null;
  29615. this.attributeField = null;
  29616. this.statisticModes = null;
  29617. if (this.output instanceof OutputSetting_OutputSetting) {
  29618. this.output.destroy();
  29619. this.output = null;
  29620. }
  29621. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  29622. this.mappingParameters.destroy();
  29623. this.mappingParameters = null;
  29624. }
  29625. }
  29626. /**
  29627. * @function SuperMap.SummaryAttributesJobsParameter.toObject
  29628. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  29629. * @param {Object} tempObj - 目标对象。
  29630. * @description 生成属性汇总分析任务对象。
  29631. */
  29632. static toObject(SummaryAttributesJobsParameter, tempObj) {
  29633. for (var name in SummaryAttributesJobsParameter) {
  29634. if (name === "datasetName") {
  29635. tempObj['input'] = tempObj['input'] || {};
  29636. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  29637. continue;
  29638. }
  29639. if (name === "output") {
  29640. tempObj['output'] = tempObj['output'] || {};
  29641. tempObj['output'] = SummaryAttributesJobsParameter[name];
  29642. continue;
  29643. }
  29644. tempObj['analyst'] = tempObj['analyst'] || {};
  29645. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  29646. if(name === 'mappingParameters'){
  29647. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  29648. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  29649. }
  29650. }
  29651. }
  29652. }
  29653. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter_SummaryAttributesJobsParameter;
  29654. // CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  29655. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29656. * This program are made available under the terms of the Apache License, Version 2.0
  29657. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29658. /**
  29659. * @class SuperMap.SummaryAttributesJobsService
  29660. * @category iServer ProcessingService SummaryAttributes
  29661. * @classdesc 属性汇总分析服务类
  29662. * @extends {SuperMap.ProcessingServiceBase}
  29663. * @param {string} url - 汇总统计分析服务地址。
  29664. * @param {Object} options - 参数。
  29665. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29666. * @param {Object} [options.headers] - 请求头。
  29667. */
  29668. class SummaryAttributesJobsService_SummaryAttributesJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  29669. constructor(url, options) {
  29670. super(url, options);
  29671. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  29672. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  29673. }
  29674. /**
  29675. *@override
  29676. */
  29677. destroy() {
  29678. super.destroy();
  29679. }
  29680. /**
  29681. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  29682. * @description 获取属性汇总分析所有任务
  29683. */
  29684. getSummaryAttributesJobs (){
  29685. super.getJobs(this.url);
  29686. }
  29687. /**
  29688. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  29689. * @description 获取指定id的属性汇总分析服务
  29690. * @param {string} id - 指定要获取数据的id
  29691. */
  29692. getSummaryAttributesJob(id) {
  29693. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  29694. }
  29695. /**
  29696. * @function SuperMap.SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  29697. * @description 新建属性汇总分析服务
  29698. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  29699. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  29700. */
  29701. addSummaryAttributesJob(params, seconds) {
  29702. super.addJob(this.url, params, SummaryAttributesJobsParameter_SummaryAttributesJobsParameter, seconds);
  29703. }
  29704. }
  29705. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService_SummaryAttributesJobsService;
  29706. // CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  29707. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29708. * This program are made available under the terms of the Apache License, Version 2.0
  29709. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29710. /**
  29711. * @class SuperMap.SummaryMeshJobParameter
  29712. * @category iServer ProcessingService AggregatePoints
  29713. * @classdesc 点聚合分析任务参数类。
  29714. * @param {Object} options - 参数。
  29715. * @param {string} options.datasetName - 数据集名。
  29716. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  29717. * @param {number} options.fields - 权重索引。
  29718. * @param {number} [options.resolution=100] - 分辨率。
  29719. * @param {SuperMap.StatisticAnalystMode} [options.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE] - 分析模式。
  29720. * @param {number} [options.meshType=0] - 分析类型。
  29721. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 聚合类型。
  29722. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  29723. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  29724. */
  29725. class SummaryMeshJobParameter_SummaryMeshJobParameter {
  29726. constructor(options) {
  29727. if (!options) {
  29728. return;
  29729. }
  29730. /**
  29731. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.datasetName
  29732. * @description 数据集名。
  29733. */
  29734. this.datasetName = "";
  29735. /**
  29736. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.regionDataset
  29737. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  29738. */
  29739. this.regionDataset = "";
  29740. /**
  29741. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryMeshJobParameter.prototype.query
  29742. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  29743. */
  29744. this.query = "";
  29745. /**
  29746. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.resolution=100]
  29747. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  29748. */
  29749. this.resolution = 100;
  29750. /**
  29751. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.meshType=0]
  29752. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  29753. */
  29754. this.meshType = 0;
  29755. /**
  29756. * @member {SuperMap.StatisticAnalystMode} [SuperMap.SummaryMeshJobParameter.prototype.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE]
  29757. * @description 统计模式。
  29758. */
  29759. this.statisticModes = StatisticAnalystMode.AVERAGE;
  29760. /**
  29761. * @member {number} SuperMap.SummaryMeshJobParameter.prototype.fields
  29762. * @description 权重字段。
  29763. */
  29764. this.fields = "";
  29765. /**
  29766. * @member {SuperMap.SummaryType} [SuperMap.SummaryMeshJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  29767. * @description 聚合类型。
  29768. */
  29769. this.type = SummaryType.SUMMARYMESH;
  29770. /**
  29771. * @member {SuperMap.OutputSetting} [SuperMap.SummaryMeshJobParameter.prototype.output]
  29772. * @description 输出参数设置类。
  29773. */
  29774. this.output = null;
  29775. /**
  29776. * @member {SuperMap.MappingParameters} [SuperMap.SummaryMeshJobParameter.prototype.mappingParameters]
  29777. * @description 分析后结果可视化的参数类。
  29778. */
  29779. this.mappingParameters = null;
  29780. Util_Util.extend(this, options);
  29781. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  29782. }
  29783. /**
  29784. * @function SuperMap.SummaryMeshJobParameter.destroy
  29785. * @override
  29786. */
  29787. destroy() {
  29788. this.datasetName = null;
  29789. this.query = null;
  29790. this.resolution = null;
  29791. this.statisticModes = null;
  29792. this.meshType = null;
  29793. this.fields = null;
  29794. this.regionDataset = null;
  29795. this.type = null;
  29796. if (this.output instanceof OutputSetting_OutputSetting) {
  29797. this.output.destroy();
  29798. this.output = null;
  29799. }
  29800. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  29801. this.mappingParameters.destroy();
  29802. this.mappingParameters = null;
  29803. }
  29804. }
  29805. /**
  29806. * @function SuperMap.SummaryMeshJobParameter.toObject
  29807. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  29808. * @param {Object} tempObj - 目标对象。
  29809. * @description 生成点聚合分析任务对象。
  29810. */
  29811. static toObject(summaryMeshJobParameter, tempObj) {
  29812. for (var name in summaryMeshJobParameter) {
  29813. if (name === "datasetName") {
  29814. tempObj['input'] = tempObj['input'] || {};
  29815. tempObj['input'][name] = summaryMeshJobParameter[name];
  29816. continue;
  29817. }
  29818. if (name === "type") {
  29819. tempObj['type'] = summaryMeshJobParameter[name];
  29820. continue;
  29821. }
  29822. if (name === "output") {
  29823. tempObj['output'] = tempObj['output'] || {};
  29824. tempObj['output'] = summaryMeshJobParameter[name];
  29825. continue;
  29826. }
  29827. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  29828. tempObj['analyst'] = tempObj['analyst'] || {};
  29829. if (name === 'query' && summaryMeshJobParameter[name]) {
  29830. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  29831. } else {
  29832. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  29833. }
  29834. if(name === 'mappingParameters'){
  29835. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  29836. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  29837. }
  29838. }
  29839. }
  29840. function contains(arr, obj) {
  29841. var i = arr.length;
  29842. while (i--) {
  29843. if (arr[i] === obj) {
  29844. return true;
  29845. }
  29846. }
  29847. return false;
  29848. }
  29849. }
  29850. }
  29851. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter_SummaryMeshJobParameter;
  29852. // CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  29853. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29854. * This program are made available under the terms of the Apache License, Version 2.0
  29855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29856. /**
  29857. * @class SuperMap.SummaryMeshJobsService
  29858. * @category iServer ProcessingService AggregatePoints
  29859. * @classdesc 点聚合分析任务类。
  29860. * @param {string} url -点聚合分析任务地址。
  29861. * @param {Object} options - 参数。
  29862. * @param {SuperMap.Events} options.events - 处理所有事件的对象。<br>
  29863. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29864. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  29865. * @param {number} options.index - 服务访问地址在数组中的位置。<br>
  29866. * @param {number} options.length - 服务访问地址数组长度。
  29867. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29868. * @param {Object} [options.headers] - 请求头。
  29869. */
  29870. class SummaryMeshJobsService_SummaryMeshJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  29871. constructor(url, options) {
  29872. super(url, options);
  29873. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  29874. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  29875. }
  29876. /**
  29877. * @override
  29878. */
  29879. destroy() {
  29880. super.destroy();
  29881. }
  29882. /**
  29883. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJobs
  29884. * @description 获取点聚合分析任务
  29885. */
  29886. getSummaryMeshJobs() {
  29887. super.getJobs(this.url);
  29888. }
  29889. /**
  29890. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJob
  29891. * @description 获取指定ip的点聚合分析任务
  29892. * @param {string} id - 指定要获取数据的id
  29893. */
  29894. getSummaryMeshJob(id) {
  29895. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  29896. }
  29897. /**
  29898. * @function SuperMap.SummaryMeshJobsService.prototype.addSummaryMeshJob
  29899. * @description 新建点聚合分析服务
  29900. * @param {SuperMap.SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  29901. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  29902. */
  29903. addSummaryMeshJob(params, seconds) {
  29904. super.addJob(this.url, params, SummaryMeshJobParameter_SummaryMeshJobParameter, seconds);
  29905. }
  29906. }
  29907. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService_SummaryMeshJobsService;
  29908. // CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  29909. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  29910. * This program are made available under the terms of the Apache License, Version 2.0
  29911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29912. /**
  29913. * @class SuperMap.SummaryRegionJobParameter
  29914. * @category iServer ProcessingService SummaryRegion
  29915. * @classdesc 区域汇总分析任务参数类。
  29916. * @param {Object} options - 参数。
  29917. * @param {string} options.datasetName - 数据集名。
  29918. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  29919. * @param {string} [options.standardFields] - 标准属性字段名称。
  29920. * @param {string} [options.weightedFields] - 权重字段名称。
  29921. * @param {SuperMap.StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  29922. * @param {SuperMap.StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  29923. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  29924. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
  29925. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  29926. * @param {number} [options.resolution=100] - 网格大小。
  29927. * @param {number} [options.meshType=0] - 网格面汇总类型。
  29928. * @param {SuperMap.AnalystSizeUnit} [options.meshSizeUnit=SuperMap.AnalystSizeUnit.METER] - 网格大小单位。
  29929. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 汇总类型。
  29930. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  29931. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  29932. */
  29933. class SummaryRegionJobParameter_SummaryRegionJobParameter {
  29934. constructor(options) {
  29935. if (!options) {
  29936. return;
  29937. }
  29938. /**
  29939. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.datasetName
  29940. * @description 数据集名。
  29941. */
  29942. this.datasetName = "";
  29943. /**
  29944. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.regionDataset
  29945. * @description 汇总数据源(多边形汇总时用到的参数)。
  29946. */
  29947. this.regionDataset = "";
  29948. /**
  29949. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.sumShape=true]
  29950. * @description 是否统计长度或面积。
  29951. */
  29952. this.sumShape = true;
  29953. /**
  29954. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryRegionJobParameter.prototype.query
  29955. * @description 分析范围。
  29956. */
  29957. this.query = "";
  29958. /**
  29959. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  29960. * @description 是否以标准属字段统计。
  29961. */
  29962. this.standardSummaryFields = false;
  29963. /**
  29964. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.standardFields
  29965. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  29966. */
  29967. this.standardFields = "";
  29968. /**
  29969. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.standardStatisticModes
  29970. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  29971. */
  29972. this.standardStatisticModes = "";
  29973. /**
  29974. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  29975. * @description 是否以权重字段统计。
  29976. */
  29977. this.weightedSummaryFields = false;
  29978. /**
  29979. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.weightedFields
  29980. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  29981. */
  29982. this.weightedFields = "";
  29983. /**
  29984. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.weightedStatisticModes
  29985. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  29986. */
  29987. this.weightedStatisticModes = "";
  29988. /**
  29989. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.meshType=0]
  29990. * @description 网格面汇总类型。
  29991. */
  29992. this.meshType = 0;
  29993. /**
  29994. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.resolution=100]
  29995. * @description 网格大小。
  29996. */
  29997. this.resolution = 100;
  29998. /**
  29999. * @member {SuperMap.AnalystSizeUnit} [SuperMap.SummaryRegionJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  30000. * @description 网格大小单位。
  30001. */
  30002. this.meshSizeUnit = AnalystSizeUnit.METER;
  30003. /**
  30004. * @member {SuperMap.SummaryType} [SuperMap.SummaryRegionJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  30005. * @description 汇总类型。
  30006. */
  30007. this.type = SummaryType.SUMMARYMESH;
  30008. /**
  30009. * @member {SuperMap.OutputSetting} SuperMap.SummaryRegionJobParameter.prototype.output
  30010. * @description 输出参数设置类
  30011. */
  30012. this.output = null;
  30013. /**
  30014. * @member {SuperMap.MappingParameters} [SuperMap.SummaryRegionJobParameter.prototype.mappingParameters]
  30015. * @description 分析后结果可视化的参数类。
  30016. */
  30017. this.mappingParameters = null;
  30018. Util_Util.extend(this, options);
  30019. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  30020. }
  30021. /**
  30022. * @function SuperMap.SummaryRegionJobParameter.prototype.destroy
  30023. * @description 释放资源,将引用资源的属性置空。
  30024. */
  30025. destroy() {
  30026. this.datasetName = null;
  30027. this.sumShape = null;
  30028. this.regionDataset = null;
  30029. this.query = null;
  30030. this.standardSummaryFields = null;
  30031. this.standardFields = null;
  30032. this.standardStatisticModes = null;
  30033. this.weightedSummaryFields = null;
  30034. this.weightedFields = null;
  30035. this.weightedStatisticModes = null;
  30036. this.meshType = null;
  30037. this.resolution = null;
  30038. this.meshSizeUnit = null;
  30039. this.type = null;
  30040. if (this.output instanceof OutputSetting_OutputSetting) {
  30041. this.output.destroy();
  30042. this.output = null;
  30043. }
  30044. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  30045. this.mappingParameters.destroy();
  30046. this.mappingParameters = null;
  30047. }
  30048. }
  30049. /**
  30050. * @function SuperMap.SummaryRegionJobParameter.toObject
  30051. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  30052. * @param {Object} tempObj - 目标对象。
  30053. * @description 生成区域汇总分析服务对象。
  30054. */
  30055. static toObject(summaryRegionJobParameter, tempObj) {
  30056. for (var name in summaryRegionJobParameter) {
  30057. if (name === "datasetName") {
  30058. tempObj['input'] = tempObj['input'] || {};
  30059. tempObj['input'][name] = summaryRegionJobParameter[name];
  30060. continue;
  30061. }
  30062. if (name === "type") {
  30063. tempObj['type'] = summaryRegionJobParameter[name];
  30064. continue;
  30065. }
  30066. if (name === "type") {
  30067. tempObj['type'] = summaryRegionJobParameter[name];
  30068. continue;
  30069. }
  30070. if (name === "output") {
  30071. tempObj['output'] = tempObj['output'] || {};
  30072. tempObj['output'] = summaryRegionJobParameter[name];
  30073. continue;
  30074. }
  30075. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  30076. tempObj['analyst'] = tempObj['analyst'] || {};
  30077. if (name === 'query' && summaryRegionJobParameter[name]) {
  30078. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  30079. } else {
  30080. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  30081. }
  30082. if(name === 'mappingParameters'){
  30083. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30084. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  30085. }
  30086. }
  30087. }
  30088. }
  30089. }
  30090. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter_SummaryRegionJobParameter;
  30091. // CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  30092. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30093. * This program are made available under the terms of the Apache License, Version 2.0
  30094. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30095. /**
  30096. * @class SuperMap.SummaryRegionJobsService
  30097. * @category iServer ProcessingService SummaryRegion
  30098. * @classdesc 区域汇总分析服务类
  30099. * @extends {SuperMap.ProcessingServiceBase}
  30100. * @param {string} url - 区域汇总分析服务地址。
  30101. * @param {Object} options - 参数。
  30102. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30103. * @param {Object} [options.headers] - 请求头。
  30104. */
  30105. class SummaryRegionJobsService_SummaryRegionJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  30106. constructor(url, options) {
  30107. super(url, options);
  30108. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  30109. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  30110. }
  30111. /**
  30112. *@override
  30113. */
  30114. destroy() {
  30115. super.destroy();
  30116. }
  30117. /**
  30118. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJobs
  30119. * @description 获取区域汇总分析任务集合。
  30120. */
  30121. getSummaryRegionJobs() {
  30122. super.getJobs(this.url);
  30123. }
  30124. /**
  30125. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJob
  30126. * @description 获取指定id的区域汇总分析任务。
  30127. * @param {string} id -要获取区域汇总分析任务的id
  30128. */
  30129. getSummaryRegionJob(id) {
  30130. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  30131. }
  30132. /**
  30133. * @function SuperMap.SummaryRegionJobsService.prototype.addSummaryRegionJob
  30134. * @description 新建区域汇总任务。
  30135. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总任务的请求参数。
  30136. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30137. */
  30138. addSummaryRegionJob(params, seconds) {
  30139. super.addJob(this.url, params, SummaryRegionJobParameter_SummaryRegionJobParameter, seconds);
  30140. }
  30141. }
  30142. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService_SummaryRegionJobsService;
  30143. // CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  30144. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30145. * This program are made available under the terms of the Apache License, Version 2.0
  30146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30147. /**
  30148. * @class SuperMap.SupplyCenter
  30149. * @category iServer NetworkAnalyst Location
  30150. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  30151. * @param {Object} options - 参数。
  30152. * @param {number} options.maxWeight - 资源供给中心的最大耗费值。
  30153. * @param {number} options.nodeID - 资源供给中心点的结点 ID 号。资源供给中心必须是结点。
  30154. * @param {number} options.resourceValue - 资源供给中心能提供的最大服务量或商品数量。
  30155. * @param {SuperMap.SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  30156. */
  30157. class SupplyCenter_SupplyCenter {
  30158. constructor(options) {
  30159. /**
  30160. * @member {number} SuperMap.SupplyCenter.prototype.maxWeight
  30161. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  30162. * 最大阻力值是用来限制需求点到中心点的花费。
  30163. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  30164. */
  30165. this.maxWeight = null;
  30166. /**
  30167. * @member {number} SuperMap.SupplyCenter.prototype.nodeID
  30168. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  30169. */
  30170. this.nodeID = null;
  30171. /**
  30172. * @member {number} SuperMap.SupplyCenter.prototype.resourceValue
  30173. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  30174. */
  30175. this.resourceValue = null;
  30176. /**
  30177. * @member {SuperMap.SupplyCenterType} [SuperMap.SupplyCenter.prototype.type]
  30178. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  30179. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  30180. */
  30181. this.type = null;
  30182. if (options) {
  30183. Util_Util.extend(this, options);
  30184. }
  30185. this.CLASS_NAME = "SuperMap.SupplyCenter";
  30186. }
  30187. /**
  30188. * @function SuperMap.SupplyCenter.prototype.destroy
  30189. * @description 释放资源,将引用资源的属性置空。
  30190. */
  30191. destroy() {
  30192. var me = this;
  30193. me.maxWeight = null;
  30194. me.nodeID = null;
  30195. me.resourceValue = null;
  30196. me.type = null;
  30197. }
  30198. /**
  30199. * @function SuperMap.SupplyCenter.fromJson
  30200. * @description 将服务端 JSON 对象转换成当前客户端对象。
  30201. * @param {Object} jsonObject - 要转换的 JSON 对象。
  30202. * @returns {SuperMap.SupplyCenter} SupplyCenter 对象。
  30203. */
  30204. static fromJson(jsonObject) {
  30205. if (!jsonObject) {
  30206. return;
  30207. }
  30208. return new SupplyCenter_SupplyCenter({
  30209. maxWeight: jsonObject.maxWeight,
  30210. nodeID: jsonObject.nodeID,
  30211. resourceValue: jsonObject.resourceValue,
  30212. type: jsonObject.type
  30213. });
  30214. }
  30215. }
  30216. SuperMap.SupplyCenter = SupplyCenter_SupplyCenter;
  30217. // CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  30218. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30219. * This program are made available under the terms of the Apache License, Version 2.0
  30220. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30221. /**
  30222. * @class SuperMap.SurfaceAnalystService
  30223. * @category iServer SpatialAnalyst SurfaceAnalyst
  30224. * @classdesc 表面分析服务类。
  30225. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  30226. * 表面分析结果通过该类支持的事件的监听函数参数获取
  30227. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  30228. * @param {Object} options - 参数。</br>
  30229. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30230. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30231. * @param {Object} [options.headers] - 请求头。
  30232. * @extends {SuperMap.SpatialAnalystBase}
  30233. * @example 例如:
  30234. * (start code)
  30235. * var mySurfaceAnalystService = new SuperMap.SurfaceAnalystService(url, {
  30236. * eventListeners: {
  30237. * "processCompleted": surfaceAnalysCompleted,
  30238. * "processFailed": surfaceAnalysFailed
  30239. * }
  30240. * });
  30241. * (end)
  30242. *
  30243. */
  30244. class SurfaceAnalystService_SurfaceAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  30245. constructor(url, options) {
  30246. super(url, options);
  30247. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  30248. }
  30249. /**
  30250. * @function SuperMap.SurfaceAnalystService.prototype.destroy
  30251. * @description 释放资源,将引用的资源属性置空。
  30252. */
  30253. destroy() {
  30254. super.destroy();
  30255. }
  30256. /**
  30257. * @function SuperMap.SurfaceAnalystService.prototype.processAsync
  30258. * @description 负责将客户端的表面分析服务参数传递到服务端。
  30259. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  30260. */
  30261. processAsync(params) {
  30262. if (!(params instanceof SurfaceAnalystParameters_SurfaceAnalystParameters)) {
  30263. return;
  30264. }
  30265. var me = this, jsonParameters;
  30266. jsonParameters = me.getJsonParameters(params);
  30267. me.request({
  30268. method: "POST",
  30269. data: jsonParameters,
  30270. scope: me,
  30271. success: me.serviceProcessCompleted,
  30272. failure: me.serviceProcessFailed
  30273. });
  30274. }
  30275. /**
  30276. * @function SuperMap.SurfaceAnalystService.prototype.getJsonParameters
  30277. * @description 将参数转化为 JSON 字符串。
  30278. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  30279. * @returns {Object} 转化后的JSON字符串。
  30280. */
  30281. getJsonParameters(params) {
  30282. var jsonParameters = '';
  30283. var parameterObject = {};
  30284. var me = this;
  30285. if (params instanceof DatasetSurfaceAnalystParameters_DatasetSurfaceAnalystParameters) {
  30286. me.url = Util_Util.urlPathAppend(
  30287. me.url,
  30288. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  30289. );
  30290. DatasetSurfaceAnalystParameters_DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  30291. jsonParameters = Util_Util.toJSON(parameterObject);
  30292. } else if (params instanceof GeometrySurfaceAnalystParameters_GeometrySurfaceAnalystParameters) {
  30293. me.url = Util_Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  30294. jsonParameters = Util_Util.toJSON(params);
  30295. } else {
  30296. return;
  30297. }
  30298. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  30299. return jsonParameters;
  30300. }
  30301. }
  30302. SuperMap.SurfaceAnalystService = SurfaceAnalystService_SurfaceAnalystService;
  30303. // CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  30304. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30305. * This program are made available under the terms of the Apache License, Version 2.0
  30306. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30307. /**
  30308. * @class SuperMap.TerrainCurvatureCalculationParameters
  30309. * @category iServer SpatialAnalyst TerrainCalculation
  30310. * @classdesc 地形曲率计算参数类。
  30311. * @param {Object} options - 参数。
  30312. * @param {string} options.dataset - 要用来做地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  30313. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  30314. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  30315. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  30316. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  30317. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30318. */
  30319. class TerrainCurvatureCalculationParameters_TerrainCurvatureCalculationParameters {
  30320. constructor(options) {
  30321. if (!options) {
  30322. return;
  30323. }
  30324. /**
  30325. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.dataset
  30326. * @description 要用来做地形曲率计算数据源中数据集的名称。
  30327. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  30328. * 注:地形曲率计算必须为栅格数据集。
  30329. */
  30330. this.dataset = null;
  30331. /**
  30332. * @member {number} [SuperMap.TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  30333. * @description 指定的高程缩放系数。1.0 表示不缩放。
  30334. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  30335. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  30336. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  30337. */
  30338. this.zFactor = 1.0;
  30339. /**
  30340. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  30341. * @description 结果数据集:平均曲率数据集的名称。
  30342. */
  30343. this.averageCurvatureName = null;
  30344. /**
  30345. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  30346. * @description 结果数据集:剖面曲率数据集的名称。
  30347. */
  30348. this.profileCurvatureName = "";
  30349. /**
  30350. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  30351. * @description 结果数据集:平面曲率数据集的名称。
  30352. */
  30353. this.planCurvatureName = "";
  30354. /**
  30355. * @member {boolean} [SuperMap.TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  30356. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30357. */
  30358. this.deleteExistResultDataset = false;
  30359. Util_Util.extend(this, options);
  30360. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  30361. }
  30362. /**
  30363. * @function SuperMap.TerrainCurvatureCalculationParameters.prototype.destroy
  30364. * @description 释放资源,将引用资源的属性置空。
  30365. */
  30366. destroy() {
  30367. var me = this;
  30368. me.dataset = null;
  30369. me.zFactor = 1.0;
  30370. me.averageCurvatureName = null;
  30371. me.profileCurvatureName = null;
  30372. me.planCurvatureName = null;
  30373. me.deleteExistResultDataset = true;
  30374. }
  30375. /**
  30376. * @function SuperMap.TerrainCurvatureCalculationParameters.toObject
  30377. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  30378. * @param {Object} tempObj - 目标对象。
  30379. * @description 生成地形曲率计算对象。
  30380. */
  30381. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  30382. for (var name in derrainCurvatureCalculationParameters) {
  30383. if (name !== "dataset") {
  30384. tempObj[name] = derrainCurvatureCalculationParameters[name];
  30385. }
  30386. }
  30387. }
  30388. }
  30389. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters_TerrainCurvatureCalculationParameters;
  30390. // CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  30391. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30392. * This program are made available under the terms of the Apache License, Version 2.0
  30393. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30394. /**
  30395. * @class SuperMap.TerrainCurvatureCalculationService
  30396. * @category iServer SpatialAnalyst TerrainCalculation
  30397. * @classdesc 地形曲率计算服务类。
  30398. * @extends {SuperMap.SpatialAnalystBase}
  30399. * @param {Object} options - 参数。
  30400. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30401. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  30402. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30403. * @param {Object} [options.headers] - 请求头。
  30404. * @example 例如:
  30405. * (start code)
  30406. * var myTerrainCurvatureCalculationService = new SuperMap.TerrainCurvatureCalculationService(url);
  30407. * myTerrainCurvatureCalculationService.on({
  30408. * "processCompleted": processCompleted,
  30409. * "processFailed": processFailed
  30410. * }
  30411. * );
  30412. * (end)
  30413. *
  30414. */
  30415. class TerrainCurvatureCalculationService_TerrainCurvatureCalculationService extends SpatialAnalystBase_SpatialAnalystBase {
  30416. constructor(url, options) {
  30417. super(url, options);
  30418. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  30419. }
  30420. /**
  30421. *@override
  30422. */
  30423. destroy() {
  30424. super.destroy();
  30425. }
  30426. /**
  30427. * @function SuperMap.TerrainCurvatureCalculationService.prototype.processAsync
  30428. * @description 负责将客户端的查询参数传递到服务端。
  30429. * @param {SuperMap.TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  30430. */
  30431. processAsync(parameter) {
  30432. var me = this;
  30433. var parameterObject = {};
  30434. if (parameter instanceof TerrainCurvatureCalculationParameters_TerrainCurvatureCalculationParameters) {
  30435. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  30436. }
  30437. TerrainCurvatureCalculationParameters_TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  30438. var jsonParameters = SuperMap.Util.toJSON(parameterObject);
  30439. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  30440. me.request({
  30441. method: "POST",
  30442. data: jsonParameters,
  30443. scope: me,
  30444. success: me.serviceProcessCompleted,
  30445. failure: me.serviceProcessFailed
  30446. });
  30447. }
  30448. }
  30449. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService_TerrainCurvatureCalculationService;
  30450. // CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  30451. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30452. * This program are made available under the terms of the Apache License, Version 2.0
  30453. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30454. /**
  30455. * @class SuperMap.ThemeGridRangeItem
  30456. * @category iServer Map Theme
  30457. * @classdesc 栅格分段专题图子项类。
  30458. * @description 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  30459. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  30460. * @param {Object} options - 参数。
  30461. * @param {SuperMap.ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  30462. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  30463. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  30464. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  30465. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  30466. */
  30467. class ThemeGridRangeItem_ThemeGridRangeItem {
  30468. constructor(options) {
  30469. /**
  30470. * @member {string} [SuperMap.ThemeGridRangeItem.prototype.caption]
  30471. * @description 栅格分段专题图子项的标题。
  30472. */
  30473. this.caption = null;
  30474. /**
  30475. * @member {SuperMap.ServerColor} SuperMap.ThemeGridRangeItem.prototype.color
  30476. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  30477. */
  30478. this.color = new ServerColor();
  30479. /**
  30480. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.end=0]
  30481. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  30482. */
  30483. this.end = 0;
  30484. /**
  30485. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.start=0]
  30486. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  30487. */
  30488. this.start = 0;
  30489. /**
  30490. * @member {boolean} [SuperMap.ThemeGridRangeItem.prototype.visible=true]
  30491. * @description 栅格分段专题图子项是否可见。
  30492. */
  30493. this.visible = true;
  30494. if (options) {
  30495. Util_Util.extend(this, options);
  30496. }
  30497. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  30498. }
  30499. /**
  30500. * @function SuperMap.ThemeGridRangeItem.prototype.destroy
  30501. * @description 释放资源,将引用资源的属性置空。
  30502. */
  30503. destroy() {
  30504. var me = this;
  30505. me.caption = null;
  30506. me.end = null;
  30507. me.start = null;
  30508. //需要验证是够存在destroy方法
  30509. if (me.color) {
  30510. me.color.destroy();
  30511. me.color = null;
  30512. }
  30513. me.visible = null;
  30514. }
  30515. /**
  30516. * @function SuperMap.ThemeGridRangeItem.prototype.toServerJSONObject
  30517. * @description 转换成对应的 JSON 格式对象。
  30518. * @returns {Object} 对应的 JSON 格式对象。
  30519. */
  30520. toServerJSONObject() {
  30521. var obj = {};
  30522. obj = Util_Util.copyAttributes(obj, this);
  30523. if (obj.color) {
  30524. if (obj.color.toServerJSONObject) {
  30525. obj.color = obj.color.toServerJSONObject();
  30526. }
  30527. }
  30528. return obj;
  30529. }
  30530. /**
  30531. * @function SuperMap.ThemeGridRangeItem.fromObj
  30532. * @description 从传入对象获取栅格分段专题图子项类。
  30533. * @param {Object} obj - 传入对象。
  30534. * @returns {SuperMap.ThemeGridRangeItem} ThemeGridRangeItem 对象。
  30535. */
  30536. static fromObj(obj) {
  30537. if (!obj) {
  30538. return;
  30539. }
  30540. var res = new ThemeGridRangeItem_ThemeGridRangeItem();
  30541. Util_Util.copy(res, obj);
  30542. res.color = ServerColor.fromJson(obj.color);
  30543. return res;
  30544. }
  30545. }
  30546. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem_ThemeGridRangeItem;
  30547. // CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  30548. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30549. * This program are made available under the terms of the Apache License, Version 2.0
  30550. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30551. /**
  30552. * @class SuperMap.ThemeGridRange
  30553. * @category iServer Map Theme
  30554. * @classdesc 栅格分段专题图。
  30555. * @description 栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。
  30556. * 栅格分段专题图一般用来反映连续分布现象的数量或程度特征。比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  30557. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  30558. * @extends {SuperMap.Theme}
  30559. * @param {Object} options - 参数。
  30560. * @param {Array.<SuperMap.ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  30561. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  30562. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  30563. * @param {number} [options.rangeParameter=0] - 分段参数。
  30564. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  30565. */
  30566. class ThemeGridRange_ThemeGridRange extends Theme_Theme {
  30567. constructor(options) {
  30568. super("GRIDRANGE", options);
  30569. /**
  30570. * @member {Array.<SuperMap.ThemeGridRangeItem>} SuperMap.ThemeGridRange.prototype.items
  30571. * @description 栅格分段专题图子项数组。<br>
  30572. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  30573. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  30574. */
  30575. this.items = null;
  30576. /**
  30577. * @member {SuperMap.RangeMode} [SuperMap.ThemeGridRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  30578. * @description 分段专题图的分段模式。<br>
  30579. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  30580. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  30581. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  30582. */
  30583. this.rangeMode = RangeMode.EQUALINTERVAL;
  30584. /**
  30585. * @member {number} [SuperMap.ThemeGridRange.prototype.rangeParameter=0]
  30586. * @description 分段参数。<br>
  30587. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  30588. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  30589. */
  30590. this.rangeParameter = 0;
  30591. /**
  30592. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeGridRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  30593. * @description 渐变颜色枚举类。
  30594. *
  30595. */
  30596. this.colorGradientType = ColorGradientType.YELLOW_RED;
  30597. /**
  30598. * @member {boolean} SuperMap.ThemeGridRange.prototype.reverseColor
  30599. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  30600. */
  30601. this.reverseColor = false;
  30602. if (options) {
  30603. Util_Util.extend(this, options);
  30604. }
  30605. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  30606. }
  30607. /**
  30608. * @function SuperMap.ThemeGridRange.prototype.destroy
  30609. * @override
  30610. */
  30611. destroy() {
  30612. super.destroy();
  30613. var me = this;
  30614. if (me.items) {
  30615. if (me.items.length > 0) {
  30616. for (var item in me.items) {
  30617. me.items[item].destroy();
  30618. me.items[item] = null;
  30619. }
  30620. }
  30621. me.items = null;
  30622. }
  30623. me.reverseColor = null;
  30624. me.rangeMode = null;
  30625. me.rangeParameter = null;
  30626. me.colorGradientType = null;
  30627. }
  30628. /**
  30629. * @function SuperMap.ThemeGridRange.fromObj
  30630. * @description 从传入对象获取栅格分段专题图。
  30631. * @param {Object} obj - 传入对象。
  30632. * @returns {SuperMap.ThemeGridRange} ThemeGridRange 对象。
  30633. */
  30634. static fromObj(obj) {
  30635. if (!obj) {
  30636. return;
  30637. }
  30638. var res = new ThemeGridRange_ThemeGridRange();
  30639. Util_Util.copy(res, obj);
  30640. var itemsR = obj.items;
  30641. var len = itemsR ? itemsR.length : 0;
  30642. res.items = [];
  30643. for (var i = 0; i < len; i++) {
  30644. res.items.push(ThemeGridRangeItem_ThemeGridRangeItem.fromObj(itemsR[i]));
  30645. }
  30646. return res;
  30647. }
  30648. }
  30649. SuperMap.ThemeGridRange = ThemeGridRange_ThemeGridRange;
  30650. // CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  30651. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30652. * This program are made available under the terms of the Apache License, Version 2.0
  30653. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30654. /**
  30655. * @class SuperMap.ThemeGridUniqueItem
  30656. * @category iServer Map Theme
  30657. * @classdesc 栅格单值专题图子项类。
  30658. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  30659. * @param {Object} options - 参数。
  30660. * @param {string} [options.caption] - 栅格单值专题图子项的名称。
  30661. * @param {SuperMap.ServerColor} [options.color] - 栅格单值专题图子项的显示颜色。
  30662. * @param {number} options.unique - 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  30663. * @param {boolean} [options.visible=true] - 栅格单值专题图子项是否可见。
  30664. */
  30665. class ThemeGridUniqueItem_ThemeGridUniqueItem {
  30666. constructor(options) {
  30667. /**
  30668. * @member {string} [SuperMap.ThemeGridUniqueItem.prototype.caption]
  30669. * @description 栅格单值专题图子项的名称。
  30670. */
  30671. this.caption = null;
  30672. /**
  30673. * @member {SuperMap.ServerColor} [SuperMap.ThemeGridUniqueItem.prototype.color]
  30674. * @description 栅格单值专题图子项的显示颜色。
  30675. */
  30676. this.color = new ServerColor();
  30677. /**
  30678. * @member {number} SuperMap.ThemeGridUniqueItem.prototype.unique
  30679. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  30680. */
  30681. this.unique = null;
  30682. /**
  30683. * @member {boolean} [SuperMap.ThemeGridUniqueItem.prototype.visible=true]
  30684. * @description 栅格单值专题图子项是否可见。
  30685. */
  30686. this.visible = true;
  30687. if (options) {
  30688. Util_Util.extend(this, options);
  30689. }
  30690. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  30691. }
  30692. /**
  30693. * @function SuperMap.ThemeGridUniqueItem.prototype.destroy
  30694. * @description 释放资源,将引用资源的属性置空。
  30695. */
  30696. destroy() {
  30697. var me = this;
  30698. me.caption = null;
  30699. me.unique = null;
  30700. if (me.color) {
  30701. me.color.destroy();
  30702. me.color = null;
  30703. }
  30704. me.visible = null;
  30705. }
  30706. /**
  30707. * @function SuperMap.ThemeGridUniqueItem.prototype.toServerJSONObject
  30708. * @description 转换成对应的 JSON 格式对象。
  30709. * @returns {Object} 对应的 JSON 格式对象。
  30710. */
  30711. toServerJSONObject() {
  30712. var obj = {};
  30713. obj = Util_Util.copyAttributes(obj, this);
  30714. if (obj.color) {
  30715. if (obj.color.toServerJSONObject) {
  30716. obj.color = obj.color.toServerJSONObject();
  30717. }
  30718. }
  30719. return obj;
  30720. }
  30721. /**
  30722. * @function SuperMap.ThemeGridUniqueItem.fromObj
  30723. * @description 从传入对象获取栅格单值专题图子项类。
  30724. * @param {Object} obj - 传入对象。
  30725. * @returns {SuperMap.ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  30726. */
  30727. static fromObj(obj) {
  30728. var res = new ThemeGridUniqueItem_ThemeGridUniqueItem();
  30729. Util_Util.copy(res, obj);
  30730. res.color = ServerColor.fromJson(obj.color);
  30731. return res;
  30732. }
  30733. }
  30734. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem_ThemeGridUniqueItem;
  30735. // CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  30736. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30737. * This program are made available under the terms of the Apache License, Version 2.0
  30738. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30739. /**
  30740. * @class SuperMap.ThemeGridUnique
  30741. * @category iServer Map Theme
  30742. * @classdesc 栅格单值专题图类。
  30743. * @description 栅格单值专题图,是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。<br>
  30744. * 栅格单值专题图适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  30745. * @extends {SuperMap.Theme}
  30746. * @param {Object} options - 参数。
  30747. * @param {Array.<SuperMap.ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  30748. * @param {SuperMap.ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  30749. */
  30750. class ThemeGridUnique_ThemeGridUnique extends Theme_Theme {
  30751. constructor(options) {
  30752. super("GRIDUNIQUE", options);
  30753. /**
  30754. * @member {SuperMap.ServerColor} SuperMap.ThemeGridUnique.prototype.defaultcolor
  30755. * @description 栅格单值专题图的默认颜色。
  30756. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  30757. */
  30758. this.defaultcolor = new ServerColor();
  30759. /**
  30760. * @member {Array.<SuperMap.ThemeGridUniqueItem>} SuperMap.ThemeGridUnique.prototype.items
  30761. * @description 栅格单值专题图子项数组。
  30762. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  30763. */
  30764. this.items = null;
  30765. if (options) {
  30766. Util_Util.extend(this, options);
  30767. }
  30768. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  30769. }
  30770. /**
  30771. * @function SuperMap.ThemeGridUnique.prototype.destroy
  30772. * @override
  30773. */
  30774. destroy() {
  30775. super.destroy();
  30776. var me = this;
  30777. if (me.items) {
  30778. if (me.items.length > 0) {
  30779. for (var item in me.items) {
  30780. me.items[item].destroy();
  30781. me.items[item] = null;
  30782. }
  30783. }
  30784. me.items = null;
  30785. }
  30786. if (me.defaultcolor) {
  30787. me.defaultcolor.destroy();
  30788. me.defaultcolor = null;
  30789. }
  30790. }
  30791. /**
  30792. * @function SuperMap.ThemeGridUnique.prototype.toServerJSONObject
  30793. * @description 转换成对应的 JSON 格式对象。
  30794. * @returns {Object} 对应的 JSON 格式对象
  30795. */
  30796. toServerJSONObject() {
  30797. var obj = {};
  30798. obj = Util_Util.copyAttributes(obj, this);
  30799. if (obj.defaultcolor) {
  30800. if (obj.defaultcolor.toServerJSONObject) {
  30801. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  30802. }
  30803. }
  30804. if (obj.items) {
  30805. var items = [],
  30806. len = obj.items.length;
  30807. for (var i = 0; i < len; i++) {
  30808. items.push(obj.items[i].toServerJSONObject());
  30809. }
  30810. obj.items = items;
  30811. }
  30812. return obj;
  30813. }
  30814. /**
  30815. * @function SuperMap.ThemeGridUnique.fromObj
  30816. * @description 从传入对象获取栅格单值专题图类。
  30817. * @param {Object} obj - 传入对象
  30818. * @returns {SuperMap.ThemeGridUnique} ThemeGridUnique 对象
  30819. */
  30820. static fromObj(obj) {
  30821. var res = new ThemeGridUnique_ThemeGridUnique();
  30822. var uItems = obj.items;
  30823. var len = uItems ? uItems.length : 0;
  30824. Util_Util.extend(res, obj);
  30825. res.items = [];
  30826. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  30827. for (var i = 0; i < len; i++) {
  30828. res.items.push(ThemeGridUniqueItem_ThemeGridUniqueItem.fromObj(uItems[i]));
  30829. }
  30830. return res;
  30831. }
  30832. }
  30833. SuperMap.ThemeGridUnique = ThemeGridUnique_ThemeGridUnique;
  30834. // CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  30835. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30836. * This program are made available under the terms of the Apache License, Version 2.0
  30837. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30838. /**
  30839. * @class SuperMap.ThemeLabelUniqueItem
  30840. * @category iServer Map Theme
  30841. * @classdesc 单值标签专题图的子项。
  30842. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  30843. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  30844. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  30845. * @param {Object} options - 参数。
  30846. * @param {string} options.unique - 单值专题图子项的值,可以为数字、字符串等。
  30847. * @param {string} [options.caption] - 专题图子项的名称。
  30848. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  30849. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  30850. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  30851. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  30852. */
  30853. class ThemeLabelUniqueItem_ThemeLabelUniqueItem {
  30854. constructor(options) {
  30855. /**
  30856. * @member {string} [SuperMap.ThemeLabelUniqueItem.prototype.caption]
  30857. * @description 标签专题子项的标题。
  30858. */
  30859. this.caption = null;
  30860. /**
  30861. * @member {string} SuperMap.ThemeLabelUniqueItem.prototype.unique
  30862. * @description 单值专题图子项的值,可以为数字、字符串等。
  30863. */
  30864. this.unique = null;
  30865. /**
  30866. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetX=0]
  30867. * @description 标签在 X 方向偏移量。
  30868. */
  30869. this.offsetX = 0;
  30870. /**
  30871. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetY=0]
  30872. * @description 标签在 Y 方向偏移量。
  30873. */
  30874. this.offsetY = 0;
  30875. /**
  30876. * @member {boolean} [SuperMap.ThemeLabelUniqueItem.prototype.visible=true]
  30877. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  30878. */
  30879. this.visible = true;
  30880. /**
  30881. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelUniqueItem.prototype.style
  30882. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  30883. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  30884. */
  30885. this.style = new ServerTextStyle_ServerTextStyle();
  30886. if (options) {
  30887. Util_Util.extend(this, options);
  30888. }
  30889. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  30890. }
  30891. /**
  30892. * @function SuperMap.ThemeLabelUniqueItem.prototype.destroy
  30893. * @description 释放资源,将引用资源的属性置空。
  30894. */
  30895. destroy() {
  30896. var me = this;
  30897. me.unique = null;
  30898. me.caption = null;
  30899. me.offsetX = null;
  30900. me.offsetY = null;
  30901. if (me.style) {
  30902. me.style.destroy();
  30903. me.style = null;
  30904. }
  30905. me.visible = null;
  30906. }
  30907. /**
  30908. * @function SuperMap.ThemeLabelUniqueItem.fromObj
  30909. * @description 从传入对象获取单值标签专题图的子项类。
  30910. * @param {Object} obj - 传入对象。
  30911. * @returns {SuperMap.ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  30912. */
  30913. static fromObj(obj) {
  30914. if (!obj) {
  30915. return;
  30916. }
  30917. var t = new ThemeLabelUniqueItem_ThemeLabelUniqueItem();
  30918. Util_Util.copy(t, obj);
  30919. return t;
  30920. }
  30921. }
  30922. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem_ThemeLabelUniqueItem;
  30923. // CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  30924. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  30925. * This program are made available under the terms of the Apache License, Version 2.0
  30926. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30927. /**
  30928. * @class SuperMap.ThemeParameters
  30929. * @category iServer Map Theme
  30930. * @classdesc 专题图参数类。
  30931. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  30932. * @param {Object} options - 参数。
  30933. * @param {Array.<string>} options.datasetNames - 要制作专题图的数据集数组。
  30934. * @param {Array.<string>} options.dataSourceNames - 要制作专题图的数据集所在的数据源数组。
  30935. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  30936. * @param {Array.<SuperMap.Theme>} options.themes - 专题图对象列表。
  30937. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  30938. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  30939. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  30940. */
  30941. class ThemeParameters_ThemeParameters {
  30942. constructor(options) {
  30943. /**
  30944. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.datasetNames
  30945. * @description 要制作专题图的数据集数组。
  30946. */
  30947. this.datasetNames = null;
  30948. /**
  30949. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.dataSourceNames
  30950. * @description 要制作专题图的数据集所在的数据源数组。
  30951. */
  30952. this.dataSourceNames = null;
  30953. /**
  30954. * @member {Array.<SuperMap.JoinItem>} [SuperMap.ThemeParameters.prototype.joinItems]
  30955. * @description 设置与外部表的连接信息 JoinItem 数组。
  30956. * 使用此属性可以制作与外部表连接的专题图。
  30957. */
  30958. this.joinItems = null;
  30959. /**
  30960. * @member {Array.<SuperMap.Theme>} SuperMap.ThemeParameters.prototype.themes
  30961. * @description 专题图对象列表。
  30962. * 该参数为实例化的各类专题图对象的集合。
  30963. */
  30964. this.themes = null;
  30965. /**
  30966. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayFilters]
  30967. * @description 专题图属性过滤条件。
  30968. */
  30969. this.displayFilters = null;
  30970. /**
  30971. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayOrderBys]
  30972. * @description 专题图对象生成符号叠加次序排序字段。
  30973. */
  30974. this.displayOrderBys = null;
  30975. /**
  30976. * @member {Object} [SuperMap.ThemeParameters.prototype.fieldValuesDisplayFilter]
  30977. * @property {Array.<number>} values - 需要过滤的值。
  30978. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  30979. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  30980. */
  30981. this.fieldValuesDisplayFilter = null;
  30982. if (options) {
  30983. Util_Util.extend(this, options);
  30984. }
  30985. this.CLASS_NAME = "SuperMap.ThemeParameters";
  30986. }
  30987. /**
  30988. * @function SuperMap.ThemeParameters.prototype.destroy
  30989. * @description 释放资源,将引用资源的属性置空。
  30990. */
  30991. destroy() {
  30992. var me = this;
  30993. me.datasetNames = null;
  30994. me.dataSourceNames = null;
  30995. if (me.joinItems) {
  30996. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  30997. joinItems[i].destroy();
  30998. }
  30999. me.joinItems = null;
  31000. }
  31001. if (me.themes) {
  31002. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  31003. themes[i].destroy();
  31004. }
  31005. me.themes = null;
  31006. }
  31007. }
  31008. }
  31009. SuperMap.ThemeParameters = ThemeParameters_ThemeParameters;
  31010. // CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  31011. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31012. * This program are made available under the terms of the Apache License, Version 2.0
  31013. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31014. /**
  31015. * @class SuperMap.ThemeService
  31016. * @category iServer Map Theme
  31017. * @classdesc 专题图服务类。
  31018. * @extends {SuperMap.CommonServiceBase}
  31019. * @example
  31020. * var myThemeService = new SuperMap.ThemeService(url, {
  31021. * eventListeners: {
  31022. * "processCompleted": themeCompleted,
  31023. * "processFailed": themeFailed
  31024. * }
  31025. * });
  31026. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  31027. * @param {Object} options - 参数。
  31028. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31029. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31030. * @param {Object} [options.headers] - 请求头。
  31031. */
  31032. class ThemeService_ThemeService extends CommonServiceBase_CommonServiceBase {
  31033. constructor(url, options) {
  31034. super(url, options);
  31035. if (options) {
  31036. SuperMap.Util.extend(this, options);
  31037. }
  31038. this.url = Util_Util.urlPathAppend(this.url, 'tempLayersSet');
  31039. this.CLASS_NAME = 'SuperMap.ThemeService';
  31040. }
  31041. /**
  31042. * @override
  31043. */
  31044. destroy() {
  31045. super.destroy();
  31046. }
  31047. /**
  31048. * @function SuperMap.ThemeService.prototype.processAsync
  31049. * @description 负责将客户端的专题图参数传递到服务端。
  31050. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  31051. */
  31052. processAsync(params) {
  31053. if (!(params instanceof ThemeParameters_ThemeParameters)) {
  31054. return;
  31055. }
  31056. var me = this,
  31057. jsonParameters = null;
  31058. jsonParameters = me.getJsonParameters(params);
  31059. me.request({
  31060. method: "POST",
  31061. data: jsonParameters,
  31062. scope: me,
  31063. success: me.serviceProcessCompleted,
  31064. failure: me.serviceProcessFailed
  31065. });
  31066. }
  31067. /**
  31068. * @function SuperMap.ThemeService.prototype.getJsonParameters
  31069. * @description 将专题图参数参数转化为 JSON 字符串。
  31070. * @param {SuperMap.ThemeParameters} parameter - 专题图参数类。
  31071. * @returns {Object} 转化后的JSON字符串。
  31072. */
  31073. getJsonParameters(parameter) {
  31074. var jsonParameters = "",
  31075. themeObj = null,
  31076. filters = null,
  31077. orderBys = null,
  31078. fieldValuesDisplayFilter;
  31079. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  31080. for (var i = 0; i < parameter.themes.length; i++) {
  31081. themeObj = parameter.themes[i];
  31082. var jsonTheme = Util_Util.toJSON(themeObj);
  31083. jsonTheme = jsonTheme.slice(0, -1);
  31084. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  31085. filters = parameter.displayFilters;
  31086. if (filters && filters.length > 0) {
  31087. if (filters.length === 1) {
  31088. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  31089. } else {
  31090. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  31091. }
  31092. }
  31093. orderBys = parameter.displayOrderBy;
  31094. if (orderBys && orderBys.length > 0) {
  31095. if (orderBys.length === 1) {
  31096. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  31097. } else {
  31098. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  31099. }
  31100. }
  31101. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  31102. if (fieldValuesDisplayFilter) {
  31103. jsonParameters += "'fieldValuesDisplayFilter':" + Util_Util.toJSON(fieldValuesDisplayFilter) + ",";
  31104. }
  31105. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  31106. jsonParameters += "'joinItems':[" + Util_Util.toJSON(parameter.joinItems[i]) + "],";
  31107. }
  31108. if (parameter.datasetNames && parameter.dataSourceNames) {
  31109. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  31110. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  31111. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  31112. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  31113. } else {
  31114. jsonParameters += "},";
  31115. }
  31116. }
  31117. //去除多余的逗号
  31118. if (parameter.themes && parameter.themes.length > 0) {
  31119. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  31120. }
  31121. jsonParameters += "]},";
  31122. var urlArray = this.url.split("/");
  31123. var jsonMapName = urlArray[urlArray.length - 2];
  31124. jsonParameters += "'name': '" + jsonMapName + "'}]";
  31125. return jsonParameters;
  31126. }
  31127. }
  31128. SuperMap.ThemeService = ThemeService_ThemeService;
  31129. // CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  31130. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31131. * This program are made available under the terms of the Apache License, Version 2.0
  31132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31133. /**
  31134. * @class SuperMap.ThiessenAnalystService
  31135. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  31136. * @classdesc
  31137. * 泰森多边形分析服务类
  31138. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  31139. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  31140. * 泰森多边形分析的参数支持两种,当参数为 {SuperMap.DatasetThiessenAnalystParameters} 类型
  31141. * 时,执行数据集泰森多边形分析,当参数为 {SuperMap.GeometryThiessenAnalystParameters} 类型时,
  31142. * 执行几何对象泰森多边形分析。
  31143. * @param url - {string} 服务的访问地址。
  31144. * 如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  31145. * @param {Object} options - 参数。</br>
  31146. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31147. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31148. * @param {Object} [options.headers] - 请求头。
  31149. * @extends {SuperMap.SpatialAnalystBase}
  31150. * @example 例如:
  31151. * (start code)
  31152. * var myThiessenAnalystService = new SuperMap.ThiessenAnalystService(url, {
  31153. * eventListeners: {
  31154. * "processCompleted": bufferCompleted,
  31155. * "processFailed": bufferFailed
  31156. * }
  31157. * });
  31158. * (end)
  31159. *
  31160. */
  31161. class ThiessenAnalystService_ThiessenAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  31162. constructor(url, options) {
  31163. super(url, options);
  31164. /**
  31165. * @member {string} SuperMap.ThiessenAnalystService.prototype.mode
  31166. * @description 缓冲区分析类型
  31167. */
  31168. this.mode = null;
  31169. if (options) {
  31170. Util_Util.extend(this, options);
  31171. }
  31172. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  31173. }
  31174. /**
  31175. * @override
  31176. */
  31177. destroy() {
  31178. super.destroy();
  31179. this.mode = null;
  31180. }
  31181. /**
  31182. * @function SuperMap.ThiessenAnalystService.prototype.processAsync
  31183. * @description 负责将客户端的查询参数传递到服务端。
  31184. * @param {(SuperMap.DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters)} parameter - 泰森多边形分析参数基类。
  31185. */
  31186. processAsync(parameter) {
  31187. var parameterObject = {};
  31188. var me = this;
  31189. if (parameter instanceof DatasetThiessenAnalystParameters_DatasetThiessenAnalystParameters) {
  31190. me.mode = "datasets";
  31191. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  31192. DatasetThiessenAnalystParameters_DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  31193. } else if (parameter instanceof GeometryThiessenAnalystParameters_GeometryThiessenAnalystParameters) {
  31194. me.mode = "geometry";
  31195. me.url = Util_Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  31196. GeometryThiessenAnalystParameters_GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  31197. }
  31198. var jsonParameters = Util_Util.toJSON(parameterObject);
  31199. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  31200. me.request({
  31201. method: "POST",
  31202. data: jsonParameters,
  31203. scope: me,
  31204. success: me.serviceProcessCompleted,
  31205. failure: me.serviceProcessFailed
  31206. });
  31207. }
  31208. }
  31209. SuperMap.ThiessenAnalystService = ThiessenAnalystService_ThiessenAnalystService;
  31210. // CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  31211. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31212. * This program are made available under the terms of the Apache License, Version 2.0
  31213. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31214. /**
  31215. * @class SuperMap.GeometryBatchAnalystService
  31216. * @category iServer SpatialAnalyst BatchAnalyst
  31217. * @classdesc 批量空间分析服务类
  31218. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  31219. * 叠加分析结果通过该类支持的事件的监听函数参数获取,参数类型为 {<SuperMap.REST.OverlayAnalystEventArgs>}; 获取的结果数据包括 originResult 、result 两种,
  31220. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  31221. * @extends {SuperMap.SpatialAnalystBase}
  31222. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  31223. * @param {Object} options - 参数。
  31224. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31225. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31226. * @param {Object} [options.headers] - 请求头。
  31227. * @example
  31228. * var myOverlayAnalystService = new SuperMap.REST.GeometryBatchAnalystService(url, {
  31229. * eventListeners: {
  31230. * "processCompleted": OverlayCompleted,
  31231. * "processFailed": OverlayFailed
  31232. * }
  31233. * });
  31234. */
  31235. class GeometryBatchAnalystService_GeometryBatchAnalystService extends SpatialAnalystBase_SpatialAnalystBase {
  31236. constructor(url, options) {
  31237. super(url, options);
  31238. if (options) {
  31239. Util_Util.extend(this, options);
  31240. }
  31241. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  31242. }
  31243. /**
  31244. * @function SuperMap.GeometryBatchAnalystService.prototype.processAsync
  31245. * @description 负责将客户端的查询参数传递到服务端。
  31246. * @param {SuperMap.GeometryBatchOverlayAnalystParameters} parameter - 批量几何对象叠加分析参数类
  31247. *
  31248. */
  31249. processAsync(parameters) {
  31250. var me = this;
  31251. me.url = Util_Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  31252. me.url = Util_Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  31253. var parameterObjects = me._processParams(parameters);
  31254. var jsonParameters = Util_Util.toJSON(parameterObjects);
  31255. me.request({
  31256. method: "POST",
  31257. data: jsonParameters,
  31258. scope: me,
  31259. success: me.serviceProcessCompleted,
  31260. failure: me.serviceProcessFailed
  31261. });
  31262. }
  31263. _processParams(parameters) {
  31264. var me = this;
  31265. if (!Util_Util.isArray(parameters)) {
  31266. return;
  31267. }
  31268. var processParams = [];
  31269. parameters.map(function (item) {
  31270. processParams.push(me._toJSON(item));
  31271. return item;
  31272. });
  31273. return processParams;
  31274. }
  31275. _toJSON(parameter) {
  31276. var tempObj = {};
  31277. if(parameter.analystName ==="buffer"){
  31278. tempObj.analystName = "buffer";
  31279. tempObj.param = {};
  31280. //几何对象的批量空间分析,
  31281. GeometryBufferAnalystParameters_GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  31282. }else if(parameter.analystName ==="overlay"){
  31283. tempObj.analystName = "overlay";
  31284. tempObj.param = {};
  31285. GeometryOverlayAnalystParameters_GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  31286. }else if(parameter.analystName ==="interpolationDensity"){
  31287. tempObj.analystName = "interpolationDensity";
  31288. tempObj.param = {};
  31289. InterpolationAnalystParameters_InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31290. }else if(parameter.analystName ==="interpolationidw"){
  31291. tempObj.analystName = "interpolationidw";
  31292. tempObj.param = {};
  31293. InterpolationAnalystParameters_InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31294. }else if(parameter.analystName ==="interpolationRBF"){
  31295. tempObj.analystName = "interpolationRBF";
  31296. tempObj.param = {};
  31297. InterpolationAnalystParameters_InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31298. }else if(parameter.analystName ==="interpolationKriging"){
  31299. tempObj.analystName = "interpolationKriging";
  31300. tempObj.param = {};
  31301. InterpolationAnalystParameters_InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31302. }else if(parameter.analystName ==="thiessenpolygon"){
  31303. tempObj.analystName = "thiessenpolygon";
  31304. tempObj.param = {};
  31305. GeometryThiessenAnalystParameters_GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  31306. }else {
  31307. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  31308. return parameter;
  31309. }
  31310. return tempObj;
  31311. }
  31312. /**
  31313. * @override
  31314. */
  31315. destroy() {
  31316. super.destroy();
  31317. }
  31318. }
  31319. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService_GeometryBatchAnalystService;
  31320. // CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  31321. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31322. * This program are made available under the terms of the Apache License, Version 2.0
  31323. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31324. /**
  31325. * @class SuperMap.TilesetsService
  31326. * @category iServer Map Tilesets
  31327. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  31328. * @extends {SuperMap.CommonServiceBase}
  31329. * @param {string} url - 地图服务地址。URL 应为:
  31330. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  31331. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  31332. * @param {Object} options - 参数。
  31333. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  31334. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  31335. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  31336. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31337. * @param {Object} [options.headers] - 请求头。
  31338. */
  31339. class TilesetsService_TilesetsService extends CommonServiceBase_CommonServiceBase {
  31340. constructor(url, options) {
  31341. super(url, options);
  31342. this.CLASS_NAME = "SuperMap.TilesetsService";
  31343. }
  31344. /**
  31345. * @override
  31346. */
  31347. destroy() {
  31348. super.destroy();
  31349. }
  31350. /**
  31351. * @function SuperMap.TilesetsService.prototype.processAsync
  31352. * @description 负责将客户端的查询参数传递到服务端。
  31353. */
  31354. processAsync() {
  31355. if (!this.url) {
  31356. return;
  31357. }
  31358. var me = this;
  31359. me.url = Util_Util.urlPathAppend(me.url, 'tilesets');
  31360. me.request({
  31361. method: "GET",
  31362. scope: me,
  31363. success: me.serviceProcessCompleted,
  31364. failure: me.serviceProcessFailed
  31365. });
  31366. }
  31367. }
  31368. SuperMap.TilesetsService = TilesetsService_TilesetsService;
  31369. // CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  31370. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31371. * This program are made available under the terms of the Apache License, Version 2.0
  31372. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31373. /**
  31374. * @class SuperMap.TopologyValidatorJobsParameter
  31375. * @category iServer ProcessingService TopologyValidator
  31376. * @classdesc 拓扑检查分析任务参数类。
  31377. * @param {Object} options - 必填参数。
  31378. * @param {string} options.datasetName - 数据集名。
  31379. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  31380. * @param {SuperMap.TopologyValidatorRule} [options.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  31381. * @param {string} [options.tolerance] - 容限。
  31382. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  31383. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  31384. */
  31385. class TopologyValidatorJobsParameter_TopologyValidatorJobsParameter {
  31386. constructor(options) {
  31387. if (!options) {
  31388. return;
  31389. }
  31390. /**
  31391. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetName
  31392. * @description 数据集名。
  31393. */
  31394. this.datasetName = "";
  31395. /**
  31396. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetTopology
  31397. * @description 拓扑检查对象所在的数据集名称。
  31398. */
  31399. this.datasetTopology = "";
  31400. /**
  31401. * @member {string} [SuperMap.TopologyValidatorJobsParameter.prototype.tolerance]
  31402. * @description 容限,指定的拓扑错误检查时使用的容限。
  31403. */
  31404. this.tolerance = "";
  31405. /**
  31406. * @member {SuperMap.TopologyValidatorRule} [SuperMap.TopologyValidatorJobsParameter.prototype.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP]
  31407. * @description 拓扑检查模式。
  31408. */
  31409. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  31410. /**
  31411. * @member {SuperMap.OutputSetting} [SuperMap.TopologyValidatorJobsParameter.prototype.output]
  31412. * @description 输出参数设置类。
  31413. */
  31414. this.output = null;
  31415. /**
  31416. * @member {SuperMap.MappingParameters} [SuperMap.TopologyValidatorJobsParameter.prototype.mappingParameters]
  31417. * @description 分析后结果可视化的参数类。
  31418. */
  31419. this.mappingParameters = null;
  31420. Util_Util.extend(this, options);
  31421. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  31422. }
  31423. /**
  31424. * @function SuperMap.TopologyValidatorJobsParameter.prototype.destroy
  31425. * @description 释放资源,将引用资源的属性置空。
  31426. */
  31427. destroy() {
  31428. this.datasetName = null;
  31429. this.datasetTopology = null;
  31430. this.tolerance = null;
  31431. this.rule = null;
  31432. if (this.output instanceof OutputSetting_OutputSetting) {
  31433. this.output.destroy();
  31434. this.output = null;
  31435. }
  31436. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  31437. this.mappingParameters.destroy();
  31438. this.mappingParameters = null;
  31439. }
  31440. }
  31441. /**
  31442. * @function SuperMap.TopologyValidatorJobsParameter.toObject
  31443. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  31444. * @param {Object} tempObj - 目标对象。
  31445. * @description 生成拓扑检查分析任务对象。
  31446. */
  31447. static toObject(TopologyValidatorJobsParameter, tempObj) {
  31448. for (var name in TopologyValidatorJobsParameter) {
  31449. if (name === "datasetName") {
  31450. tempObj['input'] = tempObj['input'] || {};
  31451. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  31452. continue;
  31453. }
  31454. if (name === "output") {
  31455. tempObj['output'] = tempObj['output'] || {};
  31456. tempObj['output'] = TopologyValidatorJobsParameter[name];
  31457. continue;
  31458. }
  31459. tempObj['analyst'] = tempObj['analyst'] || {};
  31460. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  31461. if(name === 'mappingParameters'){
  31462. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31463. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  31464. }
  31465. }
  31466. }
  31467. }
  31468. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter_TopologyValidatorJobsParameter;
  31469. // CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  31470. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31471. * This program are made available under the terms of the Apache License, Version 2.0
  31472. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31473. /**
  31474. * @class SuperMap.TopologyValidatorJobsService
  31475. * @category iServer ProcessingService TopologyValidator
  31476. * @classdesc 拓扑检查分析服务类
  31477. * @extends {SuperMap.ProcessingServiceBase}
  31478. * @param {string} url - 拓扑检查分析服务地址。
  31479. * @param {Object} options - 参数。
  31480. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31481. * @param {Object} [options.headers] - 请求头。
  31482. */
  31483. class TopologyValidatorJobsService_TopologyValidatorJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  31484. constructor(url, options) {
  31485. super(url, options);
  31486. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  31487. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  31488. }
  31489. /**
  31490. *@override
  31491. */
  31492. destroy() {
  31493. super.destroy();
  31494. }
  31495. /**
  31496. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  31497. * @description 获取拓扑检查分析所有任务
  31498. */
  31499. getTopologyValidatorJobs() {
  31500. super.getJobs(this.url);
  31501. }
  31502. /**
  31503. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  31504. * @description 获取指定id的拓扑检查分析服务
  31505. * @param {string} id - 指定要获取数据的id
  31506. */
  31507. getTopologyValidatorJob(id) {
  31508. super.getJobs( Util_Util.urlPathAppend(this.url, id));
  31509. }
  31510. /**
  31511. * @function SuperMap.TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  31512. * @description 新建拓扑检查分析服务
  31513. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  31514. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31515. */
  31516. addTopologyValidatorJob(params, seconds) {
  31517. super.addJob(this.url, params, TopologyValidatorJobsParameter_TopologyValidatorJobsParameter, seconds);
  31518. }
  31519. }
  31520. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService_TopologyValidatorJobsService;
  31521. // CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  31522. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31523. * This program are made available under the terms of the Apache License, Version 2.0
  31524. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31525. /**
  31526. * @class SuperMap.TransferLine
  31527. * @category iServer TrafficTransferAnalyst TransferPath
  31528. * @classdesc 换乘路线信息类。
  31529. * @param {Object} options - 参数。
  31530. * @param {number} options.lineID - 乘车路线 ID。
  31531. * @param {string} options.lineName - 乘车路线名称。
  31532. * @param {string} options.lineAliasName - 乘车路线别名。
  31533. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  31534. * @param {string} options.startStopName - 上车站点名称。
  31535. * @param {string} options.startStopAliasName - 上车站点别名。
  31536. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  31537. * @param {string} options.endStopName - 下车站点名称。
  31538. * @param {string} options.endStopAliasName - 下车站点别名。
  31539. */
  31540. class TransferLine_TransferLine {
  31541. constructor(options) {
  31542. options = options || {};
  31543. /**
  31544. * @member {number} SuperMap.TransferLine.prototype.lineID
  31545. * @description 乘车路线 ID。
  31546. */
  31547. this.lineID = null;
  31548. /**
  31549. * @member {string} SuperMap.TransferLine.prototype.lineName
  31550. * @description 乘车路线名称。
  31551. */
  31552. this.lineName = null;
  31553. /**
  31554. * @member {string} SuperMap.TransferLine.prototype.lineAliasName
  31555. * @description 乘车路线别名。
  31556. */
  31557. this.lineAliasName = null;
  31558. /**
  31559. * @member {number} SuperMap.TransferLine.prototype.startStopIndex
  31560. * @description 上车站点在本公交路线中的索引。
  31561. */
  31562. this.startStopIndex = null;
  31563. /**
  31564. * @member {string} SuperMap.TransferLine.prototype.startStopName
  31565. * @description 上车站点名称。
  31566. */
  31567. this.startStopName = null;
  31568. /**
  31569. * @member {string} SuperMap.TransferLine.prototype.startStopAliasName
  31570. * @description 上车站点别名。
  31571. */
  31572. this.startStopAliasName = null;
  31573. /**
  31574. * @member {number} SuperMap.TransferLine.prototype.endStopIndex
  31575. * @description 下车站点在本公交路线中的索引。
  31576. */
  31577. this.endStopIndex = null;
  31578. /**
  31579. * @member {string} SuperMap.TransferLine.prototype.endStopName
  31580. * @description 下车站点名称。
  31581. */
  31582. this.endStopName = null;
  31583. /**
  31584. * @member {string} SuperMap.TransferLine.prototype.endStopAliasName
  31585. * @description 下车站点别名。
  31586. */
  31587. this.endStopAliasName = null;
  31588. Util_Util.extend(this, options);
  31589. this.CLASS_NAME = "SuperMap.TransferLine";
  31590. }
  31591. /**
  31592. * @function SuperMap.TransferLine.prototype.destroy
  31593. * @description 释放资源,将引用资源的属性置空。
  31594. */
  31595. destroy() {
  31596. Util_Util.reset(this);
  31597. }
  31598. /**
  31599. * @function SuperMap.TransferLine.fromJson
  31600. * @description 将返回结果转化为 {@link SuperMap.TransferLine} 对象。
  31601. * @param {Object} jsonObject - 新的返回结果。
  31602. * @returns {SuperMap.TransferLine} 转化后的 {@link SuperMap.TransferLine} 对象。
  31603. */
  31604. static fromJson(jsonObject) {
  31605. if (!jsonObject) {
  31606. return;
  31607. }
  31608. return new TransferLine_TransferLine({
  31609. lineID: jsonObject['lineID'],
  31610. lineName: jsonObject['lineName'],
  31611. lineAliasName: jsonObject['lineAliasName'],
  31612. startStopIndex: jsonObject['startStopIndex'],
  31613. startStopName: jsonObject['startStopName'],
  31614. startStopAliasName: jsonObject['startStopAliasName'],
  31615. endStopIndex: jsonObject['endStopIndex'],
  31616. endStopName: jsonObject['endStopName'],
  31617. endStopAliasName: jsonObject['endStopAliasName']
  31618. });
  31619. }
  31620. }
  31621. SuperMap.TransferLine = TransferLine_TransferLine;
  31622. // CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  31623. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31624. * This program are made available under the terms of the Apache License, Version 2.0
  31625. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31626. /**
  31627. * @class SuperMap.TransferPathParameters
  31628. * @category iServer TrafficTransferAnalyst TransferPaths
  31629. * @classdesc 交通换乘线路查询参数类。
  31630. * @param {Object} options - 参数。
  31631. * @param {Array.<SuperMap.TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  31632. * @param {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  31633. *
  31634. */
  31635. class TransferPathParameters_TransferPathParameters {
  31636. constructor(options) {
  31637. options = options || {};
  31638. /**
  31639. * @member {Array.<SuperMap.TransferLine>} SuperMap.TransferPathParameters.prototype.transferLines
  31640. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  31641. */
  31642. this.transferLines = null;
  31643. /**
  31644. * @member {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransferPathParameters.prototype.points
  31645. * @description 两种查询方式:<br>
  31646. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  31647. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  31648. */
  31649. this.points = null;
  31650. Util_Util.extend(this, options);
  31651. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  31652. }
  31653. /**
  31654. * @function SuperMap.TransferPathParameters.prototype.destroy
  31655. * @description 释放资源,将引用资源的属性置空。
  31656. */
  31657. destroy() {
  31658. Util_Util.reset(this);
  31659. }
  31660. /**
  31661. * @function SuperMap.TransferPathParameters.toJson
  31662. * @description 将 {@link SuperMap.TransferPathParameters} 对象参数转换为 JSON 字符串。
  31663. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  31664. * @returns {string} 转化后的 JSON 字符串。
  31665. */
  31666. static toJson(params) {
  31667. if (params) {
  31668. return Util_Util.toJSON(params);
  31669. }
  31670. }
  31671. }
  31672. SuperMap.TransferPathParameters = TransferPathParameters_TransferPathParameters;
  31673. // CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  31674. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31675. * This program are made available under the terms of the Apache License, Version 2.0
  31676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31677. /**
  31678. * @class SuperMap.TransferPathService
  31679. * @category iServer TrafficTransferAnalyst TransferPath
  31680. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  31681. * 返回结果通过该类支持的事件的监听函数参数获取
  31682. * @extends {SuperMap.CommonServiceBase}
  31683. * @example 例如:
  31684. * var myService = new SuperMap.TransferPathService(url, {eventListeners: {
  31685. * "processCompleted": TrafficTransferCompleted,
  31686. * "processFailed": TrafficTransferError
  31687. * }
  31688. * };
  31689. * @param {string} url - 与客户端交互的交通换乘线路查询服务地址。
  31690. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  31691. * @param {Object} options - 参数。</br>
  31692. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31693. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31694. * @param {Object} [options.headers] - 请求头。
  31695. */
  31696. class TransferPathService_TransferPathService extends CommonServiceBase_CommonServiceBase {
  31697. constructor(url, options) {
  31698. super(url, options);
  31699. this.CLASS_NAME = "SuperMap.TransferPathService";
  31700. }
  31701. /**
  31702. * @override
  31703. */
  31704. destroy() {
  31705. super.destroy();
  31706. }
  31707. /**
  31708. * @function SuperMap.TransferPathService.prototype.processAsync
  31709. * @description 负责将客户端的更新参数传递到服务端。
  31710. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  31711. */
  31712. processAsync(params) {
  31713. if (!(params instanceof TransferPathParameters_TransferPathParameters)) {
  31714. return;
  31715. }
  31716. var me = this,
  31717. method = "GET",
  31718. jsonParameters;
  31719. me.url = Util_Util.urlPathAppend(me.url, 'path');
  31720. jsonParameters = {
  31721. points: Util_Util.toJSON(params.points),
  31722. transferLines: Util_Util.toJSON(params['transferLines'])
  31723. };
  31724. me.request({
  31725. method: method,
  31726. params: jsonParameters,
  31727. scope: me,
  31728. success: me.serviceProcessCompleted,
  31729. failure: me.serviceProcessFailed
  31730. });
  31731. }
  31732. }
  31733. SuperMap.TransferPathService = TransferPathService_TransferPathService;
  31734. // CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  31735. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31736. * This program are made available under the terms of the Apache License, Version 2.0
  31737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31738. /**
  31739. * @class SuperMap.TransferSolutionParameters
  31740. * @category iServer TrafficTransferAnalyst TransferSolutions
  31741. * @classdesc 交通换乘方案查询参数类。
  31742. * @param {Object} options - 参数。
  31743. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|number)>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  31744. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  31745. * @param {SuperMap.TransferTactic} [options.transferTactic=SuperMap.TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  31746. * @param {SuperMap.TransferPreference} [options.transferPreference=SuperMap.TransferPreference.NONE] - 乘车偏好枚举。
  31747. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  31748. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  31749. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  31750. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  31751. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  31752. * @param {string} [options.travelTime] - 出行的时间。
  31753. */
  31754. class TransferSolutionParameters_TransferSolutionParameters {
  31755. constructor(options) {
  31756. options = options || {};
  31757. /**
  31758. * @member {number} [SuperMap.TransferSolutionParameters.prototype.solutionCount=6]
  31759. * @description 乘车方案的数量。
  31760. */
  31761. this.solutionCount = 6;
  31762. /**
  31763. * @member {SuperMap.TransferPreference} [SuperMap.TransferSolutionParameters.prototype.transferPreference=SuperMap.TransferPreference.NONE]
  31764. * @description 乘车偏好枚举。
  31765. */
  31766. this.transferPreference = TransferPreference.NONE;
  31767. /**
  31768. * @member {SuperMap.TransferTactic} [SuperMap.TransferSolutionParameters.prototype.transferTactic=TransferTactic|SuperMap.TransferTactic.LESS_TIME]
  31769. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  31770. */
  31771. this.transferTactic = TransferTactic.LESS_TIME;
  31772. /**
  31773. * @member {number} [SuperMap.TransferSolutionParameters.prototype.walkingRatio=10]
  31774. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  31775. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  31776. * 方案1:坐车 10 公里,走路 1 公里;</br>
  31777. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  31778. * 1. 假设权重比为 15:</br>
  31779. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  31780. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  31781. * 此时方案 2 消耗更低。</br>
  31782. * 2. 假设权重比为2:</br>
  31783. * •方案 1 的总消耗为:10+1*2 = 12</br>
  31784. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  31785. * 此时方案 1 消耗更低。</br>
  31786. */
  31787. this.walkingRatio = null;
  31788. /**
  31789. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|string)>} SuperMap.TransferSolutionParameters.prototype.points
  31790. * @description 两种查询方式:</br>
  31791. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  31792. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  31793. */
  31794. this.points = false;
  31795. /**
  31796. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeLinesnull]
  31797. * @description 避让路线 ID。
  31798. * */
  31799. this.evadeLines = null;
  31800. /**
  31801. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeStops=TransferLine]
  31802. * @description 避让站点 ID。
  31803. * */
  31804. this.evadeStops = null;
  31805. /**
  31806. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorLines]
  31807. * @description 优先路线 ID。
  31808. * */
  31809. this.priorLines = null;
  31810. /**
  31811. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorStops]
  31812. * @description 优先站点 ID。
  31813. * */
  31814. this.priorStops = null;
  31815. /**
  31816. * @member {string} SuperMap.TransferSolutionParameters.prototype.travelTime
  31817. * @description 出行的时间; 格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  31818. */
  31819. this.travelTime = null;
  31820. Util_Util.extend(this, options);
  31821. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  31822. }
  31823. /**
  31824. * @function SuperMap.TransferSolutionParameters.prototype.destroy
  31825. * @description 释放资源,将引用资源的属性置空。
  31826. */
  31827. destroy() {
  31828. Util_Util.reset(this);
  31829. }
  31830. /**
  31831. * @function SuperMap.TransferSolutionParameters.toJsonParameters
  31832. * @description 将 {@link SuperMap.TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  31833. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  31834. * @returns {string} 转化后的 JSON 字符串。
  31835. */
  31836. static toJson(params) {
  31837. if (params) {
  31838. return Util_Util.toJSON(params);
  31839. }
  31840. }
  31841. }
  31842. SuperMap.TransferSolutionParameters = TransferSolutionParameters_TransferSolutionParameters;
  31843. // CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  31844. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31845. * This program are made available under the terms of the Apache License, Version 2.0
  31846. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31847. /**
  31848. * @class SuperMap.TransferSolutionService
  31849. * @category iServer TrafficTransferAnalyst TransferSolutions
  31850. * @classdesc 交通换乘方案查询服务类。
  31851. * 返回结果通过该类支持的事件的监听函数参数获取。
  31852. * @param {string} url - 与客户端交互的交通换乘方案查询服务地址。
  31853. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  31854. * @param {Object} options - 参数。</br>
  31855. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  31856. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31857. * @param {Object} [options.headers] - 请求头。
  31858. * @extends {SuperMap.CommonServiceBase}
  31859. * @example 例如:
  31860. * (start code)
  31861. * var myService = new SuperMap.TransferSolutionService(url, {eventListeners: {
  31862. * "processCompleted": trafficTransferCompleted,
  31863. * "processFailed": trafficTransferError
  31864. * }
  31865. * };
  31866. * (end)
  31867. *
  31868. */
  31869. class TransferSolutionService_TransferSolutionService extends CommonServiceBase_CommonServiceBase {
  31870. constructor(url, options) {
  31871. super(url, options);
  31872. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  31873. }
  31874. /**
  31875. * @override
  31876. */
  31877. destroy() {
  31878. super.destroy();
  31879. }
  31880. /**
  31881. * @function SuperMap.TransferSolutionService.prototype.processAsync
  31882. * @description 负责将客户端的更新参数传递到服务端。
  31883. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  31884. */
  31885. processAsync(params) {
  31886. if (!(params instanceof TransferSolutionParameters_TransferSolutionParameters)) {
  31887. return;
  31888. }
  31889. var me = this,
  31890. method = "GET",
  31891. jsonParameters;
  31892. me.url = Util_Util.urlPathAppend(me.url, 'solutions');
  31893. jsonParameters = {
  31894. points: Util_Util.toJSON(params.points),
  31895. walkingRatio: params['walkingRatio'],
  31896. transferTactic: params['transferTactic'],
  31897. solutionCount: params['solutionCount'],
  31898. transferPreference: params["transferPreference"]
  31899. };
  31900. if (params.evadeLines) {
  31901. jsonParameters["evadeLines"] = Util_Util.toJSON(params.evadeLines);
  31902. }
  31903. if (params.evadeStops) {
  31904. jsonParameters["evadeStops"] = Util_Util.toJSON(params.evadeStops);
  31905. }
  31906. if (params.priorLines) {
  31907. jsonParameters["priorLines"] = Util_Util.toJSON(params.priorLines);
  31908. }
  31909. if (params.priorStops) {
  31910. jsonParameters["priorStops"] = Util_Util.toJSON(params.priorStops);
  31911. }
  31912. if (params.travelTime) {
  31913. jsonParameters["travelTime"] = params.travelTime;
  31914. }
  31915. me.request({
  31916. method: method,
  31917. params: jsonParameters,
  31918. scope: me,
  31919. success: me.serviceProcessCompleted,
  31920. failure: me.serviceProcessFailed
  31921. });
  31922. }
  31923. }
  31924. SuperMap.TransferSolutionService = TransferSolutionService_TransferSolutionService;
  31925. // CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  31926. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31927. * This program are made available under the terms of the Apache License, Version 2.0
  31928. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31929. /**
  31930. * @class SuperMap.UpdateEdgeWeightParameters
  31931. * @category iServer NetworkAnalyst EdgeWeight
  31932. * @classdesc 边的耗费权重更新服务参数类。
  31933. * @param {Object} options - 参数。
  31934. * @param {string} options.edgeId - 所在边的 ID。
  31935. * @param {string} options.fromNodeId - 起始转向点的 ID。
  31936. * @param {string} options.toNodeId - 终止转向点的 ID。
  31937. * @param {string} options.weightField - 边的耗费字段。
  31938. * @param {string} options.edgeWeight - 耗费权重。
  31939. */
  31940. class UpdateEdgeWeightParameters_UpdateEdgeWeightParameters {
  31941. constructor(options) {
  31942. if (!options) {
  31943. return;
  31944. }
  31945. /**
  31946. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeId
  31947. * @description 所在边的 ID。
  31948. */
  31949. this.edgeId = "";
  31950. /**
  31951. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.fromNodeId
  31952. * @description 起始转向点的 ID。
  31953. */
  31954. this.fromNodeId = "";
  31955. /**
  31956. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.toNodeId
  31957. * @description 终止转向点的 ID。
  31958. */
  31959. this.toNodeId = "";
  31960. /**
  31961. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.weightField
  31962. * @description 边的耗费字段。
  31963. */
  31964. this.weightField = "";
  31965. /**
  31966. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeWeight
  31967. * @description 耗费权重。
  31968. */
  31969. this.edgeWeight = "";
  31970. Util_Util.extend(this, options);
  31971. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  31972. }
  31973. /**
  31974. * @function SuperMap.UpdateEdgeWeightParameters.prototype.destroy
  31975. * @description 释放资源,将引用资源的属性置空。
  31976. */
  31977. destroy() {
  31978. this.edgeId = null;
  31979. this.fromNodeId = null;
  31980. this.toNodeId = null;
  31981. this.weightField = null;
  31982. this.edgeWeight = null;
  31983. }
  31984. }
  31985. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters_UpdateEdgeWeightParameters;
  31986. // CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  31987. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  31988. * This program are made available under the terms of the Apache License, Version 2.0
  31989. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31990. /**
  31991. * @class SuperMap.UpdateEdgeWeightService
  31992. * @category iServer NetworkAnalyst EdgeWeight
  31993. * @classdesc 更新边的边的耗费权重服务
  31994. * @extends {SuperMap.NetworkAnalystServiceBase}
  31995. * @example
  31996. *(start code)
  31997. * var updateEdgeWeightService = new SuperMap.UpdateEdgeWeightService(url, {
  31998. * eventListeners: {
  31999. * "processCompleted": UpdateEdgeWeightCompleted, //参数为SuperMap.UpdateEdgeWeightEventArgs
  32000. * "processFailed": UpdateEdgeWeightError //参数为SuperMap.ServiceFailedEventArgs
  32001. * }
  32002. * });
  32003. * (end)
  32004. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  32005. * @param {Object} options - 参数。
  32006. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32007. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32008. * @param {Object} [options.headers] - 请求头。
  32009. */
  32010. class UpdateEdgeWeightService_UpdateEdgeWeightService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  32011. constructor(url, options) {
  32012. super(url, options);
  32013. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  32014. }
  32015. /**
  32016. * @override
  32017. */
  32018. destroy() {
  32019. super.destroy();
  32020. }
  32021. /**
  32022. * @function SuperMap.UpdateEdgeWeightService.prototype.processAsync
  32023. * @description 开始异步执行边的边的耗费权重的更新
  32024. * @param {SuperMap.UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  32025. * @example
  32026. * (code)
  32027. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  32028. * edgeId:"20",
  32029. * fromNodeId:"26",
  32030. * toNodeId:"109",
  32031. * weightField:"time",
  32032. * edgeWeight:"25"
  32033. * });
  32034. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  32035. * (end)
  32036. */
  32037. processAsync(params) {
  32038. if (!(params instanceof UpdateEdgeWeightParameters_UpdateEdgeWeightParameters)) {
  32039. return;
  32040. }
  32041. var me = this;
  32042. var paramStr = me.parse(params);
  32043. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  32044. var data = params.edgeWeight ? params.edgeWeight : null;
  32045. me.request({
  32046. method: "PUT",
  32047. scope: me,
  32048. data: data,
  32049. success: me.serviceProcessCompleted,
  32050. failure: me.serviceProcessFailed
  32051. });
  32052. }
  32053. /**
  32054. * @function SuperMap.UpdateEdgeWeightService.prototype.parse
  32055. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  32056. */
  32057. parse(params) {
  32058. if (!params) {
  32059. return;
  32060. }
  32061. var paramStr = "";
  32062. for (var attr in params) {
  32063. if (params[attr] === "" || params[attr] === "edgeWeight") {
  32064. continue;
  32065. }
  32066. switch (attr) {
  32067. case "edgeId":
  32068. paramStr += "/edgeweight/" + params[attr];
  32069. break;
  32070. case "fromNodeId":
  32071. paramStr += "/fromnode/" + params[attr];
  32072. break;
  32073. case "toNodeId":
  32074. paramStr += "/tonode/" + params[attr];
  32075. break;
  32076. case "weightField":
  32077. paramStr += "/weightfield/" + params[attr];
  32078. break;
  32079. default :
  32080. break;
  32081. }
  32082. }
  32083. return paramStr;
  32084. }
  32085. }
  32086. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService_UpdateEdgeWeightService;
  32087. // CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  32088. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32089. * This program are made available under the terms of the Apache License, Version 2.0
  32090. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32091. /**
  32092. * @class SuperMap.UpdateTurnNodeWeightParameters
  32093. * @category iServer NetworkAnalyst TurnNodeWeight
  32094. * @classdesc 转向耗费权重更新服务参数类。
  32095. * @param {Object} options - 参数。
  32096. * @param {string} options.nodeId - 转向结点的 ID。
  32097. * @param {string} options.fromEdgeId - 起始边的 ID。
  32098. * @param {string} options.toEdgeId - 终止边的 ID。
  32099. * @param {string} options.weightField - 转向结点的耗费字段。
  32100. * @param {string} options.turnNodeWeight - 耗费权重。
  32101. */
  32102. class UpdateTurnNodeWeightParameters_UpdateTurnNodeWeightParameters {
  32103. constructor(options) {
  32104. if (!options) {
  32105. return;
  32106. }
  32107. /**
  32108. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.nodeId
  32109. * @description 转向结点的 ID。
  32110. */
  32111. this.nodeId = "";
  32112. /**
  32113. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  32114. * @description 起始边的 ID。
  32115. */
  32116. this.fromEdgeId = "";
  32117. /**
  32118. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.toEdgeId
  32119. * @description 终止边的 ID。
  32120. */
  32121. this.toEdgeId = "";
  32122. /**
  32123. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.weightField
  32124. * @description 转向结点的耗费字段。
  32125. */
  32126. this.weightField = "";
  32127. /**
  32128. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  32129. * @description 耗费权重。
  32130. */
  32131. this.turnNodeWeight = "";
  32132. Util_Util.extend(this, options);
  32133. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  32134. }
  32135. /**
  32136. * @function SuperMap.UpdateTurnNodeWeightParameters.prototype.destroy
  32137. * @description 释放资源,将引用资源的属性置空。
  32138. */
  32139. destroy() {
  32140. this.nodeId = null;
  32141. this.fromEdgeId = null;
  32142. this.toEdgeId = null;
  32143. this.weightField = null;
  32144. this.turnNodeWeight = null;
  32145. }
  32146. }
  32147. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters_UpdateTurnNodeWeightParameters;
  32148. // CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  32149. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32150. * This program are made available under the terms of the Apache License, Version 2.0
  32151. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32152. /**
  32153. * @class SuperMap.UpdateTurnNodeWeightService
  32154. * @category iServer NetworkAnalyst TurnNodeWeight
  32155. * @classdesc 转向耗费权重更新服务类
  32156. * @extends {SuperMap.NetworkAnalystServiceBase}
  32157. * @example
  32158. * var UpdateTurnNodeWeightService = new SuperMap.UpdateTurnNodeWeightService(url, {
  32159. * eventListeners: {
  32160. * "processCompleted": UpdateTurnNodeWeightCompleted, //参数为SuperMap.UpdateTurnNodeWeightEventArgs
  32161. * "processFailed": UpdateTurnNodeWeightError //参数为SuperMap.ServiceFailedEventArgs
  32162. * }
  32163. * });
  32164. * @param {string} url - 服务的访问地址。如:
  32165. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  32166. * @param {Object} options - 参数。
  32167. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32168. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32169. * @param {Object} [options.headers] - 请求头。
  32170. */
  32171. class UpdateTurnNodeWeightService_UpdateTurnNodeWeightService extends NetworkAnalystServiceBase_NetworkAnalystServiceBase {
  32172. constructor(url, options) {
  32173. super(url, options);
  32174. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  32175. }
  32176. /**
  32177. * @override
  32178. */
  32179. destroy() {
  32180. super.destroy();
  32181. }
  32182. /**
  32183. * @function SuperMap.UpdateTurnNodeWeightService.prototype.processAsync
  32184. * @description 开始异步执行转向耗费权重的更新
  32185. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  32186. * @example
  32187. * (code)
  32188. * var updateTurnNodeWeightParam=new SuperMap.UpdateTurnNodeWeightParameters({
  32189. * nodeId:"106",
  32190. * fromEdgeId:"6508",
  32191. * toEdgeId:"6504",
  32192. * weightField:"TurnCost",
  32193. * turnNodeWeight:"50"
  32194. * });
  32195. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  32196. * (end)
  32197. **/
  32198. processAsync(params) {
  32199. if (!(params instanceof UpdateTurnNodeWeightParameters_UpdateTurnNodeWeightParameters)) {
  32200. return;
  32201. }
  32202. var me = this;
  32203. var paramStr = me.parse(params);
  32204. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  32205. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  32206. me.request({
  32207. method: "PUT",
  32208. scope: me,
  32209. data: data,
  32210. success: me.serviceProcessCompleted,
  32211. failure: me.serviceProcessFailed
  32212. });
  32213. }
  32214. /**
  32215. * @function SuperMap.UpdateTurnNodeWeightService.prototype.parse
  32216. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  32217. */
  32218. parse(params) {
  32219. if (!params) {
  32220. return;
  32221. }
  32222. var paramStr = "";
  32223. for (var attr in params) {
  32224. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  32225. continue;
  32226. }
  32227. switch (attr) {
  32228. case "nodeId":
  32229. paramStr += "/turnnodeweight/" + params[attr];
  32230. break;
  32231. case "fromEdgeId":
  32232. paramStr += "/fromedge/" + params[attr];
  32233. break;
  32234. case "toEdgeId":
  32235. paramStr += "/toedge/" + params[attr];
  32236. break;
  32237. case "weightField":
  32238. paramStr += "/weightfield/" + params[attr];
  32239. break;
  32240. default :
  32241. break;
  32242. }
  32243. }
  32244. return paramStr;
  32245. }
  32246. }
  32247. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService_UpdateTurnNodeWeightService;
  32248. // CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  32249. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32250. * This program are made available under the terms of the Apache License, Version 2.0
  32251. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32252. /**
  32253. * @class SuperMap.VectorClipJobsParameter
  32254. * @category iServer ProcessingService VectorClip
  32255. * @classdesc 矢量裁剪分析任务参数类。
  32256. * @param {Object} options - 参数。
  32257. * @param {string} options.datasetName - 数据集名。
  32258. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  32259. * @param {SuperMap.ClipAnalystMode} [options.mode=SuperMap.ClipAnalystMode.CLIP] - 裁剪分析模式。
  32260. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  32261. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32262. */
  32263. class VectorClipJobsParameter_VectorClipJobsParameter {
  32264. constructor(options) {
  32265. options = options || {};
  32266. /**
  32267. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetName
  32268. * @description 数据集名。
  32269. */
  32270. this.datasetName = "";
  32271. /**
  32272. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetOverlay
  32273. * @description 裁剪对象数据集。
  32274. */
  32275. this.datasetVectorClip = "";
  32276. /**
  32277. * @member {string} SuperMap.VectorClipJobsParameter.prototype.geometryClip
  32278. * @description 裁剪几何对象。
  32279. */
  32280. this.geometryClip = "";
  32281. /**
  32282. * @member {SuperMap.ClipAnalystMode} [SuperMap.VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  32283. * @description 裁剪分析模式 。
  32284. */
  32285. this.mode = ClipAnalystMode.CLIP;
  32286. /**
  32287. * @member {SuperMap.OutputSetting} SuperMap.VectorClipJobsParameter.prototype.output
  32288. * @description 输出参数设置类。
  32289. */
  32290. this.output = null;
  32291. /**
  32292. * @member {SuperMap.MappingParameters} [SuperMap.VectorClipJobsParameter.prototype.mappingParameters]
  32293. * @description 分析后结果可视化的参数类。
  32294. */
  32295. this.mappingParameters = null;
  32296. Util_Util.extend(this, options);
  32297. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  32298. }
  32299. /**
  32300. * @function SuperMap.VectorClipJobsParameter.prototype.destroy
  32301. * @description 释放资源,将引用资源的属性置空。
  32302. */
  32303. destroy() {
  32304. this.datasetName = null;
  32305. this.datasetVectorClip = null;
  32306. this.geometryClip = null;
  32307. this.mode = null;
  32308. if (this.output instanceof OutputSetting_OutputSetting) {
  32309. this.output.destroy();
  32310. this.output = null;
  32311. }
  32312. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  32313. this.mappingParameters.destroy();
  32314. this.mappingParameters = null;
  32315. }
  32316. }
  32317. /**
  32318. * @function SuperMap.VectorClipJobsParameter.toObject
  32319. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  32320. * @param {Object} tempObj - 目标对象。
  32321. * @description 矢量裁剪分析任务对象。
  32322. */
  32323. static toObject(vectorClipJobsParameter, tempObj) {
  32324. for (var name in vectorClipJobsParameter) {
  32325. if (name === "datasetName") {
  32326. tempObj['input'] = tempObj['input'] || {};
  32327. tempObj['input'][name] = vectorClipJobsParameter[name];
  32328. continue;
  32329. }
  32330. if (name === "output"){
  32331. tempObj['output'] = tempObj['output'] || {};
  32332. tempObj['output'] = vectorClipJobsParameter[name];
  32333. continue;
  32334. }
  32335. tempObj['analyst'] = tempObj['analyst'] || {};
  32336. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  32337. if(name === 'mappingParameters'){
  32338. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32339. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  32340. }
  32341. }
  32342. }
  32343. }
  32344. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter_VectorClipJobsParameter;
  32345. // CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  32346. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32347. * This program are made available under the terms of the Apache License, Version 2.0
  32348. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32349. /**
  32350. * @class SuperMap.VectorClipJobsService
  32351. * @category iServer ProcessingService VectorClip
  32352. * @classdesc 矢量裁剪分析服务类
  32353. * @extends {SuperMap.ProcessingServiceBase}
  32354. * @param {string} url -矢量裁剪分析服务地址。
  32355. * @param {Object} options - 交互服务时所需可选参数。
  32356. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32357. * @param {Object} [options.headers] - 请求头。
  32358. */
  32359. class VectorClipJobsService_VectorClipJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  32360. constructor(url, options) {
  32361. super(url, options);
  32362. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  32363. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  32364. }
  32365. /**
  32366. *@override
  32367. */
  32368. destroy() {
  32369. super.destroy();
  32370. }
  32371. /**
  32372. * @function SuperMap.VectorClipJobsService.protitype.getVectorClipJobs
  32373. * @description 获取矢量裁剪分析所有任务
  32374. */
  32375. getVectorClipJobs() {
  32376. super.getJobs(this.url);
  32377. }
  32378. /**
  32379. * @function SuperMap.KernelDensityJobsService.protitype.getVectorClipJob
  32380. * @description 获取指定id的矢量裁剪分析服务
  32381. * @param {string} id - 指定要获取数据的id
  32382. */
  32383. getVectorClipJob(id) {
  32384. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  32385. }
  32386. /**
  32387. * @function SuperMap.VectorClipJobsService.protitype.addVectorClipJob
  32388. * @description 新建矢量裁剪分析服务
  32389. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  32390. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32391. */
  32392. addVectorClipJob(params, seconds) {
  32393. super.addJob(this.url, params, VectorClipJobsParameter_VectorClipJobsParameter, seconds);
  32394. }
  32395. }
  32396. SuperMap.VectorClipJobsService = VectorClipJobsService_VectorClipJobsService;
  32397. // CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  32398. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32399. * This program are made available under the terms of the Apache License, Version 2.0
  32400. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32401. /**
  32402. * @class SuperMap.RasterFunctionParameter
  32403. * @category iServer Map
  32404. * @classdesc iServer 地图服务栅格分析参数基类
  32405. * @param {Object} options - 参数。
  32406. * @param {SuperMap.RasterFunctionType} options.type - 栅格分析方法。
  32407. */
  32408. class RasterFunctionParameter_RasterFunctionParameter {
  32409. constructor(options) {
  32410. options = options || {};
  32411. /**
  32412. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  32413. * @description 栅格分析方法。
  32414. */
  32415. this.type = null;
  32416. Util_Util.extend(this, options);
  32417. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  32418. }
  32419. /**
  32420. * @function SuperMap.RasterFunctionParameter.prototype.destroy
  32421. * @description 释放资源,将资源的属性置空。
  32422. */
  32423. destroy() {
  32424. this.type = null;
  32425. }
  32426. }
  32427. SuperMap.RasterFunctionParameter = RasterFunctionParameter_RasterFunctionParameter;
  32428. // CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  32429. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32430. * This program are made available under the terms of the Apache License, Version 2.0
  32431. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32432. /**
  32433. * @class SuperMap.NDVIParameter
  32434. * @category iServer Map
  32435. * @classdesc 归一化植被指数参数类
  32436. * @param {Object} options - 参数。
  32437. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  32438. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  32439. * @param {string} [options.colorMap="0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff"] - 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  32440. * @extends {SuperMap.RasterFunctionParameter}
  32441. */
  32442. class NDVIParameter_NDVIParameter extends RasterFunctionParameter_RasterFunctionParameter {
  32443. constructor(options) {
  32444. super(options);
  32445. /**
  32446. * @member {number} [SuperMap.NDVIParameter.prototype.redIndex=0]
  32447. * @description 红光谱波段索引。
  32448. */
  32449. this.redIndex = 0;
  32450. /**
  32451. * @member {number} [SuperMap.NDVIParameter.prototype.nirIndex=1]
  32452. * @description 近红外光谱波段索引。
  32453. */
  32454. this.nirIndex = 1;
  32455. /**
  32456. * @member {string} [SuperMap.NDVIParameter.prototype.colorMap="0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff"]
  32457. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  32458. */
  32459. this.colorMap =
  32460. '0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff';
  32461. /**
  32462. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  32463. * @description 栅格分析方法。
  32464. */
  32465. this.type = RasterFunctionType.NDVI;
  32466. Util_Util.extend(this, options);
  32467. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  32468. }
  32469. /**
  32470. * @function SuperMap.NDVIParameter.prototype.destroy
  32471. * @override
  32472. */
  32473. destroy() {
  32474. super.destroy();
  32475. this.redIndex = null;
  32476. this.nirIndex = null;
  32477. this.colorMap = null;
  32478. }
  32479. /**
  32480. * @function SuperMap.NDVIParameter.prototype.toJSON
  32481. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  32482. * @returns {string} 返回转换后的 JSON 字符串。
  32483. */
  32484. toJSON() {
  32485. return {
  32486. redIndex: this.redIndex,
  32487. nirIndex: this.nirIndex,
  32488. colorMap: this.colorMap,
  32489. type: this.type
  32490. };
  32491. }
  32492. }
  32493. SuperMap.NDVIParameter = NDVIParameter_NDVIParameter;
  32494. // CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  32495. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32496. * This program are made available under the terms of the Apache License, Version 2.0
  32497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32498. /**
  32499. * @class SuperMap.HillshadeParameter
  32500. * @category iServer Map
  32501. * @classdesc 阴影面分析参数类
  32502. * @param {Object} options - 参数。
  32503. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  32504. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  32505. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  32506. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  32507. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  32508. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  32509. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  32510. * Latitude Z-factor
  32511. * 0 0.00000898
  32512. * 10 0.00000912
  32513. * 20 0.00000956
  32514. * 30 0.00001036
  32515. * 40 0.00001171
  32516. * 50 0.00001395
  32517. * 60 0.00001792
  32518. * 70 0.00002619
  32519. * 80 0.00005156
  32520. * @extends {SuperMap.RasterFunctionParameter}
  32521. */
  32522. class HillshadeParameter_HillshadeParameter extends RasterFunctionParameter_RasterFunctionParameter {
  32523. constructor(options) {
  32524. super(options);
  32525. /**
  32526. * @member {number} [SuperMap.HillshadeParameter.prototype.altitude = 45]
  32527. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  32528. */
  32529. this.altitude = 45;
  32530. /**
  32531. * @member {number} [SuperMap.HillshadeParameter.prototype.azimuth = 315]
  32532. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  32533. */
  32534. this.azimuth = 315;
  32535. /**
  32536. * @member {number} [SuperMap.HillshadeParameter.prototype.zFactor = 1]
  32537. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  32538. */
  32539. this.zFactor = 1;
  32540. /**
  32541. * @member {SuperMap.RasterFunctionType} SuperMap.RasterFunctionParameter.prototype.type
  32542. * @description 栅格分析方法。
  32543. */
  32544. this.type = RasterFunctionType.HILLSHADE;
  32545. Util_Util.extend(this, options);
  32546. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  32547. }
  32548. /**
  32549. * @function SuperMap.HillshadeParameter.prototype.destroy
  32550. * @override
  32551. */
  32552. destroy() {
  32553. super.destroy();
  32554. this.altitude = null;
  32555. this.azimuth = null;
  32556. this.zFactor = null;
  32557. }
  32558. /**
  32559. * @function SuperMap.HillshadeParameter.prototype.toJSON
  32560. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  32561. * @returns {string} 返回转换后的 JSON 字符串。
  32562. */
  32563. toJSON() {
  32564. return {
  32565. altitude: this.altitude,
  32566. azimuth: this.azimuth,
  32567. zFactor: this.zFactor,
  32568. type: this.type
  32569. };
  32570. }
  32571. }
  32572. SuperMap.HillshadeParameter = HillshadeParameter_HillshadeParameter;
  32573. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  32574. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32575. * This program are made available under the terms of the Apache License, Version 2.0
  32576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32577. /**
  32578. * @class SuperMap.WebPrintingJobCustomItems
  32579. * @classdesc Web 打印图例元素参数类。
  32580. * @version 10.1.0
  32581. * @category iServer WebPrintingJob
  32582. * @param {Object} option - 初始化参数。
  32583. * @param {string} option.name - 图例元素的名称。
  32584. * @param {string} [option.picAsUrl] - 图例元素 Base64 格式图片。
  32585. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。
  32586. */
  32587. class WebPrintingJobCustomItems_WebPrintingJobCustomItems {
  32588. constructor(option) {
  32589. /**
  32590. * @member {string} SuperMap.WebPrintingJobCustomItems.prototype.name
  32591. * @description 图例元素的名称。
  32592. */
  32593. this.name = null;
  32594. /**
  32595. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsUrl]
  32596. * @description 图例元素 Base64 格式图片。
  32597. */
  32598. this.picAsUrl = null;
  32599. /**
  32600. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsBase64]
  32601. * @description 图例元素图片的获取地址。
  32602. */
  32603. this.picAsBase64 = null;
  32604. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  32605. Util_Util.extend(this, option);
  32606. }
  32607. /**
  32608. * @function SuperMap.WebPrintingJobCustomItems.prototype.destroy
  32609. * @description 释放资源,将引用资源的属性置空。
  32610. */
  32611. destroy() {
  32612. var me = this;
  32613. me.name = null;
  32614. me.picAsUrl = null;
  32615. me.picAsBase64 = null;
  32616. }
  32617. /**
  32618. * @function SuperMap.WebPrintingJobCustomItems.prototype.toJSON
  32619. * @description 将 SuperMap.WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  32620. * @returns {string} 返回转换后的 JSON 字符串。
  32621. */
  32622. toJSON() {
  32623. var params = {
  32624. name: this.name
  32625. };
  32626. if (this.title) {
  32627. params.title = this.title;
  32628. }
  32629. if (this.picAsUrl) {
  32630. params.picAsUrl = this.picAsUrl;
  32631. } else if (this.picAsBase64) {
  32632. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  32633. }
  32634. return Util_Util.toJSON(params);
  32635. }
  32636. }
  32637. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems_WebPrintingJobCustomItems;
  32638. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  32639. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32640. * This program are made available under the terms of the Apache License, Version 2.0
  32641. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32642. /**
  32643. * @class SuperMap.WebPrintingJobImage
  32644. * @classdesc 表达小地图的静态图片参数类。
  32645. * @version 10.1.0
  32646. * @category iServer WebPrintingJob
  32647. * @param {Object} option - 初始化参数。
  32648. * @param {string} [option.picAsUrl] - 小地图的图片 url 地址。
  32649. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。
  32650. */
  32651. class WebPrintingJobImage_WebPrintingJobImage {
  32652. constructor(option) {
  32653. /**
  32654. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsUrl]
  32655. * @description 小地图的图片 url 地址。
  32656. */
  32657. this.picAsUrl = null;
  32658. /**
  32659. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsBase64]
  32660. * @description 小地图的base64位图片信息。
  32661. */
  32662. this.picAsBase64 = null;
  32663. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  32664. Util_Util.extend(this, option);
  32665. }
  32666. /**
  32667. * @function SuperMap.WebPrintingJobImage.prototype.destroy
  32668. * @description 释放资源,将引用资源的属性置空。
  32669. */
  32670. destroy() {
  32671. this.picAsUrl = null;
  32672. this.picAsBase64 = null;
  32673. }
  32674. /**
  32675. * @function SuperMap.WebPrintingJobImage.prototype.toJSON
  32676. * @description 将 SuperMap.WebPrintingJobImage 对象转化为 JSON 字符串。
  32677. * @returns {string} 返回转换后的 JSON 字符串。
  32678. */
  32679. toJSON() {
  32680. var params = {};
  32681. if (this.picAsUrl) {
  32682. params.picAsUrl = this.picAsUrl;
  32683. }
  32684. if (this.picAsBase64) {
  32685. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  32686. }
  32687. return Util_Util.toJSON(params);
  32688. }
  32689. }
  32690. SuperMap.WebPrintingJobImage = WebPrintingJobImage_WebPrintingJobImage;
  32691. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  32692. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32693. * This program are made available under the terms of the Apache License, Version 2.0
  32694. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32695. /**
  32696. * @class SuperMap.WebPrintingJobLayers
  32697. * @classdesc 将图例添加到布局的业务图层参数类。
  32698. * @version 10.1.0
  32699. * @category iServer WebPrintingJob
  32700. * @param {Object} option - 初始化参数。
  32701. * @param {string} [option.name] - 表示图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  32702. */
  32703. class WebPrintingJobLayers_WebPrintingJobLayers {
  32704. constructor(option) {
  32705. /**
  32706. * @member {string} SuperMap.WebPrintingJobLayers.prototype.name
  32707. * @description 图层 name。
  32708. */
  32709. this.name = null;
  32710. /**
  32711. * @member {string} SuperMap.WebPrintingJobLayers.prototype.layerType
  32712. * @description 图层 type。
  32713. */
  32714. this.layerType = null;
  32715. /**
  32716. * @member {string} SuperMap.WebPrintingJobLayers.prototype.url
  32717. * @description 图层 url。
  32718. */
  32719. this.url = null;
  32720. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  32721. Util_Util.extend(this, option);
  32722. }
  32723. /**
  32724. * @function SuperMap.WebPrintingJobLayers.prototype.destroy
  32725. * @description 释放资源,将引用资源的属性置空。
  32726. */
  32727. destroy() {
  32728. this.name = null;
  32729. this.layerType = null;
  32730. this.url = null;
  32731. }
  32732. }
  32733. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers_WebPrintingJobLayers;
  32734. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  32735. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32736. * This program are made available under the terms of the Apache License, Version 2.0
  32737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32738. /**
  32739. * @class SuperMap.WebPrintingJobLegendOptions
  32740. * @classdesc Web 打印图例参数类。
  32741. * @version 10.1.0
  32742. * @category iServer WebPrintingJob
  32743. * @param {Object} option - 初始化参数。
  32744. * @param {string} [option.title] - 图例名称。
  32745. * @param {string} [option.picAsUrl] - 图例的图片 url 地址。
  32746. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  32747. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  32748. * @param {SuperMap.WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  32749. */
  32750. class WebPrintingJobLegendOptions_WebPrintingJobLegendOptions {
  32751. constructor(option) {
  32752. /**
  32753. * @member {string} SuperMap.WebPrintingJobLegendOptions.prototype.title
  32754. * @description 图例名称。
  32755. */
  32756. this.title = null;
  32757. /**
  32758. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsUrl]
  32759. * @description 图例的图片 url 地址。
  32760. */
  32761. this.picAsUrl = null;
  32762. /**
  32763. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsBase64]
  32764. * @description 图例的 base64 位图片信息。
  32765. */
  32766. this.picAsBase64 = null;
  32767. /**
  32768. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLegendOptions.prototype.layers]
  32769. * @description 图例的布局业务图层参数类。
  32770. */
  32771. this.layers = null;
  32772. /**
  32773. * @member {SuperMap.WebPrintingJobCustomItems} [SuperMap.WebPrintingJobLegendOptions.prototype.customItems]
  32774. * @description 自定义图例元素参数类。
  32775. */
  32776. this.customItems = null;
  32777. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  32778. Util_Util.extend(this, option);
  32779. }
  32780. /**
  32781. * @function SuperMap.WebPrintingJobLegendOptions.prototype.destroy
  32782. * @description 释放资源,将引用资源的属性置空。
  32783. */
  32784. destroy() {
  32785. this.title = null;
  32786. this.picAsUrl = null;
  32787. this.picAsBase64 = null;
  32788. if (this.layers instanceof WebPrintingJobLayers_WebPrintingJobLayers) {
  32789. this.layers.destroy();
  32790. this.layers = null;
  32791. }
  32792. if (this.customItems instanceof WebPrintingJobCustomItems_WebPrintingJobCustomItems) {
  32793. this.customItems.destroy();
  32794. this.customItems = null;
  32795. }
  32796. }
  32797. /**
  32798. * @function SuperMap.WebPrintingJobLegendOptions.prototype.toJSON
  32799. * @description 将 SuperMap.WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  32800. * @returns {string} 返回转换后的 JSON 字符串。
  32801. */
  32802. toJSON() {
  32803. var params = {
  32804. title: this.title || ""
  32805. };
  32806. if (this.picAsUrl) {
  32807. params.picAsUrl = this.picAsUrl;
  32808. } else if (this.picAsBase64) {
  32809. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  32810. } else if (this.customItems) {
  32811. params.customItems = this.customItems;
  32812. }
  32813. return Util_Util.toJSON(params);
  32814. }
  32815. }
  32816. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions_WebPrintingJobLegendOptions;
  32817. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  32818. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32819. * This program are made available under the terms of the Apache License, Version 2.0
  32820. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32821. /**
  32822. * @class SuperMap.WebPrintingJobLittleMapOptions
  32823. * @classdesc Web 打印小地图参数类。
  32824. * @version 10.1.0
  32825. * @category iServer WebPrintingJob
  32826. * @param {Object} option - 初始化参数。
  32827. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  32828. * @param {number} [option.scale] - 小地图的比例尺。
  32829. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  32830. * @param {SuperMap.WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  32831. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  32832. */
  32833. class WebPrintingJobLittleMapOptions_WebPrintingJobLittleMapOptions {
  32834. constructor(option) {
  32835. /**
  32836. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.WebPrintingJobLittleMapOptions.prototype.center
  32837. * @description 小地图的中心点。
  32838. */
  32839. this.center = null;
  32840. /**
  32841. * @member {number} [SuperMap.WebPrintingJobLittleMapOptions.prototype.scale]
  32842. * @description 小地图的比例尺。
  32843. */
  32844. this.scale = null;
  32845. /**
  32846. * @member {Array.<string>} SuperMap.WebPrintingJobLittleMapOptions.prototype.layerNames
  32847. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  32848. */
  32849. this.layerNames = null;
  32850. /**
  32851. * @member {SuperMap.WebPrintingJobImage} [SuperMap.WebPrintingJobLittleMapOptions.prototype.image]
  32852. * @description 表达小地图的静态图类。暂不支持
  32853. */
  32854. this.image = null;
  32855. /**
  32856. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLittleMapOptions.prototype.layers]
  32857. * @description 指定 WebMap 中的 layers 图层类。
  32858. */
  32859. this.layers = null;
  32860. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  32861. Util_Util.extend(this, option);
  32862. }
  32863. /**
  32864. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.destroy
  32865. * @description 释放资源,将引用资源的属性置空。
  32866. */
  32867. destroy() {
  32868. this.center = null;
  32869. this.scale = null;
  32870. this.layerNames = null;
  32871. if (this.image instanceof WebPrintingJobImage_WebPrintingJobImage) {
  32872. this.image.destroy();
  32873. this.image = null;
  32874. }
  32875. if (this.layers instanceof WebPrintingJobLayers_WebPrintingJobLayers) {
  32876. this.layers.destroy();
  32877. this.layers = null;
  32878. }
  32879. }
  32880. /**
  32881. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.toJSON
  32882. * @description 将 SuperMap.WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  32883. * @returns {string} 返回转换后的 JSON 字符串。
  32884. */
  32885. toJSON() {
  32886. var params = {
  32887. scale: this.scale,
  32888. center: this.center
  32889. };
  32890. if (this.layerNames) {
  32891. params.layerNames = this.layerNames;
  32892. } else if (this.layers) {
  32893. params.layers = this.layers;
  32894. }
  32895. if (this.image) {
  32896. params.image = this.image;
  32897. }
  32898. return Util_Util.toJSON(params);
  32899. }
  32900. }
  32901. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions_WebPrintingJobLittleMapOptions;
  32902. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  32903. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32904. * This program are made available under the terms of the Apache License, Version 2.0
  32905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32906. /**
  32907. * @class SuperMap.WebPrintingJobNorthArrowOptions
  32908. * @classdesc Web 打印地图指北针参数类。
  32909. * @version 10.1.0
  32910. * @category iServer WebPrintingJob
  32911. * @param {Object} option - 初始化参数。
  32912. * @param {string} option.picAsUrl - 指北针的图片 url 地址。
  32913. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  32914. */
  32915. class WebPrintingJobNorthArrowOptions_WebPrintingJobNorthArrowOptions {
  32916. constructor(option) {
  32917. /**
  32918. * @member {string} SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  32919. * @description 指北针的图片 url 地址。
  32920. */
  32921. this.picAsUrl = null;
  32922. /**
  32923. * @member {string} [SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  32924. * @description 指北针的base64位图片信息。
  32925. */
  32926. this.picAsBase64 = null;
  32927. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  32928. Util_Util.extend(this, option);
  32929. }
  32930. /**
  32931. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.destroy
  32932. * @description 释放资源,将引用资源的属性置空。
  32933. */
  32934. destroy() {
  32935. this.picAsUrl = null;
  32936. this.picAsBase64 = null;
  32937. }
  32938. /**
  32939. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.toJSON
  32940. * @description 将 SuperMap.WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  32941. * @returns {string} 返回转换后的 JSON 字符串。
  32942. */
  32943. toJSON() {
  32944. var params = {};
  32945. if (this.picAsUrl) {
  32946. params.picAsUrl = this.picAsUrl;
  32947. } else if (this.picAsBase64) {
  32948. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  32949. }
  32950. return Util_Util.toJSON(params);
  32951. }
  32952. }
  32953. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions_WebPrintingJobNorthArrowOptions;
  32954. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  32955. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  32956. * This program are made available under the terms of the Apache License, Version 2.0
  32957. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32958. /**
  32959. * @class SuperMap.WebPrintingJobScaleBarOptions
  32960. * @classdesc Web 打印比例尺参数类。
  32961. * @category iServer WebPrintingJob
  32962. * @version 10.1.0
  32963. * @param {Object} option - 初始化参数。
  32964. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000
  32965. * @param {SuperMap.WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  32966. * @param {SuperMap.WebScaleType} [option.type] - 比例尺的样式。
  32967. * @param {number} [option.intervals] - 比例尺条的段数。
  32968. * @param {SuperMap.WebScaleUnit} [option.unit] - 比例尺的单位制。
  32969. */
  32970. class WebPrintingJobScaleBarOptions_WebPrintingJobScaleBarOptions {
  32971. constructor(option) {
  32972. /**
  32973. * @member {string} SuperMap.WebPrintingJobScaleBarOptions.prototype.scaleText
  32974. * @description 比例尺文本信息。
  32975. */
  32976. this.scaleText = null;
  32977. /**
  32978. * @member {SuperMap.WebScaleOrientationType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.orientation]
  32979. * @description 比例尺的方位样式。
  32980. */
  32981. this.orientation = null;
  32982. /**
  32983. * @member {SuperMap.WebScaleType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.type]
  32984. * @description 比例尺的样式。
  32985. */
  32986. this.type = null;
  32987. /**
  32988. * @member {object} [SuperMap.WebPrintingJobScaleBarOptions.prototype.intervals]
  32989. * @description 比例尺条的段数。
  32990. */
  32991. this.intervals = null;
  32992. /**
  32993. * @member {SuperMap.WebScaleUnit} [SuperMap.WebPrintingJobScaleBarOptions.prototype.unit]
  32994. * @description 比例尺的单位制。
  32995. */
  32996. this.unit = null;
  32997. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  32998. Util_Util.extend(this, option);
  32999. }
  33000. /**
  33001. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.destroy
  33002. * @description 释放资源,将引用资源的属性置空。
  33003. */
  33004. destroy() {
  33005. this.scaleText = null;
  33006. this.orientation = null;
  33007. this.type = null;
  33008. this.intervals = null;
  33009. this.unit = null;
  33010. }
  33011. /**
  33012. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.toJSON
  33013. * @description 将 SuperMap.WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  33014. * @returns {string} 返回转换后的 JSON 字符串。
  33015. */
  33016. toJSON() {
  33017. var params = {
  33018. scaleText: this.scaleText || "",
  33019. type: this.type || "BAR",
  33020. intervals: this.intervals || "",
  33021. unit: this.unit || "METER"
  33022. };
  33023. if (this.orientation) {
  33024. params.orientation = this.orientation;
  33025. }
  33026. return Util_Util.toJSON(params);
  33027. }
  33028. }
  33029. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions_WebPrintingJobScaleBarOptions;
  33030. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  33031. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33032. * This program are made available under the terms of the Apache License, Version 2.0
  33033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33034. /**
  33035. * @class SuperMap.WebPrintingJobContent
  33036. * @classdesc Web 打印内容参数类。
  33037. * @version 10.1.0
  33038. * @category iServer WebPrintingJob
  33039. * @param {Object} option - 初始化参数。
  33040. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP
  33041. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 url 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson
  33042. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  33043. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。如果已填了 url 参数,此参数可不传
  33044. */
  33045. class WebPrintingJobContent_WebPrintingJobContent {
  33046. constructor(option) {
  33047. /**
  33048. * @member {string} SuperMap.WebPrintingJobContent.prototype.type
  33049. * @description Web 打印内容支持的类型。
  33050. */
  33051. this.type = null;
  33052. /**
  33053. * @member {string} [SuperMap.WebPrintingJobContent.prototype.url]
  33054. * @description 待打印的 SuperMap iPortal WebMap 的 url 地址。
  33055. */
  33056. this.url = null;
  33057. /**
  33058. * @member {string} [SuperMap.WebPrintingJobContent.prototype.token]
  33059. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  33060. */
  33061. this.token = null;
  33062. /**
  33063. * @member {WebMapSummaryObject} [SuperMap.WebPrintingJobContent.prototype.value]
  33064. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。
  33065. */
  33066. this.value = null;
  33067. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  33068. Util_Util.extend(this, option);
  33069. }
  33070. /**
  33071. * @function SuperMap.WebPrintingJobContent.prototype.destroy
  33072. * @description 释放资源,将引用资源的属性置空。
  33073. */
  33074. destroy() {
  33075. this.type = false || "WEBMAP";
  33076. this.url = null;
  33077. this.token = null;
  33078. this.value = null;
  33079. }
  33080. /**
  33081. * @function SuperMap.WebPrintingJobContent.prototype.toJSON
  33082. * @description 将 SuperMap.WebPrintingJobContent 对象转化为 JSON 字符串。
  33083. * @returns {string} 返回转换后的 JSON 字符串。
  33084. */
  33085. toJSON() {
  33086. var params = {
  33087. type: this.type
  33088. };
  33089. if (this.token) {
  33090. params.token = this.token;
  33091. }
  33092. if (this.url) {
  33093. params.url = this.url;
  33094. } else if (this.value) {
  33095. params.value = this.value;
  33096. }
  33097. return Util_Util.toJSON(params);
  33098. }
  33099. }
  33100. SuperMap.WebPrintingJobContent = WebPrintingJobContent_WebPrintingJobContent;
  33101. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  33102. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33103. * This program are made available under the terms of the Apache License, Version 2.0
  33104. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33105. /**
  33106. * @class SuperMap.WebPrintingJobLayoutOptions
  33107. * @classdesc Web 打印的布局参数类。
  33108. * @version 10.1.0
  33109. * @category iServer WebPrintingJob
  33110. * @param {Object} option - 初始化参数。
  33111. * @param {string} option.templateName - 布局模板的名称。
  33112. * @param {string} option.title - 地图主标题名称。
  33113. * @param {string} option.subTitle - 地图副标题名称。
  33114. * @param {string} option.author - 地图作者名称。
  33115. * @param {string} option.copyright - 地图版权信息。
  33116. * @param {SuperMap.WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  33117. * @param {SuperMap.WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  33118. * @param {SuperMap.WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  33119. * @param {SuperMap.WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  33120. */
  33121. class WebPrintingJobLayoutOptions_WebPrintingJobLayoutOptions {
  33122. constructor(option) {
  33123. /**
  33124. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.templateName
  33125. * @description 布局模板的名称。
  33126. */
  33127. this.templateName = null;
  33128. /**
  33129. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.title
  33130. * @description 地图主标题名称。
  33131. */
  33132. this.title = null;
  33133. /**
  33134. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.subTitle
  33135. * @description 地图副标题名称。
  33136. */
  33137. this.subTitle = null;
  33138. /**
  33139. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.author
  33140. * @description 地图作者名称。
  33141. */
  33142. this.author = null;
  33143. /**
  33144. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.copyright
  33145. * @description 地图版权信息。
  33146. */
  33147. this.copyright = null;
  33148. /**
  33149. * @member {SuperMap.WebPrintingJobScaleBarOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  33150. * @description 地图比例尺参数类。
  33151. */
  33152. this.scaleBarOptions = null;
  33153. /**
  33154. * @member {SuperMap.WebPrintingJobNorthArrowOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  33155. * @description 地图指北针参数类。
  33156. */
  33157. this.northArrowOptions = null;
  33158. /**
  33159. * @member {SuperMap.WebPrintingJobLittleMapOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.littleMapOptions
  33160. * @description 小地图参数类。
  33161. */
  33162. this.littleMapOptions = null;
  33163. /**
  33164. * @member {SuperMap.WebPrintingJobLegendOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.legendOptions
  33165. * @description 图例参数类。
  33166. */
  33167. this.legendOptions = null;
  33168. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  33169. Util_Util.extend(this, option);
  33170. }
  33171. /**
  33172. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.destroy
  33173. * @description 释放资源,将引用资源的属性置空。
  33174. */
  33175. destroy() {
  33176. this.templateName = null;
  33177. this.title = null;
  33178. this.subTitle = null;
  33179. this.author = null;
  33180. this.copyright = null;
  33181. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions_WebPrintingJobScaleBarOptions) {
  33182. this.scaleBarOptions.destroy();
  33183. this.scaleBarOptions = null;
  33184. }
  33185. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions_WebPrintingJobNorthArrowOptions) {
  33186. this.northArrowOptions.destroy();
  33187. this.northArrowOptions = null;
  33188. }
  33189. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions_WebPrintingJobLittleMapOptions) {
  33190. this.littleMapOptions.destroy();
  33191. this.littleMapOptions = null;
  33192. }
  33193. if (this.legendOptions instanceof WebPrintingJobLegendOptions_WebPrintingJobLegendOptions) {
  33194. this.legendOptions.destroy();
  33195. this.legendOptions = null;
  33196. }
  33197. }
  33198. /**
  33199. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.toJSON
  33200. * @description 将 SuperMap.WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  33201. * @returns {string} 返回转换后的 JSON 字符串。
  33202. */
  33203. toJSON() {
  33204. var params = {
  33205. templateName: this.templateName,
  33206. title: this.title,
  33207. subTitle: this.subTitle,
  33208. author: this.author,
  33209. copyright: this.copyright
  33210. };
  33211. if (this.scaleBarOptions) {
  33212. params.scaleBarOptions = this.scaleBarOptions;
  33213. }
  33214. if (this.northArrowOptions) {
  33215. params.northArrowOptions = this.northArrowOptions;
  33216. }
  33217. if (this.littleMapOptions) {
  33218. params.littleMapOptions = this.littleMapOptions;
  33219. }
  33220. if (this.legendOptions) {
  33221. params.legendOptions = this.legendOptions;
  33222. }
  33223. return Util_Util.toJSON(params);
  33224. }
  33225. }
  33226. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions_WebPrintingJobLayoutOptions;
  33227. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  33228. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33229. * This program are made available under the terms of the Apache License, Version 2.0
  33230. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33231. /**
  33232. * @class SuperMap.WebPrintingJobExportOptions
  33233. * @classdesc Web 打印的输出参数类。
  33234. * @version 10.1.0
  33235. * @category iServer WebPrintingJob
  33236. * @param {Object} option - 初始化参数。
  33237. * @param {SuperMap.WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  33238. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 dpi。
  33239. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  33240. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  33241. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  33242. */
  33243. class WebPrintingJobExportOptions_WebPrintingJobExportOptions {
  33244. constructor(option) {
  33245. /**
  33246. * @member {SuperMap.WebExportFormatType} SuperMap.WebPrintingJobExportOptions.prototype.format
  33247. * @description Web 打印输出的格式。
  33248. */
  33249. this.format = null;
  33250. /**
  33251. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.dpi=96]
  33252. * @description Web 打印输出的分辨率,单位为每英寸点数。
  33253. */
  33254. this.dpi = 96;
  33255. /**
  33256. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.scale]
  33257. * @description Web 打印输出的地图比例尺。
  33258. */
  33259. this.scale = null;
  33260. /**
  33261. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.rotation]
  33262. * @description Web 打印输出的地图角度。
  33263. */
  33264. this.rotation = null;
  33265. /**
  33266. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [SuperMap.WebPrintingJobExportOptions.prototype.center]
  33267. * @description Web 打印输出的地图中心点。
  33268. */
  33269. this.center = null;
  33270. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  33271. Util_Util.extend(this, option);
  33272. }
  33273. /**
  33274. * @function SuperMap.WebPrintingJobExportOptions.prototype.destroy
  33275. * @description 释放资源,将引用资源的属性置空。
  33276. */
  33277. destroy() {
  33278. this.format = null;
  33279. this.dpi = null;
  33280. this.scale = null;
  33281. this.rotation = null;
  33282. this.center = null;
  33283. this.outputSize = null;
  33284. }
  33285. /**
  33286. * @function SuperMap.WebPrintingJobExportOptions.prototype.toJSON
  33287. * @description 将 SuperMap.WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  33288. * @returns {string} 返回转换后的 JSON 字符串。
  33289. */
  33290. toJSON() {
  33291. var params = {
  33292. format: this.format || "PDF",
  33293. dpi: this.dpi,
  33294. scale: this.scale,
  33295. center: this.center
  33296. };
  33297. if (this.rotation) {
  33298. params.rotation = this.rotation;
  33299. }
  33300. if (this.outputSize) {
  33301. params.outputSize = this.outputSize;
  33302. }
  33303. return Util_Util.toJSON(params);
  33304. }
  33305. }
  33306. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions_WebPrintingJobExportOptions;
  33307. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  33308. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33309. * This program are made available under the terms of the Apache License, Version 2.0
  33310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33311. /**
  33312. * @class SuperMap.WebPrintingJobParameters
  33313. * @category iServer WebPrintingJob
  33314. * @version 10.1.0
  33315. * @classdesc Web 打印参数类
  33316. * @param {Object} options - 初始化参数。
  33317. * @param {SuperMap.WebPrintingJobContent} options.content - Web 打印的内容类。
  33318. * @param {SuperMap.WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  33319. * @param {SuperMap.WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  33320. */
  33321. class WebPrintingJobParameters_WebPrintingJobParameters {
  33322. constructor(options) {
  33323. if (!options) {
  33324. return;
  33325. }
  33326. /**
  33327. * @member {SuperMap.WebPrintingJobContent} SuperMap.WebPrintingJobParameters.prototype.content
  33328. * @description Web 打印的内容类。
  33329. */
  33330. this.content = null;
  33331. /**
  33332. * @member {SuperMap.WebPrintingJobLayoutOptions} SuperMap.WebPrintingJobParameters.prototype.layoutOptions
  33333. * @description Web 打印的布局类,包含各种布局元素的设置。
  33334. */
  33335. this.layoutOptions = null;
  33336. /**
  33337. * @member {SuperMap.WebPrintingJobExportOptions} SuperMap.WebPrintingJobParameters.prototype.exportOptions
  33338. * @description Web 打印的输出类,包含 DPI、页面大小等。
  33339. */
  33340. this.exportOptions = null;
  33341. Util_Util.extend(this, options);
  33342. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  33343. }
  33344. /**
  33345. * @function SuperMap.WebPrintingJobParameters.prototype.destroy
  33346. * @description 释放资源,将引用资源的属性置空。
  33347. */
  33348. destroy() {
  33349. if (this.content instanceof WebPrintingJobContent_WebPrintingJobContent) {
  33350. this.content.destroy();
  33351. this.content = null;
  33352. }
  33353. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions_WebPrintingJobLayoutOptions) {
  33354. this.layoutOptions.destroy();
  33355. this.layoutOptions = null;
  33356. }
  33357. if (this.exportOptions instanceof WebPrintingJobExportOptions_WebPrintingJobExportOptions) {
  33358. this.exportOptions.destroy();
  33359. this.exportOptions = null;
  33360. }
  33361. }
  33362. }
  33363. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters_WebPrintingJobParameters;
  33364. // CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  33365. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33366. * This program are made available under the terms of the Apache License, Version 2.0
  33367. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33368. /**
  33369. * @class SuperMap.WebPrintingService
  33370. * @category iServer WebPrintingJob
  33371. * @version 10.1.0
  33372. * @classdesc 打印地图服务基类。
  33373. * @extends {SuperMap.CommonServiceBase}
  33374. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  33375. * @param {Object} options - 参数。
  33376. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  33377. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33378. * @param {Object} [options.headers] - 请求头。
  33379. */
  33380. class WebPrintingService_WebPrintingService extends CommonServiceBase_CommonServiceBase {
  33381. /**
  33382. * @function SuperMap.WebPrintingService.prototype.constructor
  33383. * @description 打印地图服务基类。
  33384. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  33385. * @param {Object} options -参数。
  33386. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33387. */
  33388. constructor(url, options) {
  33389. super(url, options);
  33390. if (options) {
  33391. Util_Util.extend(this, options);
  33392. }
  33393. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  33394. if (!this.url) {
  33395. return;
  33396. }
  33397. }
  33398. /**
  33399. * @function SuperMap.WebPrintingService.prototype.destroy
  33400. * @description 释放资源,将引用资源的属性置空。
  33401. */
  33402. destroy() {
  33403. super.destroy();
  33404. }
  33405. /**
  33406. * @function SuperMap.WebPrintingService.prototype.createWebPrintingJob
  33407. * @description 创建 Web 打印任务。
  33408. * @param {SuperMap.WebPrintingJobParameters} params - Web 打印的请求参数。
  33409. */
  33410. createWebPrintingJob(params) {
  33411. if (!params) {
  33412. return;
  33413. }
  33414. if (params.layoutOptions) {
  33415. if (params.layoutOptions.legendOptions) {
  33416. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  33417. params.layoutOptions.legendOptions.picAsBase64 =
  33418. params.layoutOptions.legendOptions.picAsBase64 &&
  33419. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  33420. if (
  33421. params.layoutOptions.legendOptions.customItems &&
  33422. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  33423. ) {
  33424. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  33425. /^data:.+;base64,/,
  33426. ''
  33427. );
  33428. }
  33429. }
  33430. }
  33431. var me = this;
  33432. me.request({
  33433. url: me._processUrl('jobs'),
  33434. method: 'POST',
  33435. data: Util_Util.toJSON(params),
  33436. scope: me,
  33437. success: me.serviceProcessCompleted,
  33438. failure: me.serviceProcessFailed
  33439. });
  33440. }
  33441. /**
  33442. * @function SuperMap.WebPrintingService.prototype.getPrintingJob
  33443. * @description 获取 Web 打印输出文档任务。
  33444. * @param {String} jobId - Web 打印任务 ID
  33445. */
  33446. getPrintingJob(jobId) {
  33447. var me = this;
  33448. var url = me._processUrl(`jobs/${jobId}`);
  33449. me.request({
  33450. url,
  33451. method: 'GET',
  33452. scope: me,
  33453. success: function (result) {
  33454. me.rollingProcess(result, url);
  33455. },
  33456. failure: me.serviceProcessFailed
  33457. });
  33458. }
  33459. /**
  33460. * @function SuperMap.WebPrintingService.prototype.getPrintingJobResult
  33461. * @description 获取 Web 打印任务的输出文档。
  33462. * @param {String} jobId - Web 打印输入文档任务 ID。
  33463. */
  33464. getPrintingJobResult(jobId) {
  33465. var me = this;
  33466. me.request({
  33467. url: me._processUrl(`jobs/${jobId}/result`),
  33468. method: 'GET',
  33469. scope: me,
  33470. success: me.serviceProcessCompleted,
  33471. failure: me.serviceProcessFailed
  33472. });
  33473. }
  33474. /**
  33475. * @function SuperMap.WebPrintingService.prototype.getLayoutTemplates
  33476. * @description 查询 Web 打印服务所有可用的模板信息。
  33477. */
  33478. getLayoutTemplates() {
  33479. var me = this;
  33480. me.request({
  33481. url: me._processUrl('layouts'),
  33482. method: 'GET',
  33483. scope: me,
  33484. success: me.serviceProcessCompleted,
  33485. failure: me.serviceProcessFailed
  33486. });
  33487. }
  33488. /**
  33489. * @function SuperMap.WebPrintingService.prototype.rollingProcess
  33490. * @description 轮询查询 Web 打印任务。
  33491. * @param {Object} result - 服务器返回的结果对象。
  33492. */
  33493. rollingProcess(result, url) {
  33494. var me = this;
  33495. if (!result) {
  33496. return;
  33497. }
  33498. var id = setInterval(function () {
  33499. me.request({
  33500. url,
  33501. method: 'GET',
  33502. scope: me,
  33503. success: function (result) {
  33504. switch (result.status) {
  33505. case 'FINISHED':
  33506. clearInterval(id);
  33507. me.serviceProcessCompleted(result);
  33508. break;
  33509. case 'ERROR':
  33510. clearInterval(id);
  33511. me.serviceProcessFailed(result);
  33512. break;
  33513. case 'RUNNING':
  33514. me.events.triggerEvent('processRunning', result);
  33515. break;
  33516. }
  33517. },
  33518. failure: me.serviceProcessFailed
  33519. });
  33520. }, 1000);
  33521. }
  33522. _processUrl(appendContent) {
  33523. if (appendContent) {
  33524. return Util_Util.urlPathAppend(this.url, appendContent);
  33525. }
  33526. return this.url;
  33527. }
  33528. }
  33529. SuperMap.WebPrintingService = WebPrintingService_WebPrintingService;
  33530. // CONCATENATED MODULE: ./src/common/iServer/index.js
  33531. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33532. * This program are made available under the terms of the Apache License, Version 2.0
  33533. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33534. // CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  33535. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33536. * This program are made available under the terms of the Apache License, Version 2.0
  33537. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33538. /**
  33539. * @enum ServiceStatus
  33540. * @memberOf SuperMap
  33541. * @category iPortal/Online
  33542. * @description 服务发布状态。
  33543. */
  33544. var ServiceStatus = SuperMap.ServiceStatus = {
  33545. /** 不涉及,不可发布。 */
  33546. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  33547. /** 发布失败。 */
  33548. PUBLISH_FAILED: "PUBLISH_FAILED",
  33549. /** 已发布。 */
  33550. PUBLISHED: "PUBLISHED",
  33551. /** 正在发布。 */
  33552. PUBLISHING: "PUBLISHING",
  33553. /** 未发布。 */
  33554. UNPUBLISHED: "UNPUBLISHED",
  33555. /** 取消服务失败。 */
  33556. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  33557. };
  33558. /**
  33559. *
  33560. * @enum DataItemType
  33561. * @memberOf SuperMap
  33562. * @category iPortal/Online
  33563. * @description 数据项类型。
  33564. */
  33565. var OnlineResources_DataItemType = SuperMap.DataItemType = {
  33566. /** AUDIO */
  33567. AUDIO: "AUDIO",
  33568. /** COLOR */
  33569. COLOR: "COLOR",
  33570. /** COLORSCHEME */
  33571. COLORSCHEME: "COLORSCHEME",
  33572. /** CSV */
  33573. CSV: "CSV",
  33574. /** EXCEL */
  33575. EXCEL: "EXCEL",
  33576. /** FILLSYMBOL */
  33577. FILLSYMBOL: "FILLSYMBOL",
  33578. /** IMAGE */
  33579. IMAGE: "IMAGE",
  33580. /** LAYERTEMPLATE */
  33581. LAYERTEMPLATE: "LAYERTEMPLATE",
  33582. /** LAYOUTTEMPLATE */
  33583. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  33584. /** LINESYMBOL */
  33585. LINESYMBOL: "LINESYMBOL",
  33586. /** MAPTEMPLATE */
  33587. MAPTEMPLATE: "MAPTEMPLATE",
  33588. /** MARKERSYMBOL */
  33589. MARKERSYMBOL: "MARKERSYMBOL",
  33590. /** MBTILES */
  33591. MBTILES: "MBTILES",
  33592. /** PHOTOS */
  33593. PHOTOS: "PHOTOS",
  33594. /** SHP */
  33595. SHP: "SHP",
  33596. /** SMTILES */
  33597. SMTILES: "SMTILES",
  33598. /** SVTILES */
  33599. SVTILES: "SVTILES",
  33600. /** THEMETEMPLATE */
  33601. THEMETEMPLATE: "THEMETEMPLATE",
  33602. /** TPK */
  33603. TPK: "TPK",
  33604. /** UDB */
  33605. UDB: "UDB",
  33606. /** UGCV5 */
  33607. UGCV5: "UGCV5",
  33608. /** UNKNOWN */
  33609. UNKNOWN: "UNKNOWN",
  33610. /** VIDEO */
  33611. VIDEO: "VIDEO",
  33612. /** WORKENVIRONMENT */
  33613. WORKENVIRONMENT: "WORKENVIRONMENT",
  33614. /** WORKSPACE */
  33615. WORKSPACE: "WORKSPACE"
  33616. };
  33617. /**
  33618. * @enum DataItemOrderBy
  33619. * @memberOf SuperMap
  33620. * @category iPortal/Online
  33621. * @description 数据排序字段。
  33622. */
  33623. var DataItemOrderBy = SuperMap.DataItemOrderBy = {
  33624. /** FILENAME */
  33625. FILENAME: "FILENAME",
  33626. /** ID */
  33627. ID: "ID",
  33628. /** LASTMODIFIEDTIME */
  33629. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  33630. /** NICKNAME */
  33631. NICKNAME: "NICKNAME",
  33632. /** SERVICESTATUS */
  33633. SERVICESTATUS: "SERVICESTATUS",
  33634. /** SIZE */
  33635. SIZE: "SIZE",
  33636. /** STATUS */
  33637. STATUS: "STATUS",
  33638. /** TYPE */
  33639. TYPE: "TYPE",
  33640. /** UPDATETIME */
  33641. UPDATETIME: "UPDATETIME",
  33642. /** USERNAME */
  33643. USERNAME: "USERNAME"
  33644. };
  33645. /**
  33646. * @enum FilterField
  33647. * @memberOf SuperMap
  33648. * @category iPortal/Online
  33649. * @description 关键字查询时的过滤字段。
  33650. */
  33651. var FilterField = SuperMap.FilterField = {
  33652. /** LINKPAGE */
  33653. LINKPAGE: "LINKPAGE",
  33654. /** LINKPAGE */
  33655. MAPTITLE: "MAPTITLE",
  33656. /** LINKPAGE */
  33657. NICKNAME: "NICKNAME",
  33658. /** LINKPAGE */
  33659. RESTITLE: "RESTITLE",
  33660. /** LINKPAGE */
  33661. USERNAME: "USERNAME"
  33662. };
  33663. // CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  33664. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33665. * This program are made available under the terms of the Apache License, Version 2.0
  33666. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33667. // import {SecurityManager} from '../security/SecurityManager';
  33668. /**
  33669. * @class SuperMap.OnlineServiceBase
  33670. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  33671. * @category iPortal/Online
  33672. * @param {Object} options - 服务参数。
  33673. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33674. * @param {Object} [options.headers] - 请求头。
  33675. */
  33676. class OnlineServiceBase_OnlineServiceBase {
  33677. constructor(options) {
  33678. options = options || {};
  33679. Util_Util.extend(this, options);
  33680. this.serverType = ServerType.ONLINE;
  33681. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  33682. }
  33683. /**
  33684. * @function SuperMap.OnlineServiceBase.prototype.request
  33685. * @description 请求 online 服务
  33686. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  33687. * @param {string} url - 服务地址。
  33688. * @param {Object} param - URL 查询参数。
  33689. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  33690. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  33691. */
  33692. request(method, url, param, requestOptions = {}) {
  33693. url = this.createCredentialUrl(url);
  33694. requestOptions['crossOrigin'] = this.options.crossOrigin;
  33695. requestOptions['headers'] = this.options.headers;
  33696. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  33697. return response.json();
  33698. });
  33699. }
  33700. /**
  33701. * @function SuperMap.OnlineServiceBase.prototype.createCredentialUrl
  33702. * @description 追加授权信息。
  33703. * @param {string} url - 对接的 online 服务地址。
  33704. */
  33705. createCredentialUrl(url) {
  33706. var newUrl = url,
  33707. key = this.getCredential();
  33708. if (key) {
  33709. var paramStr = "key=" + key;
  33710. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  33711. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  33712. newUrl += paramStr;
  33713. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  33714. newUrl += "&" + paramStr;
  33715. } else {
  33716. newUrl += "?" + paramStr;
  33717. }
  33718. }
  33719. return newUrl;
  33720. }
  33721. //其子类需要重写该方法,修改其中获取key的字段
  33722. //存储key可能是服务id字段,可能是url,或者是WebAPI类型
  33723. getCredential() {
  33724. //return SecurityManager.getKey(this.id);
  33725. //或
  33726. //return SecurityManager.getKey(this.serviceUrl);
  33727. }
  33728. }
  33729. SuperMap.OnlineServiceBase = OnlineServiceBase_OnlineServiceBase;
  33730. // CONCATENATED MODULE: ./src/common/online/OnlineData.js
  33731. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33732. * This program are made available under the terms of the Apache License, Version 2.0
  33733. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33734. /**
  33735. * @class SuperMap.OnlineData
  33736. * @classdesc Online myData 服务。
  33737. * @category iPortal/Online
  33738. * @param {string} serviceRootUrl - 服务根地址。
  33739. * @param {Object} options - 服务相关参数。
  33740. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33741. * @param {Object} [options.headers] - 请求头。
  33742. */
  33743. class OnlineData_OnlineData extends OnlineServiceBase_OnlineServiceBase {
  33744. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  33745. constructor(serviceRootUrl, options) {
  33746. super(serviceRootUrl);
  33747. options = options || {};
  33748. //MD5
  33749. this.MD5 = null;
  33750. //文件类型。
  33751. this.type = null;
  33752. //数据上传者名称。
  33753. this.userName = null;
  33754. //文件名称。
  33755. this.fileName = null;
  33756. //文件大小,单位为 B 。
  33757. this.size = null;
  33758. //服务发布状态。
  33759. this.serviceStatus = null;
  33760. //服务 id 。
  33761. this.serviceId = null;
  33762. //数据项 id 。
  33763. this.id = null;
  33764. //最后修改时间。
  33765. this.lastModfiedTime = null;
  33766. //文件状态。
  33767. this.status = null;
  33768. //数据文件存储 id 。
  33769. this.storageId = null;
  33770. //数据的发布信息。
  33771. this.publishInfo = null;
  33772. //数据的权限信息。
  33773. this.authorizeSetting = null;
  33774. //用户的昵称。
  33775. this.nickname = null;
  33776. //数据的标签。
  33777. this.tags = [];
  33778. //数据的描述信息。
  33779. this.description = null;
  33780. //数据发布的服务信息集合。
  33781. this.dataItemServices = null;
  33782. //数据坐标类型。
  33783. this.coordType = null;
  33784. //数据审核信息
  33785. this.dataCheckResult = null;
  33786. //数据元数据信息
  33787. this.dataMetaInfo = null;
  33788. //数据的缩略图路径。
  33789. this.thumbnail = null;
  33790. Util_Util.extend(this, options);
  33791. if (this.id) {
  33792. this.serviceUrl = serviceRootUrl + "/" + this.id;
  33793. }
  33794. this.CLASS_NAME = "SuperMap.OnlineData";
  33795. }
  33796. /**
  33797. * @function SuperMap.OnlineData.prototype.load
  33798. * @description 通过 URL 请求获取该服务完整信息。
  33799. * @returns {Promise} 返回不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  33800. */
  33801. load() {
  33802. if (!this.serviceUrl) {
  33803. return;
  33804. }
  33805. var me = this;
  33806. return me.request("GET", this.serviceUrl).then(function (result) {
  33807. Util_Util.extend(me, result);
  33808. });
  33809. }
  33810. /**
  33811. * @function SuperMap.OnlineData.prototype.getPublishedServices
  33812. * @description 获取数据发布的所有服务。
  33813. * @returns {Object} 数据发布的所有服务。
  33814. */
  33815. getPublishedServices() {
  33816. return this.dataItemServices;
  33817. }
  33818. /**
  33819. * @function SuperMap.OnlineData.prototype.getAuthorizeSetting
  33820. * @description 获取数据的权限信息。
  33821. * @returns {Object} 权限信息。
  33822. */
  33823. getAuthorizeSetting() {
  33824. return this.authorizeSetting;
  33825. }
  33826. }
  33827. SuperMap.OnlineData = OnlineData_OnlineData;
  33828. // CONCATENATED MODULE: ./src/common/online/Online.js
  33829. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33830. * This program are made available under the terms of the Apache License, Version 2.0
  33831. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33832. /**
  33833. * @class SuperMap.Online
  33834. * @classdesc 对接 SuperMap Online 所有基础服务。
  33835. * @category iPortal/Online
  33836. * @example
  33837. * var online=new SuperMap.Online();
  33838. * var services = online.queryDatas(param);
  33839. * service.then(function(services){
  33840. * var service= services[0];
  33841. * service.updateDataInfo();
  33842. * })
  33843. */
  33844. class Online_Online {
  33845. //TODO 目前并没有对接Online的所有操作,需要补充完整
  33846. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  33847. constructor() {
  33848. this.rootUrl = "https://www.supermapol.com";
  33849. this.webUrl = this.rootUrl + "/web";
  33850. var mContentUrl = this.webUrl + "/mycontent";
  33851. this.mDatasUrl = mContentUrl + "/datas";
  33852. this.CLASS_NAME = "SuperMap.Online";
  33853. }
  33854. /**
  33855. * @function SuperMap.Online.prototype.load
  33856. * @description 加载 online,验证 online 是否可用。
  33857. * @returns {Promise} 返回包含网络请求结果的 Promise 对象。
  33858. */
  33859. load() {
  33860. return FetchRequest.get(this.rootUrl).then(function (response) {
  33861. return response;
  33862. });
  33863. }
  33864. /**
  33865. * @function SuperMap.Online.prototype.login
  33866. * @description 登录Online
  33867. */
  33868. login() {
  33869. SecurityManager_SecurityManager.loginOnline(this.rootUrl, true);
  33870. }
  33871. /**
  33872. * @function SuperMap.Online.prototype.queryDatas
  33873. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  33874. * @param {SuperMap.OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  33875. * @returns {Promise} 返回包含所有数据服务信息的 Promise 对象。
  33876. */
  33877. queryDatas(parameter) {
  33878. var me = this, url = me.mDatasUrl;
  33879. if (parameter) {
  33880. parameter = parameter.toJSON();
  33881. }
  33882. return FetchRequest.get(url, parameter).then(function (json) {
  33883. if (!json || !json.content || json.content.length < 1) {
  33884. return;
  33885. }
  33886. var services = [], contents = json.content, len = contents.length;
  33887. for (var i = 0; i < len; i++) {
  33888. var content = contents[i];
  33889. var service = new OnlineData_OnlineData(me.mDatasUrl, content);
  33890. services.push(service);
  33891. }
  33892. return services;
  33893. });
  33894. }
  33895. }
  33896. SuperMap.Online = Online_Online;
  33897. // CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  33898. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33899. * This program are made available under the terms of the Apache License, Version 2.0
  33900. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33901. /**
  33902. * @class SuperMap.OnlineQueryDatasParameter
  33903. * @classdesc myDatas 服务资源查询参数。
  33904. * @category iPortal/Online
  33905. * @param {Object} options - 查询参数。
  33906. */
  33907. class OnlineQueryDatasParameter_OnlineQueryDatasParameter {
  33908. constructor(options) {
  33909. options = options || {};
  33910. /**
  33911. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.userNames
  33912. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  33913. */
  33914. this.userNames = null;
  33915. /**
  33916. * @member {Array.<Object>} SuperMap.OnlineQueryDatasParameter.prototype.types
  33917. * @description 数据类型。
  33918. */
  33919. this.types = null;
  33920. /**
  33921. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.fileName
  33922. * @description 文件名称。
  33923. */
  33924. this.fileName = null;
  33925. /**
  33926. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceStatuses
  33927. * @description 服务发布状态。
  33928. */
  33929. this.serviceStatuses = null;
  33930. /**
  33931. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceId
  33932. * @description 服务 ID。
  33933. */
  33934. this.serviceId = null;
  33935. /**
  33936. * @member {Array.<integer>} SuperMap.OnlineQueryDatasParameter.prototype.ids
  33937. * @description 由数据项 ID 组成的整型数组。
  33938. */
  33939. this.ids = null;
  33940. /**
  33941. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.keywords
  33942. * @description 关键字。
  33943. */
  33944. this.keywords = null;
  33945. /**
  33946. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.orderBy
  33947. * @description 排序字段。
  33948. */
  33949. this.orderBy = null;
  33950. /**
  33951. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.tags
  33952. * @description 数据的标签。
  33953. */
  33954. this.tags = null;
  33955. /**
  33956. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.filterFields
  33957. * @description 用于关键字查询时的过滤字段。
  33958. */
  33959. this.filterFields = null;
  33960. Util_Util.extend(this, options)
  33961. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  33962. }
  33963. /**
  33964. * @function SuperMap.OnlineQueryDatasParameter.prototype.toJSON
  33965. * @description 返回对应的 JSON 对象。
  33966. * @returns {Object} 对应的 JSON 对象。
  33967. */
  33968. toJSON() {
  33969. var me = this;
  33970. var jsonObj = {
  33971. "types": me.types,
  33972. "fileName": me.fileName,
  33973. "serviceStatuses": me.serviceStatuses,
  33974. "serviceId": me.serviceId,
  33975. "ids": me.ids,
  33976. "keywords": me.keywords,
  33977. "orderBy": me.orderBy,
  33978. "tags": me.tags,
  33979. "filterFields": me.filterFields
  33980. };
  33981. for (var key in jsonObj) {
  33982. if (jsonObj[key] == null) {
  33983. delete jsonObj[key]
  33984. }
  33985. }
  33986. return jsonObj;
  33987. }
  33988. }
  33989. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter_OnlineQueryDatasParameter;
  33990. // CONCATENATED MODULE: ./src/common/online/index.js
  33991. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33992. * This program are made available under the terms of the Apache License, Version 2.0
  33993. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33994. // CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  33995. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  33996. * This program are made available under the terms of the Apache License, Version 2.0
  33997. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33998. /**
  33999. * @class SuperMap.KeyServiceParameter
  34000. * @classdesc key申请参数
  34001. * @category Security
  34002. * @param {Object} options - 参数。
  34003. * @param {string} options.name - 申请服务名称。
  34004. * @param {number} options.serviceIds - 服务 ID。
  34005. * @param {SuperMap.ClientType} [options.clientType=SuperMap.ClientType.SERVER] - 服务端类型。
  34006. * @param {number} options.limitation - 有效期
  34007. */
  34008. class KeyServiceParameter_KeyServiceParameter {
  34009. constructor(options) {
  34010. this.name = null;
  34011. this.serviceIds = null;
  34012. this.clientType = ClientType.SERVER;
  34013. this.limitation = null;
  34014. Util_Util.extend(this, options);
  34015. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  34016. }
  34017. /**
  34018. * @function SuperMap.KeyServiceParameter.prototype.toJSON
  34019. * @description 转换成 JSON 对象
  34020. * @returns {Object} 参数的 JSON 对象
  34021. */
  34022. toJSON() {
  34023. return {
  34024. name: this.name,
  34025. serviceIds: this.serviceIds,
  34026. clientType: this.clientType,
  34027. limitation: this.limitation
  34028. }
  34029. }
  34030. }
  34031. SuperMap.KeyServiceParameter = KeyServiceParameter_KeyServiceParameter;
  34032. // CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  34033. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34034. * This program are made available under the terms of the Apache License, Version 2.0
  34035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34036. /**
  34037. * @class SuperMap.ServerInfo
  34038. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等
  34039. * @category Security
  34040. * @param {string} type - 服务器类型
  34041. * @param {Object} options - 服务器信息相关可选参数。
  34042. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver
  34043. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  34044. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  34045. */
  34046. class ServerInfo_ServerInfo {
  34047. constructor(type, options) {
  34048. /**
  34049. * @member {SuperMap.ServerType} SuperMap.ServerInfo.prototype.type
  34050. * @description 服务器类型
  34051. */
  34052. this.type = type;
  34053. /**
  34054. * @member {string} SuperMap.ServerInfo.prototype.server
  34055. * @description 服务器地址
  34056. */
  34057. this.server = null;
  34058. /**
  34059. * @member {string} [SuperMap.ServerInfo.prototype.tokenServiceUrl]
  34060. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  34061. */
  34062. this.tokenServiceUrl = null;
  34063. /**
  34064. * @member {string} [SuperMap.ServerInfo.prototype.keyServiceUrl]
  34065. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  34066. */
  34067. this.keyServiceUrl = null;
  34068. Util_Util.extend(this, options);
  34069. this.CLASS_NAME = "SuperMap.ServerInfo";
  34070. this.type = this.type || ServerType.ISERVER;
  34071. if (!this.server) {
  34072. console.error('server url require is not undefined')
  34073. }
  34074. // var patten = /http:\/\/([^\/]+)/i;
  34075. //this.server = this.server.match(patten)[0];
  34076. var tokenServiceSuffix = "/services/security/tokens";
  34077. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  34078. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  34079. }
  34080. if (!this.tokenServiceUrl) {
  34081. this.tokenServiceUrl = Util_Util.urlPathAppend(this.server, tokenServiceSuffix);
  34082. }
  34083. if (!this.keyServiceUrl) {
  34084. if (this.type === ServerType.IPORTAL) {
  34085. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  34086. } else if (this.type === ServerType.ONLINE) {
  34087. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys");
  34088. }
  34089. }
  34090. }
  34091. }
  34092. SuperMap.ServerInfo = ServerInfo_ServerInfo;
  34093. // CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  34094. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34095. * This program are made available under the terms of the Apache License, Version 2.0
  34096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34097. /**
  34098. * @class SuperMap.TokenServiceParameter
  34099. * @classdesc token 申请参数。
  34100. * @category Security
  34101. * @param {Object} options - token 申请参数。
  34102. * @param {string} options.username - 用户名。
  34103. * @param {string} options.password - 密码。
  34104. * @param {SuperMap.ClientType} [options.clientType='SuperMap.ClientType.NONE'] - token 申请的客户端标识类型。
  34105. * @param {string} [options.ip] - clientType=IP 时,必选。
  34106. * @param {string} [options.referer] -clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  34107. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  34108. *
  34109. *
  34110. */
  34111. class TokenServiceParameter_TokenServiceParameter {
  34112. constructor(options) {
  34113. /**
  34114. * @member {string} SuperMap.TokenServiceParameter.prototype.userName
  34115. * @description 用户名。
  34116. */
  34117. this.userName = null;
  34118. /**
  34119. * @member {string} SuperMap.TokenServiceParameter.prototype.password
  34120. * @description 密码。
  34121. */
  34122. this.password = null;
  34123. /**
  34124. * @member {SuperMap.ClientType} SuperMap.TokenServiceParameter.prototype.clientType
  34125. * @description token 申请的客户端标识类型。
  34126. */
  34127. this.clientType = ClientType.NONE;
  34128. /**
  34129. * @member {string} [SuperMap.TokenServiceParameter.prototype.ip]
  34130. * @description clientType=IP 时,必选。
  34131. */
  34132. this.ip = null;
  34133. /**
  34134. * @member {string} [SuperMap.TokenServiceParameter.prototype.referer]
  34135. * @description clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  34136. */
  34137. this.referer = null;
  34138. /**
  34139. * @member {number} SuperMap.TokenServiceParameter.prototype.expiration
  34140. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  34141. */
  34142. this.expiration = 60;
  34143. Util_Util.extend(this, options);
  34144. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  34145. }
  34146. /**
  34147. * @function SuperMap.TokenServiceParameter.prototype.toJSON
  34148. * @description 将所有信息转成 JSON 字符串
  34149. * @returns {string} 参数的 JSON 字符串
  34150. */
  34151. toJSON() {
  34152. return {
  34153. userName: this.userName,
  34154. password: this.password,
  34155. clientType: this.clientType,
  34156. ip: this.ip,
  34157. referer: this.referer,
  34158. expiration: this.expiration
  34159. }
  34160. }
  34161. }
  34162. SuperMap.TokenServiceParameter = TokenServiceParameter_TokenServiceParameter;
  34163. // CONCATENATED MODULE: ./src/common/security/index.js
  34164. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34165. * This program are made available under the terms of the Apache License, Version 2.0
  34166. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34167. // EXTERNAL MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  34168. var external_function_try_return_elasticsearch_catch_e_return_ = __webpack_require__(7);
  34169. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_);
  34170. // CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  34171. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34172. * This program are made available under the terms of the Apache License, Version 2.0
  34173. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34174. /**
  34175. * @class SuperMap.ElasticSearch
  34176. * @classdesc ElasticSearch服务类。
  34177. * @category ElasticSearch
  34178. * @param {string} url - ElasticSearch服务地址。
  34179. * @param {Object} options - 参数。
  34180. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  34181. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  34182. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  34183. * @param {Object} [options.geoFence] - 地理围栏。
  34184. */
  34185. class ElasticSearch_ElasticSearch {
  34186. constructor(url, options) {
  34187. options = options || {};
  34188. /**
  34189. * @member {string} SuperMap.ElasticSearch.prototype.url
  34190. * @description ElasticSearch服务地址
  34191. */
  34192. this.url = url;
  34193. /**
  34194. * @member {Object} SuperMap.ElasticSearch.prototype.client
  34195. * @description client ES客户端
  34196. */
  34197. this.client = new external_function_try_return_elasticsearch_catch_e_return_default.a.Client({
  34198. host: this.url
  34199. });
  34200. /**
  34201. * @deprecated
  34202. * @member {function} [SuperMap.ElasticSearch.prototype.change]
  34203. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  34204. */
  34205. this.change = null;
  34206. /**
  34207. * @member {boolean} [SuperMap.ElasticSearch.prototype.openGeoFence=false]
  34208. * @description 是否开启地理围栏验证,默认为不开启。
  34209. */
  34210. this.openGeoFence = false;
  34211. /**
  34212. * @member {function} [SuperMap.ElasticSearch.prototype.outOfGeoFence]
  34213. * @description 数据超出地理围栏后执行的函数
  34214. */
  34215. this.outOfGeoFence = null;
  34216. /**
  34217. * @member {Object} [SuperMap.ElasticSearch.prototype.geoFence]
  34218. * @description 地理围栏
  34219. * @example {
  34220. * radius: 1000,//单位是m
  34221. * center: [104.40, 30.43],
  34222. * unit: 'meter|degree'
  34223. * }
  34224. */
  34225. this.geoFence = null;
  34226. /*
  34227. * Constant: EVENT_TYPES
  34228. * {Array.<String>}
  34229. * 此类支持的事件类型。
  34230. *
  34231. */
  34232. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  34233. /**
  34234. * @member {SuperMap.Events} SuperMap.ElasticSearch.prototype.events
  34235. * @description 事件
  34236. */
  34237. this.events = new Events_Events(this, null, this.EVENT_TYPES);
  34238. /**
  34239. * @member {Object} SuperMap.ElasticSearch.prototype.eventListeners
  34240. * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  34241. * 相当于调用 SuperMap.Events.on(eventListeners)。
  34242. */
  34243. this.eventListeners = null;
  34244. Util_Util.extend(this, options);
  34245. if (this.eventListeners instanceof Object) {
  34246. this.events.on(this.eventListeners);
  34247. }
  34248. }
  34249. /**
  34250. * @function SuperMap.ElasticSearch.prototype.setGeoFence
  34251. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  34252. * @param {SuperMap.Geometry} geoFence - 地理围栏。
  34253. */
  34254. setGeoFence(geoFence) {
  34255. this.geoFence = geoFence;
  34256. }
  34257. /**
  34258. * @function SuperMap.ElasticSearch.prototype.bulk
  34259. * @description 批量操作API,允许执行多个索引/删除操作。
  34260. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  34261. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  34262. * @param {Object} params - 参数。
  34263. * @param {function} callback - 回调函数。
  34264. */
  34265. bulk(params, callback) {
  34266. return this.client.bulk(params, callback);
  34267. }
  34268. /**
  34269. * @function SuperMap.ElasticSearch.prototype.clearScroll
  34270. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  34271. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  34272. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  34273. * @param {Object} params - 参数。
  34274. * @param {function} callback - 回调函数。
  34275. */
  34276. clearScroll(params, callback) {
  34277. return this.client.clearScroll(params, callback);
  34278. }
  34279. /**
  34280. * @function SuperMap.ElasticSearch.prototype.count
  34281. * @description 获取集群、索引、类型或查询的文档个数。
  34282. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  34283. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  34284. * @param {Object} params - 参数。
  34285. * @param {function} callback - 回调函数。
  34286. */
  34287. count(params, callback) {
  34288. return this.client.count(params, callback);
  34289. }
  34290. /**
  34291. * @function SuperMap.ElasticSearch.prototype.count
  34292. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
  34293. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  34294. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  34295. * @param {Object} params - 参数。
  34296. * @param {function} callback - 回调函数。
  34297. */
  34298. create(params, callback) {
  34299. return this.client.create(params, callback);
  34300. }
  34301. /**
  34302. * @function SuperMap.ElasticSearch.prototype.delete
  34303. * @description 根据其ID从特定索引中删除键入的JSON文档。
  34304. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  34305. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  34306. * @param {Object} params - 参数。
  34307. * @param {function} callback - 回调函数。
  34308. */
  34309. delete(params, callback) {
  34310. return this.client.delete(params, callback);
  34311. }
  34312. /**
  34313. * @function SuperMap.ElasticSearch.prototype.delete
  34314. * @description 根据其ID从特定索引中删除键入的JSON文档。
  34315. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  34316. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  34317. * @param {Object} params - 参数。
  34318. * @param {function} callback - 回调函数。
  34319. */
  34320. deleteByQuery(params, callback) {
  34321. return this.client.deleteByQuery(params, callback);
  34322. }
  34323. /**
  34324. * @function SuperMap.ElasticSearch.prototype.delete
  34325. * @description 根据其ID删除脚本。</br>
  34326. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  34327. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  34328. * @param {Object} params - 参数。
  34329. * @param {function} callback - 回调函数。
  34330. */
  34331. deleteScript(params, callback) {
  34332. return this.client.deleteScript(params, callback);
  34333. }
  34334. /**
  34335. * @function SuperMap.ElasticSearch.prototype.deleteTemplate
  34336. * @description 根据其ID删除模板。</br>
  34337. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  34338. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  34339. * @param {Object} params - 参数。
  34340. * @param {function} callback - 回调函数。
  34341. */
  34342. deleteTemplate(params, callback) {
  34343. return this.client.deleteTemplate(params, callback);
  34344. }
  34345. /**
  34346. * @function SuperMap.ElasticSearch.prototype.exists
  34347. * @description 检查给定文档是否存在。</br>
  34348. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  34349. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  34350. * @param {Object} params - 参数。
  34351. * @param {function} callback - 回调函数。
  34352. */
  34353. exists(params, callback) {
  34354. return this.client.exists(params, callback);
  34355. }
  34356. /**
  34357. * @function SuperMap.ElasticSearch.prototype.existsSource
  34358. * @description 检查资源是否存在。</br>
  34359. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  34360. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  34361. * @param {Object} params - 参数。
  34362. * @param {function} callback - 回调函数。
  34363. */
  34364. existsSource(params, callback) {
  34365. return this.client.existsSource(params, callback);
  34366. }
  34367. /**
  34368. * @function SuperMap.ElasticSearch.prototype.explain
  34369. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  34370. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  34371. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  34372. * @param {Object} params - 参数。
  34373. * @param {function} callback - 回调函数。
  34374. */
  34375. explain(params, callback) {
  34376. return this.client.explain(params, callback);
  34377. }
  34378. /**
  34379. * @function SuperMap.ElasticSearch.prototype.fieldCaps
  34380. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  34381. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  34382. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  34383. * @param {Object} params - 参数。
  34384. * @param {function} callback - 回调函数。
  34385. */
  34386. fieldCaps(params, callback) {
  34387. return this.client.fieldCaps(params, callback);
  34388. }
  34389. /**
  34390. * @function SuperMap.ElasticSearch.prototype.get
  34391. * @description 从索引获取一个基于其id的类型的JSON文档。</br>
  34392. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  34393. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  34394. * @param {Object} params - 参数。
  34395. * @param {function} callback - 回调函数。
  34396. */
  34397. get(params, callback) {
  34398. return this.client.get(params, callback);
  34399. }
  34400. /**
  34401. * @function SuperMap.ElasticSearch.prototype.getScript
  34402. * @description 获取脚本。</br>
  34403. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  34404. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  34405. * @param {Object} params - 参数。
  34406. * @param {function} callback - 回调函数。
  34407. */
  34408. getScript(params, callback) {
  34409. return this.client.getScript(params, callback);
  34410. }
  34411. /**
  34412. * @function SuperMap.ElasticSearch.prototype.getSource
  34413. * @description 通过索引,类型和ID获取文档的源。</br>
  34414. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  34415. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  34416. * @param {Object} params - 参数。
  34417. * @param {function} callback - 回调函数。
  34418. */
  34419. getSource(params, callback) {
  34420. return this.client.getSource(params, callback);
  34421. }
  34422. /**
  34423. * @function SuperMap.ElasticSearch.prototype.getTemplate
  34424. * @description 获取模板。</br>
  34425. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  34426. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  34427. * @param {Object} params - 参数。
  34428. * @param {function} callback - 回调函数。
  34429. */
  34430. getTemplate(params, callback) {
  34431. return this.client.getTemplate(params, callback);
  34432. }
  34433. /**
  34434. * @function SuperMap.ElasticSearch.prototype.index
  34435. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  34436. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  34437. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  34438. * @param {Object} params - 参数。
  34439. * @param {function} callback - 回调函数。
  34440. */
  34441. index(params, callback) {
  34442. return this.client.index(params, callback);
  34443. }
  34444. /**
  34445. * @function SuperMap.ElasticSearch.prototype.info
  34446. * @description 从当前集群获取基本信息。</br>
  34447. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  34448. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  34449. * @param {Object} params - 参数。
  34450. * @param {function} callback - 回调函数。
  34451. */
  34452. info(params, callback) {
  34453. return this.client.info(params, callback);
  34454. }
  34455. /**
  34456. * @function SuperMap.ElasticSearch.prototype.mget
  34457. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  34458. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  34459. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  34460. * @param {Object} params - 参数。
  34461. * @param {function} callback - 回调函数。
  34462. */
  34463. mget(params, callback) {
  34464. return this.client.mget(params, callback);
  34465. }
  34466. /**
  34467. * @function SuperMap.ElasticSearch.prototype.msearch
  34468. * @description 在同一请求中执行多个搜索请求。</br>
  34469. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  34470. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  34471. * @param {Object} params - 参数。
  34472. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  34473. * 回调参数:error,response。结果存储在response.responses中
  34474. */
  34475. msearch(params, callback) {
  34476. let me = this;
  34477. return me.client.msearch(params)
  34478. .then(function (resp) {
  34479. me._update(resp.responses, callback);
  34480. return resp;
  34481. }, function (err) {
  34482. callback(err);
  34483. me.events.triggerEvent('error', {error: err});
  34484. return err;
  34485. });
  34486. }
  34487. /**
  34488. * @function SuperMap.ElasticSearch.prototype.msearchTemplate
  34489. * @description 在同一请求中执行多个搜索模板请求。</br>
  34490. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  34491. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  34492. * @param {Object} params - 参数。
  34493. * @param {function} callback - 回调函数。
  34494. */
  34495. msearchTemplate(params, callback) {
  34496. return this.client.msearchTemplate(params, callback);
  34497. }
  34498. /**
  34499. * @function SuperMap.ElasticSearch.prototype.mtermvectors
  34500. * @description 多termvectors API允许一次获得多个termvectors。</br>
  34501. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  34502. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  34503. * @param {Object} params - 参数。
  34504. * @param {function} callback - 回调函数。
  34505. */
  34506. mtermvectors(params, callback) {
  34507. return this.client.mtermvectors(params, callback);
  34508. }
  34509. /**
  34510. * @function SuperMap.ElasticSearch.prototype.ping
  34511. * @description 测试连接。</br>
  34512. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  34513. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  34514. * @param {Object} params - 参数。
  34515. * @param {function} callback - 回调函数。
  34516. */
  34517. ping(params, callback) {
  34518. return this.client.ping(params, callback);
  34519. }
  34520. /**
  34521. * @function SuperMap.ElasticSearch.prototype.putScript
  34522. * @description 添加脚本。</br>
  34523. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  34524. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  34525. * @param {Object} params - 参数。
  34526. * @param {function} callback - 回调函数。
  34527. */
  34528. putScript(params, callback) {
  34529. return this.client.putScript(params, callback);
  34530. }
  34531. /**
  34532. * @function SuperMap.ElasticSearch.prototype.putTemplate
  34533. * @description 添加模板。</br>
  34534. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  34535. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  34536. * @param {Object} params - 参数。
  34537. * @param {function} callback - 回调函数。
  34538. */
  34539. putTemplate(params, callback) {
  34540. return this.client.putTemplate(params, callback);
  34541. }
  34542. /**
  34543. * @function SuperMap.ElasticSearch.prototype.reindex
  34544. * @description 重新索引。</br>
  34545. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  34546. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  34547. * @param {Object} params - 参数。
  34548. * @param {function} callback - 回调函数。
  34549. */
  34550. reindex(params, callback) {
  34551. return this.client.reindex(params, callback);
  34552. }
  34553. /**
  34554. * @function SuperMap.ElasticSearch.prototype.reindexRessrottle
  34555. * @description 重新索引。</br>
  34556. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  34557. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  34558. * @param {Object} params - 参数。
  34559. * @param {function} callback - 回调函数。
  34560. */
  34561. reindexRessrottle(params, callback) {
  34562. return this.client.reindexRessrottle(params, callback);
  34563. }
  34564. /**
  34565. * @function SuperMap.ElasticSearch.prototype.renderSearchTemplate
  34566. * @description 搜索模板。</br>
  34567. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  34568. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  34569. * @param {Object} params - 参数。
  34570. * @param {function} callback - 回调函数。
  34571. */
  34572. renderSearchTemplate(params, callback) {
  34573. return this.client.renderSearchTemplate(params, callback);
  34574. }
  34575. /**
  34576. * @function SuperMap.ElasticSearch.prototype.scroll
  34577. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  34578. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  34579. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  34580. * @param {Object} params - 参数。
  34581. * @param {function} callback - 回调函数。
  34582. */
  34583. scroll(params, callback) {
  34584. return this.client.scroll(params, callback);
  34585. }
  34586. /**
  34587. * @function SuperMap.ElasticSearch.prototype.search
  34588. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  34589. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  34590. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  34591. * @param {Object} params - 参数。
  34592. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  34593. * 回调参数:error,response,结果存储在response.responses中
  34594. */
  34595. search(params, callback) {
  34596. let me = this;
  34597. return me.client.search(params)
  34598. .then(function (resp) {
  34599. me._update(resp.responses, callback);
  34600. return resp;
  34601. }, function (err) {
  34602. callback(err);
  34603. me.events.triggerEvent('error', {error: err});
  34604. return err;
  34605. });
  34606. }
  34607. /**
  34608. * @function SuperMap.ElasticSearch.prototype.searchShards
  34609. * @description 返回要执行搜索请求的索引和分片。
  34610. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  34611. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  34612. * @param {Object} params - 参数。
  34613. * @param {function} callback - 回调函数。
  34614. */
  34615. searchShards(params, callback) {
  34616. return this.client.searchShards(params, callback);
  34617. }
  34618. /**
  34619. * @function SuperMap.ElasticSearch.prototype.searchTemplate
  34620. * @description 搜索模板。
  34621. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  34622. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  34623. * @param {Object} params - 参数。
  34624. * @param {function} callback - 回调函数。
  34625. */
  34626. searchTemplate(params, callback) {
  34627. return this.client.searchTemplate(params, callback);
  34628. }
  34629. /**
  34630. * @function SuperMap.ElasticSearch.prototype.suggest
  34631. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  34632. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  34633. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  34634. * @param {Object} params - 参数。
  34635. * @param {function} callback - 回调函数。
  34636. */
  34637. suggest(params, callback) {
  34638. return this.client.suggest(params, callback);
  34639. }
  34640. /**
  34641. * @function SuperMap.ElasticSearch.prototype.termvectors
  34642. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  34643. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  34644. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  34645. * @param {Object} params - 参数。
  34646. * @param {function} callback - 回调函数。
  34647. */
  34648. termvectors(params, callback) {
  34649. return this.client.termvectors(params, callback);
  34650. }
  34651. /**
  34652. * @function SuperMap.ElasticSearch.prototype.update
  34653. * @description 更新文档的部分。
  34654. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  34655. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  34656. * @param {Object} params - 参数。
  34657. * @param {function} callback - 回调函数。
  34658. */
  34659. update(params, callback) {
  34660. return this.client.update(params, callback);
  34661. }
  34662. /**
  34663. * @function SuperMap.ElasticSearch.prototype.update
  34664. * @description 通过查询API来更新文档。
  34665. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  34666. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  34667. * @param {Object} params - 参数。
  34668. * @param {function} callback - 回调函数。
  34669. */
  34670. updateByQuery(params, callback) {
  34671. return this.client.updateByQuery(params, callback);
  34672. }
  34673. _update(data, callback) {
  34674. let me = this;
  34675. if (!data) {
  34676. return;
  34677. }
  34678. me.data = data;
  34679. if (me.openGeoFence && me.geoFence) {
  34680. me._validateDatas(data);
  34681. }
  34682. me.events.triggerEvent('change', {data: me.data});
  34683. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  34684. if (me.change) {
  34685. me.change && me.change(data);
  34686. } else {
  34687. //加responses是为了保持跟原来es自身的数据结构一致
  34688. callback && callback(undefined, {responses: data});
  34689. }
  34690. }
  34691. _validateDatas(datas) {
  34692. if (!datas) {
  34693. return;
  34694. }
  34695. if (!(datas instanceof Array)) {
  34696. datas = [datas];
  34697. }
  34698. var i, len = datas.length;
  34699. for (i = 0; i < len; i++) {
  34700. this._validateData(datas[i]);
  34701. }
  34702. }
  34703. _validateData(data) {
  34704. let me = this;
  34705. data.hits.hits.map(function (source) {
  34706. let content = source._source;
  34707. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  34708. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  34709. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  34710. let contentX = content.x * meterUnit;
  34711. let contentY = content.y * meterUnit;
  34712. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  34713. let radius = me.geoFence.radius;
  34714. if (distance > radius) {
  34715. me.outOfGeoFence && me.outOfGeoFence(data);
  34716. me.events.triggerEvent('outOfGeoFence', {data: data});
  34717. }
  34718. return source;
  34719. });
  34720. }
  34721. _distance(x1, y1, x2, y2) {
  34722. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  34723. }
  34724. _getMeterPerMapUnit(mapUnit) {
  34725. let earchRadiusInMeters = 6378137;
  34726. let meterPerMapUnit;
  34727. if (mapUnit === 'meter') {
  34728. meterPerMapUnit = 1;
  34729. } else if (mapUnit === 'degree') {
  34730. // 每度表示多少米。
  34731. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  34732. }
  34733. return meterPerMapUnit;
  34734. }
  34735. }
  34736. SuperMap.ElasticSearch = ElasticSearch_ElasticSearch;
  34737. // CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  34738. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34739. * This program are made available under the terms of the Apache License, Version 2.0
  34740. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34741. // CONCATENATED MODULE: ./src/common/thirdparty/index.js
  34742. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34743. * This program are made available under the terms of the Apache License, Version 2.0
  34744. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34745. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  34746. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34747. * This program are made available under the terms of the Apache License, Version 2.0
  34748. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34749. /**
  34750. * @private
  34751. * @class SuperMap.LevelRenderer.Tool.Util
  34752. * @category Visualization Theme
  34753. * LevelRenderer 基础工具类
  34754. *
  34755. */
  34756. class levelRenderer_Util_Util {
  34757. /**
  34758. * @function SuperMap.LevelRenderer.Tool.Util.constructor
  34759. * @description 构造函数。
  34760. *
  34761. */
  34762. constructor() {
  34763. /**
  34764. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  34765. * @description 用于处理merge时无法遍历Date等对象的问题
  34766. */
  34767. this.BUILTIN_OBJECT = {
  34768. '[object Function]': 1,
  34769. '[object RegExp]': 1,
  34770. '[object Date]': 1,
  34771. '[object Error]': 1,
  34772. '[object CanvasGradient]': 1
  34773. };
  34774. /**
  34775. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype._ctx
  34776. */
  34777. this._ctx = null;
  34778. /**
  34779. * Property: _canvas
  34780. * {Object}
  34781. */
  34782. this._canvas = null;
  34783. /**
  34784. * Property: _pixelCtx
  34785. * {Object}
  34786. */
  34787. this._pixelCtx = null;
  34788. /**
  34789. * Property: _width
  34790. * {Object}
  34791. */
  34792. this._width = null;
  34793. /**
  34794. * Property: _height
  34795. * {Object}
  34796. */
  34797. this._height = null;
  34798. /**
  34799. * Property: _offsetX
  34800. * {Object}
  34801. */
  34802. this._offsetX = 0;
  34803. /**
  34804. * Property: _offsetY
  34805. * {Object}
  34806. */
  34807. this._offsetY = 0;
  34808. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  34809. }
  34810. /**
  34811. * @function SuperMap.LevelRenderer.Tool.Util.prototype.clone
  34812. * @description 对一个object进行深度拷贝。
  34813. *
  34814. * @param {Object} source - 需要进行拷贝的对象。
  34815. * @return {Object} 拷贝后的新对象。
  34816. */
  34817. clone(source) {
  34818. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  34819. if (typeof source == 'object' && source !== null) {
  34820. var result = source;
  34821. if (source instanceof Array) {
  34822. result = [];
  34823. for (var i = 0, len = source.length; i < len; i++) {
  34824. result[i] = this.clone(source[i]);
  34825. }
  34826. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  34827. result = {};
  34828. for (var key in source) {
  34829. if (source.hasOwnProperty(key)) {
  34830. result[key] = this.clone(source[key]);
  34831. }
  34832. }
  34833. }
  34834. return result;
  34835. }
  34836. return source;
  34837. }
  34838. /**
  34839. * @function SuperMap.LevelRenderer.Tool.Util.prototype.mergeItem
  34840. * @description 合并源对象的单个属性到目标对象。
  34841. *
  34842. * @param {Object} target - 目标对象。
  34843. * @param {Object} source - 源对象。
  34844. * @param {string} key - 键。
  34845. * @param {boolean} overwrite - 是否覆盖。
  34846. * @return {Object} 目标对象
  34847. */
  34848. mergeItem(target, source, key, overwrite) {
  34849. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  34850. if (source.hasOwnProperty(key)) {
  34851. if (typeof target[key] == 'object'
  34852. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  34853. ) {
  34854. // 如果需要递归覆盖,就递归调用merge
  34855. this.merge(
  34856. target[key],
  34857. source[key],
  34858. overwrite
  34859. );
  34860. } else if (overwrite || !(key in target)) {
  34861. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  34862. target[key] = source[key];
  34863. }
  34864. }
  34865. }
  34866. /**
  34867. * @function SuperMap.LevelRenderer.Tool.Util.prototype.merge
  34868. * @description 合并源对象的属性到目标对象。
  34869. *
  34870. * @param {Object} target - 目标对象。
  34871. * @param {Object} source - 源对象。
  34872. * @param {boolean} overwrite - 是否覆盖。
  34873. * @return {Object} 目标对象。
  34874. */
  34875. merge(target, source, overwrite) {
  34876. for (var i in source) {
  34877. this.mergeItem(target, source, i, overwrite);
  34878. }
  34879. return target;
  34880. }
  34881. /**
  34882. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getContext
  34883. * @description 获取 Canvas 上下文。
  34884. * @return {Object} 上下文。
  34885. */
  34886. getContext() {
  34887. if (!this._ctx) {
  34888. this._ctx = document.createElement('canvas').getContext('2d');
  34889. }
  34890. return this._ctx;
  34891. }
  34892. /**
  34893. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelContext
  34894. * @description 获取像素拾取专用的上下文。
  34895. * @return {Object} 像素拾取专用的上下文。
  34896. */
  34897. getPixelContext() {
  34898. if (!this._pixelCtx) {
  34899. this._canvas = document.createElement('canvas');
  34900. this._width = this._canvas.width;
  34901. this._height = this._canvas.height;
  34902. this._pixelCtx = this._canvas.getContext('2d');
  34903. }
  34904. return this._pixelCtx;
  34905. }
  34906. /**
  34907. * @function SuperMap.LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  34908. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  34909. *
  34910. * @param {number} x - 横坐标。
  34911. * @param {number} y - 纵坐标。
  34912. *
  34913. */
  34914. adjustCanvasSize(x, y) {
  34915. var _canvas = this._canvas;
  34916. var _pixelCtx = this._pixelCtx;
  34917. var _width = this._width;
  34918. var _height = this._height;
  34919. var _offsetX = this._offsetX;
  34920. var _offsetY = this._offsetY;
  34921. // 每次加的长度
  34922. var _v = 100;
  34923. var _flag;
  34924. if (x + _offsetX > _width) {
  34925. _width = x + _offsetX + _v;
  34926. _canvas.width = _width;
  34927. _flag = true;
  34928. }
  34929. if (y + _offsetY > _height) {
  34930. _height = y + _offsetY + _v;
  34931. _canvas.height = _height;
  34932. _flag = true;
  34933. }
  34934. if (x < -_offsetX) {
  34935. _offsetX = Math.ceil(-x / _v) * _v;
  34936. _width += _offsetX;
  34937. _canvas.width = _width;
  34938. _flag = true;
  34939. }
  34940. if (y < -_offsetY) {
  34941. _offsetY = Math.ceil(-y / _v) * _v;
  34942. _height += _offsetY;
  34943. _canvas.height = _height;
  34944. _flag = true;
  34945. }
  34946. if (_flag) {
  34947. _pixelCtx.translate(_offsetX, _offsetY);
  34948. }
  34949. }
  34950. /**
  34951. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelOffset
  34952. * @description 获取像素canvas的偏移量。
  34953. * @return {Object} 偏移量。
  34954. */
  34955. getPixelOffset() {
  34956. return {
  34957. x: this._offsetX,
  34958. y: this._offsetY
  34959. };
  34960. }
  34961. /**
  34962. * @function SuperMap.LevelRenderer.Tool.Util.prototype.indexOf
  34963. * @description 查询数组中元素的index
  34964. * @return {Object} 偏移量。
  34965. */
  34966. indexOf(array, value) {
  34967. if (array.indexOf) {
  34968. return array.indexOf(value);
  34969. }
  34970. for (var i = 0, len = array.length; i < len; i++) {
  34971. if (array[i] === value) {
  34972. return i;
  34973. }
  34974. }
  34975. return -1;
  34976. }
  34977. /**
  34978. * @function SuperMap.LevelRenderer.Tool.Util.prototype.inherits
  34979. * @description 构造类继承关系
  34980. *
  34981. * @param {Function} clazz - 源类。
  34982. * @param {Function} baseClazz - 基类。
  34983. * @return {Object} 偏移量。
  34984. */
  34985. inherits(clazz, baseClazz) {
  34986. var clazzPrototype = clazz.prototype;
  34987. function F() {
  34988. }
  34989. F.prototype = baseClazz.prototype;
  34990. clazz.prototype = new F();
  34991. for (var prop in clazzPrototype) {
  34992. clazz.prototype[prop] = clazzPrototype[prop];
  34993. }
  34994. clazz.constructor = clazz;
  34995. }
  34996. }
  34997. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  34998. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  34999. * This program are made available under the terms of the Apache License, Version 2.0
  35000. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35001. /**
  35002. * @class SuperMap.LevelRenderer.Tool.Color
  35003. * @category Visualization Theme
  35004. * @classdesc LevelRenderer 工具-颜色辅助类
  35005. * @private
  35006. */
  35007. class Color_Color {
  35008. constructor() {
  35009. /**
  35010. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Color.prototype.util
  35011. * @description LevelRenderer 基础工具对象。
  35012. */
  35013. this.util = new levelRenderer_Util_Util();
  35014. /**
  35015. * @member {Object} SuperMap.LevelRenderer.Tool.Color.prototype._ctx
  35016. * @description _ctx。
  35017. */
  35018. this._ctx = null;
  35019. /**
  35020. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype.palette
  35021. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  35022. */
  35023. this.palette = [
  35024. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  35025. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  35026. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  35027. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  35028. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  35029. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  35030. ];
  35031. /**
  35032. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype._palette
  35033. * @description 复位色板,用于复位 palette
  35034. */
  35035. this._palette = this.palette;
  35036. /**
  35037. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.highlightColor
  35038. * @description 高亮色
  35039. */
  35040. this.highlightColor = 'rgba(0,0,255,1)';
  35041. /**
  35042. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._highlightColor
  35043. * @description 复位高亮色
  35044. */
  35045. this._highlightColor = this.highlightColor;
  35046. /**
  35047. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.colorRegExp
  35048. * @description 颜色格式,正则表达式。
  35049. */
  35050. this.colorRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i;
  35051. /**
  35052. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._nameColors
  35053. * @description 颜色名。
  35054. */
  35055. this._nameColors = {
  35056. aliceblue: '#f0f8ff',
  35057. antiquewhite: '#faebd7',
  35058. aqua: '#0ff',
  35059. aquamarine: '#7fffd4',
  35060. azure: '#f0ffff',
  35061. beige: '#f5f5dc',
  35062. bisque: '#ffe4c4',
  35063. black: '#000',
  35064. blanchedalmond: '#ffebcd',
  35065. blue: '#00f',
  35066. blueviolet: '#8a2be2',
  35067. brown: '#a52a2a',
  35068. burlywood: '#deb887',
  35069. cadetblue: '#5f9ea0',
  35070. chartreuse: '#7fff00',
  35071. chocolate: '#d2691e',
  35072. coral: '#ff7f50',
  35073. cornflowerblue: '#6495ed',
  35074. cornsilk: '#fff8dc',
  35075. crimson: '#dc143c',
  35076. cyan: '#0ff',
  35077. darkblue: '#00008b',
  35078. darkcyan: '#008b8b',
  35079. darkgoldenrod: '#b8860b',
  35080. darkgray: '#a9a9a9',
  35081. darkgrey: '#a9a9a9',
  35082. darkgreen: '#006400',
  35083. darkkhaki: '#bdb76b',
  35084. darkmagenta: '#8b008b',
  35085. darkolivegreen: '#556b2f',
  35086. darkorange: '#ff8c00',
  35087. darkorchid: '#9932cc',
  35088. darkred: '#8b0000',
  35089. darksalmon: '#e9967a',
  35090. darkseagreen: '#8fbc8f',
  35091. darkslateblue: '#483d8b',
  35092. darkslategray: '#2f4f4f',
  35093. darkslategrey: '#2f4f4f',
  35094. darkturquoise: '#00ced1',
  35095. darkviolet: '#9400d3',
  35096. deeppink: '#ff1493',
  35097. deepskyblue: '#00bfff',
  35098. dimgray: '#696969',
  35099. dimgrey: '#696969',
  35100. dodgerblue: '#1e90ff',
  35101. firebrick: '#b22222',
  35102. floralwhite: '#fffaf0',
  35103. forestgreen: '#228b22',
  35104. fuchsia: '#f0f',
  35105. gainsboro: '#dcdcdc',
  35106. ghostwhite: '#f8f8ff',
  35107. gold: '#ffd700',
  35108. goldenrod: '#daa520',
  35109. gray: '#808080',
  35110. grey: '#808080',
  35111. green: '#008000',
  35112. greenyellow: '#adff2f',
  35113. honeydew: '#f0fff0',
  35114. hotpink: '#ff69b4',
  35115. indianred: '#cd5c5c',
  35116. indigo: '#4b0082',
  35117. ivory: '#fffff0',
  35118. khaki: '#f0e68c',
  35119. lavender: '#e6e6fa',
  35120. lavenderblush: '#fff0f5',
  35121. lawngreen: '#7cfc00',
  35122. lemonchiffon: '#fffacd',
  35123. lightblue: '#add8e6',
  35124. lightcoral: '#f08080',
  35125. lightcyan: '#e0ffff',
  35126. lightgoldenrodyellow: '#fafad2',
  35127. lightgray: '#d3d3d3',
  35128. lightgrey: '#d3d3d3',
  35129. lightgreen: '#90ee90',
  35130. lightpink: '#ffb6c1',
  35131. lightsalmon: '#ffa07a',
  35132. lightseagreen: '#20b2aa',
  35133. lightskyblue: '#87cefa',
  35134. lightslategray: '#789',
  35135. lightslategrey: '#789',
  35136. lightsteelblue: '#b0c4de',
  35137. lightyellow: '#ffffe0',
  35138. lime: '#0f0',
  35139. limegreen: '#32cd32',
  35140. linen: '#faf0e6',
  35141. magenta: '#f0f',
  35142. maroon: '#800000',
  35143. mediumaquamarine: '#66cdaa',
  35144. mediumblue: '#0000cd',
  35145. mediumorchid: '#ba55d3',
  35146. mediumpurple: '#9370d8',
  35147. mediumseagreen: '#3cb371',
  35148. mediumslateblue: '#7b68ee',
  35149. mediumspringgreen: '#00fa9a',
  35150. mediumturquoise: '#48d1cc',
  35151. mediumvioletred: '#c71585',
  35152. midnightblue: '#191970',
  35153. mintcream: '#f5fffa',
  35154. mistyrose: '#ffe4e1',
  35155. moccasin: '#ffe4b5',
  35156. navajowhite: '#ffdead',
  35157. navy: '#000080',
  35158. oldlace: '#fdf5e6',
  35159. olive: '#808000',
  35160. olivedrab: '#6b8e23',
  35161. orange: '#ffa500',
  35162. orangered: '#ff4500',
  35163. orchid: '#da70d6',
  35164. palegoldenrod: '#eee8aa',
  35165. palegreen: '#98fb98',
  35166. paleturquoise: '#afeeee',
  35167. palevioletred: '#d87093',
  35168. papayawhip: '#ffefd5',
  35169. peachpuff: '#ffdab9',
  35170. peru: '#cd853f',
  35171. pink: '#ffc0cb',
  35172. plum: '#dda0dd',
  35173. powderblue: '#b0e0e6',
  35174. purple: '#800080',
  35175. red: '#f00',
  35176. rosybrown: '#bc8f8f',
  35177. royalblue: '#4169e1',
  35178. saddlebrown: '#8b4513',
  35179. salmon: '#fa8072',
  35180. sandybrown: '#f4a460',
  35181. seagreen: '#2e8b57',
  35182. seashell: '#fff5ee',
  35183. sienna: '#a0522d',
  35184. silver: '#c0c0c0',
  35185. skyblue: '#87ceeb',
  35186. slateblue: '#6a5acd',
  35187. slategray: '#708090',
  35188. slategrey: '#708090',
  35189. snow: '#fffafa',
  35190. springgreen: '#00ff7f',
  35191. steelblue: '#4682b4',
  35192. tan: '#d2b48c',
  35193. teal: '#008080',
  35194. thistle: '#d8bfd8',
  35195. tomato: '#ff6347',
  35196. turquoise: '#40e0d0',
  35197. violet: '#ee82ee',
  35198. wheat: '#f5deb3',
  35199. white: '#fff',
  35200. whitesmoke: '#f5f5f5',
  35201. yellow: '#ff0',
  35202. yellowgreen: '#9acd32'
  35203. };
  35204. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  35205. }
  35206. /**
  35207. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customPalette
  35208. * @description 自定义调色板。
  35209. * @param {Array} userPalete - 颜色板。
  35210. */
  35211. customPalette(userPalete) {
  35212. this.palette = userPalete;
  35213. }
  35214. /**
  35215. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetPalette
  35216. * @description 复位默认色板。
  35217. */
  35218. resetPalette() {
  35219. this.palette = this._palette;
  35220. }
  35221. /**
  35222. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getColor
  35223. * @description 获取色板颜色。
  35224. * @param {number} idx - 色板位置。
  35225. * @param {Array} userPalete - 色板。
  35226. * @returns {string} 颜色值。
  35227. */
  35228. getColor(idx, userPalete) {
  35229. idx = idx | 0;
  35230. userPalete = userPalete || this.palette;
  35231. return userPalete[idx % userPalete.length];
  35232. }
  35233. /**
  35234. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customHighlight
  35235. * @description 自定义默认高亮颜色。
  35236. * @param {string} userHighlightColor - 自定义高亮色。
  35237. */
  35238. customHighlight(userHighlightColor) {
  35239. this.highlightColor = userHighlightColor;
  35240. }
  35241. /**
  35242. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetHighlight
  35243. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  35244. */
  35245. resetHighlight() {
  35246. this.highlightColor = this._highlightColor;
  35247. }
  35248. /**
  35249. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getHighlightColor
  35250. * @description 获取默认高亮颜色
  35251. * @returns {string} 颜色值。
  35252. */
  35253. getHighlightColor() {
  35254. return this.highlightColor;
  35255. }
  35256. /**
  35257. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getRadialGradient
  35258. * @description 径向渐变。
  35259. * @param {number} x0 - 渐变起点横坐标。
  35260. * @param {number} y0 - 渐变起点纵坐标。
  35261. * @param {number} r0 - 半径
  35262. * @param {number} x1 - 渐变终点横坐标。
  35263. * @param {number} y1 - 渐变终点纵坐标。
  35264. * @param {number} r1 - 半径
  35265. * @param {Array} colorList - 颜色列表。
  35266. * @returns {CanvasGradient} Cavans 渐变颜色。
  35267. */
  35268. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  35269. var util = this.util;
  35270. if (!this._ctx) {
  35271. this._ctx = util.getContext();
  35272. }
  35273. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  35274. for (var i = 0, l = colorList.length; i < l; i++) {
  35275. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  35276. }
  35277. gradient.__nonRecursion = true;
  35278. return gradient;
  35279. }
  35280. /**
  35281. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getLinearGradient
  35282. * @description 线性渐变。
  35283. * @param {number} x0 - 渐变起点横坐标。
  35284. * @param {number} y0 - 渐变起点纵坐标。
  35285. * @param {number} x1 - 渐变终点横坐标。
  35286. * @param {number} y1 - 渐变终点纵坐标。
  35287. * @param {Array} colorList - 颜色列表。
  35288. * @returns {CanvasGradient} Cavans 渐变颜色。
  35289. */
  35290. getLinearGradient(x0, y0, x1, y1, colorList) {
  35291. var util = this.util;
  35292. if (!this._ctx) {
  35293. this._ctx = util.getContext();
  35294. }
  35295. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  35296. for (var i = 0, l = colorList.length; i < l; i++) {
  35297. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  35298. }
  35299. gradient.__nonRecursion = true;
  35300. return gradient;
  35301. }
  35302. /**
  35303. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getStepColors
  35304. * @description 获取两种颜色之间渐变颜色数组。
  35305. * @param {Object} start - 起始颜色对象。
  35306. * @param {Object} end - 结束颜色对象。
  35307. * @param {number} step - 渐变级数。
  35308. * @returns {Array} 颜色数组。
  35309. */
  35310. getStepColors(start, end, step) {
  35311. start = this.toRGBA(start);
  35312. end = this.toRGBA(end);
  35313. start = this.getData(start);
  35314. end = this.getData(end);
  35315. var colors = [];
  35316. var stepR = (end[0] - start[0]) / step;
  35317. var stepG = (end[1] - start[1]) / step;
  35318. var stepB = (end[2] - start[2]) / step;
  35319. var stepA = (end[3] - start[3]) / step;
  35320. // 生成颜色集合
  35321. // fix by linfeng 颜色堆积
  35322. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  35323. colors[i] = this.toColor([
  35324. this.adjust(Math.floor(r), [0, 255]),
  35325. this.adjust(Math.floor(g), [0, 255]),
  35326. this.adjust(Math.floor(b), [0, 255]),
  35327. a.toFixed(4) - 0
  35328. ], 'rgba');
  35329. r += stepR;
  35330. g += stepG;
  35331. b += stepB;
  35332. a += stepA;
  35333. }
  35334. r = end[0];
  35335. g = end[1];
  35336. b = end[2];
  35337. a = end[3];
  35338. colors[i] = this.toColor([r, g, b, a], 'rgba');
  35339. return colors;
  35340. }
  35341. /**
  35342. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getGradientColors
  35343. * @description 获取指定级数的渐变颜色数组。
  35344. * @param {Array.<string>} colors - 颜色数组。
  35345. * @param {number} [step=20] - 渐变级数。
  35346. * @returns {Array.<string>} 颜色数组。
  35347. */
  35348. getGradientColors(colors, step) {
  35349. var ret = [];
  35350. var len = colors.length;
  35351. if (step === undefined) {
  35352. step = 20;
  35353. }
  35354. if (len === 1) {
  35355. ret = this.getStepColors(colors[0], colors[0], step);
  35356. } else if (len > 1) {
  35357. for (var i = 0, n = len - 1; i < n; i++) {
  35358. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  35359. if (i < n - 1) {
  35360. steps.pop();
  35361. }
  35362. ret = ret.concat(steps);
  35363. }
  35364. }
  35365. return ret;
  35366. }
  35367. /**
  35368. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toColor
  35369. * @description 颜色值数组转为指定格式颜色。
  35370. * @param {Array} data - 颜色值数组。
  35371. * @param {string} format - 格式,默认'rgb'
  35372. * @returns {string} 颜色。
  35373. */
  35374. toColor(data, format) {
  35375. format = format || 'rgb';
  35376. if (data && (data.length === 3 || data.length === 4)) {
  35377. data = this.map(data,
  35378. function (c) {
  35379. return c > 1 ? Math.ceil(c) : c;
  35380. }
  35381. );
  35382. if (format.indexOf('hex') > -1) {
  35383. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  35384. } else if (format.indexOf('hs') > -1) {
  35385. var sx = this.map(data.slice(1, 3),
  35386. function (c) {
  35387. return c + '%';
  35388. }
  35389. );
  35390. data[1] = sx[0];
  35391. data[2] = sx[1];
  35392. }
  35393. if (format.indexOf('a') > -1) {
  35394. if (data.length === 3) {
  35395. data.push(1);
  35396. }
  35397. data[3] = this.adjust(data[3], [0, 1]);
  35398. return format + '(' + data.slice(0, 4).join(',') + ')';
  35399. }
  35400. return format + '(' + data.slice(0, 3).join(',') + ')';
  35401. }
  35402. }
  35403. /**
  35404. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toArray
  35405. * @description 颜色字符串转换为rgba数组。
  35406. * @param {string} color - 颜色。
  35407. * @returns {Array.<number>} 颜色值数组。
  35408. */
  35409. toArray(color) {
  35410. color = this.trim(color);
  35411. if (color.indexOf('rgba') < 0) {
  35412. color = this.toRGBA(color);
  35413. }
  35414. var data = [];
  35415. var i = 0;
  35416. color.replace(/[\d.]+/g, function (n) {
  35417. if (i < 3) {
  35418. n = n | 0;
  35419. } else {
  35420. // Alpha
  35421. n = +n;
  35422. }
  35423. data[i++] = n;
  35424. });
  35425. return data;
  35426. }
  35427. /**
  35428. * @function SuperMap.LevelRenderer.Tool.Color.prototype.convert
  35429. * @description 颜色格式转化。
  35430. * @param {Array} data - 颜色值数组。
  35431. * @param {string} format - 格式,默认'rgb'
  35432. * @returns {string} 颜色。
  35433. */
  35434. convert(color, format) {
  35435. if (!this.isCalculableColor(color)) {
  35436. return color;
  35437. }
  35438. var data = this.getData(color);
  35439. var alpha = data[3];
  35440. if (typeof alpha === 'undefined') {
  35441. alpha = 1;
  35442. }
  35443. if (color.indexOf('hsb') > -1) {
  35444. data = this._HSV_2_RGB(data);
  35445. } else if (color.indexOf('hsl') > -1) {
  35446. data = this._HSL_2_RGB(data);
  35447. }
  35448. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  35449. data = this._RGB_2_HSB(data);
  35450. } else if (format.indexOf('hsl') > -1) {
  35451. data = this._RGB_2_HSL(data);
  35452. }
  35453. data[3] = alpha;
  35454. return this.toColor(data, format);
  35455. }
  35456. /**
  35457. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGBA
  35458. * @description 转换为rgba格式的颜色。
  35459. * @param {string} color - 颜色。
  35460. * @returns {string} 颜色。
  35461. */
  35462. toRGBA(color) {
  35463. return this.convert(color, 'rgba');
  35464. }
  35465. /**
  35466. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGB
  35467. * @description 转换为rgb数字格式的颜色。
  35468. * @param {string} color - 颜色。
  35469. * @returns {string} 颜色。
  35470. */
  35471. toRGB(color) {
  35472. return this.convert(color, 'rgb');
  35473. }
  35474. /**
  35475. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHex
  35476. * @description 转换为16进制颜色。
  35477. * @param {string} color - 颜色。
  35478. * @returns {string} 16进制颜色,#rrggbb格式
  35479. */
  35480. toHex(color) {
  35481. return this.convert(color, 'hex');
  35482. }
  35483. /**
  35484. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSVA
  35485. * @description 转换为HSV颜色。
  35486. * @param {string} color - 颜色。
  35487. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  35488. */
  35489. toHSVA(color) {
  35490. return this.convert(color, 'hsva');
  35491. }
  35492. /**
  35493. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSV
  35494. * @description 转换为HSV颜色。
  35495. * @param {string} color - 颜色。
  35496. * @returns {string} HSV颜色,hsv(h,s,v)
  35497. */
  35498. toHSV(color) {
  35499. return this.convert(color, 'hsv');
  35500. }
  35501. /**
  35502. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSBA
  35503. * @description 转换为HSBA颜色。
  35504. * @param {string} color - 颜色。
  35505. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  35506. */
  35507. toHSBA(color) {
  35508. return this.convert(color, 'hsba');
  35509. }
  35510. /**
  35511. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSB
  35512. * @description 转换为HSB颜色。
  35513. * @param {string} color - 颜色。
  35514. * @returns {string} HSB颜色,hsb(h,s,b)
  35515. */
  35516. toHSB(color) {
  35517. return this.convert(color, 'hsb');
  35518. }
  35519. /**
  35520. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSLA
  35521. * @description 转换为HSLA颜色。
  35522. * @param {string} color - 颜色。
  35523. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  35524. */
  35525. toHSLA(color) {
  35526. return this.convert(color, 'hsla');
  35527. }
  35528. /**
  35529. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSL
  35530. * @description 转换为HSL颜色。
  35531. * @param {string} color - 颜色。
  35532. * @returns {string} HSL颜色,hsl(h,s,l)
  35533. */
  35534. toHSL(color) {
  35535. return this.convert(color, 'hsl');
  35536. }
  35537. /**
  35538. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toName
  35539. * @description 转换颜色名。
  35540. * @param {string} color - 颜色。
  35541. * @returns {string} 颜色名
  35542. */
  35543. toName(color) {
  35544. for (var key in this._nameColors) {
  35545. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  35546. return key;
  35547. }
  35548. }
  35549. return null;
  35550. }
  35551. /**
  35552. * @function SuperMap.LevelRenderer.Tool.Color.prototype.trim
  35553. * @description 移除颜色中多余空格。
  35554. * @param {string} color - 颜色。
  35555. * @returns {string} 无空格颜色
  35556. */
  35557. trim(color) {
  35558. return String(color).replace(/\s+/g, '');
  35559. }
  35560. /**
  35561. * @function SuperMap.LevelRenderer.Tool.Color.prototype.normalize
  35562. * @description 颜色规范化。
  35563. * @param {string} color - 颜色。
  35564. * @returns {string} 规范化后的颜色
  35565. */
  35566. normalize(color) {
  35567. // 颜色名
  35568. if (this._nameColors[color]) {
  35569. color = this._nameColors[color];
  35570. }
  35571. // 去掉空格
  35572. color = this.trim(color);
  35573. // hsv与hsb等价
  35574. color = color.replace(/hsv/i, 'hsb');
  35575. // rgb转为rrggbb
  35576. if (/^#[\da-f]{3}$/i.test(color)) {
  35577. color = parseInt(color.slice(1), 16);
  35578. var r = (color & 0xf00) << 8;
  35579. var g = (color & 0xf0) << 4;
  35580. var b = color & 0xf;
  35581. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  35582. }
  35583. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  35584. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  35585. return color;
  35586. }
  35587. /**
  35588. * @function SuperMap.LevelRenderer.Tool.Color.prototype.lift
  35589. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  35590. * @param {string} color - 颜色。
  35591. * @param {number} level - 升降程度,取值区间[-1,1]。
  35592. * @returns {string} 加深或减淡后颜色值
  35593. */
  35594. lift(color, level) {
  35595. if (!this.isCalculableColor(color)) {
  35596. return color;
  35597. }
  35598. var direct = level > 0 ? 1 : -1;
  35599. if (typeof level === 'undefined') {
  35600. level = 0;
  35601. }
  35602. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  35603. color = this.toRGB(color);
  35604. var data = this.getData(color);
  35605. for (var i = 0; i < 3; i++) {
  35606. if (direct === 1) {
  35607. data[i] = data[i] * (1 - level) | 0;
  35608. } else {
  35609. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  35610. }
  35611. }
  35612. return 'rgb(' + data.join(',') + ')';
  35613. }
  35614. /**
  35615. * @function SuperMap.LevelRenderer.Tool.Color.prototype.reverse
  35616. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  35617. * @param {string} color - 颜色。
  35618. * @returns {string} 翻转颜色
  35619. */
  35620. reverse(color) {
  35621. if (!this.isCalculableColor(color)) {
  35622. return color;
  35623. }
  35624. var data = this.getData(this.toRGBA(color));
  35625. data = this.map(data,
  35626. function (c) {
  35627. return 255 - c;
  35628. }
  35629. );
  35630. return this.toColor(data, 'rgb');
  35631. }
  35632. /**
  35633. * @function SuperMap.LevelRenderer.Tool.Color.prototype.mix
  35634. * @description 简单两种颜色混合
  35635. * @param {string} color1 - 第一种颜色。
  35636. * @param {string} color2 - 第二种颜色。
  35637. * @param {number} weight - 混合权重[0-1]。
  35638. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  35639. */
  35640. mix(color1, color2, weight) {
  35641. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  35642. return color1;
  35643. }
  35644. if (typeof weight === 'undefined') {
  35645. weight = 0.5;
  35646. }
  35647. weight = 1 - this.adjust(weight, [0, 1]);
  35648. var w = weight * 2 - 1;
  35649. var data1 = this.getData(this.toRGBA(color1));
  35650. var data2 = this.getData(this.toRGBA(color2));
  35651. var d = data1[3] - data2[3];
  35652. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  35653. var weight2 = 1 - weight1;
  35654. var data = [];
  35655. for (var i = 0; i < 3; i++) {
  35656. data[i] = data1[i] * weight1 + data2[i] * weight2;
  35657. }
  35658. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  35659. alpha = Math.max(0, Math.min(1, alpha));
  35660. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  35661. return this.toColor(data, 'rgb');
  35662. }
  35663. data[3] = alpha;
  35664. return this.toColor(data, 'rgba');
  35665. }
  35666. /**
  35667. * @function SuperMap.LevelRenderer.Tool.Color.prototype.random
  35668. * @description 随机颜色
  35669. * @returns {string} 颜色值,#rrggbb格式
  35670. */
  35671. random() {
  35672. return '#' + Math.random().toString(16).slice(2, 8);
  35673. }
  35674. /**
  35675. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getData
  35676. * @description 获取颜色值数组,返回值范围。
  35677. * RGB 范围[0-255]
  35678. * HSL/HSV/HSB 范围[0-1]
  35679. * A透明度范围[0-1]
  35680. * 支持格式:
  35681. * #rgb
  35682. * #rrggbb
  35683. * rgb(r,g,b)
  35684. * rgb(r%,g%,b%)
  35685. * rgba(r,g,b,a)
  35686. * hsb(h,s,b) // hsv与hsb等价
  35687. * hsb(h%,s%,b%)
  35688. * hsba(h,s,b,a)
  35689. * hsl(h,s,l)
  35690. * hsl(h%,s%,l%)
  35691. * hsla(h,s,l,a)
  35692. * @param {string} color - 颜色。
  35693. * @returns {Array.<number>} 颜色值数组或null
  35694. */
  35695. getData(color) {
  35696. color = this.normalize(color);
  35697. var r = color.match(this.colorRegExp);
  35698. if (r === null) {
  35699. throw new Error('The color format error'); // 颜色格式错误
  35700. }
  35701. var d;
  35702. var a;
  35703. var data = [];
  35704. var rgb;
  35705. if (r[2]) {
  35706. // #rrggbb
  35707. d = r[2].replace('#', '').split('');
  35708. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  35709. data = this.map(rgb,
  35710. function (c) {
  35711. return Color_Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  35712. }
  35713. );
  35714. } else if (r[4]) {
  35715. // rgb rgba
  35716. var rgba = (r[4]).split(',');
  35717. a = rgba[3];
  35718. rgb = rgba.slice(0, 3);
  35719. data = this.map(
  35720. rgb,
  35721. function (c) {
  35722. c = Math.floor(
  35723. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  35724. );
  35725. return Color_Color.prototype.adjust.call(this, c, [0, 255]);
  35726. }
  35727. );
  35728. if (typeof a !== 'undefined') {
  35729. data.push(this.adjust(parseFloat(a), [0, 1]));
  35730. }
  35731. } else if (r[5] || r[6]) {
  35732. // hsb hsba hsl hsla
  35733. var hsxa = (r[5] || r[6]).split(',');
  35734. var h = parseInt(hsxa[0], 0) / 360;
  35735. var s = hsxa[1];
  35736. var x = hsxa[2];
  35737. a = hsxa[3];
  35738. data = this.map([s, x],
  35739. function (c) {
  35740. return Color_Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  35741. }
  35742. );
  35743. data.unshift(h);
  35744. if (typeof a !== 'undefined') {
  35745. data.push(this.adjust(parseFloat(a), [0, 1]));
  35746. }
  35747. }
  35748. return data;
  35749. }
  35750. /**
  35751. * @function SuperMap.LevelRenderer.Tool.Color.prototype.alpha
  35752. * @description 设置颜色透明度
  35753. * @param {string} color - 颜色。
  35754. * @param {number} a - 透明度,区间[0,1]。
  35755. * @returns {string} rgba颜色值
  35756. */
  35757. alpha(color, a) {
  35758. if (!this.isCalculableColor(color)) {
  35759. return color;
  35760. }
  35761. if (a === null) {
  35762. a = 1;
  35763. }
  35764. var data = this.getData(this.toRGBA(color));
  35765. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  35766. return this.toColor(data, 'rgba');
  35767. }
  35768. /**
  35769. * @function SuperMap.LevelRenderer.Tool.Color.prototype.map
  35770. * @description 数组映射
  35771. * @param {Array} array - 数组。
  35772. * @param {function} fun - 函数。
  35773. * @returns {string} 数组映射结果
  35774. */
  35775. map(array, fun) {
  35776. if (typeof fun !== 'function') {
  35777. throw new TypeError();
  35778. }
  35779. var len = array ? array.length : 0;
  35780. for (var i = 0; i < len; i++) {
  35781. array[i] = fun(array[i]);
  35782. }
  35783. return array;
  35784. }
  35785. /**
  35786. * @function SuperMap.LevelRenderer.Tool.Color.prototype.adjust
  35787. * @description 调整值区间
  35788. * @param {Array.<number>} value - 数组。
  35789. * @param {Array.<number>} region - 区间。
  35790. * @returns {number} 调整后的值
  35791. */
  35792. adjust(value, region) {
  35793. // < to <= & > to >=
  35794. // modify by linzhifeng 2014-05-25 because -0 == 0
  35795. if (value <= region[0]) {
  35796. value = region[0];
  35797. } else if (value >= region[1]) {
  35798. value = region[1];
  35799. }
  35800. return value;
  35801. }
  35802. /**
  35803. * @function SuperMap.LevelRenderer.Tool.Color.prototype.isCalculableColor
  35804. * @description 判断是否是可计算的颜色
  35805. * @param {string} color - 颜色。
  35806. * @returns {boolean} 是否是可计算的颜色
  35807. */
  35808. isCalculableColor(color) {
  35809. return color instanceof Array || typeof color === 'string';
  35810. }
  35811. /**
  35812. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35813. */
  35814. _HSV_2_RGB(data) {
  35815. var H = data[0];
  35816. var S = data[1];
  35817. var V = data[2];
  35818. // HSV from 0 to 1
  35819. var R;
  35820. var G;
  35821. var B;
  35822. if (S === 0) {
  35823. R = V * 255;
  35824. G = V * 255;
  35825. B = V * 255;
  35826. } else {
  35827. var h = H * 6;
  35828. if (h === 6) {
  35829. h = 0;
  35830. }
  35831. var i = h | 0;
  35832. var v1 = V * (1 - S);
  35833. var v2 = V * (1 - S * (h - i));
  35834. var v3 = V * (1 - S * (1 - (h - i)));
  35835. var r = 0;
  35836. var g = 0;
  35837. var b = 0;
  35838. if (i === 0) {
  35839. r = V;
  35840. g = v3;
  35841. b = v1;
  35842. } else if (i === 1) {
  35843. r = v2;
  35844. g = V;
  35845. b = v1;
  35846. } else if (i === 2) {
  35847. r = v1;
  35848. g = V;
  35849. b = v3;
  35850. } else if (i === 3) {
  35851. r = v1;
  35852. g = v2;
  35853. b = V;
  35854. } else if (i === 4) {
  35855. r = v3;
  35856. g = v1;
  35857. b = V;
  35858. } else {
  35859. r = V;
  35860. g = v1;
  35861. b = v2;
  35862. }
  35863. // RGB results from 0 to 255
  35864. R = r * 255;
  35865. G = g * 255;
  35866. B = b * 255;
  35867. }
  35868. return [R, G, B];
  35869. }
  35870. /**
  35871. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35872. */
  35873. _HSL_2_RGB(data) {
  35874. var H = data[0];
  35875. var S = data[1];
  35876. var L = data[2];
  35877. // HSL from 0 to 1
  35878. var R;
  35879. var G;
  35880. var B;
  35881. if (S === 0) {
  35882. R = L * 255;
  35883. G = L * 255;
  35884. B = L * 255;
  35885. } else {
  35886. var v2;
  35887. if (L < 0.5) {
  35888. v2 = L * (1 + S);
  35889. } else {
  35890. v2 = (L + S) - (S * L);
  35891. }
  35892. var v1 = 2 * L - v2;
  35893. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  35894. G = 255 * this._HUE_2_RGB(v1, v2, H);
  35895. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  35896. }
  35897. return [R, G, B];
  35898. }
  35899. /**
  35900. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35901. */
  35902. _HUE_2_RGB(v1, v2, vH) {
  35903. if (vH < 0) {
  35904. vH += 1;
  35905. }
  35906. if (vH > 1) {
  35907. vH -= 1;
  35908. }
  35909. if ((6 * vH) < 1) {
  35910. return (v1 + (v2 - v1) * 6 * vH);
  35911. }
  35912. if ((2 * vH) < 1) {
  35913. return (v2);
  35914. }
  35915. if ((3 * vH) < 2) {
  35916. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  35917. }
  35918. return v1;
  35919. }
  35920. /**
  35921. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35922. */
  35923. _RGB_2_HSB(data) {
  35924. // RGB from 0 to 255
  35925. var R = (data[0] / 255);
  35926. var G = (data[1] / 255);
  35927. var B = (data[2] / 255);
  35928. var vMin = Math.min(R, G, B); // Min. value of RGB
  35929. var vMax = Math.max(R, G, B); // Max. value of RGB
  35930. var delta = vMax - vMin; // Delta RGB value
  35931. var V = vMax;
  35932. var H;
  35933. var S;
  35934. // HSV results from 0 to 1
  35935. if (delta === 0) {
  35936. H = 0;
  35937. S = 0;
  35938. } else {
  35939. S = delta / vMax;
  35940. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  35941. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  35942. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  35943. if (R === vMax) {
  35944. H = deltaB - deltaG;
  35945. } else if (G === vMax) {
  35946. H = (1 / 3) + deltaR - deltaB;
  35947. } else if (B === vMax) {
  35948. H = (2 / 3) + deltaG - deltaR;
  35949. }
  35950. if (H < 0) {
  35951. H += 1;
  35952. }
  35953. if (H > 1) {
  35954. H -= 1;
  35955. }
  35956. }
  35957. H = H * 360;
  35958. S = S * 100;
  35959. V = V * 100;
  35960. return [H, S, V];
  35961. }
  35962. /**
  35963. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35964. */
  35965. _RGB_2_HSL(data) {
  35966. // RGB from 0 to 255
  35967. var R = (data[0] / 255);
  35968. var G = (data[1] / 255);
  35969. var B = (data[2] / 255);
  35970. var vMin = Math.min(R, G, B); // Min. value of RGB
  35971. var vMax = Math.max(R, G, B); // Max. value of RGB
  35972. var delta = vMax - vMin; // Delta RGB value
  35973. var L = (vMax + vMin) / 2;
  35974. var H;
  35975. var S;
  35976. // HSL results from 0 to 1
  35977. if (delta === 0) {
  35978. H = 0;
  35979. S = 0;
  35980. } else {
  35981. if (L < 0.5) {
  35982. S = delta / (vMax + vMin);
  35983. } else {
  35984. S = delta / (2 - vMax - vMin);
  35985. }
  35986. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  35987. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  35988. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  35989. if (R === vMax) {
  35990. H = deltaB - deltaG;
  35991. } else if (G === vMax) {
  35992. H = (1 / 3) + deltaR - deltaB;
  35993. } else if (B === vMax) {
  35994. H = (2 / 3) + deltaG - deltaR;
  35995. }
  35996. if (H < 0) {
  35997. H += 1;
  35998. }
  35999. if (H > 1) {
  36000. H -= 1;
  36001. }
  36002. }
  36003. H = H * 360;
  36004. S = S * 100;
  36005. L = L * 100;
  36006. return [H, S, L];
  36007. }
  36008. }
  36009. // CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  36010. var ColorRender = new Color_Color();
  36011. // let "http://www.qzu.zj.cn": "#bd10e0"
  36012. // "www.qzct.net": "#7ed321" = new SuperMap.LevelRenderer.Tool.Color();
  36013. /**
  36014. * Created by yzy on 2016/11/9.
  36015. * 色带选择器工具类 用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色
  36016. *
  36017. */
  36018. class ColorsPickerUtil {
  36019. /**
  36020. * 创建DOM canvas
  36021. * @param height canvas 高度
  36022. * @param width canvas 宽度
  36023. *
  36024. */
  36025. static createCanvas (height, width){
  36026. var canvas = document.createElement("canvas");
  36027. canvas.height = height;
  36028. canvas.width = width;
  36029. return canvas.getContext("2d");
  36030. }
  36031. /**
  36032. * 线性渐变。
  36033. * Parameters:
  36034. * x0 - {Number} 渐变起点。
  36035. * y0 - {Number}
  36036. * x1 - {Number} 渐变终点。
  36037. * y1 - {Number}
  36038. * colorList - {Array} 颜色列表。
  36039. *
  36040. * Returns:
  36041. * {CanvasGradient} Cavans 渐变颜色。
  36042. */
  36043. static getLinearGradient (x0, y0, x1, y1, colorList){
  36044. if (!this._ctx) {
  36045. this._ctx = this.getContext();
  36046. }
  36047. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  36048. var leng = colorList.length;
  36049. var add = 1/(leng -1);
  36050. var offset = 0;
  36051. for (var i = 0; i < leng; i++) {
  36052. gradient.addColorStop(offset, colorList[i]);
  36053. offset += add;
  36054. }
  36055. gradient.__nonRecursion = true;
  36056. return gradient;
  36057. }
  36058. /**
  36059. * 获取 Cavans 上下文
  36060. *
  36061. * Returns:
  36062. * {Object} Cavans 上下文。
  36063. */
  36064. static getContext () {
  36065. if (!this._ctx) {
  36066. this._ctx = document.createElement('canvas').getContext('2d');
  36067. }
  36068. return this._ctx;
  36069. }
  36070. /**
  36071. * 获取两种颜色之间渐变颜色数组。
  36072. *
  36073. * Parameters:
  36074. * start - {color} 起始颜色。
  36075. * end - {color} 结束颜色。
  36076. * step - {Number} 渐变级数。
  36077. * colorList - {Array} 颜色列表。
  36078. *
  36079. * Returns:
  36080. * {Array} 颜色数组。
  36081. */
  36082. static getStepColors (start, end, step){
  36083. start = ColorRender.toRGBA(start);
  36084. end = ColorRender.toRGBA(end);
  36085. start = ColorRender.getData(start);
  36086. end = ColorRender.getData(end);
  36087. var colors = [];
  36088. var stepR = (end[0] - start[0]) / step;
  36089. var stepG = (end[1] - start[1]) / step;
  36090. var stepB = (end[2] - start[2]) / step;
  36091. var stepA = (end[3] - start[3]) / step;
  36092. // 生成颜色集合
  36093. // fix by linfeng 颜色堆积
  36094. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  36095. colors[i] = ColorRender.toColor([
  36096. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  36097. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  36098. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  36099. a.toFixed(4) - 0
  36100. ],'hex');
  36101. r += stepR;
  36102. g += stepG;
  36103. b += stepB;
  36104. a += stepA;
  36105. }
  36106. r = end[0];
  36107. g = end[1];
  36108. b = end[2];
  36109. a = end[3];
  36110. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  36111. return colors;
  36112. }
  36113. /**
  36114. * APIMethod: getGradientColors
  36115. * 获取指定级数的渐变颜色数组。
  36116. *
  36117. * Parameters:
  36118. * colors - {Array{String}} 颜色组。
  36119. * total - {Number} 颜色总数。
  36120. * total - {String} 专题类型
  36121. *
  36122. * Returns:
  36123. * {Array{String}} 颜色数组。
  36124. */
  36125. static getGradientColors (colors, total, themeType){
  36126. var ret = [], step;
  36127. var i, n, len = colors.length;
  36128. if (total === undefined) {
  36129. return;
  36130. }
  36131. if(len >= total){
  36132. if(themeType === 'RANGE'){
  36133. for(i = 0; i<total; i++){
  36134. ret.push(colors[i]);
  36135. }
  36136. }else {
  36137. //1/2前后取色
  36138. for(i = 0; i<total; i++){
  36139. let ii = Math.floor(i/2);
  36140. if(i%2 === 0){
  36141. ret.push(colors[ii]);
  36142. }else {
  36143. let index = colors.length -1 - ii;
  36144. ret.push(colors[index]);
  36145. }
  36146. }
  36147. }
  36148. } else {
  36149. step = Math.ceil(total/(len-1));
  36150. for (i = 0, n = len - 1; i < n; i++) {
  36151. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  36152. if (i < n - 1) {
  36153. steps.pop();
  36154. }
  36155. ret = ret.concat(steps);
  36156. }
  36157. //删除多余元素
  36158. var nouse = ret.length - total;
  36159. for(var j = 0, index = 0; j< nouse; j++){
  36160. ret.splice(index+2,1);
  36161. }
  36162. }
  36163. return ret;
  36164. }
  36165. }
  36166. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  36167. // CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  36168. class ArrayStatistic {
  36169. // geostatsInstance: null,
  36170. /**
  36171. * 初始化插件实例
  36172. */
  36173. static newInstance() {
  36174. // if(!this.geostatsInstance) {
  36175. // // this.geostatsInstance = new geostats();
  36176. // // }
  36177. // window.dataList = [];
  36178. if(!this.geostatsInstance) {
  36179. this.geostatsInstance = new window.geostats();
  36180. }
  36181. return this.geostatsInstance;
  36182. }
  36183. /**
  36184. * 设置需要被处理的数组
  36185. *
  36186. * @param array
  36187. */
  36188. static getInstance(array) {
  36189. let instance = this.newInstance();
  36190. instance.setSerie(array);
  36191. return instance;
  36192. }
  36193. /**
  36194. * 获取数组统计的值
  36195. *
  36196. * @param array 需要统计的数组
  36197. * @param type 统计方法
  36198. */
  36199. static getArrayStatistic(array, type){
  36200. if(!array.length) {
  36201. return 0;
  36202. }
  36203. if(type === "Sum" || type === "求和"){
  36204. return this.getSum(array);
  36205. } else if(type === "Maximum" || type === "最大值"){
  36206. return this.getMax(array);
  36207. } else if(type === "Minimum" || type === "最小值"){
  36208. return this.getMin(array);
  36209. } else if(type === "Average" || type === "平均值"){
  36210. return this.getMean(array);
  36211. } else if(type === "Median" || type === "中位数"){
  36212. return this.getMedian(array);
  36213. } else if(type === "times" || type === "计数"){
  36214. return this.getTimes(array);
  36215. }
  36216. }
  36217. /**
  36218. * 获取数组分段后的数值
  36219. *
  36220. * @param array 需要分段的数组
  36221. * @param type 分段方法
  36222. * @param segNum 分段个数
  36223. */
  36224. static getArraySegments(array, type, segNum) {
  36225. if(type === "offset") {
  36226. return this.getEqInterval(array, segNum);
  36227. } else if(type === "jenks") {
  36228. return this.getJenks(array, segNum);
  36229. } else if(type === "square") {
  36230. // 数据都必须 >= 0
  36231. let minValue = this.getMin(array);
  36232. if(minValue >= 0){
  36233. return this.getSqrtInterval(array, segNum);
  36234. }else {
  36235. //console.log('数据都必须 >= 0');
  36236. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  36237. return false;
  36238. }
  36239. } else if(type === "logarithm") {
  36240. // 数据都必须 > 0
  36241. let minValue = this.getMin(array);
  36242. if(minValue > 0){
  36243. return this.getGeometricProgression(array, segNum);
  36244. }else {
  36245. //console.log('数据都必须 > 0');
  36246. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  36247. return false;
  36248. }
  36249. }
  36250. }
  36251. /**
  36252. * 求和
  36253. * @param array
  36254. * @returns {number}
  36255. */
  36256. static getSum(array){
  36257. return this.getInstance(array).sum();
  36258. }
  36259. /**
  36260. * 最小值
  36261. * @param array
  36262. * @returns {*}
  36263. */
  36264. static getMax(array){
  36265. return this.getInstance(array).max();
  36266. }
  36267. /**
  36268. * 最大值
  36269. * @param array
  36270. * @returns {*}
  36271. */
  36272. static getMin(array){
  36273. return this.getInstance(array).min();
  36274. }
  36275. /**
  36276. * 求平均
  36277. * @param array
  36278. * @returns {number}
  36279. */
  36280. static getMean(array){
  36281. return this.getInstance(array).mean();
  36282. }
  36283. /**
  36284. * 求中位数
  36285. *
  36286. * @param array
  36287. * @returns {number}
  36288. */
  36289. static getMedian(array) {
  36290. return this.getInstance(array).median();
  36291. }
  36292. /**
  36293. * 计数
  36294. *
  36295. * @param array
  36296. * @returns {number}
  36297. */
  36298. static getTimes(array) {
  36299. return array.length;
  36300. }
  36301. /**
  36302. * 等距分段法
  36303. *
  36304. * @param array
  36305. * @param segNum
  36306. */
  36307. static getEqInterval(array, segNum) {
  36308. return this.getInstance(array).getClassEqInterval(segNum);
  36309. }
  36310. /**
  36311. * 自然断裂法
  36312. *
  36313. * @param array
  36314. * @param segNum
  36315. */
  36316. static getJenks(array, segNum) {
  36317. return this.getInstance(array).getClassJenks(segNum);
  36318. }
  36319. /**
  36320. * 平方根分段法
  36321. *
  36322. * @param array
  36323. * @param segNum
  36324. */
  36325. static getSqrtInterval(array, segNum) {
  36326. array = array.map(function(value) {
  36327. return Math.sqrt(value);
  36328. });
  36329. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  36330. return (
  36331. breaks.map(function(value) {
  36332. return value * value;
  36333. })
  36334. )
  36335. }
  36336. /**
  36337. * 对数分段法
  36338. *
  36339. * @param array
  36340. * @param segNum
  36341. */
  36342. static getGeometricProgression(array, segNum) {
  36343. return this.getInstance(array).getClassGeometricProgression(segNum);
  36344. }
  36345. }
  36346. SuperMap.ArrayStatistic = ArrayStatistic;
  36347. // CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  36348. var getMeterPerMapUnit = function(mapUnit) {
  36349. var earchRadiusInMeters = 6378137;
  36350. var meterPerMapUnit;
  36351. if (mapUnit === Unit.METER) {
  36352. meterPerMapUnit = 1;
  36353. } else if (mapUnit === Unit.DEGREE) {
  36354. // 每度表示多少米。
  36355. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  36356. } else if (mapUnit === Unit.KILOMETER) {
  36357. meterPerMapUnit = 1.0e-3;
  36358. } else if (mapUnit === Unit.INCH) {
  36359. meterPerMapUnit = 1 / 2.5399999918e-2;
  36360. } else if (mapUnit === Unit.FOOT) {
  36361. meterPerMapUnit = 0.3048;
  36362. } else {
  36363. return meterPerMapUnit;
  36364. }
  36365. return meterPerMapUnit;
  36366. };
  36367. // CONCATENATED MODULE: ./src/common/util/index.js
  36368. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  36369. * This program are made available under the terms of the Apache License, Version 2.0
  36370. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36371. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  36372. var lodash_topairs = __webpack_require__(8);
  36373. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  36374. // CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  36375. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  36376. * This program are made available under the terms of the Apache License, Version 2.0
  36377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36378. /**
  36379. * @class SuperMap.CartoCSS
  36380. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  36381. * @category BaseTypes Style
  36382. * @param {string} cartoStr - CartoCSS 样式表字符串
  36383. * @example
  36384. * var cartocss = "@provinceLineColor:#ddd;
  36385. * #China_Provinces_L___China400{
  36386. * line-dasharray:10,10;
  36387. * line-color:@provinceLineColor;
  36388. * line-width:1;
  36389. * }";
  36390. * new SuperMap.CartoCSS(cartocss);
  36391. */
  36392. /*eslint no-useless-escape: "off"*/
  36393. class CartoCSS_CartoCSS {
  36394. constructor(cartoStr) {
  36395. this.env = null;
  36396. /**
  36397. * @member SuperMap.CartoCSS.prototype.parser
  36398. * @description 解析器
  36399. */
  36400. this.parser = null;
  36401. /**
  36402. * @member SuperMap.CartoCSS.prototype.ruleSet
  36403. * @description CartoCSS 规则对象
  36404. */
  36405. this.ruleSet = null;
  36406. /**
  36407. * @member SuperMap.CartoCSS.prototype.cartoStr
  36408. * @description CartoCSS 样式表字符串
  36409. */
  36410. this.cartoStr = "";
  36411. /**
  36412. * @member SuperMap.CartoCSS.prototype.shaders
  36413. * @description Carto 着色器集
  36414. */
  36415. this.shaders = null;
  36416. if (typeof cartoStr === "string") {
  36417. this.cartoStr = cartoStr;
  36418. this.env = {
  36419. frames: [],
  36420. errors: [],
  36421. error: function (obj) {
  36422. this.errors.push(obj);
  36423. }
  36424. };
  36425. this.parser = this.getParser(this.env);
  36426. this.parse(cartoStr);
  36427. this.shaders = this.toShaders();
  36428. }
  36429. }
  36430. /**
  36431. * @function SuperMap.CartoCSS.prototype.getParser
  36432. * @description 获取 CartoCSS 解析器
  36433. */
  36434. getParser(env) {
  36435. var input, // LeSS input string
  36436. i, // current index in `input`
  36437. j, // current chunk
  36438. temp, // temporarily holds a chunk's state, for backtracking
  36439. memo, // temporarily holds `i`, when backtracking
  36440. furthest, // furthest index the parser has gone to
  36441. chunks, // chunkified input
  36442. current, // index of current chunk, in `input`
  36443. parser;
  36444. var that = this;
  36445. // This function is called after all files
  36446. // have been imported through `@import`.
  36447. var finish = function () {//NOSONAR
  36448. //所有文件导入完成之后调用
  36449. };
  36450. function save() {
  36451. temp = chunks[j];
  36452. memo = i;
  36453. current = i;
  36454. }
  36455. function restore() {
  36456. chunks[j] = temp;
  36457. i = memo;
  36458. current = i;
  36459. }
  36460. function sync() {
  36461. if (i > current) {
  36462. chunks[j] = chunks[j].slice(i - current);
  36463. current = i;
  36464. }
  36465. }
  36466. //
  36467. // Parse from a token, regexp or string, and move forward if match
  36468. //
  36469. function _match(tok) {
  36470. var match, length, c, endIndex;
  36471. // Non-terminal
  36472. if (tok instanceof Function) {
  36473. return tok.call(parser.parsers);
  36474. // Terminal
  36475. // Either match a single character in the input,
  36476. // or match a regexp in the current chunk (chunk[j]).
  36477. } else if (typeof(tok) === 'string') {
  36478. match = input.charAt(i) === tok ? tok : null;
  36479. length = 1;
  36480. sync();
  36481. } else {
  36482. sync();
  36483. match = tok.exec(chunks[j]);
  36484. if (match) {
  36485. length = match[0].length;
  36486. } else {
  36487. return null;
  36488. }
  36489. }
  36490. // The match is confirmed, add the match length to `i`,
  36491. // and consume any extra white-space characters (' ' || '\n')
  36492. // which come after that. The reason for this is that LeSS's
  36493. // grammar is mostly white-space insensitive.
  36494. if (match) {
  36495. var mem = i += length;
  36496. endIndex = i + chunks[j].length - length;
  36497. while (i < endIndex) {
  36498. c = input.charCodeAt(i);
  36499. if (!(c === 32 || c === 10 || c === 9)) {
  36500. break;
  36501. }
  36502. i++;
  36503. }
  36504. chunks[j] = chunks[j].slice(length + (i - mem));
  36505. current = i;
  36506. if (chunks[j].length === 0 && j < chunks.length - 1) {
  36507. j++;
  36508. }
  36509. if (typeof(match) === 'string') {
  36510. return match;
  36511. } else {
  36512. return match.length === 1 ? match[0] : match;
  36513. }
  36514. }
  36515. }
  36516. // Same as _match(), but don't change the state of the parser,
  36517. // just return the match.
  36518. function peek(tok) {
  36519. if (typeof(tok) === 'string') {
  36520. return input.charAt(i) === tok;
  36521. } else {
  36522. return !!tok.test(chunks[j]);
  36523. }
  36524. }
  36525. // Make an error object from a passed set of properties.
  36526. // Accepted properties:
  36527. // - `message`: Text of the error message.
  36528. // - `filename`: Filename where the error occurred.
  36529. // - `index`: Char. index where the error occurred.
  36530. function makeError(err) {
  36531. var einput;
  36532. var defautls = {
  36533. index: furthest,
  36534. filename: env.filename,
  36535. message: 'Parse error.',
  36536. line: 0,
  36537. column: -1
  36538. };
  36539. for (var prop in defautls) {
  36540. if (err[prop] === 0) {
  36541. err[prop] = defautls[prop];
  36542. }
  36543. }
  36544. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  36545. einput = that.env.inputs[err.filename];
  36546. } else {
  36547. einput = input;
  36548. }
  36549. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  36550. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  36551. err.column++;
  36552. }
  36553. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  36554. }
  36555. this.env = env = env || {};
  36556. this.env.filename = this.env.filename || null;
  36557. this.env.inputs = this.env.inputs || {};
  36558. // The Parser
  36559. parser = {
  36560. // Parse an input string into an abstract syntax tree.
  36561. // Throws an error on parse errors.
  36562. parse: function (str) {
  36563. var root, error = null;
  36564. i = j = current = furthest = 0;
  36565. chunks = [];
  36566. input = str.replace(/\r\n/g, '\n');
  36567. if (env.filename) {
  36568. that.env.inputs[env.filename] = input;
  36569. }
  36570. // Split the input into chunks.
  36571. chunks = (function (chunks) {
  36572. var j = 0,
  36573. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  36574. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  36575. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  36576. level = 0,
  36577. match,
  36578. chunk = chunks[0],
  36579. inParam;
  36580. for (var i = 0, c, cc; i < input.length;) {
  36581. skip.lastIndex = i;
  36582. if (match = skip.exec(input)) {
  36583. if (match.index === i) {
  36584. i += match[0].length;
  36585. chunk.push(match[0]);
  36586. }
  36587. }
  36588. c = input.charAt(i);
  36589. comment.lastIndex = string.lastIndex = i;
  36590. if (match = string.exec(input)) {
  36591. if (match.index === i) {
  36592. i += match[0].length;
  36593. chunk.push(match[0]);
  36594. continue;
  36595. }
  36596. }
  36597. if (!inParam && c === '/') {
  36598. cc = input.charAt(i + 1);
  36599. if (cc === '/' || cc === '*') {
  36600. if (match = comment.exec(input)) {
  36601. if (match.index === i) {
  36602. i += match[0].length;
  36603. chunk.push(match[0]);
  36604. continue;
  36605. }
  36606. }
  36607. }
  36608. }
  36609. switch (c) {
  36610. case '{'://NOSONAR
  36611. if (!inParam) {
  36612. level++;
  36613. chunk.push(c);
  36614. break;
  36615. }
  36616. case '}'://NOSONAR
  36617. if (!inParam) {
  36618. level--;
  36619. chunk.push(c);
  36620. chunks[++j] = chunk = [];
  36621. break;
  36622. }
  36623. case '('://NOSONAR
  36624. if (!inParam) {
  36625. inParam = true;
  36626. chunk.push(c);
  36627. break;
  36628. }
  36629. case ')'://NOSONAR
  36630. if (inParam) {
  36631. inParam = false;
  36632. chunk.push(c);
  36633. break;
  36634. }
  36635. default:
  36636. chunk.push(c);
  36637. break;
  36638. }
  36639. i++;
  36640. }
  36641. if (level !== 0) {
  36642. error = {
  36643. index: i - 1,
  36644. type: 'Parse',
  36645. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  36646. };
  36647. }
  36648. return chunks.map(function (c) {
  36649. return c.join('');
  36650. });
  36651. })([[]]);
  36652. if (error) {
  36653. throw makeError(error);
  36654. }
  36655. // Sort rules by specificity: this function expects selectors to be
  36656. // split already.
  36657. //
  36658. // Written to be used as a .sort(Function);
  36659. // argument.
  36660. //
  36661. // [1, 0, 0, 467] > [0, 0, 1, 520]
  36662. var specificitySort = function (a, b) {
  36663. var as = a.specificity;
  36664. var bs = b.specificity;
  36665. if (as[0] != bs[0]) {return bs[0] - as[0];}
  36666. if (as[1] != bs[1]) {return bs[1] - as[1];}
  36667. if (as[2] != bs[2]) {return bs[2] - as[2];}
  36668. return bs[3] - as[3];
  36669. };
  36670. // Start with the primary rule.
  36671. // The whole syntax tree is held under a Ruleset node,
  36672. // with the `root` property set to true, so no `{}` are
  36673. // output.
  36674. root = new SuperMap.CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  36675. root.root = true;
  36676. // Get an array of Ruleset objects, flattened
  36677. // and sorted according to specificitySort
  36678. root.toList = (function () {
  36679. return function (env) {
  36680. env.error = function (e) {
  36681. if (!env.errors) {env.errors = new Error('');}
  36682. if (env.errors.message) {
  36683. env.errors.message += '\n' + makeError(e).message;
  36684. } else {
  36685. env.errors.message = makeError(e).message;
  36686. }
  36687. };
  36688. env.frames = env.frames || [];
  36689. // call populates Invalid-caused errors
  36690. var definitions = this.flatten([], [], env);
  36691. definitions.sort(specificitySort);
  36692. return definitions;
  36693. };
  36694. })();
  36695. return root;
  36696. },
  36697. // Here in, the parsing rules/functions
  36698. //
  36699. // The basic structure of the syntax tree generated is as follows:
  36700. //
  36701. // Ruleset -> Rule -> Value -> Expression -> Entity
  36702. //
  36703. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  36704. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  36705. // first, before parsing, that's when we use `peek()`.
  36706. parsers: {
  36707. // The `primary` rule is the *entry* and *exit* point of the parser.
  36708. // The rules here can appear at any level of the parse tree.
  36709. //
  36710. // The recursive nature of the grammar is an interplay between the `block`
  36711. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  36712. // as represented by this simplified grammar:
  36713. //
  36714. // primary → (ruleset | rule)+
  36715. // ruleset → selector+ block
  36716. // block → '{' primary '}'
  36717. //
  36718. // Only at one point is the primary rule not called from the
  36719. // block rule: at the root level.
  36720. primary: function () {
  36721. var node, root = [];
  36722. while ((node = _match(this.rule) || _match(this.ruleset) ||
  36723. _match(this.comment)) ||
  36724. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  36725. if (node) {root.push(node);}
  36726. }
  36727. return root;
  36728. },
  36729. invalid: function () {
  36730. var chunk = _match(/^[^;\n]*[;\n]/);
  36731. // To fail gracefully, match everything until a semicolon or linebreak.
  36732. if (chunk) {
  36733. return new SuperMap.CartoCSS.Tree.Invalid(chunk, memo);
  36734. }
  36735. },
  36736. // We create a Comment node for CSS comments `/* */`,
  36737. // but keep the LeSS comments `//` silent, by just skipping
  36738. // over them.
  36739. comment: function () {
  36740. var comment;
  36741. if (input.charAt(i) !== '/') {return;}
  36742. if (input.charAt(i + 1) === '/') {
  36743. return new SuperMap.CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  36744. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  36745. return new SuperMap.CartoCSS.Tree.Comment(comment);
  36746. }
  36747. },
  36748. // Entities are tokens which can be found inside an Expression
  36749. entities: {
  36750. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  36751. quoted: function () {
  36752. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  36753. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  36754. if (str) {
  36755. return new SuperMap.CartoCSS.Tree.Quoted(str[1] || str[2]);
  36756. }
  36757. },
  36758. // A reference to a Mapnik field, like [NAME]
  36759. // Behind the scenes, this has the same representation, but Carto
  36760. // needs to be careful to warn when unsupported operations are used.
  36761. field: function () {
  36762. var l = '[', r = ']';
  36763. if (!_match(l)) {return;}
  36764. var field_name = _match(/(^[^\]]+)/);
  36765. if (!_match(r)) {return;}
  36766. if (field_name) {return new SuperMap.CartoCSS.Tree.Field(field_name[1]);}
  36767. },
  36768. // This is a comparison operator
  36769. comparison: function () {
  36770. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  36771. if (str) {
  36772. return str;
  36773. }
  36774. },
  36775. // A catch-all word, such as: hard-light
  36776. // These can start with either a letter or a dash (-),
  36777. // and then contain numbers, underscores, and letters.
  36778. keyword: function () {
  36779. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  36780. if (k) {
  36781. return new SuperMap.CartoCSS.Tree.Keyword(k);
  36782. }
  36783. },
  36784. // A function call like rgb(255, 0, 255)
  36785. // The arguments are parsed with the `entities.arguments` parser.
  36786. call: function () {
  36787. var name, args;
  36788. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  36789. name = name[1];
  36790. if (name === 'url') {
  36791. // url() is handled by the url parser instead
  36792. return null;
  36793. } else {
  36794. i += name.length;
  36795. }
  36796. var l = '(', r = ')';
  36797. _match(l); // Parse the '(' and consume whitespace.
  36798. args = _match(this.entities['arguments']);
  36799. if (!_match(r)) {return;}
  36800. if (name) {
  36801. return new SuperMap.CartoCSS.Tree.Call(name, args, i);
  36802. }
  36803. },
  36804. // Arguments are comma-separated expressions
  36805. 'arguments': function () {
  36806. var args = [], arg;
  36807. while (arg = _match(this.expression)) {
  36808. args.push(arg);
  36809. var q = ',';
  36810. if (!_match(q)) {
  36811. break;
  36812. }
  36813. }
  36814. return args;
  36815. },
  36816. literal: function () {
  36817. return _match(this.entities.dimension) ||
  36818. _match(this.entities.keywordcolor) ||
  36819. _match(this.entities.hexcolor) ||
  36820. _match(this.entities.quoted);
  36821. },
  36822. // Parse url() tokens
  36823. //
  36824. // We use a specific rule for urls, because they don't really behave like
  36825. // standard function calls. The difference is that the argument doesn't have
  36826. // to be enclosed within a string, so it can't be parsed as an Expression.
  36827. url: function () {
  36828. var value;
  36829. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  36830. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  36831. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  36832. var r = ')';
  36833. if (!_match(r)) {
  36834. return new SuperMap.CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  36835. } else {
  36836. return new SuperMap.CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  36837. value instanceof SuperMap.CartoCSS.Tree.Variable) ?
  36838. value : new SuperMap.CartoCSS.Tree.Quoted(value));
  36839. }
  36840. },
  36841. // A Variable entity, such as `@fink`, in
  36842. //
  36843. // width: @fink + 2px
  36844. //
  36845. // We use a different parser for variable definitions,
  36846. // see `parsers.variable`.
  36847. variable: function () {
  36848. var name, index = i;
  36849. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  36850. return new SuperMap.CartoCSS.Tree.Variable(name, index, env.filename);
  36851. }
  36852. },
  36853. hexcolor: function () {
  36854. var rgb;
  36855. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  36856. return new SuperMap.CartoCSS.Tree.Color(rgb[1]);
  36857. }
  36858. },
  36859. keywordcolor: function () {
  36860. var rgb = chunks[j].match(/^[a-z]+/);
  36861. if (rgb && rgb[0] in SuperMap.CartoCSS.Tree.Reference.data.colors) {
  36862. return new SuperMap.CartoCSS.Tree.Color(SuperMap.CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  36863. }
  36864. },
  36865. // A Dimension, that is, a number and a unit. The only
  36866. // unit that has an effect is %
  36867. dimension: function () {
  36868. var c = input.charCodeAt(i);
  36869. if ((c > 57 || c < 45) || c === 47) {return;}
  36870. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  36871. if (value) {
  36872. return new SuperMap.CartoCSS.Tree.Dimension(value[1], value[2], memo);
  36873. }
  36874. }
  36875. },
  36876. // The variable part of a variable definition.
  36877. // Used in the `rule` parser. Like @fink:
  36878. variable: function () {
  36879. var name;
  36880. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  36881. return name[1];
  36882. }
  36883. },
  36884. // Entities are the smallest recognized token,
  36885. // and can be found inside a rule's value.
  36886. entity: function () {
  36887. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  36888. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  36889. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  36890. return property1 || property2 || property3;
  36891. },
  36892. // A Rule terminator. Note that we use `peek()` to check for '}',
  36893. // because the `block` rule will be expecting it, but we still need to make sure
  36894. // it's there, if ';' was ommitted.
  36895. end: function () {
  36896. var q = ';';
  36897. return _match(q) || peek('}');
  36898. },
  36899. // Elements are the building blocks for Selectors. They consist of
  36900. // an element name, such as a tag a class, or `*`.
  36901. //增加对中文的支持,[\u4e00-\u9fa5]
  36902. element: function () {
  36903. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  36904. if (e) {return new SuperMap.CartoCSS.Tree.Element(e);}
  36905. },
  36906. // Attachments allow adding multiple lines, polygons etc. to an
  36907. // object. There can only be one attachment per selector.
  36908. attachment: function () {
  36909. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  36910. if (s) {return s[1];}
  36911. },
  36912. // Selectors are made out of one or more Elements, see above.
  36913. selector: function () {
  36914. var a, attachment,
  36915. e, elements = [],
  36916. f, filters = new SuperMap.CartoCSS.Tree.Filterset(),
  36917. z, zooms = [],
  36918. segments = 0, conditions = 0;
  36919. while (
  36920. (e = _match(this.element)) ||
  36921. (z = _match(this.zoom)) ||
  36922. (f = _match(this.filter)) ||
  36923. (a = _match(this.attachment))
  36924. ) {
  36925. segments++;
  36926. if (e) {
  36927. elements.push(e);
  36928. } else if (z) {
  36929. zooms.push(z);
  36930. conditions++;
  36931. } else if (f) {
  36932. var err = filters.add(f);
  36933. if (err) {
  36934. throw makeError({
  36935. message: err,
  36936. index: i - 1
  36937. });
  36938. }
  36939. conditions++;
  36940. } else if (attachment) {
  36941. throw makeError({
  36942. message: 'Encountered second attachment name.',
  36943. index: i - 1
  36944. });
  36945. } else {
  36946. attachment = a;
  36947. }
  36948. var c = input.charAt(i);
  36949. if (c === '{' || c === '}' || c === ';' || c === ',') {
  36950. break;
  36951. }
  36952. }
  36953. if (segments) {
  36954. return new SuperMap.CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  36955. }
  36956. },
  36957. filter: function () {
  36958. save();
  36959. var key, op, val, l = '[', r = ']';
  36960. if (!_match(l)) {return;}
  36961. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  36962. _match(this.entities.quoted) ||
  36963. _match(this.entities.variable) ||
  36964. _match(this.entities.keyword) ||
  36965. _match(this.entities.field)) {
  36966. if (key instanceof SuperMap.CartoCSS.Tree.Quoted) {
  36967. key = new SuperMap.CartoCSS.Tree.Field(key.toString());
  36968. }
  36969. if ((op = _match(this.entities.comparison)) &&
  36970. (val = _match(this.entities.quoted) ||
  36971. _match(this.entities.variable) ||
  36972. _match(this.entities.dimension) ||
  36973. _match(this.entities.keyword) ||
  36974. _match(this.entities.field))) {
  36975. if (!_match(r)) {
  36976. throw makeError({
  36977. message: 'Missing closing ] of filter.',
  36978. index: memo - 1
  36979. });
  36980. }
  36981. if (!key.is) {key = new SuperMap.CartoCSS.Tree.Field(key);}
  36982. return new SuperMap.CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  36983. }
  36984. }
  36985. },
  36986. zoom: function () {
  36987. save();
  36988. var op, val, r = ']';
  36989. if (_match(/^\[\s*zoom/g) &&
  36990. (op = _match(this.entities.comparison)) &&
  36991. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  36992. return new SuperMap.CartoCSS.Tree.Zoom(op, val, memo);
  36993. } else {
  36994. // backtrack
  36995. restore();
  36996. }
  36997. },
  36998. // The `block` rule is used by `ruleset`
  36999. // It's a wrapper around the `primary` rule, with added `{}`.
  37000. block: function () {
  37001. var content, l = '{', r = '}';
  37002. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  37003. return content;
  37004. }
  37005. },
  37006. // div, .class, body > p {...}
  37007. ruleset: function () {
  37008. var selectors = [], s, rules, q = ',';
  37009. save();
  37010. while (s = _match(this.selector)) {
  37011. selectors.push(s);
  37012. while (_match(this.comment)) {//NOSONAR
  37013. }
  37014. if (!_match(q)) {
  37015. break;
  37016. }
  37017. while (_match(this.comment)) {//NOSONAR
  37018. }
  37019. }
  37020. if (s) {
  37021. while (_match(this.comment)) {//NOSONAR
  37022. }
  37023. }
  37024. if (selectors.length > 0 && (rules = _match(this.block))) {
  37025. if (selectors.length === 1 &&
  37026. selectors[0].elements.length &&
  37027. selectors[0].elements[0].value === 'Map') {
  37028. var rs = new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  37029. rs.isMap = true;
  37030. return rs;
  37031. }
  37032. return new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  37033. } else {
  37034. // Backtrack
  37035. restore();
  37036. }
  37037. },
  37038. rule: function () {
  37039. var name, value, c = input.charAt(i);
  37040. save();
  37041. if (c === '.' || c === '#') {
  37042. return;
  37043. }
  37044. if (name = _match(this.variable) || _match(this.property)) {
  37045. value = _match(this.value);
  37046. if (value && _match(this.end)) {
  37047. return new SuperMap.CartoCSS.Tree.Rule(name, value, memo, env.filename);
  37048. } else {
  37049. furthest = i;
  37050. restore();
  37051. }
  37052. }
  37053. },
  37054. font: function () {
  37055. var value = [], expression = [], e, q = ',';
  37056. while (e = _match(this.entity)) {
  37057. expression.push(e);
  37058. }
  37059. value.push(new SuperMap.CartoCSS.Tree.Expression(expression));
  37060. if (_match(q)) {
  37061. while (e = _match(this.expression)) {
  37062. value.push(e);
  37063. if (!_match(q)) {
  37064. break;
  37065. }
  37066. }
  37067. }
  37068. return new SuperMap.CartoCSS.Tree.Value(value);
  37069. },
  37070. // A Value is a comma-delimited list of Expressions
  37071. // In a Rule, a Value represents everything after the `:`,
  37072. // and before the `;`.
  37073. value: function () {
  37074. var e, expressions = [], q = ',';
  37075. while (e = _match(this.expression)) {
  37076. expressions.push(e);
  37077. if (!_match(q)) {
  37078. break;
  37079. }
  37080. }
  37081. if (expressions.length > 1) {
  37082. return new SuperMap.CartoCSS.Tree.Value(expressions.map(function (e) {
  37083. return e.value[0];
  37084. }));
  37085. } else if (expressions.length === 1) {
  37086. return new SuperMap.CartoCSS.Tree.Value(expressions);
  37087. }
  37088. },
  37089. // A sub-expression, contained by parenthensis
  37090. sub: function () {
  37091. var e, l = '(', r = ")";
  37092. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  37093. return e;
  37094. }
  37095. },
  37096. // This is a misnomer because it actually handles multiplication
  37097. // and division.
  37098. multiplication: function () {
  37099. var m, a, op, operation, q = '/';
  37100. if (m = _match(this.operand)) {
  37101. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  37102. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  37103. }
  37104. return operation || m;
  37105. }
  37106. },
  37107. addition: function () {
  37108. var m, a, op, operation, plus = '+';
  37109. if (m = _match(this.multiplication)) {
  37110. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  37111. (a = _match(this.multiplication))) {
  37112. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  37113. }
  37114. return operation || m;
  37115. }
  37116. },
  37117. // An operand is anything that can be part of an operation,
  37118. // such as a Color, or a Variable
  37119. operand: function () {
  37120. return _match(this.sub) || _match(this.entity);
  37121. },
  37122. // Expressions either represent mathematical operations,
  37123. // or white-space delimited Entities. @var * 2
  37124. expression: function () {
  37125. var e, entities = [];
  37126. while (e = _match(this.addition) || _match(this.entity)) {
  37127. entities.push(e);
  37128. }
  37129. if (entities.length > 0) {
  37130. return new SuperMap.CartoCSS.Tree.Expression(entities);
  37131. }
  37132. },
  37133. property: function () {
  37134. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  37135. if (name) {return name[1];}
  37136. }
  37137. }
  37138. };
  37139. return parser;
  37140. }
  37141. /**
  37142. * @function SuperMap.CartoCSS.prototype.parse
  37143. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集
  37144. * @returns {Object} CartoCSS规则集
  37145. */
  37146. parse(str) {
  37147. var parser = this.parser;
  37148. var ruleSet = this.ruleSet = parser.parse(str);
  37149. return ruleSet;
  37150. }
  37151. /**
  37152. * @function SuperMap.CartoCSS.prototype.toShaders
  37153. * @description 将CartoCSS规则集转化为着色器
  37154. * @returns {Array} CartoCSS着色器集
  37155. */
  37156. toShaders() {
  37157. if (this.ruleSet) {
  37158. var ruleset = this.ruleSet;
  37159. if (ruleset) {
  37160. var defs = ruleset.toList(this.env);
  37161. defs.reverse();
  37162. var shaders = {};
  37163. var keys = [];
  37164. this._toShaders(shaders,keys,defs);
  37165. var ordered_shaders = [];
  37166. var done = {};
  37167. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  37168. var def = defs[i];
  37169. var k = def.attachment;
  37170. var shader = shaders[keys[i]];
  37171. var shaderArray = [];
  37172. if (!done[k]) {
  37173. var j = 0;
  37174. for (var prop in shader) {
  37175. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  37176. //对layer-index作特殊处理以实现图层的控制
  37177. if (prop === "layer-index") {
  37178. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  37179. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  37180. var _value = null;
  37181. shader[prop].join('\n');
  37182. return _value;
  37183. };
  37184. var layerIndex = getLayerIndex();
  37185. Object.defineProperty(shaderArray, "layerIndex", {
  37186. configurable: true,
  37187. enumerable: false,
  37188. value: layerIndex
  37189. });
  37190. } else {
  37191. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  37192. if (!Array.isArray(ops)) {
  37193. return ops;
  37194. }
  37195. var body = ops.join('\n');
  37196. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  37197. var index = body.indexOf(myKeyword);
  37198. if (index >= 0) {
  37199. //对featureID作一些特殊处理,以将featureID提取出来
  37200. if (!shaderArray.featureFilter) {
  37201. var featureFilterStart = index + myKeyword.length;
  37202. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  37203. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  37204. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  37205. var featureFilter = function (featureId) {
  37206. if (featureFilterStr) {
  37207. return true;
  37208. }
  37209. return false;
  37210. }
  37211. Object.defineProperty(shaderArray, "featureFilter", {
  37212. configurable: true,
  37213. enumerable: false,
  37214. value: featureFilter
  37215. });
  37216. }
  37217. return {
  37218. "property": prop,
  37219. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  37220. };
  37221. } else {
  37222. return {
  37223. "property": prop,
  37224. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  37225. };
  37226. }
  37227. }(shader[prop], shaderArray);
  37228. }
  37229. }
  37230. }
  37231. Object.defineProperty(shaderArray, "attachment", {
  37232. configurable: true,
  37233. enumerable: false,
  37234. value: k
  37235. });
  37236. Object.defineProperty(shaderArray, "elements", {
  37237. configurable: true,
  37238. enumerable: false,
  37239. value: def.elements
  37240. });
  37241. ordered_shaders.push(shaderArray);
  37242. done[keys[i]] = true;
  37243. }
  37244. Object.defineProperty(shaderArray, "zoom", {
  37245. configurable: true,
  37246. enumerable: false,
  37247. value: def.zoom
  37248. });
  37249. //shader.frames.push(def.frame_offset);
  37250. }
  37251. return ordered_shaders;
  37252. }
  37253. }
  37254. return null;
  37255. }
  37256. _toShaders(shaders, keys,defs) {
  37257. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  37258. let def = defs[i];
  37259. let element_str = [];
  37260. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  37261. element_str.push(def.elements[j]);
  37262. }
  37263. let filters = def.filters.filters;
  37264. let filterStr = [];
  37265. for (let attr in filters) {
  37266. filterStr.push(filters[attr].id);
  37267. }
  37268. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  37269. keys.push(key);
  37270. let shader = shaders[key] = (shaders[key] || {});
  37271. //shader.frames = [];
  37272. shader.zoom = SuperMap.CartoCSS.Tree.Zoom.all;
  37273. let props = def.toJS(this.env);
  37274. for (let v in props) {
  37275. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  37276. }
  37277. }
  37278. }
  37279. /**
  37280. * @function SuperMap.CartoCSS.prototype.getShaders
  37281. * @description 获取CartoCSS着色器
  37282. * @returns {Array} 着色器集
  37283. * @example
  37284. * //shaders的结构大概如下:
  37285. * var shaders=[
  37286. * {
  37287. * attachment:"one",
  37288. * elements:[],
  37289. * zoom:23,
  37290. * length:2,
  37291. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  37292. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  37293. * },
  37294. * {
  37295. * attachment:"two",
  37296. * elements:[],
  37297. * zoom:23,
  37298. * length:2,
  37299. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  37300. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  37301. * }
  37302. * ];
  37303. */
  37304. getShaders() {
  37305. return this.shaders;
  37306. }
  37307. /**
  37308. * @function SuperMap.CartoCSS.prototype.destroy
  37309. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象
  37310. */
  37311. destroy() {
  37312. this.cartoStr = null;
  37313. this.env = null;
  37314. this.ruleSet = null;
  37315. this.parser = null;
  37316. this.shaders = null;
  37317. }
  37318. }
  37319. SuperMap._mapnik_reference_latest = {
  37320. "version": "2.1.1",
  37321. "style": {
  37322. "filter-mode": {
  37323. "type": [
  37324. "all",
  37325. "first"
  37326. ],
  37327. "doc": "Control the processing behavior of Rule filters within a Style. If 'all' is used then all Rules are processed sequentially independent of whether any previous filters matched. If 'first' is used then it means processing ends after the first match (a positive filter evaluation) and no further Rules in the Style are processed ('first' is usually the default for CSS implementations on top of Mapnik to simplify translation from CSS to Mapnik XML)",
  37328. "default-value": "all",
  37329. "default-meaning": "All Rules in a Style are processed whether they have filters or not and whether or not the filter conditions evaluate to true."
  37330. },
  37331. "image-filters": {
  37332. "css": "image-filters",
  37333. "default-value": "none",
  37334. "default-meaning": "no filters",
  37335. "type": "functions",
  37336. "functions": [
  37337. ["agg-stack-blur", 2],
  37338. ["emboss", 0],
  37339. ["blur", 0],
  37340. ["gray", 0],
  37341. ["sobel", 0],
  37342. ["edge-detect", 0],
  37343. ["x-gradient", 0],
  37344. ["y-gradient", 0],
  37345. ["invert", 0],
  37346. ["sharpen", 0]
  37347. ],
  37348. "doc": "A list of image filters."
  37349. },
  37350. "comp-op": {
  37351. "css": "comp-op",
  37352. "default-value": "src-over",
  37353. "default-meaning": "add the current layer on top of other layers",
  37354. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  37355. "type": ["clear",
  37356. "src",
  37357. "dst",
  37358. "src-over",
  37359. "dst-over",
  37360. "src-in",
  37361. "dst-in",
  37362. "src-out",
  37363. "dst-out",
  37364. "src-atop",
  37365. "dst-atop",
  37366. "xor",
  37367. "plus",
  37368. "minus",
  37369. "multiply",
  37370. "screen",
  37371. "overlay",
  37372. "darken",
  37373. "lighten",
  37374. "color-dodge",
  37375. "color-burn",
  37376. "hard-light",
  37377. "soft-light",
  37378. "difference",
  37379. "exclusion",
  37380. "contrast",
  37381. "invert",
  37382. "invert-rgb",
  37383. "grain-merge",
  37384. "grain-extract",
  37385. "hue",
  37386. "saturation",
  37387. "color",
  37388. "value"
  37389. ]
  37390. },
  37391. "opacity": {
  37392. "css": "opacity",
  37393. "type": "float",
  37394. "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)",
  37395. "default-value": 1,
  37396. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  37397. }
  37398. },
  37399. "layer": {
  37400. "name": {
  37401. "default-value": "",
  37402. "type": "string",
  37403. "required": true,
  37404. "default-meaning": "No layer name has been provided",
  37405. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  37406. },
  37407. "srs": {
  37408. "default-value": "",
  37409. "type": "string",
  37410. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  37411. "doc": "The spatial reference system definition for the layer, aka the projection. Can either be a proj4 literal string like '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' or, if the proper proj4 epsg/nad/etc identifier files are installed, a string that uses an id like: '+init=epsg:4326'"
  37412. },
  37413. "status": {
  37414. "default-value": true,
  37415. "type": "boolean",
  37416. "default-meaning": "This layer will be marked as active and available for processing",
  37417. "doc": "A property that can be set to false to disable this layer from being processed"
  37418. },
  37419. "minzoom": {
  37420. "default-value": "0",
  37421. "type": "float",
  37422. "default-meaning": "The layer will be visible at the minimum possible scale",
  37423. "doc": "The minimum scale denominator that this layer will be visible at. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"
  37424. },
  37425. "maxzoom": {
  37426. "default-value": "1.79769e+308",
  37427. "type": "float",
  37428. "default-meaning": "The layer will be visible at the maximum possible scale",
  37429. "doc": "The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"
  37430. },
  37431. "queryable": {
  37432. "default-value": false,
  37433. "type": "boolean",
  37434. "default-meaning": "The layer will not be available for the direct querying of data values",
  37435. "doc": "This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"
  37436. },
  37437. "clear-label-cache": {
  37438. "default-value": false,
  37439. "type": "boolean",
  37440. "default-meaning": "The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",
  37441. "doc": "This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"
  37442. },
  37443. "group-by": {
  37444. "default-value": "",
  37445. "type": "string",
  37446. "default-meaning": "No special layer grouping will be used during rendering",
  37447. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  37448. },
  37449. "buffer-size": {
  37450. "default-value": "0",
  37451. "type": "float",
  37452. "default-meaning": "No buffer will be used",
  37453. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  37454. },
  37455. "maximum-extent": {
  37456. "default-value": "none",
  37457. "type": "bbox",
  37458. "default-meaning": "No clipping extent will be used",
  37459. "doc": "An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."
  37460. }
  37461. },
  37462. "symbolizers": {
  37463. "*": {
  37464. "image-filters": {
  37465. "css": "image-filters",
  37466. "default-value": "none",
  37467. "default-meaning": "no filters",
  37468. "type": "functions",
  37469. "functions": [
  37470. ["agg-stack-blur", 2],
  37471. ["emboss", 0],
  37472. ["blur", 0],
  37473. ["gray", 0],
  37474. ["sobel", 0],
  37475. ["edge-detect", 0],
  37476. ["x-gradient", 0],
  37477. ["y-gradient", 0],
  37478. ["invert", 0],
  37479. ["sharpen", 0]
  37480. ],
  37481. "doc": "A list of image filters."
  37482. },
  37483. "comp-op": {
  37484. "css": "comp-op",
  37485. "default-value": "src-over",
  37486. "default-meaning": "add the current layer on top of other layers",
  37487. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  37488. "type": ["clear",
  37489. "src",
  37490. "dst",
  37491. "src-over",
  37492. "dst-over",
  37493. "src-in",
  37494. "dst-in",
  37495. "src-out",
  37496. "dst-out",
  37497. "src-atop",
  37498. "dst-atop",
  37499. "xor",
  37500. "plus",
  37501. "minus",
  37502. "multiply",
  37503. "screen",
  37504. "overlay",
  37505. "darken",
  37506. "lighten",
  37507. "color-dodge",
  37508. "color-burn",
  37509. "hard-light",
  37510. "soft-light",
  37511. "difference",
  37512. "exclusion",
  37513. "contrast",
  37514. "invert",
  37515. "invert-rgb",
  37516. "grain-merge",
  37517. "grain-extract",
  37518. "hue",
  37519. "saturation",
  37520. "color",
  37521. "value"
  37522. ]
  37523. },
  37524. "opacity": {
  37525. "css": "opacity",
  37526. "type": "float",
  37527. "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)",
  37528. "default-value": 1,
  37529. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  37530. }
  37531. },
  37532. "map": {
  37533. "background-color": {
  37534. "css": "background-color",
  37535. "default-value": "none",
  37536. "default-meaning": "transparent",
  37537. "type": "color",
  37538. "doc": "Map Background color"
  37539. },
  37540. "background-image": {
  37541. "css": "background-image",
  37542. "type": "uri",
  37543. "default-value": "",
  37544. "default-meaning": "transparent",
  37545. "doc": "An image that is repeated below all features on a map as a background.",
  37546. "description": "Map Background image"
  37547. },
  37548. "srs": {
  37549. "css": "srs",
  37550. "type": "string",
  37551. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  37552. "default-meaning": "The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",
  37553. "doc": "Map spatial reference (proj4 string)"
  37554. },
  37555. "buffer-size": {
  37556. "css": "buffer-size",
  37557. "default-value": "0",
  37558. "type": "float",
  37559. "default-meaning": "No buffer will be used",
  37560. "doc": "Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with \"avoid-edges\"."
  37561. },
  37562. "maximum-extent": {
  37563. "css": "",
  37564. "default-value": "none",
  37565. "type": "bbox",
  37566. "default-meaning": "No clipping extent will be used",
  37567. "doc": "An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."
  37568. },
  37569. "base": {
  37570. "css": "base",
  37571. "default-value": "",
  37572. "default-meaning": "This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.",
  37573. "type": "string",
  37574. "doc": "Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."
  37575. },
  37576. "paths-from-xml": {
  37577. "css": "",
  37578. "default-value": true,
  37579. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  37580. "type": "boolean",
  37581. "doc": "value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"
  37582. },
  37583. "minimum-version": {
  37584. "css": "",
  37585. "default-value": "none",
  37586. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  37587. "type": "string",
  37588. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  37589. },
  37590. "font-directory": {
  37591. "css": "font-directory",
  37592. "type": "uri",
  37593. "default-value": "none",
  37594. "default-meaning": "No map-specific fonts will be registered",
  37595. "doc": "Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."
  37596. }
  37597. },
  37598. "polygon": {
  37599. "fill": {
  37600. "css": "polygon-fill",
  37601. "type": "color",
  37602. "default-value": "rgba(128,128,128,1)",
  37603. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  37604. "doc": "Fill color to assign to a polygon"
  37605. },
  37606. "fill-opacity": {
  37607. "css": "polygon-opacity",
  37608. "type": "float",
  37609. "doc": "The opacity of the polygon",
  37610. "default-value": 1,
  37611. "default-meaning": "opaque"
  37612. },
  37613. "gamma": {
  37614. "css": "polygon-gamma",
  37615. "type": "float",
  37616. "default-value": 1,
  37617. "default-meaning": "fully antialiased",
  37618. "range": "0-1",
  37619. "doc": "Level of antialiasing of polygon edges"
  37620. },
  37621. "gamma-method": {
  37622. "css": "polygon-gamma-method",
  37623. "type": [
  37624. "power",
  37625. "linear",
  37626. "none",
  37627. "threshold",
  37628. "multiply"
  37629. ],
  37630. "default-value": "power",
  37631. "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",
  37632. "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"
  37633. },
  37634. "clip": {
  37635. "css": "polygon-clip",
  37636. "type": "boolean",
  37637. "default-value": true,
  37638. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37639. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  37640. },
  37641. "smooth": {
  37642. "css": "polygon-smooth",
  37643. "type": "float",
  37644. "default-value": 0,
  37645. "default-meaning": "no smoothing",
  37646. "range": "0-1",
  37647. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  37648. },
  37649. "geometry-transform": {
  37650. "css": "polygon-geometry-transform",
  37651. "type": "functions",
  37652. "default-value": "none",
  37653. "default-meaning": "geometry will not be transformed",
  37654. "doc": "Allows transformation functions to be applied to the geometry.",
  37655. "functions": [
  37656. ["matrix", 6],
  37657. ["translate", 2],
  37658. ["scale", 2],
  37659. ["rotate", 3],
  37660. ["skewX", 1],
  37661. ["skewY", 1]
  37662. ]
  37663. },
  37664. "comp-op": {
  37665. "css": "polygon-comp-op",
  37666. "default-value": "src-over",
  37667. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37668. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37669. "type": ["clear",
  37670. "src",
  37671. "dst",
  37672. "src-over",
  37673. "dst-over",
  37674. "src-in",
  37675. "dst-in",
  37676. "src-out",
  37677. "dst-out",
  37678. "src-atop",
  37679. "dst-atop",
  37680. "xor",
  37681. "plus",
  37682. "minus",
  37683. "multiply",
  37684. "screen",
  37685. "overlay",
  37686. "darken",
  37687. "lighten",
  37688. "color-dodge",
  37689. "color-burn",
  37690. "hard-light",
  37691. "soft-light",
  37692. "difference",
  37693. "exclusion",
  37694. "contrast",
  37695. "invert",
  37696. "invert-rgb",
  37697. "grain-merge",
  37698. "grain-extract",
  37699. "hue",
  37700. "saturation",
  37701. "color",
  37702. "value"
  37703. ]
  37704. }
  37705. },
  37706. "line": {
  37707. "stroke": {
  37708. "css": "line-color",
  37709. "default-value": "rgba(0,0,0,1)",
  37710. "type": "color",
  37711. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  37712. "doc": "The color of a drawn line"
  37713. },
  37714. "stroke-width": {
  37715. "css": "line-width",
  37716. "default-value": 1,
  37717. "type": "float",
  37718. "doc": "The width of a line in pixels"
  37719. },
  37720. "stroke-opacity": {
  37721. "css": "line-opacity",
  37722. "default-value": 1,
  37723. "type": "float",
  37724. "default-meaning": "opaque",
  37725. "doc": "The opacity of a line"
  37726. },
  37727. "stroke-linejoin": {
  37728. "css": "line-join",
  37729. "default-value": "miter",
  37730. "type": [
  37731. "miter",
  37732. "round",
  37733. "bevel"
  37734. ],
  37735. "doc": "The behavior of lines when joining"
  37736. },
  37737. "stroke-linecap": {
  37738. "css": "line-cap",
  37739. "default-value": "butt",
  37740. "type": [
  37741. "butt",
  37742. "round",
  37743. "square"
  37744. ],
  37745. "doc": "The display of line endings"
  37746. },
  37747. "stroke-gamma": {
  37748. "css": "line-gamma",
  37749. "type": "float",
  37750. "default-value": 1,
  37751. "default-meaning": "fully antialiased",
  37752. "range": "0-1",
  37753. "doc": "Level of antialiasing of stroke line"
  37754. },
  37755. "stroke-gamma-method": {
  37756. "css": "line-gamma-method",
  37757. "type": [
  37758. "power",
  37759. "linear",
  37760. "none",
  37761. "threshold",
  37762. "multiply"
  37763. ],
  37764. "default-value": "power",
  37765. "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",
  37766. "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"
  37767. },
  37768. "stroke-dasharray": {
  37769. "css": "line-dasharray",
  37770. "type": "numbers",
  37771. "doc": "A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.",
  37772. "default-value": "none",
  37773. "default-meaning": "solid line"
  37774. },
  37775. "stroke-dashoffset": {
  37776. "css": "line-dash-offset",
  37777. "type": "numbers",
  37778. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  37779. "default-value": "none",
  37780. "default-meaning": "solid line"
  37781. },
  37782. "stroke-miterlimit": {
  37783. "css": "line-miterlimit",
  37784. "type": "float",
  37785. "doc": "The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.",
  37786. "default-value": 4.0,
  37787. "default-meaning": "Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"
  37788. },
  37789. "clip": {
  37790. "css": "line-clip",
  37791. "type": "boolean",
  37792. "default-value": true,
  37793. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37794. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  37795. },
  37796. "smooth": {
  37797. "css": "line-smooth",
  37798. "type": "float",
  37799. "default-value": 0,
  37800. "default-meaning": "no smoothing",
  37801. "range": "0-1",
  37802. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  37803. },
  37804. "offset": {
  37805. "css": "line-offset",
  37806. "type": "float",
  37807. "default-value": 0,
  37808. "default-meaning": "no offset",
  37809. "doc": "Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."
  37810. },
  37811. "rasterizer": {
  37812. "css": "line-rasterizer",
  37813. "type": [
  37814. "full",
  37815. "fast"
  37816. ],
  37817. "default-value": "full",
  37818. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  37819. },
  37820. "geometry-transform": {
  37821. "css": "line-geometry-transform",
  37822. "type": "functions",
  37823. "default-value": "none",
  37824. "default-meaning": "geometry will not be transformed",
  37825. "doc": "Allows transformation functions to be applied to the geometry.",
  37826. "functions": [
  37827. ["matrix", 6],
  37828. ["translate", 2],
  37829. ["scale", 2],
  37830. ["rotate", 3],
  37831. ["skewX", 1],
  37832. ["skewY", 1]
  37833. ]
  37834. },
  37835. "comp-op": {
  37836. "css": "line-comp-op",
  37837. "default-value": "src-over",
  37838. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37839. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37840. "type": ["clear",
  37841. "src",
  37842. "dst",
  37843. "src-over",
  37844. "dst-over",
  37845. "src-in",
  37846. "dst-in",
  37847. "src-out",
  37848. "dst-out",
  37849. "src-atop",
  37850. "dst-atop",
  37851. "xor",
  37852. "plus",
  37853. "minus",
  37854. "multiply",
  37855. "screen",
  37856. "overlay",
  37857. "darken",
  37858. "lighten",
  37859. "color-dodge",
  37860. "color-burn",
  37861. "hard-light",
  37862. "soft-light",
  37863. "difference",
  37864. "exclusion",
  37865. "contrast",
  37866. "invert",
  37867. "invert-rgb",
  37868. "grain-merge",
  37869. "grain-extract",
  37870. "hue",
  37871. "saturation",
  37872. "color",
  37873. "value"
  37874. ]
  37875. }
  37876. },
  37877. "markers": {
  37878. "file": {
  37879. "css": "marker-file",
  37880. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  37881. "default-value": "",
  37882. "default-meaning": "An ellipse or circle, if width equals height",
  37883. "type": "uri"
  37884. },
  37885. "opacity": {
  37886. "css": "marker-opacity",
  37887. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  37888. "default-value": 1,
  37889. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  37890. "type": "float"
  37891. },
  37892. "fill-opacity": {
  37893. "css": "marker-fill-opacity",
  37894. "doc": "The fill opacity of the marker",
  37895. "default-value": 1,
  37896. "default-meaning": "opaque",
  37897. "type": "float"
  37898. },
  37899. "stroke": {
  37900. "css": "marker-line-color",
  37901. "doc": "The color of the stroke around a marker shape.",
  37902. "default-value": "black",
  37903. "type": "color"
  37904. },
  37905. "stroke-width": {
  37906. "css": "marker-line-width",
  37907. "doc": "The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",
  37908. "type": "float"
  37909. },
  37910. "stroke-opacity": {
  37911. "css": "marker-line-opacity",
  37912. "default-value": 1,
  37913. "default-meaning": "opaque",
  37914. "doc": "The opacity of a line",
  37915. "type": "float"
  37916. },
  37917. "placement": {
  37918. "css": "marker-placement",
  37919. "type": [
  37920. "point",
  37921. "line",
  37922. "interior"
  37923. ],
  37924. "default-value": "point",
  37925. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  37926. "doc": "Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"
  37927. },
  37928. "multi-policy": {
  37929. "css": "marker-multi-policy",
  37930. "type": [
  37931. "each",
  37932. "whole",
  37933. "largest"
  37934. ],
  37935. "default-value": "each",
  37936. "default-meaning": "If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",
  37937. "doc": "A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."
  37938. },
  37939. "marker-type": {
  37940. "css": "marker-type",
  37941. "type": [
  37942. "arrow",
  37943. "ellipse"
  37944. ],
  37945. "default-value": "ellipse",
  37946. "doc": "The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"
  37947. },
  37948. "width": {
  37949. "css": "marker-width",
  37950. "default-value": 10,
  37951. "doc": "The width of the marker, if using one of the default types.",
  37952. "type": "expression"
  37953. },
  37954. "height": {
  37955. "css": "marker-height",
  37956. "default-value": 10,
  37957. "doc": "The height of the marker, if using one of the default types.",
  37958. "type": "expression"
  37959. },
  37960. "fill": {
  37961. "css": "marker-fill",
  37962. "default-value": "blue",
  37963. "doc": "The color of the area of the marker.",
  37964. "type": "color"
  37965. },
  37966. "allow-overlap": {
  37967. "css": "marker-allow-overlap",
  37968. "type": "boolean",
  37969. "default-value": false,
  37970. "doc": "Control whether overlapping markers are shown or hidden.",
  37971. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  37972. },
  37973. "ignore-placement": {
  37974. "css": "marker-ignore-placement",
  37975. "type": "boolean",
  37976. "default-value": false,
  37977. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  37978. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  37979. },
  37980. "spacing": {
  37981. "css": "marker-spacing",
  37982. "doc": "Space between repeated labels",
  37983. "default-value": 100,
  37984. "type": "float"
  37985. },
  37986. "max-error": {
  37987. "css": "marker-max-error",
  37988. "type": "float",
  37989. "default-value": 0.2,
  37990. "doc": "The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."
  37991. },
  37992. "transform": {
  37993. "css": "marker-transform",
  37994. "type": "functions",
  37995. "functions": [
  37996. ["matrix", 6],
  37997. ["translate", 2],
  37998. ["scale", 2],
  37999. ["rotate", 3],
  38000. ["skewX", 1],
  38001. ["skewY", 1]
  38002. ],
  38003. "default-value": "",
  38004. "default-meaning": "No transformation",
  38005. "doc": "SVG transformation definition"
  38006. },
  38007. "clip": {
  38008. "css": "marker-clip",
  38009. "type": "boolean",
  38010. "default-value": true,
  38011. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38012. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  38013. },
  38014. "smooth": {
  38015. "css": "marker-smooth",
  38016. "type": "float",
  38017. "default-value": 0,
  38018. "default-meaning": "no smoothing",
  38019. "range": "0-1",
  38020. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  38021. },
  38022. "geometry-transform": {
  38023. "css": "marker-geometry-transform",
  38024. "type": "functions",
  38025. "default-value": "none",
  38026. "default-meaning": "geometry will not be transformed",
  38027. "doc": "Allows transformation functions to be applied to the geometry.",
  38028. "functions": [
  38029. ["matrix", 6],
  38030. ["translate", 2],
  38031. ["scale", 2],
  38032. ["rotate", 3],
  38033. ["skewX", 1],
  38034. ["skewY", 1]
  38035. ]
  38036. },
  38037. "comp-op": {
  38038. "css": "marker-comp-op",
  38039. "default-value": "src-over",
  38040. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38041. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38042. "type": ["clear",
  38043. "src",
  38044. "dst",
  38045. "src-over",
  38046. "dst-over",
  38047. "src-in",
  38048. "dst-in",
  38049. "src-out",
  38050. "dst-out",
  38051. "src-atop",
  38052. "dst-atop",
  38053. "xor",
  38054. "plus",
  38055. "minus",
  38056. "multiply",
  38057. "screen",
  38058. "overlay",
  38059. "darken",
  38060. "lighten",
  38061. "color-dodge",
  38062. "color-burn",
  38063. "hard-light",
  38064. "soft-light",
  38065. "difference",
  38066. "exclusion",
  38067. "contrast",
  38068. "invert",
  38069. "invert-rgb",
  38070. "grain-merge",
  38071. "grain-extract",
  38072. "hue",
  38073. "saturation",
  38074. "color",
  38075. "value"
  38076. ]
  38077. }
  38078. },
  38079. "shield": {
  38080. "name": {
  38081. "css": "shield-name",
  38082. "type": "expression",
  38083. "serialization": "content",
  38084. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  38085. },
  38086. "file": {
  38087. "css": "shield-file",
  38088. "required": true,
  38089. "type": "uri",
  38090. "default-value": "none",
  38091. "doc": "Image file to render behind the shield text"
  38092. },
  38093. "face-name": {
  38094. "css": "shield-face-name",
  38095. "type": "string",
  38096. "validate": "font",
  38097. "doc": "Font name and style to use for the shield text",
  38098. "default-value": "",
  38099. "required": true
  38100. },
  38101. "unlock-image": {
  38102. "css": "shield-unlock-image",
  38103. "type": "boolean",
  38104. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  38105. "default-value": false,
  38106. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  38107. },
  38108. "size": {
  38109. "css": "shield-size",
  38110. "type": "float",
  38111. "doc": "The size of the shield text in pixels"
  38112. },
  38113. "fill": {
  38114. "css": "shield-fill",
  38115. "type": "color",
  38116. "doc": "The color of the shield text"
  38117. },
  38118. "placement": {
  38119. "css": "shield-placement",
  38120. "type": [
  38121. "point",
  38122. "line",
  38123. "vertex",
  38124. "interior"
  38125. ],
  38126. "default-value": "point",
  38127. "doc": "How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."
  38128. },
  38129. "avoid-edges": {
  38130. "css": "shield-avoid-edges",
  38131. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  38132. "type": "boolean",
  38133. "default-value": false
  38134. },
  38135. "allow-overlap": {
  38136. "css": "shield-allow-overlap",
  38137. "type": "boolean",
  38138. "default-value": false,
  38139. "doc": "Control whether overlapping shields are shown or hidden.",
  38140. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  38141. },
  38142. "minimum-distance": {
  38143. "css": "shield-min-distance",
  38144. "type": "float",
  38145. "default-value": 0,
  38146. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  38147. },
  38148. "spacing": {
  38149. "css": "shield-spacing",
  38150. "type": "float",
  38151. "default-value": 0,
  38152. "doc": "The spacing between repeated occurrences of the same shield on a line"
  38153. },
  38154. "minimum-padding": {
  38155. "css": "shield-min-padding",
  38156. "default-value": 0,
  38157. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  38158. "type": "float"
  38159. },
  38160. "wrap-width": {
  38161. "css": "shield-wrap-width",
  38162. "type": "unsigned",
  38163. "default-value": 0,
  38164. "doc": "Length of a chunk of text in characters before wrapping text"
  38165. },
  38166. "wrap-before": {
  38167. "css": "shield-wrap-before",
  38168. "type": "boolean",
  38169. "default-value": false,
  38170. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  38171. },
  38172. "wrap-character": {
  38173. "css": "shield-wrap-character",
  38174. "type": "string",
  38175. "default-value": " ",
  38176. "doc": "Use this character instead of a space to wrap long names."
  38177. },
  38178. "halo-fill": {
  38179. "css": "shield-halo-fill",
  38180. "type": "color",
  38181. "default-value": "#FFFFFF",
  38182. "default-meaning": "white",
  38183. "doc": "Specifies the color of the halo around the text."
  38184. },
  38185. "halo-radius": {
  38186. "css": "shield-halo-radius",
  38187. "doc": "Specify the radius of the halo in pixels",
  38188. "default-value": 0,
  38189. "default-meaning": "no halo",
  38190. "type": "float"
  38191. },
  38192. "character-spacing": {
  38193. "css": "shield-character-spacing",
  38194. "type": "unsigned",
  38195. "default-value": 0,
  38196. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  38197. },
  38198. "line-spacing": {
  38199. "css": "shield-line-spacing",
  38200. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  38201. "type": "unsigned"
  38202. },
  38203. "dx": {
  38204. "css": "shield-text-dx",
  38205. "type": "float",
  38206. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  38207. "default-value": 0
  38208. },
  38209. "dy": {
  38210. "css": "shield-text-dy",
  38211. "type": "float",
  38212. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  38213. "default-value": 0
  38214. },
  38215. "shield-dx": {
  38216. "css": "shield-dx",
  38217. "type": "float",
  38218. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  38219. "default-value": 0
  38220. },
  38221. "shield-dy": {
  38222. "css": "shield-dy",
  38223. "type": "float",
  38224. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  38225. "default-value": 0
  38226. },
  38227. "opacity": {
  38228. "css": "shield-opacity",
  38229. "type": "float",
  38230. "doc": "(Default 1.0) - opacity of the image used for the shield",
  38231. "default-value": 1
  38232. },
  38233. "text-opacity": {
  38234. "css": "shield-text-opacity",
  38235. "type": "float",
  38236. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  38237. "default-value": 1
  38238. },
  38239. "horizontal-alignment": {
  38240. "css": "shield-horizontal-alignment",
  38241. "type": [
  38242. "left",
  38243. "middle",
  38244. "right",
  38245. "auto"
  38246. ],
  38247. "doc": "The shield's horizontal alignment from its centerpoint",
  38248. "default-value": "auto"
  38249. },
  38250. "vertical-alignment": {
  38251. "css": "shield-vertical-alignment",
  38252. "type": [
  38253. "top",
  38254. "middle",
  38255. "bottom",
  38256. "auto"
  38257. ],
  38258. "doc": "The shield's vertical alignment from its centerpoint",
  38259. "default-value": "middle"
  38260. },
  38261. "text-transform": {
  38262. "css": "shield-text-transform",
  38263. "type": [
  38264. "none",
  38265. "uppercase",
  38266. "lowercase",
  38267. "capitalize"
  38268. ],
  38269. "doc": "Transform the case of the characters",
  38270. "default-value": "none"
  38271. },
  38272. "justify-alignment": {
  38273. "css": "shield-justify-alignment",
  38274. "type": [
  38275. "left",
  38276. "center",
  38277. "right",
  38278. "auto"
  38279. ],
  38280. "doc": "Define how text in a shield's label is justified",
  38281. "default-value": "auto"
  38282. },
  38283. "clip": {
  38284. "css": "shield-clip",
  38285. "type": "boolean",
  38286. "default-value": true,
  38287. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38288. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  38289. },
  38290. "comp-op": {
  38291. "css": "shield-comp-op",
  38292. "default-value": "src-over",
  38293. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38294. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38295. "type": ["clear",
  38296. "src",
  38297. "dst",
  38298. "src-over",
  38299. "dst-over",
  38300. "src-in",
  38301. "dst-in",
  38302. "src-out",
  38303. "dst-out",
  38304. "src-atop",
  38305. "dst-atop",
  38306. "xor",
  38307. "plus",
  38308. "minus",
  38309. "multiply",
  38310. "screen",
  38311. "overlay",
  38312. "darken",
  38313. "lighten",
  38314. "color-dodge",
  38315. "color-burn",
  38316. "hard-light",
  38317. "soft-light",
  38318. "difference",
  38319. "exclusion",
  38320. "contrast",
  38321. "invert",
  38322. "invert-rgb",
  38323. "grain-merge",
  38324. "grain-extract",
  38325. "hue",
  38326. "saturation",
  38327. "color",
  38328. "value"
  38329. ]
  38330. }
  38331. },
  38332. "line-pattern": {
  38333. "file": {
  38334. "css": "line-pattern-file",
  38335. "type": "uri",
  38336. "default-value": "none",
  38337. "required": true,
  38338. "doc": "An image file to be repeated and warped along a line"
  38339. },
  38340. "clip": {
  38341. "css": "line-pattern-clip",
  38342. "type": "boolean",
  38343. "default-value": true,
  38344. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38345. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  38346. },
  38347. "smooth": {
  38348. "css": "line-pattern-smooth",
  38349. "type": "float",
  38350. "default-value": 0,
  38351. "default-meaning": "no smoothing",
  38352. "range": "0-1",
  38353. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  38354. },
  38355. "geometry-transform": {
  38356. "css": "line-pattern-geometry-transform",
  38357. "type": "functions",
  38358. "default-value": "none",
  38359. "default-meaning": "geometry will not be transformed",
  38360. "doc": "Allows transformation functions to be applied to the geometry.",
  38361. "functions": [
  38362. ["matrix", 6],
  38363. ["translate", 2],
  38364. ["scale", 2],
  38365. ["rotate", 3],
  38366. ["skewX", 1],
  38367. ["skewY", 1]
  38368. ]
  38369. },
  38370. "comp-op": {
  38371. "css": "line-pattern-comp-op",
  38372. "default-value": "src-over",
  38373. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38374. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38375. "type": ["clear",
  38376. "src",
  38377. "dst",
  38378. "src-over",
  38379. "dst-over",
  38380. "src-in",
  38381. "dst-in",
  38382. "src-out",
  38383. "dst-out",
  38384. "src-atop",
  38385. "dst-atop",
  38386. "xor",
  38387. "plus",
  38388. "minus",
  38389. "multiply",
  38390. "screen",
  38391. "overlay",
  38392. "darken",
  38393. "lighten",
  38394. "color-dodge",
  38395. "color-burn",
  38396. "hard-light",
  38397. "soft-light",
  38398. "difference",
  38399. "exclusion",
  38400. "contrast",
  38401. "invert",
  38402. "invert-rgb",
  38403. "grain-merge",
  38404. "grain-extract",
  38405. "hue",
  38406. "saturation",
  38407. "color",
  38408. "value"
  38409. ]
  38410. }
  38411. },
  38412. "polygon-pattern": {
  38413. "file": {
  38414. "css": "polygon-pattern-file",
  38415. "type": "uri",
  38416. "default-value": "none",
  38417. "required": true,
  38418. "doc": "Image to use as a repeated pattern fill within a polygon"
  38419. },
  38420. "alignment": {
  38421. "css": "polygon-pattern-alignment",
  38422. "type": [
  38423. "local",
  38424. "global"
  38425. ],
  38426. "default-value": "local",
  38427. "doc": "Specify whether to align pattern fills to the layer or to the map."
  38428. },
  38429. "gamma": {
  38430. "css": "polygon-pattern-gamma",
  38431. "type": "float",
  38432. "default-value": 1,
  38433. "default-meaning": "fully antialiased",
  38434. "range": "0-1",
  38435. "doc": "Level of antialiasing of polygon pattern edges"
  38436. },
  38437. "opacity": {
  38438. "css": "polygon-pattern-opacity",
  38439. "type": "float",
  38440. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  38441. "default-value": 1,
  38442. "default-meaning": "The image is rendered without modifications"
  38443. },
  38444. "clip": {
  38445. "css": "polygon-pattern-clip",
  38446. "type": "boolean",
  38447. "default-value": true,
  38448. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38449. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  38450. },
  38451. "smooth": {
  38452. "css": "polygon-pattern-smooth",
  38453. "type": "float",
  38454. "default-value": 0,
  38455. "default-meaning": "no smoothing",
  38456. "range": "0-1",
  38457. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  38458. },
  38459. "geometry-transform": {
  38460. "css": "polygon-pattern-geometry-transform",
  38461. "type": "functions",
  38462. "default-value": "none",
  38463. "default-meaning": "geometry will not be transformed",
  38464. "doc": "Allows transformation functions to be applied to the geometry.",
  38465. "functions": [
  38466. ["matrix", 6],
  38467. ["translate", 2],
  38468. ["scale", 2],
  38469. ["rotate", 3],
  38470. ["skewX", 1],
  38471. ["skewY", 1]
  38472. ]
  38473. },
  38474. "comp-op": {
  38475. "css": "polygon-pattern-comp-op",
  38476. "default-value": "src-over",
  38477. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38478. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38479. "type": ["clear",
  38480. "src",
  38481. "dst",
  38482. "src-over",
  38483. "dst-over",
  38484. "src-in",
  38485. "dst-in",
  38486. "src-out",
  38487. "dst-out",
  38488. "src-atop",
  38489. "dst-atop",
  38490. "xor",
  38491. "plus",
  38492. "minus",
  38493. "multiply",
  38494. "screen",
  38495. "overlay",
  38496. "darken",
  38497. "lighten",
  38498. "color-dodge",
  38499. "color-burn",
  38500. "hard-light",
  38501. "soft-light",
  38502. "difference",
  38503. "exclusion",
  38504. "contrast",
  38505. "invert",
  38506. "invert-rgb",
  38507. "grain-merge",
  38508. "grain-extract",
  38509. "hue",
  38510. "saturation",
  38511. "color",
  38512. "value"
  38513. ]
  38514. }
  38515. },
  38516. "raster": {
  38517. "opacity": {
  38518. "css": "raster-opacity",
  38519. "default-value": 1,
  38520. "default-meaning": "opaque",
  38521. "type": "float",
  38522. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  38523. },
  38524. "filter-factor": {
  38525. "css": "raster-filter-factor",
  38526. "default-value": -1,
  38527. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  38528. "type": "float",
  38529. "doc": "This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."
  38530. },
  38531. "scaling": {
  38532. "css": "raster-scaling",
  38533. "type": [
  38534. "near",
  38535. "fast",
  38536. "bilinear",
  38537. "bilinear8",
  38538. "bicubic",
  38539. "spline16",
  38540. "spline36",
  38541. "hanning",
  38542. "hamming",
  38543. "hermite",
  38544. "kaiser",
  38545. "quadric",
  38546. "catrom",
  38547. "gaussian",
  38548. "bessel",
  38549. "mitchell",
  38550. "sinc",
  38551. "lanczos",
  38552. "blackman"
  38553. ],
  38554. "default-value": "near",
  38555. "doc": "The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."
  38556. },
  38557. "mesh-size": {
  38558. "css": "raster-mesh-size",
  38559. "default-value": 16,
  38560. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  38561. "type": "unsigned",
  38562. "doc": "A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."
  38563. },
  38564. "comp-op": {
  38565. "css": "raster-comp-op",
  38566. "default-value": "src-over",
  38567. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38568. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38569. "type": ["clear",
  38570. "src",
  38571. "dst",
  38572. "src-over",
  38573. "dst-over",
  38574. "src-in",
  38575. "dst-in",
  38576. "src-out",
  38577. "dst-out",
  38578. "src-atop",
  38579. "dst-atop",
  38580. "xor",
  38581. "plus",
  38582. "minus",
  38583. "multiply",
  38584. "screen",
  38585. "overlay",
  38586. "darken",
  38587. "lighten",
  38588. "color-dodge",
  38589. "color-burn",
  38590. "hard-light",
  38591. "soft-light",
  38592. "difference",
  38593. "exclusion",
  38594. "contrast",
  38595. "invert",
  38596. "invert-rgb",
  38597. "grain-merge",
  38598. "grain-extract",
  38599. "hue",
  38600. "saturation",
  38601. "color",
  38602. "value"
  38603. ]
  38604. }
  38605. },
  38606. "point": {
  38607. "file": {
  38608. "css": "point-file",
  38609. "type": "uri",
  38610. "required": false,
  38611. "default-value": "none",
  38612. "doc": "Image file to represent a point"
  38613. },
  38614. "allow-overlap": {
  38615. "css": "point-allow-overlap",
  38616. "type": "boolean",
  38617. "default-value": false,
  38618. "doc": "Control whether overlapping points are shown or hidden.",
  38619. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  38620. },
  38621. "ignore-placement": {
  38622. "css": "point-ignore-placement",
  38623. "type": "boolean",
  38624. "default-value": false,
  38625. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  38626. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  38627. },
  38628. "opacity": {
  38629. "css": "point-opacity",
  38630. "type": "float",
  38631. "default-value": 1.0,
  38632. "default-meaning": "Fully opaque",
  38633. "doc": "A value from 0 to 1 to control the opacity of the point"
  38634. },
  38635. "placement": {
  38636. "css": "point-placement",
  38637. "type": [
  38638. "centroid",
  38639. "interior"
  38640. ],
  38641. "doc": "How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.",
  38642. "default-value": "centroid"
  38643. },
  38644. "transform": {
  38645. "css": "point-transform",
  38646. "type": "functions",
  38647. "functions": [
  38648. ["matrix", 6],
  38649. ["translate", 2],
  38650. ["scale", 2],
  38651. ["rotate", 3],
  38652. ["skewX", 1],
  38653. ["skewY", 1]
  38654. ],
  38655. "default-value": "",
  38656. "default-meaning": "No transformation",
  38657. "doc": "SVG transformation definition"
  38658. },
  38659. "comp-op": {
  38660. "css": "point-comp-op",
  38661. "default-value": "src-over",
  38662. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38663. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38664. "type": ["clear",
  38665. "src",
  38666. "dst",
  38667. "src-over",
  38668. "dst-over",
  38669. "src-in",
  38670. "dst-in",
  38671. "src-out",
  38672. "dst-out",
  38673. "src-atop",
  38674. "dst-atop",
  38675. "xor",
  38676. "plus",
  38677. "minus",
  38678. "multiply",
  38679. "screen",
  38680. "overlay",
  38681. "darken",
  38682. "lighten",
  38683. "color-dodge",
  38684. "color-burn",
  38685. "hard-light",
  38686. "soft-light",
  38687. "difference",
  38688. "exclusion",
  38689. "contrast",
  38690. "invert",
  38691. "invert-rgb",
  38692. "grain-merge",
  38693. "grain-extract",
  38694. "hue",
  38695. "saturation",
  38696. "color",
  38697. "value"
  38698. ]
  38699. }
  38700. },
  38701. "text": {
  38702. "name": {
  38703. "css": "text-name",
  38704. "type": "expression",
  38705. "required": true,
  38706. "default-value": "",
  38707. "serialization": "content",
  38708. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  38709. },
  38710. "face-name": {
  38711. "css": "text-face-name",
  38712. "type": "string",
  38713. "validate": "font",
  38714. "doc": "Font name and style to render a label in",
  38715. "required": true
  38716. },
  38717. "size": {
  38718. "css": "text-size",
  38719. "type": "float",
  38720. "default-value": 10,
  38721. "doc": "Text size in pixels"
  38722. },
  38723. "text-ratio": {
  38724. "css": "text-ratio",
  38725. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  38726. "default-value": 0,
  38727. "type": "unsigned"
  38728. },
  38729. "wrap-width": {
  38730. "css": "text-wrap-width",
  38731. "doc": "Length of a chunk of text in characters before wrapping text",
  38732. "default-value": 0,
  38733. "type": "unsigned"
  38734. },
  38735. "wrap-before": {
  38736. "css": "text-wrap-before",
  38737. "type": "boolean",
  38738. "default-value": false,
  38739. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  38740. },
  38741. "wrap-character": {
  38742. "css": "text-wrap-character",
  38743. "type": "string",
  38744. "default-value": " ",
  38745. "doc": "Use this character instead of a space to wrap long text."
  38746. },
  38747. "spacing": {
  38748. "css": "text-spacing",
  38749. "type": "unsigned",
  38750. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  38751. },
  38752. "character-spacing": {
  38753. "css": "text-character-spacing",
  38754. "type": "float",
  38755. "default-value": 0,
  38756. "doc": "Horizontal spacing adjustment between characters in pixels"
  38757. },
  38758. "line-spacing": {
  38759. "css": "text-line-spacing",
  38760. "default-value": 0,
  38761. "type": "unsigned",
  38762. "doc": "Vertical spacing adjustment between lines in pixels"
  38763. },
  38764. "label-position-tolerance": {
  38765. "css": "text-label-position-tolerance",
  38766. "default-value": 0,
  38767. "type": "unsigned",
  38768. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  38769. },
  38770. "max-char-angle-delta": {
  38771. "css": "text-max-char-angle-delta",
  38772. "type": "float",
  38773. "default-value": "22.5",
  38774. "doc": "The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."
  38775. },
  38776. "fill": {
  38777. "css": "text-fill",
  38778. "doc": "Specifies the color for the text",
  38779. "default-value": "#000000",
  38780. "type": "color"
  38781. },
  38782. "opacity": {
  38783. "css": "text-opacity",
  38784. "doc": "A number from 0 to 1 specifying the opacity for the text",
  38785. "default-value": 1.0,
  38786. "default-meaning": "Fully opaque",
  38787. "type": "float"
  38788. },
  38789. "halo-fill": {
  38790. "css": "text-halo-fill",
  38791. "type": "color",
  38792. "default-value": "#FFFFFF",
  38793. "default-meaning": "white",
  38794. "doc": "Specifies the color of the halo around the text."
  38795. },
  38796. "halo-radius": {
  38797. "css": "text-halo-radius",
  38798. "doc": "Specify the radius of the halo in pixels",
  38799. "default-value": 0,
  38800. "default-meaning": "no halo",
  38801. "type": "float"
  38802. },
  38803. "dx": {
  38804. "css": "text-dx",
  38805. "type": "float",
  38806. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  38807. "default-value": 0
  38808. },
  38809. "dy": {
  38810. "css": "text-dy",
  38811. "type": "float",
  38812. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  38813. "default-value": 0
  38814. },
  38815. "vertical-alignment": {
  38816. "css": "text-vertical-alignment",
  38817. "type": [
  38818. "top",
  38819. "middle",
  38820. "bottom",
  38821. "auto"
  38822. ],
  38823. "doc": "Position of label relative to point position.",
  38824. "default-value": "auto",
  38825. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  38826. },
  38827. "avoid-edges": {
  38828. "css": "text-avoid-edges",
  38829. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  38830. "default-value": false,
  38831. "type": "boolean"
  38832. },
  38833. "minimum-distance": {
  38834. "css": "text-min-distance",
  38835. "doc": "Minimum permitted distance to the next text symbolizer.",
  38836. "type": "float"
  38837. },
  38838. "minimum-padding": {
  38839. "css": "text-min-padding",
  38840. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  38841. "type": "float"
  38842. },
  38843. "minimum-path-length": {
  38844. "css": "text-min-path-length",
  38845. "type": "float",
  38846. "default-value": 0,
  38847. "default-meaning": "place labels on all paths",
  38848. "doc": "Place labels only on paths longer than this value."
  38849. },
  38850. "allow-overlap": {
  38851. "css": "text-allow-overlap",
  38852. "type": "boolean",
  38853. "default-value": false,
  38854. "doc": "Control whether overlapping text is shown or hidden.",
  38855. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  38856. },
  38857. "orientation": {
  38858. "css": "text-orientation",
  38859. "type": "expression",
  38860. "doc": "Rotate the text."
  38861. },
  38862. "placement": {
  38863. "css": "text-placement",
  38864. "type": [
  38865. "point",
  38866. "line",
  38867. "vertex",
  38868. "interior"
  38869. ],
  38870. "default-value": "point",
  38871. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  38872. },
  38873. "placement-type": {
  38874. "css": "text-placement-type",
  38875. "doc": "Re-position and/or re-size text to avoid overlaps. \"simple\" for basic algorithm (using text-placements string,) \"dummy\" to turn this feature off.",
  38876. "type": [
  38877. "dummy",
  38878. "simple"
  38879. ],
  38880. "default-value": "dummy"
  38881. },
  38882. "placements": {
  38883. "css": "text-placements",
  38884. "type": "string",
  38885. "default-value": "",
  38886. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  38887. },
  38888. "text-transform": {
  38889. "css": "text-transform",
  38890. "type": [
  38891. "none",
  38892. "uppercase",
  38893. "lowercase",
  38894. "capitalize"
  38895. ],
  38896. "doc": "Transform the case of the characters",
  38897. "default-value": "none"
  38898. },
  38899. "horizontal-alignment": {
  38900. "css": "text-horizontal-alignment",
  38901. "type": [
  38902. "left",
  38903. "middle",
  38904. "right",
  38905. "auto"
  38906. ],
  38907. "doc": "The text's horizontal alignment from its centerpoint",
  38908. "default-value": "auto"
  38909. },
  38910. "justify-alignment": {
  38911. "css": "text-align",
  38912. "type": [
  38913. "left",
  38914. "right",
  38915. "center",
  38916. "auto"
  38917. ],
  38918. "doc": "Define how text is justified",
  38919. "default-value": "auto",
  38920. "default-meaning": "Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"
  38921. },
  38922. "clip": {
  38923. "css": "text-clip",
  38924. "type": "boolean",
  38925. "default-value": true,
  38926. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38927. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  38928. },
  38929. "comp-op": {
  38930. "css": "text-comp-op",
  38931. "default-value": "src-over",
  38932. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38933. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38934. "type": ["clear",
  38935. "src",
  38936. "dst",
  38937. "src-over",
  38938. "dst-over",
  38939. "src-in",
  38940. "dst-in",
  38941. "src-out",
  38942. "dst-out",
  38943. "src-atop",
  38944. "dst-atop",
  38945. "xor",
  38946. "plus",
  38947. "minus",
  38948. "multiply",
  38949. "screen",
  38950. "overlay",
  38951. "darken",
  38952. "lighten",
  38953. "color-dodge",
  38954. "color-burn",
  38955. "hard-light",
  38956. "soft-light",
  38957. "difference",
  38958. "exclusion",
  38959. "contrast",
  38960. "invert",
  38961. "invert-rgb",
  38962. "grain-merge",
  38963. "grain-extract",
  38964. "hue",
  38965. "saturation",
  38966. "color",
  38967. "value"
  38968. ]
  38969. }
  38970. },
  38971. "building": {
  38972. "fill": {
  38973. "css": "building-fill",
  38974. "default-value": "#FFFFFF",
  38975. "doc": "The color of the buildings walls.",
  38976. "type": "color"
  38977. },
  38978. "fill-opacity": {
  38979. "css": "building-fill-opacity",
  38980. "type": "float",
  38981. "doc": "The opacity of the building as a whole, including all walls.",
  38982. "default-value": 1
  38983. },
  38984. "height": {
  38985. "css": "building-height",
  38986. "doc": "The height of the building in pixels.",
  38987. "type": "expression",
  38988. "default-value": "0"
  38989. }
  38990. }
  38991. },
  38992. "colors": {
  38993. "aliceblue": [240, 248, 255],
  38994. "antiquewhite": [250, 235, 215],
  38995. "aqua": [0, 255, 255],
  38996. "aquamarine": [127, 255, 212],
  38997. "azure": [240, 255, 255],
  38998. "beige": [245, 245, 220],
  38999. "bisque": [255, 228, 196],
  39000. "black": [0, 0, 0],
  39001. "blanchedalmond": [255, 235, 205],
  39002. "blue": [0, 0, 255],
  39003. "blueviolet": [138, 43, 226],
  39004. "brown": [165, 42, 42],
  39005. "burlywood": [222, 184, 135],
  39006. "cadetblue": [95, 158, 160],
  39007. "chartreuse": [127, 255, 0],
  39008. "chocolate": [210, 105, 30],
  39009. "coral": [255, 127, 80],
  39010. "cornflowerblue": [100, 149, 237],
  39011. "cornsilk": [255, 248, 220],
  39012. "crimson": [220, 20, 60],
  39013. "cyan": [0, 255, 255],
  39014. "darkblue": [0, 0, 139],
  39015. "darkcyan": [0, 139, 139],
  39016. "darkgoldenrod": [184, 134, 11],
  39017. "darkgray": [169, 169, 169],
  39018. "darkgreen": [0, 100, 0],
  39019. "darkgrey": [169, 169, 169],
  39020. "darkkhaki": [189, 183, 107],
  39021. "darkmagenta": [139, 0, 139],
  39022. "darkolivegreen": [85, 107, 47],
  39023. "darkorange": [255, 140, 0],
  39024. "darkorchid": [153, 50, 204],
  39025. "darkred": [139, 0, 0],
  39026. "darksalmon": [233, 150, 122],
  39027. "darkseagreen": [143, 188, 143],
  39028. "darkslateblue": [72, 61, 139],
  39029. "darkslategrey": [47, 79, 79],
  39030. "darkturquoise": [0, 206, 209],
  39031. "darkviolet": [148, 0, 211],
  39032. "deeppink": [255, 20, 147],
  39033. "deepskyblue": [0, 191, 255],
  39034. "dimgray": [105, 105, 105],
  39035. "dimgrey": [105, 105, 105],
  39036. "dodgerblue": [30, 144, 255],
  39037. "firebrick": [178, 34, 34],
  39038. "floralwhite": [255, 250, 240],
  39039. "forestgreen": [34, 139, 34],
  39040. "fuchsia": [255, 0, 255],
  39041. "gainsboro": [220, 220, 220],
  39042. "ghostwhite": [248, 248, 255],
  39043. "gold": [255, 215, 0],
  39044. "goldenrod": [218, 165, 32],
  39045. "gray": [128, 128, 128],
  39046. "grey": [128, 128, 128],
  39047. "green": [0, 128, 0],
  39048. "greenyellow": [173, 255, 47],
  39049. "honeydew": [240, 255, 240],
  39050. "hotpink": [255, 105, 180],
  39051. "indianred": [205, 92, 92],
  39052. "indigo": [75, 0, 130],
  39053. "ivory": [255, 255, 240],
  39054. "khaki": [240, 230, 140],
  39055. "lavender": [230, 230, 250],
  39056. "lavenderblush": [255, 240, 245],
  39057. "lawngreen": [124, 252, 0],
  39058. "lemonchiffon": [255, 250, 205],
  39059. "lightblue": [173, 216, 230],
  39060. "lightcoral": [240, 128, 128],
  39061. "lightcyan": [224, 255, 255],
  39062. "lightgoldenrodyellow": [250, 250, 210],
  39063. "lightgray": [211, 211, 211],
  39064. "lightgreen": [144, 238, 144],
  39065. "lightgrey": [211, 211, 211],
  39066. "lightpink": [255, 182, 193],
  39067. "lightsalmon": [255, 160, 122],
  39068. "lightseagreen": [32, 178, 170],
  39069. "lightskyblue": [135, 206, 250],
  39070. "lightslategray": [119, 136, 153],
  39071. "lightslategrey": [119, 136, 153],
  39072. "lightsteelblue": [176, 196, 222],
  39073. "lightyellow": [255, 255, 224],
  39074. "lime": [0, 255, 0],
  39075. "limegreen": [50, 205, 50],
  39076. "linen": [250, 240, 230],
  39077. "magenta": [255, 0, 255],
  39078. "maroon": [128, 0, 0],
  39079. "mediumaquamarine": [102, 205, 170],
  39080. "mediumblue": [0, 0, 205],
  39081. "mediumorchid": [186, 85, 211],
  39082. "mediumpurple": [147, 112, 219],
  39083. "mediumseagreen": [60, 179, 113],
  39084. "mediumslateblue": [123, 104, 238],
  39085. "mediumspringgreen": [0, 250, 154],
  39086. "mediumturquoise": [72, 209, 204],
  39087. "mediumvioletred": [199, 21, 133],
  39088. "midnightblue": [25, 25, 112],
  39089. "mintcream": [245, 255, 250],
  39090. "mistyrose": [255, 228, 225],
  39091. "moccasin": [255, 228, 181],
  39092. "navajowhite": [255, 222, 173],
  39093. "navy": [0, 0, 128],
  39094. "oldlace": [253, 245, 230],
  39095. "olive": [128, 128, 0],
  39096. "olivedrab": [107, 142, 35],
  39097. "orange": [255, 165, 0],
  39098. "orangered": [255, 69, 0],
  39099. "orchid": [218, 112, 214],
  39100. "palegoldenrod": [238, 232, 170],
  39101. "palegreen": [152, 251, 152],
  39102. "paleturquoise": [175, 238, 238],
  39103. "palevioletred": [219, 112, 147],
  39104. "papayawhip": [255, 239, 213],
  39105. "peachpuff": [255, 218, 185],
  39106. "peru": [205, 133, 63],
  39107. "pink": [255, 192, 203],
  39108. "plum": [221, 160, 221],
  39109. "powderblue": [176, 224, 230],
  39110. "purple": [128, 0, 128],
  39111. "red": [255, 0, 0],
  39112. "rosybrown": [188, 143, 143],
  39113. "royalblue": [65, 105, 225],
  39114. "saddlebrown": [139, 69, 19],
  39115. "salmon": [250, 128, 114],
  39116. "sandybrown": [244, 164, 96],
  39117. "seagreen": [46, 139, 87],
  39118. "seashell": [255, 245, 238],
  39119. "sienna": [160, 82, 45],
  39120. "silver": [192, 192, 192],
  39121. "skyblue": [135, 206, 235],
  39122. "slateblue": [106, 90, 205],
  39123. "slategray": [112, 128, 144],
  39124. "slategrey": [112, 128, 144],
  39125. "snow": [255, 250, 250],
  39126. "springgreen": [0, 255, 127],
  39127. "steelblue": [70, 130, 180],
  39128. "tan": [210, 180, 140],
  39129. "teal": [0, 128, 128],
  39130. "thistle": [216, 191, 216],
  39131. "tomato": [255, 99, 71],
  39132. "turquoise": [64, 224, 208],
  39133. "violet": [238, 130, 238],
  39134. "wheat": [245, 222, 179],
  39135. "white": [255, 255, 255],
  39136. "whitesmoke": [245, 245, 245],
  39137. "yellow": [255, 255, 0],
  39138. "yellowgreen": [154, 205, 50],
  39139. "transparent": [0, 0, 0, 0]
  39140. },
  39141. "filter": {
  39142. "value": [
  39143. "true",
  39144. "false",
  39145. "null",
  39146. "point",
  39147. "linestring",
  39148. "polygon",
  39149. "collection"
  39150. ]
  39151. }
  39152. };
  39153. CartoCSS_CartoCSS['mapnik_reference'] = {
  39154. version: {
  39155. latest: SuperMap._mapnik_reference_latest,
  39156. '2.1.1': SuperMap._mapnik_reference_latest
  39157. }
  39158. };
  39159. SuperMap.CartoCSS = CartoCSS_CartoCSS;
  39160. SuperMap.CartoCSS.Tree = {};
  39161. SuperMap.CartoCSS.Tree.operate = function(op, a, b) {
  39162. switch (op) {
  39163. case '+': return a + b;
  39164. case '-': return a - b;
  39165. case '*': return a * b;
  39166. case '%': return a % b;
  39167. case '/': return a / b;
  39168. }
  39169. };
  39170. SuperMap.CartoCSS.Tree.functions = {
  39171. rgb: function (r, g, b) {
  39172. return this.rgba(r, g, b, 1.0);
  39173. },
  39174. rgba: function (r, g, b, a) {
  39175. var me = this;
  39176. var rgb = [r, g, b].map(function (c) {
  39177. return me.number(c);
  39178. });
  39179. a = me.number(a);
  39180. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  39181. return new SuperMap.CartoCSS.Tree.Color(rgb, a);
  39182. },
  39183. // Only require val
  39184. stop: function (val) {
  39185. var color, mode;
  39186. if (arguments.length > 1) {color = arguments[1];}
  39187. if (arguments.length > 2) {mode = arguments[2];}
  39188. return {
  39189. is: 'tag',
  39190. val: val,
  39191. color: color,
  39192. mode: mode,
  39193. toString(env) {
  39194. return '\n\t<stop value="' + val.ev(env) + '"' +
  39195. (color ? ' color="' + color.ev(env) + '" ' : '') +
  39196. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  39197. '/>';
  39198. }
  39199. };
  39200. },
  39201. hsl: function (h, s, l) {
  39202. return this.hsla(h, s, l, 1.0);
  39203. },
  39204. hsla: function (h, s, l, a) {
  39205. h = (this.number(h) % 360) / 360;
  39206. s = this.number(s);
  39207. l = this.number(l);
  39208. a = this.number(a);
  39209. if ([h, s, l, a].some(isNaN)) {return null;}
  39210. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  39211. m1 = l * 2 - m2;
  39212. return this.rgba(hue(h + 1 / 3) * 255,
  39213. hue(h) * 255,
  39214. hue(h - 1 / 3) * 255,
  39215. a);
  39216. function hue(h) {
  39217. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  39218. if (h * 6 < 1) {return m1 + (m2 - m1) * h * 6;} else if (h * 2 < 1) {return m2;} else if (h * 3 < 2) {return m1 + (m2 - m1) * (2 / 3 - h) * 6;} else {return m1;}
  39219. }
  39220. },
  39221. hue: function (color) {
  39222. if (!('toHSL' in color)) {return null;}
  39223. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  39224. },
  39225. saturation: function (color) {
  39226. if (!('toHSL' in color)) {return null;}
  39227. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  39228. },
  39229. lightness: function (color) {
  39230. if (!('toHSL' in color)) {return null;}
  39231. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  39232. },
  39233. alpha: function (color) {
  39234. if (!('toHSL' in color)) {return null;}
  39235. return new SuperMap.CartoCSS.Tree.Dimension(color.toHSL().a);
  39236. },
  39237. saturate: function (color, amount) {
  39238. if (!('toHSL' in color)) {return null;}
  39239. var hsl = color.toHSL();
  39240. hsl.s += amount.value / 100;
  39241. hsl.s = this.clamp(hsl.s);
  39242. return this.hsla_simple(hsl);
  39243. },
  39244. desaturate: function (color, amount) {
  39245. if (!('toHSL' in color)) {return null;}
  39246. var hsl = color.toHSL();
  39247. hsl.s -= amount.value / 100;
  39248. hsl.s = this.clamp(hsl.s);
  39249. return this.hsla_simple(hsl);
  39250. },
  39251. lighten: function (color, amount) {
  39252. if (!('toHSL' in color)) {return null;}
  39253. var hsl = color.toHSL();
  39254. hsl.l += amount.value / 100;
  39255. hsl.l = this.clamp(hsl.l);
  39256. return this.hsla_simple(hsl);
  39257. },
  39258. darken: function (color, amount) {
  39259. if (!('toHSL' in color)) {return null;}
  39260. var hsl = color.toHSL();
  39261. hsl.l -= amount.value / 100;
  39262. hsl.l = this.clamp(hsl.l);
  39263. return this.hsla_simple(hsl);
  39264. },
  39265. fadein: function (color, amount) {
  39266. if (!('toHSL' in color)) {return null;}
  39267. var hsl = color.toHSL();
  39268. hsl.a += amount.value / 100;
  39269. hsl.a = this.clamp(hsl.a);
  39270. return this.hsla_simple(hsl);
  39271. },
  39272. fadeout: function (color, amount) {
  39273. if (!('toHSL' in color)) {return null;}
  39274. var hsl = color.toHSL();
  39275. hsl.a -= amount.value / 100;
  39276. hsl.a = this.clamp(hsl.a);
  39277. return this.hsla_simple(hsl);
  39278. },
  39279. spin: function (color, amount) {
  39280. if (!('toHSL' in color)) {return null;}
  39281. var hsl = color.toHSL();
  39282. var hue = (hsl.h + amount.value) % 360;
  39283. hsl.h = hue < 0 ? 360 + hue : hue;
  39284. return this.hsla_simple(hsl);
  39285. },
  39286. replace: function (entity, a, b) {
  39287. if (entity.is === 'field') {
  39288. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  39289. } else {
  39290. return entity.replace(a, b);
  39291. }
  39292. },
  39293. //
  39294. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  39295. // http://sass-lang.com
  39296. //
  39297. mix: function (color1, color2, weight) {
  39298. var p = weight.value / 100.0;
  39299. var w = p * 2 - 1;
  39300. var a = color1.toHSL().a - color2.toHSL().a;
  39301. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  39302. var w2 = 1 - w1;
  39303. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  39304. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  39305. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  39306. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  39307. return new SuperMap.CartoCSS.Tree.Color(rgb, alpha);
  39308. },
  39309. greyscale: function (color) {
  39310. return this.desaturate(color, new SuperMap.CartoCSS.Tree.Dimension(100));
  39311. },
  39312. '%': function (quoted /* arg, arg, ...*/) {
  39313. var args = Array.prototype.slice.call(arguments, 1),
  39314. str = quoted.value;
  39315. for (var i = 0; i < args.length; i++) {
  39316. str = str.replace(/%s/, args[i].value)
  39317. .replace(/%[da]/, args[i].toString());
  39318. }
  39319. str = str.replace(/%%/g, '%');
  39320. return new SuperMap.CartoCSS.Tree.Quoted(str);
  39321. },
  39322. hsla_simple: function (h) {
  39323. return this.hsla(h.h, h.s, h.l, h.a);
  39324. },
  39325. number: function (n) {
  39326. if (n instanceof SuperMap.CartoCSS.Tree.Dimension) {
  39327. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  39328. } else if (typeof(n) === 'number') {
  39329. return n;
  39330. } else {
  39331. return NaN;
  39332. }
  39333. },
  39334. clamp: function (val) {
  39335. return Math.min(1, Math.max(0, val));
  39336. }
  39337. };
  39338. SuperMap.CartoCSS.Tree.Call = class Call {
  39339. constructor(name, args, index) {
  39340. this.is = 'call';
  39341. this.name = name;
  39342. this.args = args;
  39343. this.index = index;
  39344. }
  39345. // When evuating a function call,
  39346. // we either find the function in `tree.functions` [1],
  39347. // in which case we call it, passing the evaluated arguments,
  39348. // or we simply print it out as it appeared originally [2].
  39349. // The *functions.js* file contains the built-in functions.
  39350. // The reason why we evaluate the arguments, is in the case where
  39351. // we try to pass a variable to a function, like: `saturate(@color)`.
  39352. // The function should receive the value, not the variable.
  39353. 'ev'(env) {
  39354. var args = this.args.map(function (a) {
  39355. return a.ev(env);
  39356. });
  39357. for (var i = 0; i < args.length; i++) {
  39358. if (args[i].is === 'undefined') {
  39359. return {
  39360. is: 'undefined',
  39361. value: 'undefined'
  39362. };
  39363. }
  39364. }
  39365. if (this.name in SuperMap.CartoCSS.Tree.functions) {
  39366. if (SuperMap.CartoCSS.Tree.functions[this.name].length <= args.length) {
  39367. var val = SuperMap.CartoCSS.Tree.functions[this.name].apply(SuperMap.CartoCSS.Tree.functions, args);
  39368. if (val === null) {
  39369. env.error({
  39370. message: 'incorrect arguments given to ' + this.name + '()',
  39371. index: this.index,
  39372. type: 'runtime',
  39373. filename: this.filename
  39374. });
  39375. return {is: 'undefined', value: 'undefined'};
  39376. }
  39377. return val;
  39378. } else {
  39379. env.error({
  39380. message: 'incorrect number of arguments for ' + this.name +
  39381. '(). ' + SuperMap.CartoCSS.Tree.functions[this.name].length + ' expected.',
  39382. index: this.index,
  39383. type: 'runtime',
  39384. filename: this.filename
  39385. });
  39386. return {
  39387. is: 'undefined',
  39388. value: 'undefined'
  39389. };
  39390. }
  39391. } else {
  39392. var fn = SuperMap.CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  39393. if (fn === undefined) {
  39394. var functions = lodash_topairs_default()(SuperMap.CartoCSS.Tree.Reference.mapnikFunctions);
  39395. // cheap closest, needs improvement.
  39396. var name = this.name;
  39397. var mean = functions.map(function (f) {
  39398. return [f[0], SuperMap.CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  39399. }).sort(function (a, b) {
  39400. return a[1] - b[1];
  39401. });
  39402. env.error({
  39403. message: 'unknown function ' + this.name + '(), did you mean ' +
  39404. mean[0][0] + '(' + mean[0][2] + ')',
  39405. index: this.index,
  39406. type: 'runtime',
  39407. filename: this.filename
  39408. });
  39409. return {
  39410. is: 'undefined',
  39411. value: 'undefined'
  39412. };
  39413. }
  39414. if (fn !== args.length &&
  39415. // support variable-arg functions like `colorize-alpha`
  39416. fn !== -1) {
  39417. env.error({
  39418. message: 'function ' + this.name + '() takes ' +
  39419. fn + ' arguments and was given ' + args.length,
  39420. index: this.index,
  39421. type: 'runtime',
  39422. filename: this.filename
  39423. });
  39424. return {
  39425. is: 'undefined',
  39426. value: 'undefined'
  39427. };
  39428. } else {
  39429. // Save the evaluated versions of arguments
  39430. this.args = args;
  39431. return this;
  39432. }
  39433. }
  39434. }
  39435. toString(env, format) {
  39436. if (this.args.length) {
  39437. return this.name + '(' + this.args.join(',') + ')';
  39438. } else {
  39439. return this.name;
  39440. }
  39441. }
  39442. };
  39443. SuperMap.CartoCSS.Tree.Color = class Color {
  39444. constructor(rgb, a) {
  39445. this.is = 'color';
  39446. // The end goal here, is to parse the arguments
  39447. // into an integer triplet, such as `128, 255, 0`
  39448. //
  39449. // This facilitates operations and conversions.
  39450. if (Array.isArray(rgb)) {
  39451. this.rgb = rgb.slice(0, 3);
  39452. } else if (rgb.length == 6) {
  39453. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  39454. return parseInt(c, 16);
  39455. });
  39456. } else {
  39457. this.rgb = rgb.split('').map(function (c) {
  39458. return parseInt(c + c, 16);
  39459. });
  39460. }
  39461. if (typeof(a) === 'number') {
  39462. this.alpha = a;
  39463. } else if (rgb.length === 4) {
  39464. this.alpha = rgb[3];
  39465. } else {
  39466. this.alpha = 1;
  39467. }
  39468. }
  39469. 'ev'() {
  39470. return this;
  39471. }
  39472. // If we have some transparency, the only way to represent it
  39473. // is via `rgba`. Otherwise, we use the hex representation,
  39474. // which has better compatibility with older browsers.
  39475. // Values are capped between `0` and `255`, rounded and zero-padded.
  39476. toString() {
  39477. /* if (this.alpha < 1.0) {*/
  39478. return 'rgba(' + this.rgb.map(function (c) {
  39479. return Math.round(c);
  39480. }).concat(this.alpha).join(', ') + ')';
  39481. /*} else {
  39482. return '#' + this.rgb.map(function(i) {
  39483. i = Math.round(i);
  39484. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  39485. return i.length === 1 ? '0' + i : i;
  39486. }).join('');
  39487. }*/
  39488. }
  39489. // Operations have to be done per-channel, if not,
  39490. // channels will spill onto each other. Once we have
  39491. // our result, in the form of an integer triplet,
  39492. // we create a new Color node to hold the result.
  39493. operate(env, op, other) {
  39494. var result = [];
  39495. if (!(other instanceof SuperMap.CartoCSS.Tree.Color)) {
  39496. other = other.toColor();
  39497. }
  39498. for (var c = 0; c < 3; c++) {
  39499. result[c] = SuperMap.CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  39500. }
  39501. return new SuperMap.CartoCSS.Tree.Color(result);
  39502. }
  39503. toHSL() {
  39504. var r = this.rgb[0] / 255,
  39505. g = this.rgb[1] / 255,
  39506. b = this.rgb[2] / 255,
  39507. a = this.alpha;
  39508. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  39509. var h, s, l = (max + min) / 2, d = max - min;
  39510. if (max === min) {
  39511. h = s = 0;
  39512. } else {
  39513. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  39514. switch (max) {
  39515. case r:
  39516. h = (g - b) / d + (g < b ? 6 : 0);
  39517. break;
  39518. case g:
  39519. h = (b - r) / d + 2;
  39520. break;
  39521. case b:
  39522. h = (r - g) / d + 4;
  39523. break;
  39524. default:
  39525. break;
  39526. }
  39527. h /= 6;
  39528. }
  39529. return {h: h * 360, s: s, l: l, a: a};
  39530. }
  39531. };
  39532. SuperMap.CartoCSS.Tree.Comment = class Comment {
  39533. constructor(value, silent) {
  39534. this.value = value;
  39535. this.silent = !!silent;
  39536. }
  39537. toString(env) {
  39538. return '<!--' + this.value + '-->';
  39539. }
  39540. 'ev'() {
  39541. return this;
  39542. }
  39543. };
  39544. SuperMap.CartoCSS.Tree.Definition = class Definition {
  39545. constructor(selector, rules) {
  39546. this.elements = selector.elements;
  39547. //assert.ok(selector.filters instanceof SuperMap.CartoCSS.Tree.Filterset);
  39548. this.rules = rules;
  39549. this.ruleIndex = {};
  39550. for (var i = 0; i < this.rules.length; i++) {
  39551. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  39552. this.rules[i].zoom = selector.zoom;
  39553. this.ruleIndex[this.rules[i].updateID()] = true;
  39554. }
  39555. this.filters = selector.filters;
  39556. this.zoom = selector.zoom;
  39557. this.attachment = selector.attachment || '__default__';
  39558. this.specificity = selector.specificity();
  39559. }
  39560. toString() {
  39561. var str = this.filters.toString();
  39562. for (var i = 0; i < this.rules.length; i++) {
  39563. str += '\n ' + this.rules[i];
  39564. }
  39565. return str;
  39566. }
  39567. toJS(env) {
  39568. var shaderAttrs = {};
  39569. // merge conditions from filters with zoom condition of the
  39570. // definition
  39571. var zoom = this.zoom;
  39572. //var frame_offset = this.frame_offset;
  39573. var _if = this.filters.toJS(env);
  39574. var filters = [zoom];
  39575. if (_if) {filters.push(_if);}
  39576. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  39577. _if = filters.join(" && ");
  39578. function eachRule(rule) {
  39579. if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  39580. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  39581. if (_if) {
  39582. shaderAttrs[rule.name].push(
  39583. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  39584. );
  39585. } else {
  39586. shaderAttrs[rule.name].push(rule.value.toJS(env));
  39587. }
  39588. } else {
  39589. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  39590. var sh = rule.toJS(env);
  39591. for (var v in sh) {
  39592. shaderAttrs[v] = shaderAttrs[v] || [];
  39593. for (var attr in sh[v]) {
  39594. shaderAttrs[v].push(sh[v][attr]);
  39595. }
  39596. }
  39597. }
  39598. }
  39599. }
  39600. for (var id in this.rules) {
  39601. eachRule(this.rules[id]);
  39602. }
  39603. return shaderAttrs;
  39604. }
  39605. };
  39606. SuperMap.CartoCSS.Tree.Dimension = class Dimension {
  39607. constructor(value, unit, index) {
  39608. this.is = 'float';
  39609. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  39610. this.screen_units = ['px', '%'];
  39611. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  39612. this.densities = {
  39613. m: 0.0254,
  39614. mm: 25.4,
  39615. cm: 2.54,
  39616. pt: 72,
  39617. pc: 6
  39618. };
  39619. this.value = parseFloat(value);
  39620. this.unit = unit || null;
  39621. this.index = index;
  39622. }
  39623. ev(env) {
  39624. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  39625. env.error({
  39626. message: "Invalid unit: '" + this.unit + "'",
  39627. index: this.index
  39628. });
  39629. return {is: 'undefined', value: 'undefined'};
  39630. }
  39631. // normalize units which are not px or %
  39632. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  39633. if (!env.ppi) {
  39634. env.error({
  39635. message: "ppi is not set, so metric units can't be used",
  39636. index: this.index
  39637. });
  39638. return {is: 'undefined', value: 'undefined'};
  39639. }
  39640. // convert all units to inch
  39641. // convert inch to px using ppi
  39642. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  39643. this.unit = 'px';
  39644. }
  39645. return this;
  39646. }
  39647. toColor() {
  39648. return new SuperMap.CartoCSS.Tree.Color([this.value, this.value, this.value]);
  39649. }
  39650. round() {
  39651. this.value = Math.round(this.value);
  39652. return this;
  39653. }
  39654. toString() {
  39655. return this.value.toString();
  39656. }
  39657. operate(env, op, other) {
  39658. if (this.unit === '%' && other.unit !== '%') {
  39659. env.error({
  39660. message: 'If two operands differ, the first must not be %',
  39661. index: this.index
  39662. });
  39663. return {
  39664. is: 'undefined',
  39665. value: 'undefined'
  39666. };
  39667. }
  39668. if (this.unit !== '%' && other.unit === '%') {
  39669. if (op === '*' || op === '/' || op === '%') {
  39670. env.error({
  39671. message: 'Percent values can only be added or subtracted from other values',
  39672. index: this.index
  39673. });
  39674. return {
  39675. is: 'undefined',
  39676. value: 'undefined'
  39677. };
  39678. }
  39679. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op,
  39680. this.value, this.value * other.value * 0.01),
  39681. this.unit);
  39682. }
  39683. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  39684. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op, this.value, other.value),
  39685. this.unit || other.unit);
  39686. }
  39687. };
  39688. SuperMap.CartoCSS.Tree.Element = class Element {
  39689. constructor(value) {
  39690. this.value = value.trim();
  39691. if (this.value[0] === '#') {
  39692. this.type = 'id';
  39693. this.clean = this.value.replace(/^#/, '');
  39694. }
  39695. if (this.value[0] === '.') {
  39696. this.type = 'class';
  39697. this.clean = this.value.replace(/^\./, '');
  39698. }
  39699. if (this.value.indexOf('*') !== -1) {
  39700. this.type = 'wildcard';
  39701. }
  39702. }
  39703. specificity() {
  39704. return [
  39705. (this.type === 'id') ? 1 : 0, // a
  39706. (this.type === 'class') ? 1 : 0 // b
  39707. ];
  39708. }
  39709. toString() {
  39710. return this.value;
  39711. }
  39712. };
  39713. SuperMap.CartoCSS.Tree.Expression = class Expression {
  39714. constructor(value) {
  39715. this.is = 'expression';
  39716. this.value = value;
  39717. }
  39718. ev(env) {
  39719. if (this.value.length > 1) {
  39720. return new SuperMap.CartoCSS.Tree.Expression(this.value.map(function (e) {
  39721. return e.ev(env);
  39722. }));
  39723. } else {
  39724. return this.value[0].ev(env);
  39725. }
  39726. }
  39727. toString(env) {
  39728. return this.value.map(function (e) {
  39729. return e.toString(env);
  39730. }).join(' ');
  39731. }
  39732. };
  39733. SuperMap.CartoCSS.Tree.Field = class Field {
  39734. constructor(content) {
  39735. this.is = 'field';
  39736. this.value = content || '';
  39737. }
  39738. toString() {
  39739. return '["' + this.value.toUpperCase() + '"]';
  39740. }
  39741. 'ev'() {
  39742. return this;
  39743. }
  39744. };
  39745. SuperMap.CartoCSS.Tree.Filter = class Filter {
  39746. constructor(key, op, val, index, filename) {
  39747. this.ops = {
  39748. '<': [' &lt; ', 'numeric'],
  39749. '>': [' &gt; ', 'numeric'],
  39750. '=': [' = ', 'both'],
  39751. '!=': [' != ', 'both'],
  39752. '<=': [' &lt;= ', 'numeric'],
  39753. '>=': [' &gt;= ', 'numeric'],
  39754. '=~': ['.match(', 'string', ')']
  39755. };
  39756. this.key = key;
  39757. this.op = op;
  39758. this.val = val;
  39759. this.index = index;
  39760. this.filename = filename;
  39761. this.id = this.key + this.op + this.val;
  39762. }
  39763. ev(env) {
  39764. this.key = this.key.ev(env);
  39765. this.val = this.val.ev(env);
  39766. return this;
  39767. }
  39768. toString() {
  39769. return '[' + this.id + ']';
  39770. }
  39771. };
  39772. SuperMap.CartoCSS.Tree.Filterset = class Filterset {
  39773. constructor() {
  39774. this.filters = {};
  39775. }
  39776. toJS(env) {
  39777. function eachFilter(filter) {
  39778. var op = filter.op;
  39779. if (op === "=") {
  39780. op = "==";
  39781. }
  39782. var val = filter.val;
  39783. if (filter._val !== undefined) {
  39784. val = filter._val.toString(true);
  39785. }
  39786. //对scale进行特殊处理,将值转换成数值
  39787. if (filter.key && filter.key.value === 'scale') {
  39788. val = +val;
  39789. } else if (typeof val === 'string' || typeof val === 'object') {
  39790. val = "'" + val + "'";
  39791. }
  39792. var attrs = "attributes";
  39793. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  39794. }
  39795. var results = [];
  39796. for (var id in this.filters) {
  39797. results.push(eachFilter(this.filters[id]));
  39798. }
  39799. return results.join(' && ');
  39800. }
  39801. toString() {
  39802. var arr = [];
  39803. for (var id in this.filters) {arr.push(this.filters[id].id);}
  39804. return arr.sort().join('\t');
  39805. }
  39806. ev(env) {
  39807. for (var i in this.filters) {
  39808. this.filters[i].ev(env);
  39809. }
  39810. return this;
  39811. }
  39812. clone() {
  39813. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  39814. for (var id in this.filters) {
  39815. clone.filters[id] = this.filters[id];
  39816. }
  39817. return clone;
  39818. }
  39819. cloneWith(other) {
  39820. var additions = [];
  39821. for (var id in other.filters) {
  39822. var status = this.addable(other.filters[id]);
  39823. // status is true, false or null. if it's null we don't fail this
  39824. // clone nor do we add the filter.
  39825. if (status === false) {
  39826. return false;
  39827. }
  39828. if (status === true) {
  39829. // Adding the filter will override another value.
  39830. additions.push(other.filters[id]);
  39831. }
  39832. }
  39833. // Adding the other filters doesn't make this filterset invalid, but it
  39834. // doesn't add anything to it either.
  39835. if (!additions.length) {
  39836. return null;
  39837. }
  39838. // We can successfully add all filters. Now clone the filterset and add the
  39839. // new rules.
  39840. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  39841. // We can add the rules that are already present without going through the
  39842. // add function as a Filterset is always in it's simplest canonical form.
  39843. for (id in this.filters) {
  39844. clone.filters[id] = this.filters[id];
  39845. }
  39846. // Only add new filters that actually change the filter.
  39847. while (id = additions.shift()) {
  39848. clone.add(id);
  39849. }
  39850. return clone;
  39851. }
  39852. addable(filter) {
  39853. var key = filter.key.toString(),
  39854. value = filter.val.toString();
  39855. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  39856. switch (filter.op) {
  39857. case '=':
  39858. // if there is already foo= and we're adding foo=
  39859. if (this.filters[key + '='] !== undefined) {
  39860. if (this.filters[key + '='].val.toString() != value) {
  39861. return false;
  39862. } else {
  39863. return null;
  39864. }
  39865. }
  39866. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  39867. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  39868. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  39869. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  39870. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  39871. return true;
  39872. case '=~':
  39873. return true;
  39874. case '!=':
  39875. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  39876. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  39877. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  39878. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  39879. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  39880. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  39881. return true;
  39882. case '>':
  39883. if (key + '=' in this.filters) {
  39884. if (this.filters[key + '='].val <= value) {
  39885. return false;
  39886. } else {
  39887. return null;
  39888. }
  39889. }
  39890. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  39891. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  39892. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  39893. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  39894. return true;
  39895. case '>=':
  39896. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  39897. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  39898. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  39899. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  39900. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  39901. return true;
  39902. case '<':
  39903. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  39904. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  39905. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  39906. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  39907. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  39908. return true;
  39909. case '<=':
  39910. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  39911. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  39912. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  39913. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  39914. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  39915. return true;
  39916. default:
  39917. break;
  39918. }
  39919. }
  39920. conflict(filter) {
  39921. var key = filter.key.toString(),
  39922. value = filter.val.toString();
  39923. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  39924. // if (a=b) && (a=c)
  39925. // if (a=b) && (a!=b)
  39926. // or (a!=b) && (a=b)
  39927. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  39928. value != this.filters[key + '='].val.toString()) ||
  39929. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  39930. value == this.filters[key + '='].val.toString()) ||
  39931. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  39932. value === this.filters[key + '!='].val.toString())) {
  39933. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  39934. }
  39935. return false;
  39936. }
  39937. add(filter, env) {
  39938. var key = filter.key.toString(),
  39939. op = filter.op,
  39940. conflict = this.conflict(filter),
  39941. numval;
  39942. if (conflict) {return conflict;}
  39943. if (op === '=') {
  39944. for (var i in this.filters) {
  39945. if (this.filters[i].key === key) {delete this.filters[i];}
  39946. }
  39947. this.filters[key + '='] = filter;
  39948. } else if (op === '!=') {
  39949. this.filters[key + '!=' + filter.val] = filter;
  39950. } else if (op === '=~') {
  39951. this.filters[key + '=~' + filter.val] = filter;
  39952. } else if (op === '>') {
  39953. // If there are other filters that are also >
  39954. // but are less than this one, they don't matter, so
  39955. // remove them.
  39956. for (var j in this.filters) {
  39957. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  39958. delete this.filters[j];
  39959. }
  39960. }
  39961. this.filters[key + '>'] = filter;
  39962. } else if (op === '>=') {
  39963. for (var k in this.filters) {
  39964. numval = (+this.filters[k].val.toString());
  39965. if (this.filters[k].key === key && numval < filter.val) {
  39966. delete this.filters[k];
  39967. }
  39968. }
  39969. if (this.filters[key + '!=' + filter.val] !== undefined) {
  39970. delete this.filters[key + '!=' + filter.val];
  39971. filter.op = '>';
  39972. this.filters[key + '>'] = filter;
  39973. } else {
  39974. this.filters[key + '>='] = filter;
  39975. }
  39976. } else if (op === '<') {
  39977. for (var l in this.filters) {
  39978. numval = (+this.filters[l].val.toString());
  39979. if (this.filters[l].key === key && numval >= filter.val) {
  39980. delete this.filters[l];
  39981. }
  39982. }
  39983. this.filters[key + '<'] = filter;
  39984. } else if (op === '<=') {
  39985. for (var m in this.filters) {
  39986. numval = (+this.filters[m].val.toString());
  39987. if (this.filters[m].key === key && numval > filter.val) {
  39988. delete this.filters[m];
  39989. }
  39990. }
  39991. if (this.filters[key + '!=' + filter.val] !== undefined) {
  39992. delete this.filters[key + '!=' + filter.val];
  39993. filter.op = '<';
  39994. this.filters[key + '<'] = filter;
  39995. } else {
  39996. this.filters[key + '<='] = filter;
  39997. }
  39998. }
  39999. }
  40000. };
  40001. SuperMap.CartoCSS.Tree.Fontset = class Fontset {
  40002. constructor(env, fonts) {
  40003. this.fonts = fonts;
  40004. this.name = 'fontset-' + env.effects.length;
  40005. }
  40006. };
  40007. SuperMap.CartoCSS.Tree.Invalid = class Invalid {
  40008. constructor(chunk, index, message) {
  40009. this.is = 'invalid';
  40010. this.chunk = chunk;
  40011. this.index = index;
  40012. this.type = 'syntax';
  40013. this.message = message || "Invalid code: " + this.chunk;
  40014. }
  40015. ev(env) {
  40016. env.error({
  40017. chunk: this.chunk,
  40018. index: this.index,
  40019. type: 'syntax',
  40020. message: this.message || "Invalid code: " + this.chunk
  40021. });
  40022. return {
  40023. is: 'undefined'
  40024. };
  40025. }
  40026. };
  40027. SuperMap.CartoCSS.Tree.Keyword = class Keyword {
  40028. ev() {
  40029. return this;
  40030. }
  40031. constructor(value) {
  40032. this.value = value;
  40033. var special = {
  40034. 'transparent': 'color',
  40035. 'true': 'boolean',
  40036. 'false': 'boolean'
  40037. };
  40038. this.is = special[value] ? special[value] : 'keyword';
  40039. }
  40040. toString() {
  40041. return this.value;
  40042. }
  40043. };
  40044. /*Layer:class Invalid ),*/
  40045. SuperMap.CartoCSS.Tree.Literal = class Literal {
  40046. constructor(content) {
  40047. this.value = content || '';
  40048. this.is = 'field';
  40049. }
  40050. toString() {
  40051. return this.value;
  40052. }
  40053. 'ev'() {
  40054. return this;
  40055. }
  40056. };
  40057. SuperMap.CartoCSS.Tree.Operation = class Operation {
  40058. constructor(op, operands, index) {
  40059. this.is = 'operation';
  40060. this.op = op.trim();
  40061. this.operands = operands;
  40062. this.index = index;
  40063. }
  40064. ev(env) {
  40065. var a = this.operands[0].ev(env),
  40066. b = this.operands[1].ev(env),
  40067. temp;
  40068. if (a.is === 'undefined' || b.is === 'undefined') {
  40069. return {
  40070. is: 'undefined',
  40071. value: 'undefined'
  40072. };
  40073. }
  40074. if (a instanceof SuperMap.CartoCSS.Tree.Dimension && b instanceof SuperMap.CartoCSS.Tree.Color) {
  40075. if (this.op === '*' || this.op === '+') {
  40076. temp = b;
  40077. b = a;
  40078. a = temp;
  40079. } else {
  40080. env.error({
  40081. name: "OperationError",
  40082. message: "Can't substract or divide a color from a number",
  40083. index: this.index
  40084. });
  40085. }
  40086. }
  40087. // Only concatenate plain strings, because this is easily
  40088. // pre-processed
  40089. if (a instanceof SuperMap.CartoCSS.Tree.Quoted && b instanceof SuperMap.CartoCSS.Tree.Quoted && this.op !== '+') {
  40090. env.error({
  40091. message: "Can't subtract, divide, or multiply strings.",
  40092. index: this.index,
  40093. type: 'runtime',
  40094. filename: this.filename
  40095. });
  40096. return {
  40097. is: 'undefined',
  40098. value: 'undefined'
  40099. };
  40100. }
  40101. // Fields, literals, dimensions, and quoted strings can be combined.
  40102. if (a instanceof SuperMap.CartoCSS.Tree.Field || b instanceof SuperMap.CartoCSS.Tree.Field ||
  40103. a instanceof SuperMap.CartoCSS.Tree.Literal || b instanceof SuperMap.CartoCSS.Tree.Literal) {
  40104. if (a.is === 'color' || b.is === 'color') {
  40105. env.error({
  40106. message: "Can't subtract, divide, or multiply colors in expressions.",
  40107. index: this.index,
  40108. type: 'runtime',
  40109. filename: this.filename
  40110. });
  40111. return {
  40112. is: 'undefined',
  40113. value: 'undefined'
  40114. };
  40115. } else {
  40116. return new SuperMap.CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  40117. }
  40118. }
  40119. if (a.operate === undefined) {
  40120. env.error({
  40121. message: 'Cannot do math with type ' + a.is + '.',
  40122. index: this.index,
  40123. type: 'runtime',
  40124. filename: this.filename
  40125. });
  40126. return {
  40127. is: 'undefined',
  40128. value: 'undefined'
  40129. };
  40130. }
  40131. return a.operate(env, this.op, b);
  40132. }
  40133. };
  40134. SuperMap.CartoCSS.Tree.Quoted = class Quoted {
  40135. constructor(content) {
  40136. this.is = 'string';
  40137. this.value = content || '';
  40138. }
  40139. toString(quotes) {
  40140. var escapedValue = this.value
  40141. .replace(/&/g, '&amp;')
  40142. var xmlvalue = escapedValue
  40143. .replace(/\'/g, '\\\'')
  40144. .replace(/\"/g, '&quot;')
  40145. .replace(/</g, '&lt;')
  40146. .replace(/\>/g, '&gt;');
  40147. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  40148. }
  40149. ev() {
  40150. return this;
  40151. }
  40152. operate(env, op, other) {
  40153. return new SuperMap.CartoCSS.Tree.Quoted(SuperMap.CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  40154. }
  40155. };
  40156. SuperMap.CartoCSS.Tree.Reference = {
  40157. _validateValue: {
  40158. 'font': function (env, value) {
  40159. if (env.validation_data && env.validation_data.fonts) {
  40160. return env.validation_data.fonts.indexOf(value) != -1;
  40161. } else {
  40162. return true;
  40163. }
  40164. }
  40165. },
  40166. setData: function (data) {
  40167. this.data = data;
  40168. this.selector_cache = generateSelectorCache(data);
  40169. this.mapnikFunctions = generateMapnikFunctions(data);
  40170. this.required_cache = generateRequiredProperties(data);
  40171. function generateSelectorCache(data) {
  40172. var index = {};
  40173. for (var i in data.symbolizers) {
  40174. for (var j in data.symbolizers[i]) {
  40175. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  40176. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  40177. }
  40178. }
  40179. }
  40180. return index;
  40181. }
  40182. function generateMapnikFunctions(data) {
  40183. var functions = {};
  40184. for (var i in data.symbolizers) {
  40185. for (var j in data.symbolizers[i]) {
  40186. if (data.symbolizers[i][j].type === 'functions') {
  40187. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  40188. var fn = data.symbolizers[i][j].functions[k];
  40189. functions[fn[0]] = fn[1];
  40190. }
  40191. }
  40192. }
  40193. }
  40194. return functions;
  40195. }
  40196. function generateRequiredProperties(data) {
  40197. var cache = {};
  40198. for (var symbolizer_name in data.symbolizers) {
  40199. cache[symbolizer_name] = [];
  40200. for (var j in data.symbolizers[symbolizer_name]) {
  40201. if (data.symbolizers[symbolizer_name][j].required) {
  40202. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  40203. }
  40204. }
  40205. }
  40206. return cache;
  40207. }
  40208. },
  40209. setVersion: function (version) {
  40210. if (SuperMap.CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  40211. this.setData(SuperMap.CartoCSS.mapnik_reference.version[version]);
  40212. return true;
  40213. }
  40214. return false;
  40215. },
  40216. selectorData: function (selector, i) {
  40217. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  40218. },
  40219. validSelector: function (selector) {
  40220. return !!this.selector_cache[selector];
  40221. },
  40222. selectorName: function (selector) {
  40223. return this.selectorData(selector, 2);
  40224. },
  40225. selector: function (selector) {
  40226. return this.selectorData(selector, 0);
  40227. },
  40228. symbolizer: function (selector) {
  40229. return this.selectorData(selector, 1);
  40230. },
  40231. requiredProperties: function (symbolizer_name, rules) {
  40232. var req = this.required_cache[symbolizer_name];
  40233. for (var i in req) {
  40234. if (!(req[i] in rules)) {
  40235. return 'Property ' + req[i] + ' required for defining ' +
  40236. symbolizer_name + ' styles.';
  40237. }
  40238. }
  40239. },
  40240. isFont: function (selector) {
  40241. return this.selector(selector).validate === 'font';
  40242. },
  40243. editDistance: function (a, b) {
  40244. if (a.length === 0) {return b.length;}
  40245. if (b.length === 0) {return a.length;}
  40246. var matrix = [];
  40247. for (var i = 0; i <= b.length; i++) {
  40248. matrix[i] = [i];
  40249. }
  40250. for (var j = 0; j <= a.length; j++) {
  40251. matrix[0][j] = j;
  40252. }
  40253. for (i = 1; i <= b.length; i++) {
  40254. for (j = 1; j <= a.length; j++) {
  40255. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  40256. matrix[i][j] = matrix[i - 1][j - 1];
  40257. } else {
  40258. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  40259. Math.min(matrix[i][j - 1] + 1, // insertion
  40260. matrix[i - 1][j] + 1)); // deletion
  40261. }
  40262. }
  40263. }
  40264. return matrix[b.length][a.length];
  40265. },
  40266. validValue: function (env, selector, value) {
  40267. function validateFunctions(value, selector) {
  40268. if (value.value[0].is === 'string') {return true;}
  40269. for (var i in value.value) {
  40270. for (var j in value.value[i].value) {
  40271. if (value.value[i].value[j].is !== 'call') {return false;}
  40272. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  40273. return x[0] === value.value[i].value[j].name;
  40274. });
  40275. if (!(f && f[1] === -1)) {
  40276. // This filter is unknown or given an incorrect number of arguments
  40277. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  40278. }
  40279. }
  40280. }
  40281. return true;
  40282. }
  40283. function validateKeyword(value, selector) {
  40284. if (typeof this.selector(selector).type === 'object') {
  40285. return this.selector(selector).type
  40286. .indexOf(value.value[0].value) !== -1;
  40287. } else {
  40288. // allow unquoted keywords as strings
  40289. return this.selector(selector).type === 'string';
  40290. }
  40291. }
  40292. var i;
  40293. if (!this.selector(selector)) {
  40294. return false;
  40295. } else if (value.value[0].is === 'keyword') {
  40296. return validateKeyword(value, selector);
  40297. } else if (value.value[0].is === 'undefined') {
  40298. // caught earlier in the chain - ignore here so that
  40299. // error is not overridden
  40300. return true;
  40301. } else if (this.selector(selector).type === 'numbers') {
  40302. for (i in value.value) {
  40303. if (value.value[i].is !== 'float') {
  40304. return false;
  40305. }
  40306. }
  40307. return true;
  40308. } else if (this.selector(selector).type === 'tags') {
  40309. if (!value.value) {return false;}
  40310. if (!value.value[0].value) {
  40311. return value.value[0].is === 'tag';
  40312. }
  40313. for (i = 0; i < value.value[0].value.length; i++) {
  40314. if (value.value[0].value[i].is !== 'tag') {return false;}
  40315. }
  40316. return true;
  40317. } else if (this.selector(selector).type == 'functions') {
  40318. // For backwards compatibility, you can specify a string for `functions`-compatible
  40319. // values, though they will not be validated.
  40320. return validateFunctions(value, selector);
  40321. } else if (this.selector(selector).type === 'expression') {
  40322. return true;
  40323. } else if (this.selector(selector).type === 'unsigned') {
  40324. if (value.value[0].is === 'float') {
  40325. value.value[0].round();
  40326. return true;
  40327. } else {
  40328. return false;
  40329. }
  40330. } else {
  40331. if (this.selector(selector).validate) {
  40332. var valid = false;
  40333. for (i = 0; i < value.value.length; i++) {
  40334. if (this.selector(selector).type === value.value[i].is &&
  40335. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  40336. return true;
  40337. }
  40338. }
  40339. return valid;
  40340. } else {
  40341. return this.selector(selector).type === value.value[0].is;
  40342. }
  40343. }
  40344. }
  40345. };
  40346. SuperMap.CartoCSS.Tree.Reference.setVersion("latest");
  40347. SuperMap.CartoCSS.Tree.Rule = class Rule {
  40348. constructor(name, value, index, filename) {
  40349. this.is = 'rule';
  40350. var parts = name.split('/');
  40351. this.name = parts.pop();
  40352. this.instance = parts.length ? parts[0] : '__default__';
  40353. this.value = (value instanceof SuperMap.CartoCSS.Tree.Value) ?
  40354. value : new SuperMap.CartoCSS.Tree.Value([value]);
  40355. this.index = index;
  40356. this.symbolizer = SuperMap.CartoCSS.Tree.Reference.symbolizer(this.name);
  40357. this.filename = filename;
  40358. this.variable = (name.charAt(0) === '@');
  40359. }
  40360. clone() {
  40361. var clone = Object.create(SuperMap.CartoCSS.Tree.Rule.prototype);
  40362. clone.name = this.name;
  40363. clone.value = this.value;
  40364. clone.index = this.index;
  40365. clone.instance = this.instance;
  40366. clone.symbolizer = this.symbolizer;
  40367. clone.filename = this.filename;
  40368. clone.variable = this.variable;
  40369. return clone;
  40370. }
  40371. updateID() {
  40372. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  40373. }
  40374. toString() {
  40375. return '[' + SuperMap.CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  40376. }
  40377. ev(context) {
  40378. return new SuperMap.CartoCSS.Tree.Rule(this.name,
  40379. this.value.ev(context),
  40380. this.index,
  40381. this.filename);
  40382. }
  40383. };
  40384. SuperMap.CartoCSS.Tree.Ruleset = class Ruleset {
  40385. constructor(selectors, rules) {
  40386. this.is = 'ruleset';
  40387. this.selectors = selectors;
  40388. this.rules = rules;
  40389. // static cache of find() function
  40390. this._lookups = {};
  40391. }
  40392. ev(env) {
  40393. var i,
  40394. rule,
  40395. ruleset = new SuperMap.CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  40396. ruleset.root = this.root;
  40397. // push the current ruleset to the frames stack
  40398. env.frames.unshift(ruleset);
  40399. // Evaluate everything else
  40400. for (i = 0, rule; i < ruleset.rules.length; i++) {
  40401. rule = ruleset.rules[i];
  40402. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  40403. }
  40404. // Pop the stack
  40405. env.frames.shift();
  40406. return ruleset;
  40407. }
  40408. match(args) {
  40409. return !args || args.length === 0;
  40410. }
  40411. variables() {
  40412. if (this._variables) {
  40413. return this._variables;
  40414. } else {
  40415. return this._variables = this.rules.reduce(function (hash, r) {
  40416. if (r instanceof SuperMap.CartoCSS.Tree.Rule && r.variable === true) {
  40417. hash[r.name] = r;
  40418. }
  40419. return hash;
  40420. }, {});
  40421. }
  40422. }
  40423. variable(name) {
  40424. return this.variables()[name];
  40425. }
  40426. rulesets() {
  40427. if (this._rulesets) {
  40428. return this._rulesets;
  40429. } else {
  40430. return this._rulesets = this.rules.filter(function (r) {
  40431. return (r instanceof SuperMap.CartoCSS.Tree.Ruleset);
  40432. });
  40433. }
  40434. }
  40435. find(selector, self) {
  40436. self = self || this;
  40437. var rules = [], match,
  40438. key = selector.toString();
  40439. if (key in this._lookups) {
  40440. return this._lookups[key];
  40441. }
  40442. this.rulesets().forEach(function (rule) {
  40443. if (rule !== self) {
  40444. for (var j = 0; j < rule.selectors.length; j++) {
  40445. match = selector.match(rule.selectors[j]);
  40446. if (match) {
  40447. if (selector.elements.length > 1) {
  40448. Array.prototype.push.apply(rules, rule.find(
  40449. new SuperMap.CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  40450. } else {
  40451. rules.push(rule);
  40452. }
  40453. break;
  40454. }
  40455. }
  40456. }
  40457. });
  40458. return this._lookups[key] = rules;
  40459. }
  40460. // Zooms can use variables. This replaces SuperMap.CartoCSS.Tree.Zoom objects on selectors
  40461. // with simple bit-arrays that we can compare easily.
  40462. evZooms(env) {
  40463. for (var i = 0; i < this.selectors.length; i++) {
  40464. var zval = SuperMap.CartoCSS.Tree.Zoom.all;
  40465. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  40466. zval = this.selectors[i].zoom[z].ev(env).zoom;
  40467. }
  40468. this.selectors[i].zoom = zval;
  40469. }
  40470. }
  40471. flatten(result, parents, env) {
  40472. var selectors = [], i, j;
  40473. if (this.selectors.length === 0) {
  40474. env.frames = env.frames.concat(this.rules);
  40475. }
  40476. // evaluate zoom variables on this object.
  40477. this.evZooms(env);
  40478. for (i = 0; i < this.selectors.length; i++) {
  40479. var child = this.selectors[i];
  40480. if (!child.filters) {
  40481. // This is an invalid filterset.
  40482. continue;
  40483. }
  40484. if (parents.length) {
  40485. for (j = 0; j < parents.length; j++) {
  40486. var parent = parents[j];
  40487. var mergedFilters = parent.filters.cloneWith(child.filters);
  40488. if (mergedFilters === null) {
  40489. // Filters could be added, but they didn't change the
  40490. // filters. This means that we only have to clone when
  40491. // the zoom levels or the attachment is different too.
  40492. if (parent.zoom === child.zoom &&
  40493. parent.attachment === child.attachment &&
  40494. parent.elements.join() === child.elements.join()) {
  40495. selectors.push(parent);
  40496. continue;
  40497. } else {
  40498. mergedFilters = parent.filters;
  40499. }
  40500. } else if (!mergedFilters) {
  40501. // The merged filters are invalid, that means we don't
  40502. // have to clone.
  40503. continue;
  40504. }
  40505. var clone = Object.create(SuperMap.CartoCSS.Tree.Selector.prototype);
  40506. clone.filters = mergedFilters;
  40507. clone.zoom = child.zoom;
  40508. clone.elements = parent.elements.concat(child.elements);
  40509. if (parent.attachment && child.attachment) {
  40510. clone.attachment = parent.attachment + '/' + child.attachment;
  40511. } else {clone.attachment = child.attachment || parent.attachment;}
  40512. clone.conditions = parent.conditions + child.conditions;
  40513. clone.index = child.index;
  40514. selectors.push(clone);
  40515. }
  40516. } else {
  40517. selectors.push(child);
  40518. }
  40519. }
  40520. var rules = [];
  40521. for (i = 0; i < this.rules.length; i++) {
  40522. var rule = this.rules[i];
  40523. // Recursively flatten any nested rulesets
  40524. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  40525. rule.flatten(result, selectors, env);
  40526. } else if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  40527. rules.push(rule);
  40528. } else if (rule instanceof SuperMap.CartoCSS.Tree.Invalid) {
  40529. env.error(rule);
  40530. }
  40531. }
  40532. var index = rules.length ? rules[0].index : false;
  40533. for (i = 0; i < selectors.length; i++) {
  40534. // For specificity sort, use the position of the first rule to allow
  40535. // defining attachments that are under current element as a descendant
  40536. // selector.
  40537. if (index !== false) {
  40538. selectors[i].index = index;
  40539. }
  40540. result.push(new SuperMap.CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  40541. }
  40542. return result;
  40543. }
  40544. };
  40545. SuperMap.CartoCSS.Tree.Selector = class Selector {
  40546. constructor(filters, zoom, elements, attachment, conditions, index) {
  40547. this.elements = elements || [];
  40548. this.attachment = attachment;
  40549. this.filters = filters || {};
  40550. this.zoom = typeof zoom !== 'undefined' ? zoom : SuperMap.CartoCSS.Tree.Zoom.all;
  40551. this.conditions = conditions;
  40552. this.index = index;
  40553. }
  40554. specificity() {
  40555. return this.elements.reduce(function (memo, e) {
  40556. var spec = e.specificity();
  40557. memo[0] += spec[0];
  40558. memo[1] += spec[1];
  40559. return memo;
  40560. }, [0, 0, this.conditions, this.index]);
  40561. }
  40562. };
  40563. /*style:class Invalid ),*/
  40564. SuperMap.CartoCSS.Tree.URL = class URL {
  40565. constructor(val, paths) {
  40566. this.is = 'uri';
  40567. this.value = val;
  40568. this.paths = paths;
  40569. }
  40570. toString() {
  40571. return this.value.toString();
  40572. }
  40573. ev(ctx) {
  40574. return new SuperMap.CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  40575. }
  40576. };
  40577. SuperMap.CartoCSS.Tree.Value = class Value {
  40578. constructor(value) {
  40579. this.is = 'value';
  40580. this.value = value;
  40581. }
  40582. ev(env) {
  40583. if (this.value.length === 1) {
  40584. return this.value[0].ev(env);
  40585. } else {
  40586. return new SuperMap.CartoCSS.Tree.Value(this.value.map(function (v) {
  40587. return v.ev(env);
  40588. }));
  40589. }
  40590. }
  40591. toJS(env) {
  40592. //var v = this.value[0].value[0];
  40593. var val = this.ev(env);
  40594. var v = val.toString();
  40595. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  40596. v = "'" + v + "'";
  40597. } else if (val.is === 'field') {
  40598. // replace [varuable] by ctx['variable']
  40599. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  40600. } else if (val.value && typeof val.value === "object") {
  40601. v = "[" + v + "]";
  40602. }
  40603. return "_value = " + v + ";";
  40604. }
  40605. toString(env, selector, sep, format) {
  40606. return this.value.map(function (e) {
  40607. return e.toString(env, format);
  40608. }).join(sep || ', ');
  40609. }
  40610. clone() {
  40611. var obj = Object.create(SuperMap.CartoCSS.Tree.Value.prototype);
  40612. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  40613. obj.is = this.is;
  40614. return obj;
  40615. }
  40616. };
  40617. SuperMap.CartoCSS.Tree.Variable = class Variable {
  40618. constructor(name, index, filename) {
  40619. this.is = 'variable';
  40620. this.name = name;
  40621. this.index = index;
  40622. this.filename = filename;
  40623. }
  40624. toString() {
  40625. return this.name;
  40626. }
  40627. ev(env) {
  40628. if (this._css) {return this._css;}
  40629. var thisframe = env.frames.filter(function (f) {
  40630. return f.name === this.name;
  40631. }.bind(this));
  40632. if (thisframe.length) {
  40633. return thisframe[0].value.ev(env);
  40634. } else {
  40635. env.error({
  40636. message: 'variable ' + this.name + ' is undefined',
  40637. index: this.index,
  40638. type: 'runtime',
  40639. filename: this.filename
  40640. });
  40641. return {
  40642. is: 'undefined',
  40643. value: 'undefined'
  40644. };
  40645. }
  40646. }
  40647. };
  40648. SuperMap.CartoCSS.Tree.Zoom = class Zoom {
  40649. constructor(op, value, index) {
  40650. this.op = op;
  40651. this.value = value;
  40652. this.index = index;
  40653. }
  40654. setZoom(zoom) {
  40655. this.zoom = zoom;
  40656. return this;
  40657. }
  40658. ev(env) {
  40659. var value = parseInt(this.value.ev(env).toString(), 10);
  40660. if (value > SuperMap.CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  40661. env.error({
  40662. message: 'Only zoom levels between 0 and ' +
  40663. SuperMap.CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  40664. index: this.index
  40665. });
  40666. }
  40667. switch (this.op) {
  40668. case '=':
  40669. this.zoom = "zoom && zoom === " + value;
  40670. return this;
  40671. case '>':
  40672. this.zoom = "zoom && zoom > " + value;
  40673. break;
  40674. case '>=':
  40675. this.zoom = "zoom && zoom >= " + value;
  40676. break;
  40677. case '<':
  40678. this.zoom = "zoom && zoom < " + value;
  40679. break;
  40680. case '<=':
  40681. this.zoom = "zoom && zoom <= " + value;
  40682. break;
  40683. default:
  40684. return this;
  40685. break;
  40686. }
  40687. /*
  40688. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  40689. if (i >= start && i <= end) {
  40690. zoom |= (1 << i);
  40691. }
  40692. }
  40693. this.zoom = zoom;
  40694. this.zoom=value+this.op+"zoom";*/
  40695. return this;
  40696. }
  40697. toString() {
  40698. var str = '';
  40699. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  40700. str += (this.zoom & (1 << i)) ? 'X' : '.';
  40701. }
  40702. return str;
  40703. }
  40704. };
  40705. // Covers all zoomlevels from 0 to 22
  40706. SuperMap.CartoCSS.Tree.Zoom.all = 23;
  40707. SuperMap.CartoCSS.Tree.Zoom.maxZoom = 22;
  40708. SuperMap.CartoCSS.Tree.Zoom.ranges = {
  40709. 0: 1000000000,
  40710. 1: 500000000,
  40711. 2: 200000000,
  40712. 3: 100000000,
  40713. 4: 50000000,
  40714. 5: 25000000,
  40715. 6: 12500000,
  40716. 7: 6500000,
  40717. 8: 3000000,
  40718. 9: 1500000,
  40719. 10: 750000,
  40720. 11: 400000,
  40721. 12: 200000,
  40722. 13: 100000,
  40723. 14: 50000,
  40724. 15: 25000,
  40725. 16: 12500,
  40726. 17: 5000,
  40727. 18: 2500,
  40728. 19: 1500,
  40729. 20: 750,
  40730. 21: 500,
  40731. 22: 250,
  40732. 23: 100
  40733. };
  40734. // CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  40735. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  40736. * This program are made available under the terms of the Apache License, Version 2.0
  40737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40738. /**
  40739. * @class SuperMap.ThemeStyle
  40740. * @classdesc 客户端专题图风格类。
  40741. * @category Visualization Theme
  40742. * @param {Object} options - 可选参数。
  40743. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  40744. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  40745. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  40746. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  40747. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  40748. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  40749. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  40750. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  40751. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  40752. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  40753. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  40754. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效;)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  40755. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  40756. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  40757. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  40758. * @param {string} options.label - 专题要素附加文本标签内容。
  40759. * @param {string} [options.fontColor] - 附加文本字体颜色。
  40760. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  40761. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  40762. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  40763. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  40764. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  40765. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  40766. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  40767. * @param {string} [options.labelPosition='top'] - 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  40768. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  40769. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle' 。
  40770. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  40771. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  40772. */
  40773. class ThemeStyle_ThemeStyle {
  40774. constructor(options) {
  40775. options = options || {};
  40776. /**
  40777. * @member {boolean} [SuperMap.ThemeStyle.prototype.fill=true]
  40778. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  40779. */
  40780. this.fill = true;
  40781. /**
  40782. * @member {string} [SuperMap.ThemeStyle.prototype.fillColor="#000000"]
  40783. * @description 十六进制填充颜色。
  40784. */
  40785. this.fillColor = "#000000";
  40786. /**
  40787. * @member {number} [SuperMap.ThemeStyle.prototype.fillOpacity=1]
  40788. * @description 填充不透明度。取值范围[0, 1]。
  40789. */
  40790. this.fillOpacity = 1;
  40791. /**
  40792. * @member {boolean} [SuperMap.ThemeStyle.prototype.stroke=false]
  40793. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  40794. */
  40795. this.stroke = false;
  40796. /**
  40797. * @member {string} [SuperMap.ThemeStyle.prototype.strokeColor="#000000"]
  40798. * @description 十六进制描边颜色。
  40799. */
  40800. this.strokeColor = "#000000";
  40801. /**
  40802. * @member {number} [SuperMap.ThemeStyle.prototype.strokeOpacity=1]
  40803. * @description 描边的不透明度。取值范围[0, 1]。
  40804. */
  40805. this.strokeOpacity = 1;
  40806. /**
  40807. * @member {number} [SuperMap.ThemeStyle.prototype.strokeWidth=1]
  40808. * @description 线宽度/描边宽度。
  40809. */
  40810. this.strokeWidth = 1;
  40811. /**
  40812. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLinecap="butt"]
  40813. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  40814. */
  40815. this.strokeLinecap = "butt";
  40816. /**
  40817. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLineJoin="miter"]
  40818. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  40819. */
  40820. this.strokeLineJoin = "miter";
  40821. /**
  40822. * @member {string} [SuperMap.ThemeStyle.prototype.strokeDashstyle="solid"]
  40823. * @description 虚线类型; strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  40824. * solid 表示实线。
  40825. */
  40826. this.strokeDashstyle = "solid";
  40827. /**
  40828. * @member {number} [SuperMap.ThemeStyle.prototype.pointRadius=6]
  40829. * @description 点半径。单位为像素。
  40830. */
  40831. this.pointRadius = 6;
  40832. /**
  40833. * @member {number} [SuperMap.ThemeStyle.prototype.shadowBlur=0]
  40834. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  40835. */
  40836. this.shadowBlur = 0;
  40837. /**
  40838. * @member {string} [SuperMap.ThemeStyle.prototype.shadowColor='#000000']
  40839. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  40840. */
  40841. this.shadowColor = "#000000";
  40842. /**
  40843. * @member {number} [SuperMap.ThemeStyle.prototype.shadowOffsetX=0]
  40844. * @description 阴影 X 方向偏移值。
  40845. */
  40846. this.shadowOffsetX = 0;
  40847. /**
  40848. * @member {number} SuperMap.ThemeStyle.prototype.shadowOffsetY
  40849. * @description Y 方向偏移值。
  40850. */
  40851. this.shadowOffsetY = 0;
  40852. /**
  40853. * @member {string} [SuperMap.ThemeStyle.prototype.label]
  40854. * @description 专题要素附加文本标签内容。
  40855. */
  40856. this.label = "";
  40857. /**
  40858. * @member {boolean} [SuperMap.ThemeStyle.prototype.labelRect=false]
  40859. * @description 是否显示文本标签矩形背景。
  40860. */
  40861. this.labelRect = false;
  40862. /**
  40863. * @member {string} [SuperMap.ThemeStyle.prototype.fontColor]
  40864. * @description 附加文本字体颜色。
  40865. */
  40866. this.fontColor = "";
  40867. /**
  40868. * @member {number} [SuperMap.ThemeStyle.prototype.fontSize=12]
  40869. * @description 附加文本字体大小,单位是像素。
  40870. */
  40871. this.fontSize = 12;
  40872. /**
  40873. * @member {string} [SuperMap.ThemeStyle.prototype.fontStyle="normal"]
  40874. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  40875. */
  40876. this.fontStyle = "normal";
  40877. /**
  40878. * @member {string} [SuperMap.ThemeStyle.prototype.fontVariant="normal"]
  40879. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  40880. */
  40881. this.fontVariant = "normal";
  40882. /**
  40883. * @member {string} [SuperMap.ThemeStyle.prototype.fontWeight="normal"]
  40884. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  40885. */
  40886. this.fontWeight = "normal";
  40887. /**
  40888. * @member {string} [SuperMap.ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  40889. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  40890. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  40891. */
  40892. this.fontFamily = "arial,sans-serif";
  40893. /**
  40894. * @member {string} [SuperMap.ThemeStyle.prototype.labelPosition='top']
  40895. * @description 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  40896. */
  40897. this.labelPosition = "top";
  40898. /**
  40899. * @member {string} [SuperMap.ThemeStyle.prototype.labelAlign='center']
  40900. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  40901. */
  40902. this.labelAlign = "center";
  40903. /**
  40904. * @member {string} [SuperMap.ThemeStyle.prototype.labelBaseline='middle']
  40905. * @description 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle'。
  40906. */
  40907. this.labelBaseline = "middle";
  40908. /**
  40909. * @member {number} [SuperMap.ThemeStyle.prototype.labelXOffset=0]
  40910. * @description 附加文本在 X 轴方向的偏移量。
  40911. */
  40912. this.labelXOffset = 0;
  40913. /**
  40914. * @member {number} [SuperMap.ThemeStyle.prototype.labelYOffset=0]
  40915. * @description 附加文本在 Y 轴方向的偏移量。
  40916. */
  40917. this.labelYOffset = 0;
  40918. Util_Util.extend(this, options);
  40919. }
  40920. }
  40921. SuperMap.ThemeStyle = ThemeStyle_ThemeStyle;
  40922. // CONCATENATED MODULE: ./src/common/style/index.js
  40923. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  40924. * This program are made available under the terms of the Apache License, Version 2.0
  40925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40926. // CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  40927. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  40928. * This program are made available under the terms of the Apache License, Version 2.0
  40929. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40930. /**
  40931. * @class SuperMap.Feature.ShapeParameters
  40932. * @category Visualization Theme
  40933. * @classdesc 图形参数基类,此类不可实例化
  40934. */
  40935. class ShapeParameters {
  40936. /**
  40937. * @function SuperMap.Feature.ShapeParameters.prototype.constructor
  40938. * @description 图形参数对象。
  40939. * @returns {SuperMap.Feature.ShapeParameters} 图形参数对象。
  40940. */
  40941. constructor() {
  40942. /**
  40943. * @member {Array} [SuperMap.Feature.ShapeParameters.prototype.refOriginalPosition=[0,0]]
  40944. * @description 图形参考原点位置,图形的参考中心位置。
  40945. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  40946. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  40947. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  40948. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  40949. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  40950. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  40951. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  40952. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  40953. */
  40954. this.refOriginalPosition = [0, 0];
  40955. /**
  40956. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataID
  40957. * @description 图形所关联数据的 ID(<{@link SuperMap.Feature.Vector}> 的 id)。
  40958. */
  40959. this.refDataID = null;
  40960. /**
  40961. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.isHoverByRefDataID
  40962. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  40963. */
  40964. this.isHoverByRefDataID = false;
  40965. /**
  40966. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataHoverGroup
  40967. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  40968. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  40969. */
  40970. this.refDataHoverGroup = null;
  40971. /**
  40972. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.dataInfo
  40973. * @description 图形携带的附加数据。
  40974. */
  40975. this.dataInfo = null;
  40976. /**
  40977. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.clickable
  40978. * @description 是否可点击。
  40979. */
  40980. this.clickable = true;
  40981. /**
  40982. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.hoverable
  40983. * @description 是否可点击。
  40984. */
  40985. this.hoverable = true;
  40986. /**
  40987. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.style
  40988. * @description 图形样式对象,可设样式属性在子类中确定。
  40989. */
  40990. this.style = null;
  40991. /**
  40992. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.highlightStyle
  40993. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  40994. */
  40995. this.highlightStyle = {};
  40996. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  40997. }
  40998. /**
  40999. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  41000. * @description 销毁对象。
  41001. */
  41002. destroy() {
  41003. this.refOriginalPosition = null;
  41004. this.refDataID = null;
  41005. this.isHoverByRefDataID = null;
  41006. this.refDataHoverGroup = null;
  41007. this.dataInfo = null;
  41008. this.clickable = null;
  41009. this.hoverable = null;
  41010. this.style = null;
  41011. this.highlightStyle = null;
  41012. }
  41013. }
  41014. SuperMap.Feature = SuperMap.Feature || {};
  41015. SuperMap.Feature.ShapeParameters = ShapeParameters;
  41016. // CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  41017. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41018. * This program are made available under the terms of the Apache License, Version 2.0
  41019. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41020. /**
  41021. * @class SuperMap.Feature.ShapeParameters.Point
  41022. * @category Visualization Theme
  41023. * @classdesc 点参数对象。
  41024. * @extends {SuperMap.Feature.ShapeParameters}
  41025. */
  41026. class feature_Point_Point extends ShapeParameters {
  41027. /**
  41028. * @function SuperMap.Feature.ShapeParameters.Point.prototype.constructor
  41029. * @description 创建一个图形点参数对象。
  41030. * @param {number} x - 点 x 坐标,必设参数。
  41031. * @param {number} y - 点 y 坐标,必设参数。
  41032. * @returns {SuperMap.Feature.ShapeParameters.Point} 标签参数对象。
  41033. */
  41034. constructor(x, y) {
  41035. super(x, y);
  41036. /**
  41037. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.x
  41038. * @description 点 x 坐标。
  41039. */
  41040. this.x = !isNaN(x) ? x : 0;
  41041. /**
  41042. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.y
  41043. * @description 点 y 坐标。
  41044. */
  41045. this.y = !isNaN(y) ? y : 0;
  41046. /**
  41047. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.r
  41048. * @description 点的半径。
  41049. */
  41050. this.r = 6;
  41051. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  41052. }
  41053. /**
  41054. * @function SuperMap.Feature.ShapeParameters.Point.prototype.destroy
  41055. * @description 销毁对象。
  41056. */
  41057. destroy() {
  41058. this.x = null;
  41059. this.y = null;
  41060. this.r = null;
  41061. super.destroy();
  41062. }
  41063. }
  41064. /**
  41065. * @typedef {Object} SuperMap.Feature.ShapeParameters.Point.style
  41066. * @property {number} pointRadius - 点的半径,默认值:6。
  41067. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41068. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41069. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41070. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41071. * @property {string} strokeColor - 十六进制描边颜色。
  41072. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41073. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41074. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41075. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41076. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41077. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41078. */
  41079. SuperMap.Feature = SuperMap.Feature || {};
  41080. SuperMap.Feature.ShapeParameters.Point = feature_Point_Point;
  41081. // CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  41082. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41083. * This program are made available under the terms of the Apache License, Version 2.0
  41084. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41085. /**
  41086. * @class SuperMap.Feature.ShapeParameters.Line
  41087. * @category Visualization Theme
  41088. * @classdesc 线参数对象。
  41089. * @extends {SuperMap.Feature.ShapeParameters}
  41090. */
  41091. class Line_Line extends ShapeParameters {
  41092. /**
  41093. * @function SuperMap.Feature.ShapeParameters.Line.prototype.constructor
  41094. * @description 创建一个图形线参数对象。
  41095. * @param {Array} pointList - 线要素节点数组,二维数组,必设参数。
  41096. * @returns {SuperMap.Feature.ShapeParameters.Line} 圆形参数对象。
  41097. */
  41098. constructor(pointList) {
  41099. super(pointList);
  41100. /**
  41101. * @member {Array} SuperMap.Feature.ShapeParameters.Line.prototype.pointList
  41102. * @description 线要素节点数组,二维数组。
  41103. * 数组形如:
  41104. * (start code)
  41105. * [
  41106. * [10, 20], //节点
  41107. * [30, 40],
  41108. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  41109. * ]
  41110. * (end)
  41111. */
  41112. this.pointList = pointList;
  41113. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  41114. }
  41115. /**
  41116. * @function SuperMap.Feature.ShapeParameters.Line.prototype.destroy
  41117. * @description 销毁对象。
  41118. */
  41119. destroy() {
  41120. this.pointList = null;
  41121. super.destroy();
  41122. }
  41123. }
  41124. /**
  41125. * @typedef {Object} SuperMap.Feature.ShapeParameters.Line.style
  41126. * @property {string} strokeColor - 十六进制线颜色。
  41127. * @property {number} strokeWidth - 线宽度,默认值 1。
  41128. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  41129. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  41130. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  41131. * @property {number} strokeOpacity - 线的不透明度。取值范围[0, 1],默认值 1。
  41132. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41133. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41134. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41135. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41136. */
  41137. SuperMap.Feature = SuperMap.Feature || {};
  41138. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  41139. // CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  41140. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41141. * This program are made available under the terms of the Apache License, Version 2.0
  41142. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41143. /**
  41144. * @class SuperMap.Feature.ShapeParameters.Polygon
  41145. * @category Visualization Theme
  41146. * @classdesc 面参数对象。
  41147. * @extends {SuperMap.Feature.ShapeParameters}
  41148. */
  41149. class feature_Polygon_Polygon extends ShapeParameters {
  41150. /**
  41151. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.constructor
  41152. * @description 创建一个图形面参数对象。
  41153. * @param {Array} pointList - 横坐标,必设参数。
  41154. * @returns {SuperMap.Feature.ShapeParameters.Polygon} 标签参数对象。
  41155. */
  41156. constructor(pointList) {
  41157. super(pointList);
  41158. /**
  41159. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.pointList
  41160. * @description 面要素节点数组,二维数组。
  41161. * 数组形如:
  41162. * (start code)
  41163. * [
  41164. * [10, 20], //节点
  41165. * [30, 40],
  41166. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  41167. * ]
  41168. * (end)
  41169. */
  41170. this.pointList = pointList;
  41171. /**
  41172. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.holePolygonPointLists
  41173. * @description 岛洞面多边形顶点数组(三维数组)
  41174. */
  41175. this.holePolygonPointLists = null;
  41176. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  41177. }
  41178. /**
  41179. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.destroy
  41180. * @description 销毁对象。
  41181. */
  41182. destroy() {
  41183. this.pointList = null;
  41184. this.holePolygonPointLists = null;
  41185. super.destroy();
  41186. }
  41187. }
  41188. /**
  41189. * @typedef {Object} SuperMap.Feature.ShapeParameters.Polygon.style
  41190. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41191. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41192. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41193. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41194. * @property {string} strokeColor - 十六进制描边颜色。
  41195. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41196. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41197. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  41198. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  41199. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  41200. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41201. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41202. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41203. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41204. */
  41205. SuperMap.Feature = SuperMap.Feature || {};
  41206. SuperMap.Feature.ShapeParameters.Polygon = feature_Polygon_Polygon;
  41207. // CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  41208. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41209. * This program are made available under the terms of the Apache License, Version 2.0
  41210. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41211. /**
  41212. * @class SuperMap.Feature.ShapeParameters.Rectangle
  41213. * @category Visualization Theme
  41214. * @classdesc 矩形参数对象。
  41215. * @extends {SuperMap.Feature.ShapeParameters}
  41216. */
  41217. class feature_Rectangle_Rectangle extends ShapeParameters {
  41218. /**
  41219. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.constructor
  41220. * @description 创建一个图形矩形参数对象。
  41221. * @param {number} x - 矩形 x 坐标,必设参数。
  41222. * @param {number} y - 矩形 y 坐标,必设参数。
  41223. * @param {number} width - 矩形 width 坐标,必设参数。
  41224. * @param {number} height - 矩形 height 坐标,必设参数。
  41225. * @returns {SuperMap.Feature.ShapeParameters.Rectangle} 图形矩形参数对象。
  41226. */
  41227. constructor(x, y, width, height) {
  41228. super(x, y, width, height);
  41229. /**
  41230. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.x
  41231. * @description 左上角 x 坐标。
  41232. */
  41233. this.x = !isNaN(x) ? x : 0;
  41234. /**
  41235. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.y
  41236. * @description 左上角 y 坐标。
  41237. */
  41238. this.y = !isNaN(x) ? y : 0;
  41239. /**
  41240. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.width
  41241. * @description 宽度。
  41242. */
  41243. this.width = !isNaN(width) ? width : 0;
  41244. /**
  41245. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.height
  41246. * @description 高度。
  41247. */
  41248. this.height = !isNaN(height) ? height : 0;
  41249. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  41250. }
  41251. /**
  41252. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.destroy
  41253. * @description 销毁对象。
  41254. */
  41255. destroy() {
  41256. this.x = null;
  41257. this.y = null;
  41258. this.width = null;
  41259. this.height = null;
  41260. super.destroy();
  41261. }
  41262. }
  41263. /**
  41264. * @typedef {Object} SuperMap.Feature.ShapeParameters.Rectangle.style
  41265. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41266. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41267. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41268. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41269. * @property {string} strokeColor - 十六进制描边颜色。
  41270. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41271. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41272. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  41273. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  41274. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  41275. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41276. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41277. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41278. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41279. */
  41280. SuperMap.Feature = SuperMap.Feature || {};
  41281. SuperMap.Feature.ShapeParameters.Rectangle = feature_Rectangle_Rectangle;
  41282. // CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  41283. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41284. * This program are made available under the terms of the Apache License, Version 2.0
  41285. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41286. /**
  41287. * @class SuperMap.Feature.ShapeParameters.Sector
  41288. * @category Visualization Theme
  41289. * @classdesc 扇形参数对象。
  41290. * @extends {SuperMap.Feature.ShapeParameters}
  41291. */
  41292. class Sector_Sector extends ShapeParameters {
  41293. /**
  41294. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.constructor
  41295. * @description 创建一个扇形参数对象。
  41296. * @param {number} x - 圆心 x 坐标,必设参数。
  41297. * @param {number} y - 圆心 y 坐标,必设参数。
  41298. * @param {number} r - 外圆半径,必设参数。
  41299. * @param {number} startAngle - 起始角度,必设参数。取值范围[0, 360)。
  41300. * @param {number} endAngle - 结束角度,必设参数。取值范围(0, 360]。
  41301. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  41302. * @returns {SuperMap.Feature.ShapeParameters.Sector} 扇形参数对象。
  41303. */
  41304. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  41305. super(x, y, r, startAngle, endAngle, r0, clockWise);
  41306. /**
  41307. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.x
  41308. * @description 圆心 x 坐标。
  41309. */
  41310. this.x = !isNaN(x) ? x : 0;
  41311. /**
  41312. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.Y
  41313. * @description 圆心 Y 坐标。
  41314. */
  41315. this.y = !isNaN(y) ? y : 0;
  41316. /**
  41317. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.r
  41318. * @description 外圆半径。
  41319. */
  41320. this.r = !isNaN(r) ? r : 0;
  41321. /**
  41322. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.startAngle
  41323. * @description 起始角度。取值范围[0, 360),默认值:null。
  41324. */
  41325. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  41326. /**
  41327. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.endAngle
  41328. * @description 结束角度。取值范围(0, 360],默认值:null。
  41329. */
  41330. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  41331. /**
  41332. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.r0=0]
  41333. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  41334. */
  41335. this.r0 = !isNaN(r0) ? r0 : 0;
  41336. /**
  41337. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.clockWise=false]
  41338. * @description 是否是顺时针。默认值:false。
  41339. */
  41340. this.clockWise = clockWise;
  41341. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  41342. }
  41343. /**
  41344. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.destroy
  41345. * @description 销毁对象。
  41346. */
  41347. destroy() {
  41348. this.x = null;
  41349. this.y = null;
  41350. this.r = null;
  41351. this.startAngle = null;
  41352. this.endAngle = null;
  41353. this.r0 = null;
  41354. this.clockWise = null;
  41355. super.destroy();
  41356. }
  41357. }
  41358. /**
  41359. * @typedef {Object} SuperMap.Feature.ShapeParameters.Sector.style
  41360. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41361. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41362. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41363. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41364. * @property {string} strokeColor - 十六进制描边颜色。
  41365. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41366. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41367. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41368. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41369. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41370. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41371. */
  41372. SuperMap.Feature = SuperMap.Feature || {};
  41373. SuperMap.Feature.ShapeParameters.Sector = Sector_Sector;
  41374. // CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  41375. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41376. * This program are made available under the terms of the Apache License, Version 2.0
  41377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41378. /**
  41379. * @class SuperMap.Feature.ShapeParameters.Label
  41380. * @category Visualization Theme
  41381. * @classdesc 标签参数对象。
  41382. * @extent {SuperMap.Feature.ShapeParameters}
  41383. */
  41384. class Label_Label extends ShapeParameters {
  41385. /**
  41386. * @function SuperMap.Feature.ShapeParameters.Label.prototype.constructor
  41387. * @description 创建一个标签参数对象。
  41388. * @param {number} x - 横坐标,必设参数。
  41389. * @param {number} y - 纵坐标,必设参数。
  41390. * @param {string} text - 图形中的附加文本,必设参数。
  41391. * @returns {SuperMap.Feature.ShapeParameters.Label} 标签参数对象。
  41392. */
  41393. constructor(x, y, text) {
  41394. super(x, y, text);
  41395. /**
  41396. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.x
  41397. * @description 标签 x 坐标。
  41398. */
  41399. this.x = x;
  41400. /**
  41401. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.y
  41402. * @description 标签 y 坐标。
  41403. */
  41404. this.y = y;
  41405. /**
  41406. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.text
  41407. * @description 标签的文本内容。
  41408. */
  41409. this.text = text;
  41410. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  41411. }
  41412. /**
  41413. * @function SuperMap.Feature.ShapeParameters.Label.prototype.destroy
  41414. * @description 销毁对象。
  41415. */
  41416. destroy() {
  41417. this.x = null;
  41418. this.y = null;
  41419. this.text = null;
  41420. super.destroy();
  41421. }
  41422. }
  41423. /**
  41424. * @typedef {Object} SuperMap.Feature.ShapeParameters.Label.style
  41425. * @property {boolean} fill - 是否填充,不需要填充则设置为 false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41426. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41427. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41428. * @property {boolean} stroke - 是否描边,不需要描边则设置为false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41429. * @property {string} strokeColor - 十六进制描边颜色。
  41430. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41431. * @property {number} strokeWidth -描边宽度,默认值 1。
  41432. * @property {number} maxWidth - 最大宽度限制。默认值:null。
  41433. * @property {number} fontSize - 标签文本字体大小。默认值 12,单位是像素。
  41434. * @property {string} fontStyle - 标签文本字体样式。可设值:"normal", "italic", "oblique"; 默认值:"normal" 。
  41435. * @property {string} fontVariant - 标签文本字体变体。可设值:"normal", "small-caps"; 默认值:"normal" 。
  41436. * @property {string} fontWeight - 标签文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"; 默认值:"normal" 。
  41437. * @property {string} fontFamily - 标签文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个值。
  41438. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。默认值:"arial,sans-serif".
  41439. * @property {string} labelBaseline - 标签文本垂直对齐, 可以是 'top', 'bottom', 'middle',默认值 'middle'。
  41440. * @property {string} labelAlign - 标签文本水平对齐。可以是 'left', 'right', 'center'; 默认值 'center'。
  41441. * @property {number} shadowBlur - 阴影模糊度,大于 0 有效。默认值:0。
  41442. * @property {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  41443. * @property {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  41444. * @property {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  41445. */
  41446. SuperMap.Feature = SuperMap.Feature || {};
  41447. SuperMap.Feature.ShapeParameters.Label = Label_Label;
  41448. // CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  41449. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41450. * This program are made available under the terms of the Apache License, Version 2.0
  41451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41452. /**
  41453. * @class SuperMap.Feature.ShapeParameters.Image
  41454. * @category Visualization Theme
  41455. * @classdesc 图片参数对象。
  41456. * @extends {SuperMap.Feature.ShapeParameters}
  41457. */
  41458. class Image_Image extends ShapeParameters {
  41459. /**
  41460. * @function SuperMap.Feature.ShapeParameters.Image.prototype.constructor
  41461. * @description 创建一个图片参数对象。
  41462. * @param {number} x - 左上角横坐标,必设参数。
  41463. * @param {number} y - 左上角纵坐标,必设参数。
  41464. * @param {(string|Object)} image - 图片地址或Cavans对象,必设参数。
  41465. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  41466. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  41467. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  41468. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  41469. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  41470. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  41471. * @returns {SuperMap.Feature.ShapeParameters.Image} 圆形参数对象。
  41472. */
  41473. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  41474. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  41475. /**
  41476. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.x
  41477. * @description 左上角横坐标,必设参数。
  41478. */
  41479. this.x = x;
  41480. /**
  41481. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.y
  41482. * @description 左上角纵坐标,必设参数。
  41483. */
  41484. this.y = y;
  41485. /**
  41486. * @member {(string|Object)} SuperMap.Feature.ShapeParameters.Image.prototype.image
  41487. * @description 图片地址。
  41488. */
  41489. this.image = image;
  41490. /**
  41491. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.width
  41492. * @description 绘制到画布上的宽度,默认为图片高度。
  41493. */
  41494. this.width = width;
  41495. /**
  41496. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.height
  41497. * @description 绘制到画布上的高度,默认为图片高度。
  41498. */
  41499. this.height = height;
  41500. /**
  41501. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sx
  41502. * @description 从图片中裁剪的左上角横坐标。
  41503. */
  41504. this.sx = sx;
  41505. /**
  41506. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sy
  41507. * @description 从图片中裁剪的左上角纵坐标。
  41508. */
  41509. this.sy = sy;
  41510. /**
  41511. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sWidth
  41512. * @description 从图片中裁剪的宽度,默认为图片高度。
  41513. */
  41514. this.sWidth = sWidth;
  41515. /**
  41516. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sHeight
  41517. * @description 绘制到画布上的高度,默认为图片高度。
  41518. */
  41519. this.sHeight = sHeight;
  41520. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  41521. }
  41522. /**
  41523. * @function SuperMap.Feature.ShapeParameters.Image.prototype.destroy
  41524. * @description 销毁对象。
  41525. */
  41526. destroy() {
  41527. this.x = null;
  41528. this.y = null;
  41529. this.image = null;
  41530. this.width = null;
  41531. this.height = null;
  41532. this.sx = null;
  41533. this.sy = null;
  41534. this.sWidth = null;
  41535. this.sHeight = null;
  41536. super.destroy();
  41537. }
  41538. }
  41539. SuperMap.Feature = SuperMap.Feature || {};
  41540. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  41541. // CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  41542. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41543. * This program are made available under the terms of the Apache License, Version 2.0
  41544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41545. /**
  41546. * @class SuperMap.Feature.ShapeParameters.Circle
  41547. * @classdesc 圆形参数对象。
  41548. * @category Visualization Theme
  41549. * @extends {SuperMap.Feature.ShapeParameters}
  41550. */
  41551. class Circle_Circle extends ShapeParameters {
  41552. /**
  41553. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.constructor
  41554. * @description 创建一个圆形参数对象。
  41555. * @param {number} x - 圆心 x 坐标,必设参数。
  41556. * @param {number} y - 圆心 y 坐标,必设参数。
  41557. * @param {number} r - 圆半径,必设参数。
  41558. * @returns {SuperMap.Feature.ShapeParameters.Circle} 圆形参数对象。
  41559. */
  41560. constructor(x, y, r) {
  41561. super(x, y, r);
  41562. /**
  41563. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.x
  41564. * @description 圆心 x 坐标。
  41565. */
  41566. this.x = !isNaN(x) ? x : 0;
  41567. /**
  41568. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.y
  41569. * @description 圆心 y 坐标。
  41570. */
  41571. this.y = !isNaN(y) ? y : 0;
  41572. /**
  41573. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.r
  41574. * @description 圆半径。
  41575. */
  41576. this.r = !isNaN(r) ? r : 0;
  41577. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  41578. }
  41579. /**
  41580. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.destroy
  41581. * @description 销毁对象。
  41582. */
  41583. destroy() {
  41584. this.x = null;
  41585. this.y = null;
  41586. this.r = null;
  41587. super.destroy();
  41588. }
  41589. }
  41590. SuperMap.Feature = SuperMap.Feature || {};
  41591. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  41592. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  41593. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41594. * This program are made available under the terms of the Apache License, Version 2.0
  41595. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41596. /**
  41597. * @class SuperMap.LevelRenderer.Eventful
  41598. * @category Visualization Theme
  41599. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  41600. * 此类不可实例化。
  41601. * @private
  41602. */
  41603. class Eventful {
  41604. /**
  41605. * @function SuperMap.LevelRenderer.Eventful.prototype.constructor
  41606. * @description 构造函数。对象可以通过 onxxxx 绑定事件。
  41607. * 支持的事件:
  41608. * Symbolizer properties:
  41609. * onclick - {function} 默认值:null。
  41610. * onmouseover - {function} 默认值:null。
  41611. * onmouseout - {function} 默认值:null。
  41612. * onmousemove - {function} 默认值:null。
  41613. * onmousewheel - {function} 默认值:null。
  41614. * onmousedown - {function} 默认值:null。
  41615. * onmouseup - {function} 默认值:null。
  41616. * ondragstart - {function} 默认值:null。
  41617. * ondragend - {function} 默认值:null。
  41618. * ondragenter - {function} 默认值:null。
  41619. * ondragleave - {function} 默认值:null。
  41620. * ondragover - {function} 默认值:null。
  41621. * ondrop - {function} 默认值:null。
  41622. */
  41623. constructor() {
  41624. /**
  41625. * @member {Object} SuperMap.LevelRenderer.Eventful.prototype._handlers
  41626. * @description 事件处理对象(事件分发器)。
  41627. */
  41628. this._handlers = {};
  41629. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  41630. }
  41631. /**
  41632. * @function {Object} SuperMap.LevelRenderer.Eventful.prototype.destroy
  41633. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  41634. */
  41635. destroy() {
  41636. this._handlers = null;
  41637. }
  41638. /**
  41639. * @function SuperMap.LevelRenderer.Eventful.prototype.one
  41640. * @description 单次触发绑定,dispatch后销毁。
  41641. * @param {string} event - 事件名。
  41642. * @param {boolean} handler - 响应函数。
  41643. * @param {Object} context - context。
  41644. * @returns {SuperMap.LevelRenderer.Eventful} this
  41645. */
  41646. one(event, handler, context) {
  41647. var _h = this._handlers;
  41648. if (!handler || !event) {
  41649. return this;
  41650. }
  41651. if (!_h[event]) {
  41652. _h[event] = [];
  41653. }
  41654. _h[event].push({
  41655. h: handler,
  41656. one: true,
  41657. ctx: context || this
  41658. });
  41659. return this;
  41660. }
  41661. /**
  41662. * @function SuperMap.LevelRenderer.Eventful.prototype.bind
  41663. * @description 绑定事件。
  41664. * @param {string} event - 事件名。
  41665. * @param {boolean} handler - 响应函数。
  41666. * @param {Object} context - context。
  41667. * @returns {SuperMap.LevelRenderer.Eventful} this
  41668. */
  41669. bind(event, handler, context) {
  41670. var _h = this._handlers;
  41671. if (!handler || !event) {
  41672. return this;
  41673. }
  41674. if (!_h[event]) {
  41675. _h[event] = [];
  41676. }
  41677. _h[event].push({
  41678. h: handler,
  41679. one: false,
  41680. ctx: context || this
  41681. });
  41682. return this;
  41683. }
  41684. /**
  41685. * @function SuperMap.LevelRenderer.Eventful.prototype.unbind
  41686. * @description 解绑事件。
  41687. * @param {string} event - 事件名。
  41688. * @param {boolean} handler - 响应函数。
  41689. * @returns {SuperMap.LevelRenderer.Eventful} this
  41690. */
  41691. unbind(event, handler) {
  41692. var _h = this._handlers;
  41693. if (!event) {
  41694. this._handlers = {};
  41695. return this;
  41696. }
  41697. if (handler) {
  41698. if (_h[event]) {
  41699. var newList = [];
  41700. for (var i = 0, l = _h[event].length; i < l; i++) {
  41701. if (_h[event][i]['h'] != handler) {
  41702. newList.push(_h[event][i]);
  41703. }
  41704. }
  41705. _h[event] = newList;
  41706. }
  41707. if (_h[event] && _h[event].length === 0) {
  41708. delete _h[event];
  41709. }
  41710. } else {
  41711. delete _h[event];
  41712. }
  41713. return this;
  41714. }
  41715. /**
  41716. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatch
  41717. * @description 事件分发。
  41718. * @param {string} type - 事件类型。
  41719. * @returns {SuperMap.LevelRenderer.Eventful} this
  41720. */
  41721. dispatch(type) {
  41722. if (this._handlers[type]) {
  41723. var args = arguments;
  41724. var argLen = args.length;
  41725. if (argLen > 3) {
  41726. args = Array.prototype.slice.call(args, 1);
  41727. }
  41728. var _h = this._handlers[type];
  41729. var len = _h.length;
  41730. for (var i = 0; i < len;) {
  41731. // Optimize advise from backbone
  41732. switch (argLen) {
  41733. case 1:
  41734. _h[i]['h'].call(_h[i]['ctx']);
  41735. break;
  41736. case 2:
  41737. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  41738. break;
  41739. case 3:
  41740. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  41741. break;
  41742. default:
  41743. // have more than 2 given arguments
  41744. _h[i]['h'].apply(_h[i]['ctx'], args);
  41745. break;
  41746. }
  41747. if (_h[i]['one']) {
  41748. _h.splice(i, 1);
  41749. len--;
  41750. } else {
  41751. i++;
  41752. }
  41753. }
  41754. }
  41755. return this;
  41756. }
  41757. /**
  41758. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatchWithContext
  41759. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  41760. * @param {string} type - 事件类型。
  41761. * @returns {SuperMap.LevelRenderer.Eventful} this
  41762. */
  41763. dispatchWithContext(type) {
  41764. if (this._handlers[type]) {
  41765. var args = arguments;
  41766. var argLen = args.length;
  41767. if (argLen > 4) {
  41768. args = Array.prototype.slice.call(args, 1, args.length - 1);
  41769. }
  41770. var ctx = args[args.length - 1];
  41771. var _h = this._handlers[type];
  41772. var len = _h.length;
  41773. for (var i = 0; i < len;) {
  41774. // Optimize advise from backbone
  41775. switch (argLen) {
  41776. case 1:
  41777. _h[i]['h'].call(ctx);
  41778. break;
  41779. case 2:
  41780. _h[i]['h'].call(ctx, args[1]);
  41781. break;
  41782. case 3:
  41783. _h[i]['h'].call(ctx, args[1], args[2]);
  41784. break;
  41785. default:
  41786. // have more than 2 given arguments
  41787. _h[i]['h'].apply(ctx, args);
  41788. break;
  41789. }
  41790. if (_h[i]['one']) {
  41791. _h.splice(i, 1);
  41792. len--;
  41793. } else {
  41794. i++;
  41795. }
  41796. }
  41797. }
  41798. return this;
  41799. }
  41800. }
  41801. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  41802. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  41803. * This program are made available under the terms of the Apache License, Version 2.0
  41804. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41805. /**
  41806. * @private
  41807. * @class SuperMap.LevelRenderer.Tool.Vector
  41808. * @category Visualization Theme
  41809. * @classdesc LevelRenderer 二维向量类
  41810. *
  41811. */
  41812. class levelRenderer_Vector_Vector {
  41813. /**
  41814. * @function SuperMap.LevelRenderer.Tool.Vector.constructor
  41815. * @description 构造函数
  41816. */
  41817. constructor() {
  41818. this.ArrayCtor = typeof Float32Array === 'undefined'
  41819. ? Array
  41820. : Float32Array;
  41821. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  41822. }
  41823. /**
  41824. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.create
  41825. * @description 创建一个向量。
  41826. *
  41827. * @param {number} x - x坐标
  41828. * @param {number} y - Y坐标
  41829. * @return {Vector2} 向量。
  41830. */
  41831. create(x, y) {
  41832. var ArrayCtor = this.ArrayCtor;
  41833. var out = new ArrayCtor(2);
  41834. out[0] = x || 0;
  41835. out[1] = y || 0;
  41836. return out;
  41837. }
  41838. /**
  41839. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.copy
  41840. * @description 复制一个向量。
  41841. *
  41842. * @param {Vector2} out - 基础向量。
  41843. * @param {Vector2} v - 向量。
  41844. * @return {Vector2} 克隆向量。
  41845. */
  41846. copy(out, v) {
  41847. out[0] = v[0];
  41848. out[1] = v[1];
  41849. return out;
  41850. }
  41851. /**
  41852. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.set
  41853. * @description 设置向量的两个项。
  41854. *
  41855. * @param {Vector2} out - 基础向量。
  41856. * @param {number} a - 项 a。
  41857. * @param {number} b - 项 b。
  41858. * @return {Vector2} 结果。
  41859. */
  41860. set(out, a, b) {
  41861. out[0] = a;
  41862. out[1] = b;
  41863. return out;
  41864. }
  41865. /**
  41866. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.add
  41867. * @description 向量相加。
  41868. *
  41869. * @param {Vector2} out - 基础向量。
  41870. * @param {Vector2} v1 - 向量 v1。
  41871. * @param {Vector2} v2 - 向量 v2。
  41872. * @return {Vector2} 结果。
  41873. */
  41874. add(out, v1, v2) {
  41875. out[0] = v1[0] + v2[0];
  41876. out[1] = v1[1] + v2[1];
  41877. return out;
  41878. }
  41879. /**
  41880. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  41881. * @description 向量缩放后相加。
  41882. * @param {Vector2} out - 基础向量。
  41883. * @param {Vector2} v1 - 向量 v1。
  41884. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  41885. * @param {number} a - 缩放参数。
  41886. * @return {Vector2} 结果。
  41887. */
  41888. scaleAndAdd(out, v1, v2, a) {
  41889. out[0] = v1[0] + v2[0] * a;
  41890. out[1] = v1[1] + v2[1] * a;
  41891. return out;
  41892. }
  41893. /**
  41894. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.sub
  41895. * @description 向量相减。
  41896. * @param {Vector2} out - 基础向量。
  41897. * @param {Vector2} v1 - 向量 v1。
  41898. * @param {Vector2} v2 - 向量 v2。
  41899. * @return {Vector2} 结果。
  41900. */
  41901. sub(out, v1, v2) {
  41902. out[0] = v1[0] - v2[0];
  41903. out[1] = v1[1] - v2[1];
  41904. return out;
  41905. }
  41906. /**
  41907. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.len
  41908. * @description 向量长度。
  41909. * @param {Vector2} v - 向量。
  41910. * @return {number} 向量长度。
  41911. */
  41912. len(v) {
  41913. return Math.sqrt(this.lenSquare(v));
  41914. }
  41915. /**
  41916. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lenSquare
  41917. * @description 向量长度平方。
  41918. * @param {Vector2} v - 向量。
  41919. * @return {number} 向量长度平方。
  41920. */
  41921. lenSquare(v) {
  41922. return v[0] * v[0] + v[1] * v[1];
  41923. }
  41924. /**
  41925. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.mul
  41926. * @description 向量乘法。
  41927. * @param {Vector2} out - 基础向量。
  41928. * @param {Vector2} v1 - 向量 v1。
  41929. * @param {Vector2} v2 - 向量 v2。
  41930. * @return {Vector2} 结果。
  41931. */
  41932. mul(out, v1, v2) {
  41933. out[0] = v1[0] * v2[0];
  41934. out[1] = v1[1] * v2[1];
  41935. return out;
  41936. }
  41937. /**
  41938. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.div
  41939. * @description 向量除法。
  41940. *
  41941. * @param {Vector2} out - 基础向量。
  41942. * @param {Vector2} v1 - 向量 v1。
  41943. * @param {Vector2} v2 - 向量 v2。
  41944. * @return {Vector2} 结果。
  41945. */
  41946. div(out, v1, v2) {
  41947. out[0] = v1[0] / v2[0];
  41948. out[1] = v1[1] / v2[1];
  41949. return out;
  41950. }
  41951. /**
  41952. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dot
  41953. * @description 向量点乘。
  41954. *
  41955. * @param {Vector2} v1 - 向量 v1。
  41956. * @param {Vector2} v2 - 向量 v2。
  41957. * @return {number} 向量点乘。
  41958. */
  41959. dot(v1, v2) {
  41960. return v1[0] * v2[0] + v1[1] * v2[1];
  41961. }
  41962. /**
  41963. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scale
  41964. * @description 向量缩放。
  41965. *
  41966. * @param {Vector2} out - 基础向量。
  41967. * @param {Vector2} v - 向量v。
  41968. * @param {number} s -缩放参数。
  41969. * @return {Vector2} 结果。
  41970. */
  41971. scale(out, v, s) {
  41972. out[0] = v[0] * s;
  41973. out[1] = v[1] * s;
  41974. return out;
  41975. }
  41976. /**
  41977. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.normalize
  41978. * @description 向量归一化。
  41979. *
  41980. * @param {Vector2} out - 基础向量。
  41981. * @param {Vector2} v - 向量 v。
  41982. * @return {Vector2} 结果。
  41983. */
  41984. normalize(out, v) {
  41985. var d = this.len(v);
  41986. if (d === 0) {
  41987. out[0] = 0;
  41988. out[1] = 0;
  41989. } else {
  41990. out[0] = v[0] / d;
  41991. out[1] = v[1] / d;
  41992. }
  41993. return out;
  41994. }
  41995. /**
  41996. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distance
  41997. * @description 计算向量间距离。
  41998. *
  41999. * @param {Vector2} v1 - 向量 v1。
  42000. * @param {Vector2} v2 - 向量 v2。
  42001. * @return {number} 向量间距离。
  42002. */
  42003. distance(v1, v2) {
  42004. return Math.sqrt(
  42005. (v1[0] - v2[0]) * (v1[0] - v2[0])
  42006. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  42007. );
  42008. }
  42009. /**
  42010. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distanceSquare
  42011. * @description 向量距离平方。
  42012. *
  42013. * @param {Vector2} v1 - 向量 v1。
  42014. * @param {Vector2} v2 - 向量 v2。
  42015. * @return {number} 向量距离平方。
  42016. */
  42017. distanceSquare(v1, v2) {
  42018. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  42019. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  42020. }
  42021. /**
  42022. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.negate
  42023. * @description 求负向量。
  42024. *
  42025. * @param {Vector2} out - 基础向量。
  42026. * @param {Vector2} v - 向量 v。
  42027. * @return {Vector2} 负向量。
  42028. */
  42029. negate(out, v) {
  42030. out[0] = -v[0];
  42031. out[1] = -v[1];
  42032. return out;
  42033. }
  42034. /**
  42035. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lerp
  42036. * @description 两点之间线性插值。
  42037. *
  42038. * @param {Vector2} out - 基础向量。
  42039. * @param {Vector2} v1 - 向量 v1。
  42040. * @param {Vector2} v2 - 向量 v2。
  42041. * @param {number} t
  42042. * @return {Vector2} 结果。
  42043. */
  42044. lerp(out, v1, v2, t) {
  42045. out[0] = v1[0] + t * (v2[0] - v1[0]);
  42046. out[1] = v1[1] + t * (v2[1] - v1[1]);
  42047. return out;
  42048. }
  42049. /**
  42050. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.applyTransform
  42051. * @description 矩阵左乘向量。
  42052. *
  42053. * @param {Vector2} out - 基础向量。
  42054. * @param {Vector2} v1 - 向量 v1。
  42055. * @param {Vector2} v2 - 向量 v2。
  42056. * @return {Vector2} 结果。
  42057. */
  42058. applyTransform(out, v, m) {
  42059. var x = v[0];
  42060. var y = v[1];
  42061. out[0] = m[0] * x + m[2] * y + m[4];
  42062. out[1] = m[1] * x + m[3] * y + m[5];
  42063. return out;
  42064. }
  42065. /**
  42066. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.min
  42067. * @description 求两个向量最小值。
  42068. * @param {Vector2} out - 基础向量。
  42069. * @param {Vector2} v1 - 向量 v1。
  42070. * @param {Vector2} v2 - 向量 v2。
  42071. * @return {Vector2} 结果。
  42072. */
  42073. min(out, v1, v2) {
  42074. out[0] = Math.min(v1[0], v2[0]);
  42075. out[1] = Math.min(v1[1], v2[1]);
  42076. return out;
  42077. }
  42078. /**
  42079. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.max
  42080. * @description 求两个向量最大值。
  42081. *
  42082. * @param {Vector2} out - 基础向量。
  42083. * @param {Vector2} v1 - 向量 v1。
  42084. * @param {Vector2} v2 - 向量 v2。
  42085. * @return {Vector2} 结果。
  42086. */
  42087. max(out, v1, v2) {
  42088. out[0] = Math.max(v1[0], v2[0]);
  42089. out[1] = Math.max(v1[1], v2[1]);
  42090. return out;
  42091. }
  42092. /**
  42093. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.length
  42094. * @description 向量长度。
  42095. *
  42096. * @param {Vector2} v - 向量。
  42097. * @return {number} 向量长度。
  42098. */
  42099. length(v) {
  42100. return this.len(v);
  42101. }
  42102. /**
  42103. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lengthSquare
  42104. * @description 向量长度平方。
  42105. *
  42106. * @param {Vector2} v - 向量。
  42107. * @return {number} 向量长度平方。
  42108. */
  42109. lengthSquare(v) {
  42110. return this.lenSquare(v);
  42111. }
  42112. /**
  42113. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dist
  42114. * @description 计算向量间距离。
  42115. *
  42116. * @param {Vector2} v1 - 向量 v1。
  42117. * @param {Vector2} v2 - 向量 v2。
  42118. * @return {number} 向量间距离。
  42119. */
  42120. dist(v1, v2) {
  42121. return this.distance(v1, v2);
  42122. }
  42123. /**
  42124. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distSquare
  42125. * @description 向量距离平方。
  42126. *
  42127. * @param {Vector2} v1 - 向量 v1。
  42128. * @param {Vector2} v2 - 向量 v2。
  42129. * @return {number} 向量距离平方
  42130. */
  42131. distSquare(v1, v2) {
  42132. return this.distanceSquare(v1, v2);
  42133. }
  42134. }
  42135. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  42136. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  42137. * This program are made available under the terms of the Apache License, Version 2.0
  42138. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42139. /**
  42140. * @class SuperMap.LevelRenderer.Tool.Curve
  42141. * @category Visualization Theme
  42142. * @classdesc LevelRenderer 工具-曲线
  42143. * @private
  42144. */
  42145. class levelRenderer_Curve_Curve {
  42146. /**
  42147. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.constructor
  42148. * @description 构造函数。
  42149. */
  42150. constructor() {
  42151. /**
  42152. * @member {SuperMap.LevelRenderer.Tool.Vector} SuperMap.LevelRenderer.Tool.Curve.prototype.vector
  42153. * @description 矢量工具。
  42154. */
  42155. this.vector = new levelRenderer_Vector_Vector();
  42156. /**
  42157. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.EPSILON
  42158. * @description e。
  42159. */
  42160. this.EPSILON = 1e-4;
  42161. /**
  42162. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  42163. * @description 3 的平方根。
  42164. */
  42165. this.THREE_SQRT = Math.sqrt(3);
  42166. /**
  42167. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  42168. * @description 1/3。
  42169. */
  42170. this.ONE_THIRD = 1 / 3;
  42171. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  42172. }
  42173. /*
  42174. * Method: evalCubicCoeff
  42175. *
  42176. * Parameters:
  42177. * a - {number} 值。
  42178. * b - {number} 值。
  42179. * c - {number} 值。
  42180. * d - {number} 值。
  42181. * t - {number} 值。
  42182. *
  42183. * Returns:
  42184. * {number}
  42185. */
  42186. /*
  42187. evalCubicCoeff: function(a, b, c, d, t){
  42188. return ((a * t + b) * t + c) * t + d;
  42189. },
  42190. */
  42191. /**
  42192. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isAroundZero
  42193. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  42194. * @param {number} val - 值。
  42195. * @returns {boolean} 值是否趋于0。
  42196. */
  42197. isAroundZero(val) {
  42198. return val > -this.EPSILON && val < this.EPSILON;
  42199. }
  42200. /**
  42201. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  42202. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  42203. * @param {number} val - 值。
  42204. * @returns {boolean} 值是否不趋于0。
  42205. */
  42206. isNotAroundZero(val) {
  42207. return val > this.EPSILON || val < -this.EPSILON;
  42208. }
  42209. /**
  42210. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicAt
  42211. * @description 计算三次贝塞尔值
  42212. * @param {number} p0 - 点p0。
  42213. * @param {number} p1 - 点p1。
  42214. * @param {number} p2 - 点p2。
  42215. * @param {number} p3 - 点p3。
  42216. * @param {number} t - t值。
  42217. * @returns {number} 三次贝塞尔值。
  42218. */
  42219. cubicAt(p0, p1, p2, p3, t) {
  42220. var onet = 1 - t;
  42221. return onet * onet * (onet * p0 + 3 * t * p1)
  42222. + t * t * (t * p3 + 3 * onet * p2);
  42223. }
  42224. /**
  42225. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  42226. * @description 计算三次贝塞尔导数值
  42227. * @param {number} p0 - 点p0。
  42228. * @param {number} p1 - 点p1。
  42229. * @param {number} p2 - 点p2。
  42230. * @param {number} p3 - 点p3。
  42231. * @param {number} t - t值。
  42232. * @returns {number} 三次贝塞尔导数值。
  42233. */
  42234. cubicDerivativeAt(p0, p1, p2, p3, t) {
  42235. var onet = 1 - t;
  42236. return 3 * (
  42237. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  42238. + (p3 - p2) * t * t
  42239. );
  42240. }
  42241. /**
  42242. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  42243. * @description 计算三次贝塞尔方程根,使用盛金公式
  42244. * @param {number} p0 - 点p0。
  42245. * @param {number} p1 - 点p1。
  42246. * @param {number} p2 - 点p2。
  42247. * @param {number} p3 - 点p3。
  42248. * @param {number} val - 值。
  42249. * @param {Array.<number>} roots - 有效根数目。
  42250. * @returns {number} 有效根。
  42251. */
  42252. cubicRootAt(p0, p1, p2, p3, val, roots) {
  42253. // Evaluate roots of cubic functions
  42254. var a = p3 + 3 * (p1 - p2) - p0;
  42255. var b = 3 * (p2 - p1 * 2 + p0);
  42256. var c = 3 * (p1 - p0);
  42257. var d = p0 - val;
  42258. var A = b * b - 3 * a * c;
  42259. var B = b * c - 9 * a * d;
  42260. var C = c * c - 3 * b * d;
  42261. var n = 0;
  42262. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  42263. if (this.isAroundZero(b)) {
  42264. roots[0] = 0;
  42265. } else {
  42266. let t1 = -c / b; //t1, t2, t3, b is not zero
  42267. if (t1 >= 0 && t1 <= 1) {
  42268. roots[n++] = t1;
  42269. }
  42270. }
  42271. } else {
  42272. var disc = B * B - 4 * A * C;
  42273. if (this.isAroundZero(disc)) {
  42274. var K = B / A;
  42275. let t1 = -b / a + K; // t1, a is not zero
  42276. let t2 = -K / 2; // t2, t3
  42277. if (t1 >= 0 && t1 <= 1) {
  42278. roots[n++] = t1;
  42279. }
  42280. if (t2 >= 0 && t2 <= 1) {
  42281. roots[n++] = t2;
  42282. }
  42283. } else if (disc > 0) {
  42284. let discSqrt = Math.sqrt(disc);
  42285. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  42286. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  42287. if (Y1 < 0) {
  42288. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  42289. } else {
  42290. Y1 = Math.pow(Y1, this.ONE_THIRD);
  42291. }
  42292. if (Y2 < 0) {
  42293. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  42294. } else {
  42295. Y2 = Math.pow(Y2, this.ONE_THIRD);
  42296. }
  42297. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  42298. if (t1 >= 0 && t1 <= 1) {
  42299. roots[n++] = t1;
  42300. }
  42301. } else {
  42302. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  42303. var theta = Math.acos(T) / 3;
  42304. var ASqrt = Math.sqrt(A);
  42305. var tmp = Math.cos(theta);
  42306. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  42307. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  42308. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  42309. if (t1 >= 0 && t1 <= 1) {
  42310. roots[n++] = t1;
  42311. }
  42312. if (t2 >= 0 && t2 <= 1) {
  42313. roots[n++] = t2;
  42314. }
  42315. if (t3 >= 0 && t3 <= 1) {
  42316. roots[n++] = t3;
  42317. }
  42318. }
  42319. }
  42320. return n;
  42321. }
  42322. /**
  42323. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  42324. * @description 计算三次贝塞尔方程极限值的位置
  42325. * @param {number} p0 - 点p0。
  42326. * @param {number} p1 - 点p1。
  42327. * @param {number} p2 - 点p2。
  42328. * @param {number} p3 - 点p3。
  42329. * @param {Array.<number>} extrema - 值。
  42330. * @returns {number} 有效数目。
  42331. */
  42332. cubicExtrema(p0, p1, p2, p3, extrema) {
  42333. var b = 6 * p2 - 12 * p1 + 6 * p0;
  42334. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  42335. var c = 3 * p1 - 3 * p0;
  42336. var n = 0;
  42337. if (this.isAroundZero(a)) {
  42338. if (this.isNotAroundZero(b)) {
  42339. let t1 = -c / b;
  42340. if (t1 >= 0 && t1 <= 1) {
  42341. extrema[n++] = t1;
  42342. }
  42343. }
  42344. } else {
  42345. var disc = b * b - 4 * a * c;
  42346. if (this.isAroundZero(disc)) {
  42347. extrema[0] = -b / (2 * a);
  42348. } else if (disc > 0) {
  42349. let discSqrt = Math.sqrt(disc);
  42350. let t1 = (-b + discSqrt) / (2 * a);
  42351. let t2 = (-b - discSqrt) / (2 * a);
  42352. if (t1 >= 0 && t1 <= 1) {
  42353. extrema[n++] = t1;
  42354. }
  42355. if (t2 >= 0 && t2 <= 1) {
  42356. extrema[n++] = t2;
  42357. }
  42358. }
  42359. }
  42360. return n;
  42361. }
  42362. /**
  42363. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  42364. * @description 细分三次贝塞尔曲线
  42365. * @param {number} p0 - 点p0。
  42366. * @param {number} p1 - 点p1。
  42367. * @param {number} p2 - 点p2。
  42368. * @param {number} p3 - 点p3。
  42369. * @param {number} t - t值。
  42370. * @param {Array.<number>} out - 投射点。
  42371. * @returns {number} 投射点。
  42372. */
  42373. cubicSubdivide(p0, p1, p2, p3, t, out) {
  42374. var p01 = (p1 - p0) * t + p0;
  42375. var p12 = (p2 - p1) * t + p1;
  42376. var p23 = (p3 - p2) * t + p2;
  42377. var p012 = (p12 - p01) * t + p01;
  42378. var p123 = (p23 - p12) * t + p12;
  42379. var p0123 = (p123 - p012) * t + p012;
  42380. // Seg0
  42381. out[0] = p0;
  42382. out[1] = p01;
  42383. out[2] = p012;
  42384. out[3] = p0123;
  42385. // Seg1
  42386. out[4] = p0123;
  42387. out[5] = p123;
  42388. out[6] = p23;
  42389. out[7] = p3;
  42390. }
  42391. /**
  42392. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  42393. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  42394. * @param {number} x0 - 点p0横坐标。
  42395. * @param {number} y0 - 点p0纵坐标。
  42396. * @param {number} x1 - 点p1横坐标。
  42397. * @param {number} y1 - 点p1纵坐标。
  42398. * @param {number} x2 - 点p2横坐标。
  42399. * @param {number} y2 - 点p2纵坐标。
  42400. * @param {number} x3 - 点p3横坐标。
  42401. * @param {number} y3 - 点p3纵坐标。
  42402. * @param {number} x - 点p横坐标。
  42403. * @param {number} y - 点p纵坐标。
  42404. * @param {Array.<number>} out - 投射点。
  42405. * @returns {number} 投射点。
  42406. */
  42407. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  42408. // 临时变量
  42409. var _v0 = this.vector.create();
  42410. var _v1 = this.vector.create();
  42411. var _v2 = this.vector.create();
  42412. // var _v3 = vector.create();
  42413. // http://pomax.github.io/bezierinfo/#projections
  42414. var t;
  42415. var interval = 0.005;
  42416. var d = Infinity;
  42417. _v0[0] = x;
  42418. _v0[1] = y;
  42419. // 先粗略估计一下可能的最小距离的 t 值
  42420. // PENDING
  42421. for (let _t = 0; _t < 1; _t += 0.05) {
  42422. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  42423. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  42424. let d1 = this.vector.distSquare(_v0, _v1);
  42425. if (d1 < d) {
  42426. t = _t;
  42427. d = d1;
  42428. }
  42429. }
  42430. d = Infinity;
  42431. // At most 32 iteration
  42432. for (let i = 0; i < 32; i++) {
  42433. if (interval < this.EPSILON) {
  42434. break;
  42435. }
  42436. let prev = t - interval;
  42437. let next = t + interval;
  42438. // t - interval
  42439. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  42440. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  42441. let d1 = this.vector.distSquare(_v1, _v0);
  42442. if (prev >= 0 && d1 < d) {
  42443. t = prev;
  42444. d = d1;
  42445. } else {
  42446. // t + interval
  42447. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  42448. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  42449. let d2 = this.vector.distSquare(_v2, _v0);
  42450. if (next <= 1 && d2 < d) {
  42451. t = next;
  42452. d = d2;
  42453. } else {
  42454. interval *= 0.5;
  42455. }
  42456. }
  42457. }
  42458. // t
  42459. if (out) {
  42460. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  42461. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  42462. }
  42463. // console.log(interval, i);
  42464. return Math.sqrt(d);
  42465. }
  42466. /**
  42467. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  42468. * @description 计算二次方贝塞尔值。
  42469. * @param {number} p0 - 点p0。
  42470. * @param {number} p1 - 点p1。
  42471. * @param {number} p2 - 点p2。
  42472. * @param {number} t - t值。
  42473. * @returns {number} 二次方贝塞尔值。
  42474. */
  42475. quadraticAt(p0, p1, p2, t) {
  42476. var onet = 1 - t;
  42477. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  42478. }
  42479. /**
  42480. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  42481. * @description 计算二次方贝塞尔导数值。
  42482. * @param {number} p0 - 点p0。
  42483. * @param {number} p1 - 点p1。
  42484. * @param {number} p2 - 点p2。
  42485. * @param {number} t - t值。
  42486. * @returns {number} 二次方贝塞尔导数值。
  42487. */
  42488. quadraticDerivativeAt(p0, p1, p2, t) {
  42489. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  42490. }
  42491. /**
  42492. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  42493. * @description 计算二次方贝塞尔方程根
  42494. * @param {number} p0 - 点p0。
  42495. * @param {number} p1 - 点p1。
  42496. * @param {number} p2 - 点p2。
  42497. * @param {number} val - 值。
  42498. * @param {Array.<number>} roots - 有效根数目。
  42499. * @returns {number} 有效根数目。
  42500. */
  42501. quadraticRootAt(p0, p1, p2, val, roots) {
  42502. var a = p0 - 2 * p1 + p2;
  42503. var b = 2 * (p1 - p0);
  42504. var c = p0 - val;
  42505. var n = 0;
  42506. if (this.isAroundZero(a)) {
  42507. if (this.isNotAroundZero(b)) {
  42508. var t1 = -c / b;
  42509. if (t1 >= 0 && t1 <= 1) {
  42510. roots[n++] = t1;
  42511. }
  42512. }
  42513. } else {
  42514. var disc = b * b - 4 * a * c;
  42515. if (this.isAroundZero(disc)) {
  42516. let t1 = -b / (2 * a);
  42517. if (t1 >= 0 && t1 <= 1) {
  42518. roots[n++] = t1;
  42519. }
  42520. } else if (disc > 0) {
  42521. let discSqrt = Math.sqrt(disc);
  42522. let t1 = (-b + discSqrt) / (2 * a);
  42523. let t2 = (-b - discSqrt) / (2 * a);
  42524. if (t1 >= 0 && t1 <= 1) {
  42525. roots[n++] = t1;
  42526. }
  42527. if (t2 >= 0 && t2 <= 1) {
  42528. roots[n++] = t2;
  42529. }
  42530. }
  42531. }
  42532. return n;
  42533. }
  42534. /**
  42535. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  42536. * @description 计算二次贝塞尔方程极限值
  42537. * @param {number} p0 - 点p0。
  42538. * @param {number} p1 - 点p1。
  42539. * @param {number} p2 - 点p2。
  42540. * @returns {number} 二次贝塞尔方程极限值。
  42541. */
  42542. quadraticExtremum(p0, p1, p2) {
  42543. var divider = p0 + p2 - 2 * p1;
  42544. if (divider === 0) {
  42545. // p1 is center of p0 and p2
  42546. return 0.5;
  42547. } else {
  42548. return (p0 - p1) / divider;
  42549. }
  42550. }
  42551. /**
  42552. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  42553. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  42554. * @param {number} x0 - 点p0横坐标。
  42555. * @param {number} y0 - 点p0纵坐标。
  42556. * @param {number} x1 - 点p1横坐标。
  42557. * @param {number} y1 - 点p1纵坐标。
  42558. * @param {number} x2 - 点p2横坐标。
  42559. * @param {number} y2 - 点p2纵坐标。
  42560. * @param {number} x - 点p横坐标。
  42561. * @param {number} y - 点p纵坐标。
  42562. * @param {Array.<number>} out - 投射点。
  42563. * @returns {number} 投射距离。
  42564. */
  42565. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  42566. // 临时变量
  42567. var _v0 = this.vector.create();
  42568. var _v1 = this.vector.create();
  42569. var _v2 = this.vector.create();
  42570. // http://pomax.github.io/bezierinfo/#projections
  42571. var t;
  42572. var interval = 0.005;
  42573. var d = Infinity;
  42574. _v0[0] = x;
  42575. _v0[1] = y;
  42576. // 先粗略估计一下可能的最小距离的 t 值
  42577. // PENDING
  42578. for (let _t = 0; _t < 1; _t += 0.05) {
  42579. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  42580. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  42581. let d1 = this.vector.distSquare(_v0, _v1);
  42582. if (d1 < d) {
  42583. t = _t;
  42584. d = d1;
  42585. }
  42586. }
  42587. d = Infinity;
  42588. // At most 32 iteration
  42589. for (let i = 0; i < 32; i++) {
  42590. if (interval < this.EPSILON) {
  42591. break;
  42592. }
  42593. let prev = t - interval;
  42594. let next = t + interval;
  42595. // t - interval
  42596. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  42597. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  42598. let d1 = this.vector.distSquare(_v1, _v0);
  42599. if (prev >= 0 && d1 < d) {
  42600. t = prev;
  42601. d = d1;
  42602. } else {
  42603. // t + interval
  42604. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  42605. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  42606. let d2 = this.vector.distSquare(_v2, _v0);
  42607. if (next <= 1 && d2 < d) {
  42608. t = next;
  42609. d = d2;
  42610. } else {
  42611. interval *= 0.5;
  42612. }
  42613. }
  42614. }
  42615. // t
  42616. if (out) {
  42617. out[0] = this.quadraticAt(x0, x1, x2, t);
  42618. out[1] = this.quadraticAt(y0, y1, y2, t);
  42619. }
  42620. // console.log(interval, i);
  42621. return Math.sqrt(d);
  42622. }
  42623. }
  42624. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  42625. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  42626. * This program are made available under the terms of the Apache License, Version 2.0
  42627. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42628. /**
  42629. * @class SuperMap.LevelRenderer.Tool.Area
  42630. * @category Visualization Theme
  42631. * @classdesc LevelRenderer 工具-图形范围判断
  42632. * @private
  42633. */
  42634. class Area_Area {
  42635. /**
  42636. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.constructor
  42637. * @description 构造函数。
  42638. */
  42639. constructor() {
  42640. /**
  42641. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Areal.prototype.util
  42642. * @description 基础工具对象。
  42643. */
  42644. this.util = new levelRenderer_Util_Util();
  42645. /**
  42646. * @member {SuperMap.LevelRenderer.Tool.Curve} SuperMap.LevelRenderer.Tool.Areal.prototype.curve
  42647. * @description 曲线工具对象
  42648. */
  42649. this.curve = new levelRenderer_Curve_Curve();
  42650. /**
  42651. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._ctx
  42652. * @description Cavans2D 渲染上下文
  42653. */
  42654. this._ctx = null;
  42655. /**
  42656. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCache
  42657. * @description 文本宽度缓存
  42658. */
  42659. this._textWidthCache = {};
  42660. /**
  42661. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCache
  42662. * @description 文本高度缓存
  42663. */
  42664. this._textHeightCache = {};
  42665. /**
  42666. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  42667. * @description 文本宽度缓存数量
  42668. */
  42669. this._textWidthCacheCounter = 0;
  42670. /**
  42671. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  42672. * @description 文本高度缓存数量
  42673. */
  42674. this._textHeightCacheCounter = 0;
  42675. /**
  42676. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  42677. * @description 文本最大缓存数量
  42678. */
  42679. this.TEXT_CACHE_MAX = 5000;
  42680. /**
  42681. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.PI2
  42682. * @description 2*PI 的值
  42683. */
  42684. this.PI2 = Math.PI * 2;
  42685. /**
  42686. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.roots
  42687. * @description 临时数组
  42688. */
  42689. this.roots = [-1, -1, -1];
  42690. /**
  42691. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.extrema
  42692. * @description 临时数组
  42693. */
  42694. this.extrema = [-1, -1];
  42695. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  42696. }
  42697. /**
  42698. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.normalizeRadian
  42699. * @description 弧度标准化函数。
  42700. * @param {number} angle - 弧度值。
  42701. * @returns {number} 标准化后的弧度值。
  42702. */
  42703. normalizeRadian(angle) {
  42704. angle %= this.PI2;
  42705. if (angle < 0) {
  42706. angle += this.PI2;
  42707. }
  42708. return angle;
  42709. }
  42710. /**
  42711. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInside
  42712. * @description 包含判断。
  42713. * @param {Object} shape - 图形。
  42714. * @param {number} area - 目标区域。
  42715. * @param {number} x - 横坐标。
  42716. * @param {number} y - 纵坐标。
  42717. * @returns {boolean} 图形是否包含鼠标位置。
  42718. */
  42719. isInside(shape, area, x, y) {
  42720. if (!area || !shape) {
  42721. // 无参数或不支持类型
  42722. return false;
  42723. }
  42724. var zoneType = shape.type;
  42725. this._ctx = this._ctx || this.util.getContext();
  42726. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  42727. var _mathReturn = this._mathMethod(shape, area, x, y);
  42728. if (typeof _mathReturn != 'undefined') {
  42729. return _mathReturn;
  42730. }
  42731. if (shape.buildPath && this._ctx.isPointInPath) {
  42732. return this._buildPathMethod(shape, this._ctx, area, x, y);
  42733. }
  42734. // 上面的方法都行不通时
  42735. switch (zoneType) {
  42736. case 'ellipse': // Todo,不精确
  42737. case 'smicellipse': // Todo,不精确
  42738. return true;
  42739. // 旋轮曲线 不准确
  42740. case 'trochoid':
  42741. var _r = area.location == 'out'
  42742. ? area.r1 + area.r2 + area.d
  42743. : area.r1 - area.r2 + area.d;
  42744. return this.isInsideCircle(area, x, y, _r);
  42745. // 玫瑰线 不准确
  42746. case 'rose' :
  42747. return this.isInsideCircle(area, x, y, area.maxr);
  42748. // 路径,椭圆,曲线等-----------------13
  42749. default:
  42750. return false; // Todo,暂不支持
  42751. }
  42752. }
  42753. /**
  42754. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._mathMethod
  42755. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  42756. * @param {Object} shape - 图形。
  42757. * @param {number} area - 目标区域。
  42758. * @param {number} x - 横坐标。
  42759. * @param {number} y - 纵坐标。
  42760. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  42761. */
  42762. _mathMethod(shape, area, x, y) {
  42763. var zoneType = shape.type;
  42764. // 在矩形内则部分图形需要进一步判断
  42765. switch (zoneType) {
  42766. // 贝塞尔曲线
  42767. case 'bezier-curve':
  42768. if (typeof(area.cpX2) === 'undefined') {
  42769. return this.isInsideQuadraticStroke(
  42770. area.xStart, area.yStart,
  42771. area.cpX1, area.cpY1,
  42772. area.xEnd, area.yEnd,
  42773. area.lineWidth, x, y
  42774. );
  42775. }
  42776. return this.isInsideCubicStroke(
  42777. area.xStart, area.yStart,
  42778. area.cpX1, area.cpY1,
  42779. area.cpX2, area.cpY2,
  42780. area.xEnd, area.yEnd,
  42781. area.lineWidth, x, y
  42782. );
  42783. // 线
  42784. case 'line':
  42785. return this.isInsideLine(
  42786. area.xStart, area.yStart,
  42787. area.xEnd, area.yEnd,
  42788. area.lineWidth, x, y
  42789. );
  42790. // 折线
  42791. case 'broken-line':
  42792. return this.isInsideBrokenLine(
  42793. area.pointList, area.lineWidth, x, y
  42794. );
  42795. // 扩展折线
  42796. case 'smicbroken-line': {
  42797. // SMIC-修改 - start
  42798. let icX = x;
  42799. let icY = y;
  42800. if (shape.refOriginalPosition) {
  42801. icX = x - shape.refOriginalPosition[0];
  42802. icY = y - shape.refOriginalPosition[1];
  42803. }
  42804. return this.isInsideBrokenLine(
  42805. area.pointList, area.lineWidth, icX, icY
  42806. );
  42807. }
  42808. //初始代码:
  42809. // return isInsideBrokenLine(
  42810. // area.pointList, area.lineWidth, x, y
  42811. // );
  42812. // SMIC-修改 - end
  42813. // 圆环
  42814. case 'ring':
  42815. return this.isInsideRing(
  42816. area.x, area.y, area.r0, area.r, x, y
  42817. );
  42818. case 'smicring': {
  42819. let areaX = area.x;
  42820. let areaY = area.y;
  42821. if (shape.refOriginalPosition) {
  42822. areaX = area.x + shape.refOriginalPosition[0];
  42823. areaY = area.y + shape.refOriginalPosition[1];
  42824. }
  42825. return this.isInsideRing(
  42826. areaX, areaY, area.r0, area.r, x, y
  42827. );
  42828. }
  42829. // 圆形
  42830. case 'circle':
  42831. return this.isInsideCircle(
  42832. area.x, area.y, area.r, x, y
  42833. );
  42834. // 扩展-点
  42835. case 'smicpoint': {
  42836. // SMIC-修改 - start
  42837. let icX = x;
  42838. let icY = y;
  42839. if (shape.refOriginalPosition) {
  42840. icX = x - shape.refOriginalPosition[0];
  42841. icY = y - shape.refOriginalPosition[1];
  42842. }
  42843. return this.isInsideCircle(
  42844. area.x, area.y, area.r, icX, icY
  42845. );
  42846. }
  42847. //初始代码:
  42848. // 无
  42849. // SMIC-修改 - end
  42850. // 扇形
  42851. case 'sector': {
  42852. let startAngle = area.startAngle * Math.PI / 180;
  42853. let endAngle = area.endAngle * Math.PI / 180;
  42854. if (!area.clockWise) {
  42855. startAngle = -startAngle;
  42856. endAngle = -endAngle;
  42857. }
  42858. return this.isInsideSector(
  42859. area.x, area.y, area.r0, area.r,
  42860. startAngle, endAngle,
  42861. !area.clockWise,
  42862. x, y
  42863. );
  42864. }
  42865. //初始代码:
  42866. // 无
  42867. // SMIC-增加 - end
  42868. // 扇形
  42869. case 'smicsector': {
  42870. let startAngle = area.startAngle * Math.PI / 180;
  42871. let endAngle = area.endAngle * Math.PI / 180;
  42872. if (!area.clockWise) {
  42873. startAngle = -startAngle;
  42874. endAngle = -endAngle;
  42875. }
  42876. let areaX = area.x;
  42877. let areaY = area.y;
  42878. if (shape.refOriginalPosition) {
  42879. areaX = area.x + shape.refOriginalPosition[0];
  42880. areaY = area.y + shape.refOriginalPosition[1];
  42881. }
  42882. return this.isInsideSector(
  42883. areaX, areaY, area.r0, area.r,
  42884. startAngle, endAngle,
  42885. !area.clockWise,
  42886. x, y
  42887. );
  42888. }
  42889. // 多边形
  42890. case 'path':
  42891. return this.isInsidePath(
  42892. area.pathArray, Math.max(area.lineWidth, 5),
  42893. area.brushType, x, y
  42894. );
  42895. case 'polygon':
  42896. case 'star':
  42897. case 'smicstar':
  42898. case 'isogon':
  42899. case 'smicisogon':
  42900. return this.isInsidePolygon(area.pointList, x, y);
  42901. // 扩展多边形
  42902. case 'smicpolygon': {
  42903. // SMIC-修改 - start
  42904. let icX = x;
  42905. let icY = y;
  42906. if (shape.refOriginalPosition) {
  42907. icX = x - shape.refOriginalPosition[0];
  42908. icY = y - shape.refOriginalPosition[1];
  42909. }
  42910. //岛洞面
  42911. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  42912. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  42913. // 遍历岛洞子面
  42914. var holePLS = shape.holePolygonPointLists;
  42915. var isOnHole = false;
  42916. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  42917. var holePL = holePLS[i];
  42918. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  42919. if (isOnSubHole === true) {
  42920. isOnHole = true;
  42921. }
  42922. }
  42923. // 捕获判断
  42924. return isOnBase === true && isOnHole === false;
  42925. } else {
  42926. return this.isInsidePolygon(area.pointList, icX, icY);
  42927. }
  42928. }
  42929. // 初始代码:
  42930. // 无
  42931. // SMIC-修改 - end
  42932. // 文本
  42933. case 'text':
  42934. var rect = area.__rect || shape.getRect(area);
  42935. return this.isInsideRect(
  42936. rect.x, rect.y, rect.width, rect.height, x, y
  42937. );
  42938. // 扩展文本
  42939. case 'smictext':
  42940. //用文本背景矩形判断
  42941. var textBg = shape.getTextBackground(area);
  42942. return this.isInsidePolygon(textBg, x, y);
  42943. //初始代码:
  42944. // 无
  42945. // SMIC-修改 - end
  42946. // 矩形
  42947. case 'rectangle':
  42948. case 'image':
  42949. // 图片
  42950. return this.isInsideRect(
  42951. area.x, area.y, area.width, area.height, x, y
  42952. );
  42953. case 'smicimage': {
  42954. let areaX = area.x;
  42955. let areaY = area.y;
  42956. if (shape.refOriginalPosition) {
  42957. areaX = area.x + shape.refOriginalPosition[0];
  42958. areaY = area.y + shape.refOriginalPosition[1];
  42959. }
  42960. return this.isInsideRect(
  42961. areaX, areaY, area.width, area.height, x, y
  42962. );
  42963. }
  42964. //// 扩展矩形
  42965. //case 'smicpolygon':
  42966. // // SMIC-修改 - start
  42967. // var icX = x;
  42968. // var icY = y;
  42969. // if(shape.refOriginalPosition) {
  42970. // icX = x - shape.refOriginalPosition[0];
  42971. // icY = y - shape.refOriginalPosition[1];
  42972. // }
  42973. // return this.isInsideRect(
  42974. // area.x, area.y, area.width, area.height, icX, icY
  42975. // );
  42976. //初始代码:
  42977. // 无
  42978. // SMIC-修改 - end
  42979. }
  42980. }
  42981. /**
  42982. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._buildPathMethod
  42983. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  42984. * @param {Object} shape - 图形。
  42985. * @param {Object} context - 上下文。
  42986. * @param {number} area - 目标区域。
  42987. * @param {number} x - 横坐标。
  42988. * @param {number} y - 纵坐标。
  42989. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  42990. */
  42991. _buildPathMethod(shape, context, area, x, y) {
  42992. // 图形类实现路径创建了则用类的path
  42993. context.beginPath();
  42994. shape.buildPath(context, area);
  42995. context.closePath();
  42996. return context.isPointInPath(x, y);
  42997. }
  42998. /**
  42999. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isOutside
  43000. * @description 图形是否不包含鼠标位置。
  43001. * @param {Object} shape - 图形。
  43002. * @param {number} area - 目标区域。
  43003. * @param {number} x - 横坐标。
  43004. * @param {number} y - 纵坐标。
  43005. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  43006. */
  43007. isOutside(shape, area, x, y) {
  43008. return !this.isInside(shape, area, x, y);
  43009. }
  43010. /**
  43011. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideLine
  43012. * @description 线段包含判断。
  43013. * @param {number} x0 - 线起始点横坐标。
  43014. * @param {number} y0 - 线起始点纵坐标。
  43015. * @param {number} x1 - 线终点横坐标。
  43016. * @param {number} y1 - 线终点纵坐标。
  43017. * @param {number} lineWidth - 线宽。
  43018. * @param {number} x - 鼠标位置横坐标。
  43019. * @param {number} y - 鼠标位置纵坐标。
  43020. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  43021. */
  43022. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  43023. if (lineWidth === 0) {
  43024. return false;
  43025. }
  43026. var _l = Math.max(lineWidth, 5);
  43027. var _a = 0;
  43028. var _b = 0;
  43029. // Quick reject
  43030. if (
  43031. (y > y0 + _l && y > y1 + _l)
  43032. || (y < y0 - _l && y < y1 - _l)
  43033. || (x > x0 + _l && x > x1 + _l)
  43034. || (x < x0 - _l && x < x1 - _l)
  43035. ) {
  43036. return false;
  43037. }
  43038. if (x0 !== x1) {
  43039. _a = (y0 - y1) / (x0 - x1);
  43040. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  43041. } else {
  43042. return Math.abs(x - x0) <= _l / 2;
  43043. }
  43044. var tmp = _a * x - y + _b;
  43045. var _s = tmp * tmp / (_a * _a + 1);
  43046. return _s <= _l / 2 * _l / 2;
  43047. }
  43048. /**
  43049. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  43050. * @description 三次贝塞尔曲线描边包含判断。
  43051. * @param {number} x0 - 点1横坐标。
  43052. * @param {number} y0 - 点1纵坐标。
  43053. * @param {number} x1 - 点2横坐标。
  43054. * @param {number} y1 - 点2纵坐标。
  43055. * @param {number} x2 - 点3纵坐标。
  43056. * @param {number} y2 - 点3纵坐标。
  43057. * @param {number} lineWidth - 线宽。
  43058. * @param {number} x - 鼠标位置横坐标。
  43059. * @param {number} y - 鼠标位置纵坐标。
  43060. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43061. */
  43062. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  43063. if (lineWidth === 0) {
  43064. return false;
  43065. }
  43066. var _l = Math.max(lineWidth, 5);
  43067. // Quick reject
  43068. if (
  43069. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  43070. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  43071. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  43072. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  43073. ) {
  43074. return false;
  43075. }
  43076. var d = this.curve.cubicProjectPoint(
  43077. x0, y0, x1, y1, x2, y2, x3, y3,
  43078. x, y, null
  43079. );
  43080. return d <= _l / 2;
  43081. }
  43082. /**
  43083. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  43084. * @description 二次贝塞尔曲线描边包含判断。
  43085. * @param {number} x0 - 点1横坐标。
  43086. * @param {number} y0 - 点1纵坐标。
  43087. * @param {number} x1 - 点2横坐标。
  43088. * @param {number} y1 - 点2纵坐标。
  43089. * @param {number} x2 - 点3纵坐标。
  43090. * @param {number} y2 - 点3纵坐标。
  43091. * @param {number} lineWidth - 线宽。
  43092. * @param {number} x - 鼠标位置横坐标。
  43093. * @param {number} y - 鼠标位置纵坐标。
  43094. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43095. */
  43096. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  43097. if (lineWidth === 0) {
  43098. return false;
  43099. }
  43100. var _l = Math.max(lineWidth, 5);
  43101. // Quick reject
  43102. if (
  43103. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  43104. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  43105. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  43106. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  43107. ) {
  43108. return false;
  43109. }
  43110. var d = this.curve.quadraticProjectPoint(
  43111. x0, y0, x1, y1, x2, y2,
  43112. x, y, null
  43113. );
  43114. return d <= _l / 2;
  43115. }
  43116. /**
  43117. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  43118. * @description 圆弧描边包含判断。
  43119. * @param {number} cx - 圆心横坐标。
  43120. * @param {number} cy - 圆心纵坐标。
  43121. * @param {number} r - 圆半径。
  43122. * @param {number} startAngle - 起始角度。
  43123. * @param {number} endAngle - 终止角度。
  43124. * @param {number} anticlockwise - 顺时针还是逆时针。
  43125. * @param {number} lineWidth - 线宽。
  43126. * @param {number} x - 鼠标位置横坐标。
  43127. * @param {number} y - 鼠标位置纵坐标。
  43128. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43129. */
  43130. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  43131. var PI2 = this.PI2;
  43132. if (lineWidth === 0) {
  43133. return false;
  43134. }
  43135. var _l = Math.max(lineWidth, 5);
  43136. x -= cx;
  43137. y -= cy;
  43138. var d = Math.sqrt(x * x + y * y);
  43139. if ((d - _l > r) || (d + _l < r)) {
  43140. return false;
  43141. }
  43142. if (Math.abs(startAngle - endAngle) >= PI2) {
  43143. // Is a circle
  43144. return true;
  43145. }
  43146. if (anticlockwise) {
  43147. var tmp = startAngle;
  43148. startAngle = this.normalizeRadian(endAngle);
  43149. endAngle = this.normalizeRadian(tmp);
  43150. } else {
  43151. startAngle = this.normalizeRadian(startAngle);
  43152. endAngle = this.normalizeRadian(endAngle);
  43153. }
  43154. if (startAngle > endAngle) {
  43155. endAngle += PI2;
  43156. }
  43157. var angle = Math.atan2(y, x);
  43158. if (angle < 0) {
  43159. angle += PI2;
  43160. }
  43161. return (angle >= startAngle && angle <= endAngle)
  43162. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  43163. }
  43164. /**
  43165. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  43166. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  43167. * @param {Array} points - 曲线点对象。
  43168. * @param {number} lineWidth - 线宽。
  43169. * @param {number} x - 鼠标位置横坐标。
  43170. * @param {number} y - 鼠标位置纵坐标。
  43171. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43172. */
  43173. isInsideBrokenLine(points, lineWidth, x, y) {
  43174. var _lineWidth = Math.max(lineWidth, 10);
  43175. for (var i = 0, l = points.length - 1; i < l; i++) {
  43176. var x0 = points[i][0];
  43177. var y0 = points[i][1];
  43178. var x1 = points[i + 1][0];
  43179. var y1 = points[i + 1][1];
  43180. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  43181. return true;
  43182. }
  43183. }
  43184. return false;
  43185. }
  43186. /**
  43187. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRing
  43188. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  43189. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43190. */
  43191. isInsideRing(cx, cy, r0, r, x, y) {
  43192. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  43193. return (d < r * r) && (d > r0 * r0);
  43194. }
  43195. /**
  43196. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRect
  43197. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  43198. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43199. */
  43200. isInsideRect(x0, y0, width, height, x, y) {
  43201. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  43202. }
  43203. /**
  43204. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCircle
  43205. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  43206. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43207. */
  43208. isInsideCircle(x0, y0, r, x, y) {
  43209. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  43210. }
  43211. /**
  43212. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideSector
  43213. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  43214. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43215. */
  43216. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  43217. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  43218. }
  43219. /**
  43220. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  43221. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  43222. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43223. */
  43224. isInsidePolygon(points, x, y) {
  43225. var N = points.length;
  43226. var w = 0;
  43227. for (var i = 0, j = N - 1; i < N; i++) {
  43228. var x0 = points[j][0];
  43229. var y0 = points[j][1];
  43230. var x1 = points[i][0];
  43231. var y1 = points[i][1];
  43232. w += this.windingLine(x0, y0, x1, y1, x, y);
  43233. j = i;
  43234. }
  43235. return w !== 0;
  43236. }
  43237. /**
  43238. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingLine
  43239. */
  43240. windingLine(x0, y0, x1, y1, x, y) {
  43241. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  43242. return 0;
  43243. }
  43244. if (y1 == y0) {
  43245. return 0;
  43246. }
  43247. var dir = y1 < y0 ? 1 : -1;
  43248. var t = (y - y0) / (y1 - y0);
  43249. var x_ = t * (x1 - x0) + x0;
  43250. return x_ > x ? dir : 0;
  43251. }
  43252. /**
  43253. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.swapExtrema
  43254. */
  43255. swapExtrema() {
  43256. var tmp = this.extrema[0];
  43257. this.extrema[0] = this.extrema[1];
  43258. this.extrema[1] = tmp;
  43259. }
  43260. /**
  43261. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingCubic
  43262. */
  43263. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  43264. var curve = this.curve;
  43265. var roots = this.roots;
  43266. var extrema = this.extrema;
  43267. // Quick reject
  43268. if (
  43269. (y > y0 && y > y1 && y > y2 && y > y3)
  43270. || (y < y0 && y < y1 && y < y2 && y < y3)
  43271. ) {
  43272. return 0;
  43273. }
  43274. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  43275. if (nRoots === 0) {
  43276. return 0;
  43277. } else {
  43278. var w = 0;
  43279. var nExtrema = -1;
  43280. var y0_, y1_;
  43281. for (var i = 0; i < nRoots; i++) {
  43282. var t = roots[i];
  43283. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  43284. if (x_ < x) { // Quick reject
  43285. continue;
  43286. }
  43287. if (nExtrema < 0) {
  43288. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  43289. if (extrema[1] < extrema[0] && nExtrema > 1) {
  43290. this.swapExtrema();
  43291. }
  43292. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  43293. if (nExtrema > 1) {
  43294. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  43295. }
  43296. }
  43297. if (nExtrema == 2) {
  43298. // 分成三段单调函数
  43299. if (t < extrema[0]) {
  43300. w += y0_ < y0 ? 1 : -1;
  43301. } else if (t < extrema[1]) {
  43302. w += y1_ < y0_ ? 1 : -1;
  43303. } else {
  43304. w += y3 < y1_ ? 1 : -1;
  43305. }
  43306. } else {
  43307. // 分成两段单调函数
  43308. if (t < extrema[0]) {
  43309. w += y0_ < y0 ? 1 : -1;
  43310. } else {
  43311. w += y3 < y0_ ? 1 : -1;
  43312. }
  43313. }
  43314. }
  43315. return w;
  43316. }
  43317. }
  43318. /**
  43319. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingQuadratic
  43320. */
  43321. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  43322. var curve = this.curve;
  43323. var roots = this.roots;
  43324. // Quick reject
  43325. if (
  43326. (y > y0 && y > y1 && y > y2)
  43327. || (y < y0 && y < y1 && y < y2)
  43328. ) {
  43329. return 0;
  43330. }
  43331. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  43332. if (nRoots === 0) {
  43333. return 0;
  43334. } else {
  43335. var t = curve.quadraticExtremum(y0, y1, y2);
  43336. if (t >= 0 && t <= 1) {
  43337. var w = 0;
  43338. var y_ = curve.quadraticAt(y0, y1, y2, t);
  43339. for (let i = 0; i < nRoots; i++) {
  43340. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  43341. if (x_ > x) {
  43342. continue;
  43343. }
  43344. if (roots[i] < t) {
  43345. w += y_ < y0 ? 1 : -1;
  43346. } else {
  43347. w += y2 < y_ ? 1 : -1;
  43348. }
  43349. }
  43350. return w;
  43351. } else {
  43352. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  43353. if (x_ > x) {
  43354. return 0;
  43355. }
  43356. return y2 < y0 ? 1 : -1;
  43357. }
  43358. }
  43359. }
  43360. /**
  43361. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingArc
  43362. * // TODO Arc 旋转
  43363. */
  43364. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  43365. var roots = this.roots;
  43366. var PI2 = this.PI2;
  43367. y -= cy;
  43368. if (y > r || y < -r) {
  43369. return 0;
  43370. }
  43371. let tmp = Math.sqrt(r * r - y * y);
  43372. roots[0] = -tmp;
  43373. roots[1] = tmp;
  43374. if (Math.abs(startAngle - endAngle) >= PI2) {
  43375. // Is a circle
  43376. startAngle = 0;
  43377. endAngle = PI2;
  43378. var dir = anticlockwise ? 1 : -1;
  43379. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  43380. return dir;
  43381. } else {
  43382. return 0;
  43383. }
  43384. }
  43385. if (anticlockwise) {
  43386. let tmp = startAngle;
  43387. startAngle = this.normalizeRadian(endAngle);
  43388. endAngle = this.normalizeRadian(tmp);
  43389. } else {
  43390. startAngle = this.normalizeRadian(startAngle);
  43391. endAngle = this.normalizeRadian(endAngle);
  43392. }
  43393. if (startAngle > endAngle) {
  43394. endAngle += PI2;
  43395. }
  43396. var w = 0;
  43397. for (let i = 0; i < 2; i++) {
  43398. var x_ = roots[i];
  43399. if (x_ + cx > x) {
  43400. let angle = Math.atan2(y, x_);
  43401. let dir = anticlockwise ? 1 : -1;
  43402. if (angle < 0) {
  43403. angle = PI2 + angle;
  43404. }
  43405. if (
  43406. (angle >= startAngle && angle <= endAngle)
  43407. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  43408. ) {
  43409. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  43410. dir = -dir;
  43411. }
  43412. w += dir;
  43413. }
  43414. }
  43415. }
  43416. return w;
  43417. }
  43418. /**
  43419. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePath
  43420. * @description 与 canvas 一样采用 non-zero winding rule
  43421. */
  43422. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  43423. var w = 0;
  43424. var xi = 0;
  43425. var yi = 0;
  43426. var x0 = 0;
  43427. var y0 = 0;
  43428. var beginSubpath = true;
  43429. var firstCmd = true;
  43430. brushType = brushType || 'fill';
  43431. var hasStroke = brushType === 'stroke' || brushType === 'both';
  43432. var hasFill = brushType === 'fill' || brushType === 'both';
  43433. // var roots = [-1, -1, -1];
  43434. for (var i = 0; i < pathArray.length; i++) {
  43435. var seg = pathArray[i];
  43436. var p = seg.points;
  43437. // Begin a new subpath
  43438. if (beginSubpath || seg.command === 'M') {
  43439. if (i > 0) {
  43440. // Close previous subpath
  43441. if (hasFill) {
  43442. w += this.windingLine(xi, yi, x0, y0, x, y);
  43443. }
  43444. if (w !== 0) {
  43445. return true;
  43446. }
  43447. }
  43448. x0 = p[p.length - 2];
  43449. y0 = p[p.length - 1];
  43450. beginSubpath = false;
  43451. if (firstCmd && seg.command !== 'A') {
  43452. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  43453. // 等绘制命令的话,是会从该绘制的起点开始算的
  43454. // Arc 会在之后做单独处理所以这里忽略
  43455. firstCmd = false;
  43456. xi = x0;
  43457. yi = y0;
  43458. }
  43459. }
  43460. switch (seg.command) {
  43461. case 'M':
  43462. xi = p[0];
  43463. yi = p[1];
  43464. break;
  43465. case 'L':
  43466. if (hasStroke) {
  43467. if (this.isInsideLine(
  43468. xi, yi, p[0], p[1], lineWidth, x, y
  43469. )) {
  43470. return true;
  43471. }
  43472. }
  43473. if (hasFill) {
  43474. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  43475. }
  43476. xi = p[0];
  43477. yi = p[1];
  43478. break;
  43479. case 'C':
  43480. if (hasStroke) {
  43481. if (this.isInsideCubicStroke(
  43482. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  43483. lineWidth, x, y
  43484. )) {
  43485. return true;
  43486. }
  43487. }
  43488. if (hasFill) {
  43489. w += this.windingCubic(
  43490. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  43491. );
  43492. }
  43493. xi = p[4];
  43494. yi = p[5];
  43495. break;
  43496. case 'Q':
  43497. if (hasStroke) {
  43498. if (this.isInsideQuadraticStroke(
  43499. xi, yi, p[0], p[1], p[2], p[3],
  43500. lineWidth, x, y
  43501. )) {
  43502. return true;
  43503. }
  43504. }
  43505. if (hasFill) {
  43506. w += this.windingQuadratic(
  43507. xi, yi, p[0], p[1], p[2], p[3], x, y
  43508. );
  43509. }
  43510. xi = p[2];
  43511. yi = p[3];
  43512. break;
  43513. case 'A':
  43514. // TODO Arc 旋转
  43515. // TODO Arc 判断的开销比较大
  43516. var cx = p[0];
  43517. var cy = p[1];
  43518. var rx = p[2];
  43519. var ry = p[3];
  43520. var theta = p[4];
  43521. var dTheta = p[5];
  43522. var x1 = Math.cos(theta) * rx + cx;
  43523. var y1 = Math.sin(theta) * ry + cy;
  43524. // 不是直接使用 arc 命令
  43525. if (!firstCmd) {
  43526. w += this.windingLine(xi, yi, x1, y1);
  43527. } else {
  43528. firstCmd = false;
  43529. // 第一个命令起点还未定义
  43530. x0 = x1;
  43531. y0 = y1;
  43532. }
  43533. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  43534. var _x = (x - cx) * ry / rx + cx;
  43535. if (hasStroke) {
  43536. if (this.isInsideArcStroke(
  43537. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  43538. lineWidth, _x, y
  43539. )) {
  43540. return true;
  43541. }
  43542. }
  43543. if (hasFill) {
  43544. w += this.windingArc(
  43545. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  43546. _x, y
  43547. );
  43548. }
  43549. xi = Math.cos(theta + dTheta) * rx + cx;
  43550. yi = Math.sin(theta + dTheta) * ry + cy;
  43551. break;
  43552. case 'z':
  43553. if (hasStroke) {
  43554. if (this.isInsideLine(
  43555. xi, yi, x0, y0, lineWidth, x, y
  43556. )) {
  43557. return true;
  43558. }
  43559. }
  43560. beginSubpath = true;
  43561. break;
  43562. }
  43563. }
  43564. if (hasFill) {
  43565. w += this.windingLine(xi, yi, x0, y0, x, y);
  43566. }
  43567. return w !== 0;
  43568. }
  43569. /**
  43570. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextWidth
  43571. * @description 测算多行文本宽度
  43572. */
  43573. getTextWidth(text, textFont) {
  43574. var key = text + ':' + textFont;
  43575. if (this._textWidthCache[key]) {
  43576. return this._textWidthCache[key];
  43577. }
  43578. this._ctx = this._ctx || this.util.getContext();
  43579. this._ctx.save();
  43580. if (textFont) {
  43581. this._ctx.font = textFont;
  43582. }
  43583. text = (text + '').split('\n');
  43584. var width = 0;
  43585. for (var i = 0, l = text.length; i < l; i++) {
  43586. width = Math.max(
  43587. this._ctx.measureText(text[i]).width,
  43588. width
  43589. );
  43590. }
  43591. this._ctx.restore();
  43592. this._textWidthCache[key] = width;
  43593. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  43594. // 内存释放
  43595. this._textWidthCacheCounter = 0;
  43596. this._textWidthCache = {};
  43597. }
  43598. return width;
  43599. }
  43600. /**
  43601. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextHeight
  43602. * @description 测算多行文本高度
  43603. */
  43604. getTextHeight(text, textFont) {
  43605. var key = text + ':' + textFont;
  43606. if (this._textHeightCache[key]) {
  43607. return this._textHeightCache[key];
  43608. }
  43609. this._ctx = this._ctx || this.util.getContext();
  43610. this._ctx.save();
  43611. if (textFont) {
  43612. this._ctx.font = textFont;
  43613. }
  43614. text = (text + '').split('\n');
  43615. // 比较粗暴
  43616. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  43617. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  43618. this._ctx.restore();
  43619. this._textHeightCache[key] = height;
  43620. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  43621. // 内存释放
  43622. this._textHeightCacheCounter = 0;
  43623. this._textHeightCache = {};
  43624. }
  43625. return height;
  43626. }
  43627. }
  43628. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  43629. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  43630. * This program are made available under the terms of the Apache License, Version 2.0
  43631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43632. /**
  43633. * @class SuperMap.LevelRenderer.Tool.ComputeBoundingBox
  43634. * @category Visualization Theme
  43635. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  43636. * @private
  43637. */
  43638. class ComputeBoundingBox_ComputeBoundingBox {
  43639. /**
  43640. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.constructor
  43641. * @description 构造函数。
  43642. */
  43643. constructor() {
  43644. if (arguments.length === 3) {
  43645. this.computeBoundingBox(arguments);
  43646. }
  43647. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  43648. }
  43649. /**
  43650. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  43651. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  43652. * @param {Array.<Object>} points - 顶点数组。
  43653. * @param {Array} min - 最小
  43654. * @param {Array} max - 最大
  43655. */
  43656. computeBoundingBox(points, min, max) {
  43657. if (points.length === 0) {
  43658. return;
  43659. }
  43660. var left = points[0][0];
  43661. var right = points[0][0];
  43662. var top = points[0][1];
  43663. var bottom = points[0][1];
  43664. for (var i = 1; i < points.length; i++) {
  43665. var p = points[i];
  43666. if (p[0] < left) {
  43667. left = p[0];
  43668. }
  43669. if (p[0] > right) {
  43670. right = p[0];
  43671. }
  43672. if (p[1] < top) {
  43673. top = p[1];
  43674. }
  43675. if (p[1] > bottom) {
  43676. bottom = p[1];
  43677. }
  43678. }
  43679. min[0] = left;
  43680. min[1] = top;
  43681. max[0] = right;
  43682. max[1] = bottom;
  43683. }
  43684. /**
  43685. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  43686. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  43687. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  43688. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  43689. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  43690. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  43691. * @param {Array.<number>} min - 最小
  43692. * @param {Array.<number>} max - 最大
  43693. */
  43694. cubeBezier(p0, p1, p2, p3, min, max) {
  43695. var curve = new levelRenderer_Curve_Curve();
  43696. var xDim = [];
  43697. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  43698. for (let i = 0; i < xDim.length; i++) {
  43699. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  43700. }
  43701. var yDim = [];
  43702. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  43703. for (let i = 0; i < yDim.length; i++) {
  43704. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  43705. }
  43706. xDim.push(p0[0], p3[0]);
  43707. yDim.push(p0[1], p3[1]);
  43708. var left = Math.min.apply(null, xDim);
  43709. var right = Math.max.apply(null, xDim);
  43710. var top = Math.min.apply(null, yDim);
  43711. var bottom = Math.max.apply(null, yDim);
  43712. min[0] = left;
  43713. min[1] = top;
  43714. max[0] = right;
  43715. max[1] = bottom;
  43716. }
  43717. /**
  43718. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  43719. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  43720. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  43721. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  43722. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  43723. * @param {Array.<number>} min - 最小
  43724. * @param {Array.<number>} max - 最大
  43725. */
  43726. quadraticBezier(p0, p1, p2, min, max) {
  43727. var curve = new levelRenderer_Curve_Curve();
  43728. // Find extremities, where derivative in x dim or y dim is zero
  43729. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  43730. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  43731. t1 = Math.max(Math.min(t1, 1), 0);
  43732. t2 = Math.max(Math.min(t2, 1), 0);
  43733. var ct1 = 1 - t1;
  43734. var ct2 = 1 - t2;
  43735. var x1 = ct1 * ct1 * p0[0]
  43736. + 2 * ct1 * t1 * p1[0]
  43737. + t1 * t1 * p2[0];
  43738. var y1 = ct1 * ct1 * p0[1]
  43739. + 2 * ct1 * t1 * p1[1]
  43740. + t1 * t1 * p2[1];
  43741. var x2 = ct2 * ct2 * p0[0]
  43742. + 2 * ct2 * t2 * p1[0]
  43743. + t2 * t2 * p2[0];
  43744. var y2 = ct2 * ct2 * p0[1]
  43745. + 2 * ct2 * t2 * p1[1]
  43746. + t2 * t2 * p2[1];
  43747. min[0] = Math.min(p0[0], p2[0], x1, x2);
  43748. min[1] = Math.min(p0[1], p2[1], y1, y2);
  43749. max[0] = Math.max(p0[0], p2[0], x1, x2);
  43750. max[1] = Math.max(p0[1], p2[1], y1, y2);
  43751. }
  43752. /**
  43753. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  43754. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  43755. * @param {number} x - 圆弧中心点 x
  43756. * @param {number} y - 圆弧中心点 y
  43757. * @param {number} r - 圆弧半径
  43758. * @param {number} startAngle - 圆弧开始角度
  43759. * @param {number} endAngle - 圆弧结束角度
  43760. * @param {number} anticlockwise - 是否是顺时针
  43761. * @param {number} min - 最小
  43762. * @param {number} max - 最大
  43763. */
  43764. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  43765. var vec2 = new levelRenderer_Vector_Vector();
  43766. var start = vec2.create();
  43767. var end = vec2.create();
  43768. var extremity = vec2.create();
  43769. start[0] = Math.cos(startAngle) * r + x;
  43770. start[1] = Math.sin(startAngle) * r + y;
  43771. end[0] = Math.cos(endAngle) * r + x;
  43772. end[1] = Math.sin(endAngle) * r + y;
  43773. vec2.min(min, start, end);
  43774. vec2.max(max, start, end);
  43775. // Thresh to [0, Math.PI * 2]
  43776. startAngle = startAngle % (Math.PI * 2);
  43777. if (startAngle < 0) {
  43778. startAngle = startAngle + Math.PI * 2;
  43779. }
  43780. endAngle = endAngle % (Math.PI * 2);
  43781. if (endAngle < 0) {
  43782. endAngle = endAngle + Math.PI * 2;
  43783. }
  43784. if (startAngle > endAngle && !anticlockwise) {
  43785. endAngle += Math.PI * 2;
  43786. } else if (startAngle < endAngle && anticlockwise) {
  43787. startAngle += Math.PI * 2;
  43788. }
  43789. if (anticlockwise) {
  43790. var tmp = endAngle;
  43791. endAngle = startAngle;
  43792. startAngle = tmp;
  43793. }
  43794. // var number = 0;
  43795. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  43796. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  43797. if (angle > startAngle) {
  43798. extremity[0] = Math.cos(angle) * r + x;
  43799. extremity[1] = Math.sin(angle) * r + y;
  43800. vec2.min(min, extremity, min);
  43801. vec2.max(max, extremity, max);
  43802. }
  43803. }
  43804. }
  43805. }
  43806. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  43807. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  43808. * This program are made available under the terms of the Apache License, Version 2.0
  43809. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43810. /**
  43811. * @class SuperMap.LevelRenderer.Tool.Env
  43812. * @category Visualization Theme
  43813. * @classdesc 环境识别
  43814. * @private
  43815. */
  43816. class Env {
  43817. constructor() {
  43818. // Zepto.js
  43819. // (c) 2010-2013 Thomas Fuchs
  43820. // Zepto.js may be freely distributed under the MIT license.
  43821. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  43822. var me = this;
  43823. function detect(ua) {
  43824. var os = me.os = {};
  43825. var browser = me.browser = {};
  43826. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  43827. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  43828. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  43829. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  43830. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  43831. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  43832. var touchpad = webos && ua.match(/TouchPad/);
  43833. var kindle = ua.match(/Kindle\/([\d.]+)/);
  43834. var silk = ua.match(/Silk\/([\d._]+)/);
  43835. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  43836. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  43837. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  43838. var playbook = ua.match(/PlayBook/);
  43839. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  43840. var firefox = ua.match(/Firefox\/([\d.]+)/);
  43841. var ie = ua.match(/MSIE ([\d.]+)/);
  43842. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  43843. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  43844. // Todo: clean this up with a better OS/browser seperation:
  43845. // - discern (more) between multiple browsers on android
  43846. // - decide if kindle fire in silk mode is android or not
  43847. // - Firefox on Android doesn't specify the Android version
  43848. // - possibly devide in os, device and browser hashes
  43849. /*eslint-disable*/
  43850. if (browser.webkit = !!webkit) {
  43851. browser.version = webkit[1];
  43852. }
  43853. if (android) {
  43854. os.android = true;
  43855. os.version = android[2];
  43856. }
  43857. if (iphone && !ipod) {
  43858. os.ios = os.iphone = true;
  43859. os.version = iphone[2].replace(/_/g, '.');
  43860. }
  43861. if (ipad) {
  43862. os.ios = os.ipad = true;
  43863. os.version = ipad[2].replace(/_/g, '.');
  43864. }
  43865. if (ipod) {
  43866. os.ios = os.ipod = true;
  43867. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  43868. }
  43869. if (webos) {
  43870. os.webos = true;
  43871. os.version = webos[2];
  43872. }
  43873. if (touchpad) {
  43874. os.touchpad = true;
  43875. }
  43876. if (blackberry) {
  43877. os.blackberry = true;
  43878. os.version = blackberry[2];
  43879. }
  43880. if (bb10) {
  43881. os.bb10 = true;
  43882. os.version = bb10[2];
  43883. }
  43884. if (rimtabletos) {
  43885. os.rimtabletos = true;
  43886. os.version = rimtabletos[2];
  43887. }
  43888. if (playbook) {
  43889. browser.playbook = true;
  43890. }
  43891. if (kindle) {
  43892. os.kindle = true;
  43893. os.version = kindle[1];
  43894. }
  43895. if (silk) {
  43896. browser.silk = true;
  43897. browser.version = silk[1];
  43898. }
  43899. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  43900. browser.silk = true;
  43901. }
  43902. if (chrome) {
  43903. browser.chrome = true;
  43904. browser.version = chrome[1];
  43905. }
  43906. if (firefox) {
  43907. browser.firefox = true;
  43908. browser.version = firefox[1];
  43909. }
  43910. if (ie) {
  43911. browser.ie = true;
  43912. browser.version = ie[1];
  43913. }
  43914. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  43915. browser.safari = true;
  43916. }
  43917. if (webview) {
  43918. browser.webview = true;
  43919. }
  43920. if (ie) {
  43921. browser.ie = true;
  43922. browser.version = ie[1];
  43923. }
  43924. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  43925. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  43926. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  43927. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  43928. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  43929. return {
  43930. browser: browser,
  43931. os: os,
  43932. // 原生canvas支持
  43933. canvasSupported: document.createElement('canvas').getContext ? true : false
  43934. };
  43935. }
  43936. return detect(navigator.userAgent);
  43937. }
  43938. destory() {
  43939. return true;
  43940. }
  43941. }
  43942. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  43943. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  43944. * This program are made available under the terms of the Apache License, Version 2.0
  43945. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43946. /**
  43947. * @class SuperMap.LevelRenderer.Tool.Event
  43948. * @category Visualization Theme
  43949. * @classdesc LevelRenderer 工具-事件辅助类
  43950. * @private
  43951. */
  43952. class Event_Event {
  43953. /**
  43954. * @function SuperMap.LevelRenderer.Tool.Event.prototype.constructor
  43955. * @description 构造函数。
  43956. */
  43957. constructor() {
  43958. /**
  43959. * @member {function} SuperMap.LevelRenderer.Tool.Event.prototype.stop
  43960. * @description 停止冒泡和阻止默认行为
  43961. */
  43962. this.stop = typeof window.addEventListener === 'function'
  43963. ? function (e) {
  43964. e.preventDefault();
  43965. e.stopPropagation();
  43966. e.cancelBubble = true;
  43967. }
  43968. : function (e) {
  43969. e.returnValue = false;
  43970. e.cancelBubble = true;
  43971. };
  43972. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  43973. }
  43974. /**
  43975. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getX
  43976. * @description 提取鼠标(手指)x坐标。
  43977. * @param {Event} e - 事件。
  43978. * @returns {number} 鼠标(手指)x坐标。
  43979. */
  43980. getX(e) {
  43981. return typeof e.zrenderX != 'undefined' && e.zrenderX
  43982. || typeof e.offsetX != 'undefined' && e.offsetX
  43983. || typeof e.layerX != 'undefined' && e.layerX
  43984. || typeof e.clientX != 'undefined' && e.clientX;
  43985. }
  43986. /**
  43987. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getY
  43988. * @description 提取鼠标(手指)y坐标。
  43989. * @param {Event} e - 事件。
  43990. * @returns {number} 鼠标(手指)y坐标。
  43991. */
  43992. getY(e) {
  43993. return typeof e.zrenderY != 'undefined' && e.zrenderY
  43994. || typeof e.offsetY != 'undefined' && e.offsetY
  43995. || typeof e.layerY != 'undefined' && e.layerY
  43996. || typeof e.clientY != 'undefined' && e.clientY;
  43997. }
  43998. /**
  43999. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getDelta
  44000. * @description 提取鼠标滚轮变化。
  44001. * @param {Event} e - 事件。
  44002. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  44003. */
  44004. getDelta(e) {
  44005. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  44006. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  44007. || typeof e.detail != 'undefined' && -e.detail;
  44008. }
  44009. }
  44010. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  44011. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44012. * This program are made available under the terms of the Apache License, Version 2.0
  44013. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44014. /**
  44015. * @private
  44016. * @class SuperMap.LevelRenderer.Tool.Http
  44017. * @category Visualization Theme
  44018. * @classdesc LevelRenderer 工具-Http
  44019. */
  44020. class Http {
  44021. /**
  44022. * @function SuperMap.LevelRenderer.Tool.Http.constructor
  44023. * @description 构造函数。
  44024. */
  44025. constructor() {
  44026. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  44027. }
  44028. /**
  44029. * @function SuperMap.LevelRenderer.Tool.Http.prototype.get
  44030. * @description get请求。
  44031. * @param {(string|IHTTPGetOption)} url - 请求url
  44032. * @param {function} onsuccess - 请求成功函数
  44033. * @param {function} onerror - 请求失败函数
  44034. * @param {Object} opts - 额外参数
  44035. * @returns {number} cos值
  44036. */
  44037. get(url, onsuccess, onerror) {
  44038. if (typeof(url) === 'object') {
  44039. var obj = url;
  44040. url = obj.url;
  44041. onsuccess = obj.onsuccess;
  44042. onerror = obj.onerror;
  44043. }
  44044. var xhr = window.XMLHttpRequest
  44045. ? new XMLHttpRequest()
  44046. : new window.ActiveXObject('Microsoft.XMLHTTP');
  44047. xhr.open('GET', url, true);
  44048. xhr.onreadystatechange = function () {
  44049. if (xhr.readyState == 4) {
  44050. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  44051. onsuccess && onsuccess(xhr.responseText);
  44052. } else {
  44053. onerror && onerror();
  44054. }
  44055. xhr.onreadystatechange = new Function();
  44056. xhr = null;
  44057. }
  44058. };
  44059. xhr.send(null);
  44060. }
  44061. }
  44062. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  44063. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44064. * This program are made available under the terms of the Apache License, Version 2.0
  44065. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44066. class Config {
  44067. }
  44068. /**
  44069. * @enum EVENT
  44070. * @description 事件
  44071. * @type {Object}
  44072. * @private
  44073. */
  44074. Config.EVENT = {
  44075. //窗口大小变化
  44076. RESIZE: 'resize',
  44077. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  44078. CLICK: 'click',
  44079. //双击事件
  44080. DBLCLICK: 'dblclick',
  44081. //鼠标滚轮变化,事件对象是:目标图形元素或空
  44082. MOUSEWHEEL: 'mousewheel',
  44083. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  44084. MOUSEMOVE: 'mousemove',
  44085. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  44086. MOUSEOVER: 'mouseover',
  44087. //鼠标从某图形元素移开,事件对象是:目标图形元素
  44088. MOUSEOUT: 'mouseout',
  44089. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  44090. MOUSEDOWN: 'mousedown',
  44091. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  44092. MOUSEUP: 'mouseup',
  44093. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  44094. GLOBALOUT: 'globalout',
  44095. // 一次成功元素拖拽的行为事件过程是:
  44096. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  44097. //开始拖拽时触发,事件对象是:被拖拽图形元素
  44098. DRAGSTART: 'dragstart',
  44099. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  44100. DRAGEND: 'dragend',
  44101. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  44102. DRAGENTER: 'dragenter',
  44103. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  44104. DRAGOVER: 'dragover',
  44105. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  44106. DRAGLEAVE: 'dragleave',
  44107. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  44108. DROP: 'drop',
  44109. //touch end - start < delay is click
  44110. touchClickDelay: 300
  44111. };
  44112. /**
  44113. * @enum catchBrushException
  44114. * @description 是否异常捕获
  44115. * @type {boolean}
  44116. * @private
  44117. */
  44118. Config.catchBrushException = false;
  44119. /**
  44120. * @enum debugMode
  44121. * @description debug 日志选项:catchBrushException 为 true 下有效。
  44122. * 0 : 不生成debug数据,发布用
  44123. * 1 : 异常抛出,调试用
  44124. * 2 : 控制台输出,调试用
  44125. * @type {boolean}
  44126. * @private
  44127. */
  44128. Config.debugMode = 0;
  44129. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  44130. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44131. * This program are made available under the terms of the Apache License, Version 2.0
  44132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44133. /**
  44134. * @private
  44135. * @class SuperMap.LevelRenderer.Tool.Log
  44136. * @category Visualization Theme
  44137. * @classdesc LevelRenderer 工具-日志
  44138. */
  44139. class Log_Log {
  44140. /**
  44141. * @function SuperMap.LevelRenderer.Tool.Log.constructor
  44142. * @description 构造函数。
  44143. */
  44144. constructor() {
  44145. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  44146. return function () {
  44147. if (Config.debugMode === 0) {
  44148. return;
  44149. } else if (Config.debugMode == 1) {
  44150. for (let k in arguments) {
  44151. throw new Error(arguments[k]);
  44152. }
  44153. } else if (Config.debugMode > 1) {
  44154. for (let k in arguments) {
  44155. console.log(arguments[k]);
  44156. }
  44157. }
  44158. };
  44159. /* for debug
  44160. return function(mes) {
  44161. document.getElementById('wrong-message').innerHTML =
  44162. mes + ' ' + (new Date() - 0)
  44163. + '<br/>'
  44164. + document.getElementById('wrong-message').innerHTML;
  44165. };
  44166. */
  44167. }
  44168. destory() {
  44169. return true;
  44170. }
  44171. }
  44172. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  44173. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44174. * This program are made available under the terms of the Apache License, Version 2.0
  44175. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44176. /**
  44177. * @private
  44178. * @class SuperMap.LevelRenderer.Tool.Math
  44179. * @category Visualization Theme
  44180. * @classdesc LevelRenderer 工具-数学辅助类
  44181. */
  44182. class MathTool {
  44183. /**
  44184. * @function SuperMap.LevelRenderer.Tool.Math.constructor
  44185. * @description 构造函数。
  44186. */
  44187. constructor() {
  44188. /**
  44189. * @member {number} SuperMap.LevelRenderer.Tool.Math._radians
  44190. * @description 角度与弧度转化参数
  44191. */
  44192. this._radians = window.Math.PI / 180;
  44193. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  44194. }
  44195. /**
  44196. * @function SuperMap.LevelRenderer.Tool.Math.prototype.sin
  44197. * @description 正弦函数。
  44198. * @param {number} angle - 弧度(角度)参数。
  44199. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44200. * @returns {number} sin 值。
  44201. */
  44202. sin(angle, isDegrees) {
  44203. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  44204. }
  44205. /**
  44206. * @function SuperMap.LevelRenderer.Tool.Math.prototype.cos
  44207. * @description 余弦函数。
  44208. * @param {number} angle - 弧度(角度)参数。
  44209. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44210. * @returns {number} cos 值。
  44211. */
  44212. cos(angle, isDegrees) {
  44213. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  44214. }
  44215. /**
  44216. * @function SuperMap.LevelRenderer.Tool.Math.prototype.degreeToRadian
  44217. * @description 角度转弧度。
  44218. * @param {number} angle - 弧度(角度)参数。
  44219. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44220. * @returns {number} 弧度值。
  44221. */
  44222. degreeToRadian(angle) {
  44223. return angle * this._radians;
  44224. }
  44225. /**
  44226. * @function SuperMap.LevelRenderer.Tool.Math.prototype.radianToDegree
  44227. * @description 弧度转角度。
  44228. * @param {number} angle - 弧度(角度)参数。
  44229. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44230. * @returns {number} 角度。
  44231. */
  44232. radianToDegree(angle) {
  44233. return angle / this._radians;
  44234. }
  44235. }
  44236. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  44237. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44238. * This program are made available under the terms of the Apache License, Version 2.0
  44239. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44240. /**
  44241. * @private
  44242. * @class SuperMap.LevelRenderer.Tool.Matrix
  44243. * @category Visualization Theme
  44244. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  44245. */
  44246. class Matrix {
  44247. /**
  44248. * @function SuperMap.LevelRenderer.Tool.Matrix.constructor
  44249. * @description 构造函数。
  44250. */
  44251. constructor() {
  44252. /**
  44253. * @member {Object} SuperMap.LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  44254. * @description 数组类型控制
  44255. */
  44256. this.ArrayCtor = typeof Float32Array === 'undefined'
  44257. ? Array
  44258. : Float32Array;
  44259. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  44260. }
  44261. /**
  44262. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.create
  44263. * @description 创建一个单位矩阵。
  44264. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  44265. */
  44266. create() {
  44267. var ArrayCtor = this.ArrayCtor;
  44268. var out = new ArrayCtor(6);
  44269. this.identity(out);
  44270. return out;
  44271. }
  44272. /**
  44273. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.identity
  44274. * @description 设置矩阵为单位矩阵。
  44275. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44276. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  44277. */
  44278. identity(out) {
  44279. out[0] = 1;
  44280. out[1] = 0;
  44281. out[2] = 0;
  44282. out[3] = 1;
  44283. out[4] = 0;
  44284. out[5] = 0;
  44285. return out;
  44286. }
  44287. /**
  44288. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.copy
  44289. * @description 复制矩阵。
  44290. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44291. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  44292. */
  44293. copy(out, m) {
  44294. out[0] = m[0];
  44295. out[1] = m[1];
  44296. out[2] = m[2];
  44297. out[3] = m[3];
  44298. out[4] = m[4];
  44299. out[5] = m[5];
  44300. return out;
  44301. }
  44302. /**
  44303. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  44304. * @description 矩阵相乘。
  44305. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44306. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  44307. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  44308. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  44309. */
  44310. mul(out, m1, m2) {
  44311. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  44312. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  44313. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  44314. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  44315. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  44316. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  44317. return out;
  44318. }
  44319. /**
  44320. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  44321. * @description 平移变换。
  44322. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44323. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  44324. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  44325. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  44326. */
  44327. translate(out, a, v) {
  44328. out[0] = a[0];
  44329. out[1] = a[1];
  44330. out[2] = a[2];
  44331. out[3] = a[3];
  44332. out[4] = a[4] + v[0];
  44333. out[5] = a[5] + v[1];
  44334. return out;
  44335. }
  44336. /**
  44337. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.rotate
  44338. * @description 平移变换。
  44339. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44340. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  44341. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  44342. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  44343. */
  44344. rotate(out, a, rad) {
  44345. var aa = a[0];
  44346. var ac = a[2];
  44347. var atx = a[4];
  44348. var ab = a[1];
  44349. var ad = a[3];
  44350. var aty = a[5];
  44351. var st = Math.sin(rad);
  44352. var ct = Math.cos(rad);
  44353. out[0] = aa * ct + ab * st;
  44354. out[1] = -aa * st + ab * ct;
  44355. out[2] = ac * ct + ad * st;
  44356. out[3] = -ac * st + ct * ad;
  44357. out[4] = ct * atx + st * aty;
  44358. out[5] = ct * aty - st * atx;
  44359. return out;
  44360. }
  44361. /**
  44362. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.scale
  44363. * @description 缩放变换。
  44364. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44365. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  44366. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  44367. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  44368. */
  44369. scale(out, a, v) {
  44370. var vx = v[0];
  44371. var vy = v[1];
  44372. out[0] = a[0] * vx;
  44373. out[1] = a[1] * vy;
  44374. out[2] = a[2] * vx;
  44375. out[3] = a[3] * vy;
  44376. out[4] = a[4] * vx;
  44377. out[5] = a[5] * vy;
  44378. return out;
  44379. }
  44380. /**
  44381. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.invert
  44382. * @description 求逆矩阵。
  44383. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44384. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  44385. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  44386. */
  44387. invert(out, a) {
  44388. var aa = a[0];
  44389. var ac = a[2];
  44390. var atx = a[4];
  44391. var ab = a[1];
  44392. var ad = a[3];
  44393. var aty = a[5];
  44394. var det = aa * ad - ab * ac;
  44395. if (!det) {
  44396. return null;
  44397. }
  44398. det = 1.0 / det;
  44399. out[0] = ad * det;
  44400. out[1] = -ab * det;
  44401. out[2] = -ac * det;
  44402. out[3] = aa * det;
  44403. out[4] = (ac * aty - ad * atx) * det;
  44404. out[5] = (ab * atx - aa * aty) * det;
  44405. return out;
  44406. }
  44407. /**
  44408. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mulVector
  44409. * @description 矩阵左乘向量。
  44410. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44411. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  44412. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  44413. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  44414. */
  44415. mulVector(out, a, v) {
  44416. var aa = a[0];
  44417. var ac = a[2];
  44418. var atx = a[4];
  44419. var ab = a[1];
  44420. var ad = a[3];
  44421. var aty = a[5];
  44422. out[0] = v[0] * aa + v[1] * ac + atx;
  44423. out[1] = v[0] * ab + v[1] * ad + aty;
  44424. return out;
  44425. }
  44426. }
  44427. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  44428. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44429. * This program are made available under the terms of the Apache License, Version 2.0
  44430. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44431. class SUtil {
  44432. /**
  44433. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothBezier
  44434. * @description 贝塞尔平滑曲线。
  44435. * @private
  44436. * @param {Array} points - 线段顶点数组。
  44437. * @param {number} smooth - 平滑等级, 0-1。
  44438. * @param {boolean} isLoop - isLoop。
  44439. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  44440. * @param {Array} [originalPosition=[0, 0]] - 参考原点。
  44441. * @return {Array} 生成的平滑节点数组。
  44442. */
  44443. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  44444. if (!originalPosition || originalPosition !== 2) {
  44445. originalPosition = [0, 0];
  44446. }
  44447. var __OP = originalPosition;
  44448. var cps = [];
  44449. var v = [];
  44450. var v1 = [];
  44451. var v2 = [];
  44452. var hasConstraint = !!constraint;
  44453. var min, max;
  44454. if (hasConstraint) {
  44455. min = [Infinity, Infinity];
  44456. max = [-Infinity, -Infinity];
  44457. let len = points.length;
  44458. for (let i = 0; i < len; i++) {
  44459. SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  44460. SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  44461. }
  44462. // 与指定的包围盒做并集
  44463. SUtil.Util_vector.min(min, min, constraint[0]);
  44464. SUtil.Util_vector.max(max, max, constraint[1]);
  44465. }
  44466. let len = points.length;
  44467. for (let i = 0; i < len; i++) {
  44468. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  44469. let prevPoint;
  44470. let nextPoint;
  44471. if (isLoop) {
  44472. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  44473. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  44474. } else {
  44475. if (i === 0 || i === len - 1) {
  44476. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  44477. continue;
  44478. } else {
  44479. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  44480. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  44481. }
  44482. }
  44483. SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  44484. // use degree to scale the handle length
  44485. SUtil.Util_vector.scale(v, v, smooth);
  44486. let d0 = SUtil.Util_vector.distance(point, prevPoint);
  44487. let d1 = SUtil.Util_vector.distance(point, nextPoint);
  44488. let sum = d0 + d1;
  44489. if (sum !== 0) {
  44490. d0 /= sum;
  44491. d1 /= sum;
  44492. }
  44493. SUtil.Util_vector.scale(v1, v, -d0);
  44494. SUtil.Util_vector.scale(v2, v, d1);
  44495. let cp0 = SUtil.Util_vector.add([], point, v1);
  44496. let cp1 = SUtil.Util_vector.add([], point, v2);
  44497. if (hasConstraint) {
  44498. SUtil.Util_vector.max(cp0, cp0, min);
  44499. SUtil.Util_vector.min(cp0, cp0, max);
  44500. SUtil.Util_vector.max(cp1, cp1, min);
  44501. SUtil.Util_vector.min(cp1, cp1, max);
  44502. }
  44503. cps.push(cp0);
  44504. cps.push(cp1);
  44505. }
  44506. if (isLoop) {
  44507. cps.push(cps.shift());
  44508. }
  44509. return cps;
  44510. }
  44511. /**
  44512. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothSpline
  44513. * @description 插值折线。
  44514. * @private
  44515. * @param {Array} points - 线段顶点数组。
  44516. * @param {boolean} isLoop - isLoop。
  44517. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  44518. * @param {Array} originalPosition - 参考原点。默认值:[0, 0]。
  44519. * @return {Array} 生成的平滑节点数组。
  44520. */
  44521. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  44522. if (!originalPosition || originalPosition !== 2) {
  44523. originalPosition = [0, 0];
  44524. }
  44525. var __OP = originalPosition;
  44526. var len = points.length;
  44527. var ret = [];
  44528. var distance = 0;
  44529. for (let i = 1; i < len; i++) {
  44530. distance += SUtil.Util_vector.distance([points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]], [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  44531. }
  44532. var segs = distance / 5;
  44533. segs = segs < len ? len : segs;
  44534. for (let i = 0; i < segs; i++) {
  44535. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  44536. let idx = Math.floor(pos);
  44537. let w = pos - idx;
  44538. let p0;
  44539. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  44540. let p2;
  44541. let p3;
  44542. if (!isLoop) {
  44543. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  44544. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  44545. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  44546. } else {
  44547. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  44548. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  44549. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  44550. }
  44551. let w2 = w * w;
  44552. let w3 = w * w2;
  44553. ret.push([
  44554. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  44555. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  44556. ]);
  44557. }
  44558. return ret;
  44559. // inner Function
  44560. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  44561. var v0 = (p2 - p0) * 0.5;
  44562. var v1 = (p3 - p1) * 0.5;
  44563. return (2 * (p1 - p2) + v0 + v1) * t3
  44564. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  44565. + v0 * t + p1;
  44566. }
  44567. }
  44568. /**
  44569. * @function SuperMap.LevelRenderer.SUtil.SUtil_dashedLineTo
  44570. * @description 虚线 lineTo。
  44571. */
  44572. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  44573. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  44574. var dashPattern = [5, 5];
  44575. dashLength = typeof dashLength != 'number'
  44576. ? 5
  44577. : dashLength;
  44578. if (ctx.setLineDash) {
  44579. dashPattern[0] = dashLength;
  44580. dashPattern[1] = dashLength;
  44581. if (customDashPattern && (customDashPattern instanceof Array)) {
  44582. ctx.setLineDash(customDashPattern);
  44583. } else {
  44584. ctx.setLineDash(dashPattern);
  44585. }
  44586. // ctx.setLineDash(dashPattern);
  44587. ctx.moveTo(x1, y1);
  44588. ctx.lineTo(x2, y2);
  44589. return;
  44590. }
  44591. var dx = x2 - x1;
  44592. var dy = y2 - y1;
  44593. var numDashes = Math.floor(
  44594. Math.sqrt(dx * dx + dy * dy) / dashLength
  44595. );
  44596. dx = dx / numDashes;
  44597. dy = dy / numDashes;
  44598. var flag = true;
  44599. for (var i = 0; i < numDashes; ++i) {
  44600. if (flag) {
  44601. ctx.moveTo(x1, y1);
  44602. } else {
  44603. ctx.lineTo(x1, y1);
  44604. }
  44605. flag = !flag;
  44606. x1 += dx;
  44607. y1 += dy;
  44608. }
  44609. ctx.lineTo(x2, y2);
  44610. }
  44611. }
  44612. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  44613. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  44614. SUtil.Util_area = new Area_Area();
  44615. SUtil.Util_color = new Color_Color();
  44616. SUtil.Util_computeBoundingBox = new ComputeBoundingBox_ComputeBoundingBox();
  44617. SUtil.Util_curve = new levelRenderer_Curve_Curve();
  44618. SUtil.Util_env = new Env();
  44619. SUtil.Util_event = new Event_Event();
  44620. SUtil.Util_http = new Http();
  44621. SUtil.Util_log = new Log_Log();
  44622. SUtil.Util_math = new MathTool();
  44623. SUtil.Util_matrix = new Matrix();
  44624. SUtil.Util = new levelRenderer_Util_Util();
  44625. SUtil.Util_vector = new levelRenderer_Vector_Vector();
  44626. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  44627. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44628. * This program are made available under the terms of the Apache License, Version 2.0
  44629. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44630. /**
  44631. * @private
  44632. * @class SuperMap.LevelRenderer.Transformable
  44633. * @category Visualization Theme
  44634. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  44635. */
  44636. class Transformable_Transformable {
  44637. /**
  44638. * @function SuperMap.LevelRenderer.Transformable.constructor
  44639. * @description 构造函数。
  44640. */
  44641. constructor() {
  44642. /**
  44643. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.position
  44644. * @description 平移, 默认值:[0, 0]。
  44645. */
  44646. this.position = [0, 0];
  44647. /**
  44648. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.rotation
  44649. * @description 旋转,可以通过数组二三项指定旋转的原点, 默认值:[0, 0, 0]。
  44650. */
  44651. this.rotation = [0, 0, 0];
  44652. /**
  44653. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.scale
  44654. * @description 缩放,可以通过数组三四项指定缩放的原点, 默认值:[1, 1, 0, 0]。
  44655. */
  44656. this.scale = [1, 1, 0, 0];
  44657. /**
  44658. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needLocalTransform
  44659. * @description 是否变换。默认值:false。
  44660. */
  44661. this.needLocalTransform = false;
  44662. /**
  44663. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needTransform
  44664. * @description 是否有坐标变换。默认值:false。
  44665. */
  44666. this.needTransform = false;
  44667. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  44668. /**
  44669. * @function SuperMap.LevelRenderer.Transformable.prototype.lookAt
  44670. * @description 设置图形的朝向。
  44671. */
  44672. this.lookAt = (function () {
  44673. var v = SUtil.Util_vector.create();
  44674. // {Array.<Number>|Float32Array} target
  44675. return function (target) {
  44676. if (!this.transform) {
  44677. this.transform = SUtil.Util_matrix.create();
  44678. }
  44679. var m = this.transform;
  44680. SUtil.Util_vector.sub(v, target, this.position);
  44681. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  44682. return;
  44683. }
  44684. SUtil.Util_vector.normalize(v, v);
  44685. // Y Axis
  44686. // TODO Scale origin ?
  44687. m[2] = v[0] * this.scale[1];
  44688. m[3] = v[1] * this.scale[1];
  44689. // X Axis
  44690. m[0] = v[1] * this.scale[0];
  44691. m[1] = -v[0] * this.scale[0];
  44692. // Position
  44693. m[4] = this.position[0];
  44694. m[5] = this.position[1];
  44695. this.decomposeTransform();
  44696. function isAroundZero(val) {
  44697. var EPSILON = 5e-5;
  44698. return val > -EPSILON && val < EPSILON;
  44699. }
  44700. };
  44701. })();
  44702. }
  44703. /**
  44704. * @function SuperMap.LevelRenderer.Transformable.prototype.destroy
  44705. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  44706. */
  44707. destroy() {
  44708. this.position = null;
  44709. this.rotation = null;
  44710. this.scale = null;
  44711. this.needLocalTransform = null;
  44712. this.needTransform = null;
  44713. }
  44714. /**
  44715. * @function SuperMap.LevelRenderer.Transformable.prototype.updateNeedTransform
  44716. * @description 更新 needLocalTransform
  44717. */
  44718. updateNeedTransform() {
  44719. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  44720. || isNotAroundZero(this.position[0])
  44721. || isNotAroundZero(this.position[1])
  44722. || isNotAroundZero(this.scale[0] - 1)
  44723. || isNotAroundZero(this.scale[1] - 1);
  44724. function isNotAroundZero(val) {
  44725. var EPSILON = 5e-5;
  44726. return val > EPSILON || val < -EPSILON;
  44727. }
  44728. }
  44729. /**
  44730. * @function SuperMap.LevelRenderer.Transformable.prototype.updateTransform
  44731. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换, 则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵
  44732. */
  44733. updateTransform() {
  44734. this.updateNeedTransform();
  44735. if (this.parent) {
  44736. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  44737. } else {
  44738. this.needTransform = this.needLocalTransform;
  44739. }
  44740. if (!this.needTransform) {
  44741. return;
  44742. }
  44743. var origin = [0, 0];
  44744. var m = this.transform || SUtil.Util_matrix.create();
  44745. SUtil.Util_matrix.identity(m);
  44746. if (this.needLocalTransform) {
  44747. if (
  44748. isNotAroundZero(this.scale[0])
  44749. || isNotAroundZero(this.scale[1])
  44750. ) {
  44751. origin[0] = -this.scale[2] || 0;
  44752. origin[1] = -this.scale[3] || 0;
  44753. let haveOrigin = isNotAroundZero(origin[0])
  44754. || isNotAroundZero(origin[1]);
  44755. if (haveOrigin) {
  44756. SUtil.Util_matrix.translate(
  44757. m, m, origin
  44758. );
  44759. }
  44760. SUtil.Util_matrix.scale(m, m, this.scale);
  44761. if (haveOrigin) {
  44762. origin[0] = -origin[0];
  44763. origin[1] = -origin[1];
  44764. SUtil.Util_matrix.translate(
  44765. m, m, origin
  44766. );
  44767. }
  44768. }
  44769. if (this.rotation instanceof Array) {
  44770. if (this.rotation[0] !== 0) {
  44771. origin[0] = -this.rotation[1] || 0;
  44772. origin[1] = -this.rotation[2] || 0;
  44773. let haveOrigin = isNotAroundZero(origin[0])
  44774. || isNotAroundZero(origin[1]);
  44775. if (haveOrigin) {
  44776. SUtil.Util_matrix.translate(
  44777. m, m, origin
  44778. );
  44779. }
  44780. SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  44781. if (haveOrigin) {
  44782. origin[0] = -origin[0];
  44783. origin[1] = -origin[1];
  44784. SUtil.Util_matrix.translate(
  44785. m, m, origin
  44786. );
  44787. }
  44788. }
  44789. } else {
  44790. if (this.rotation !== 0) {
  44791. SUtil.Util_matrix.rotate(m, m, this.rotation);
  44792. }
  44793. }
  44794. if (
  44795. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  44796. ) {
  44797. SUtil.Util_matrix.translate(m, m, this.position);
  44798. }
  44799. }
  44800. // 保存这个变换矩阵
  44801. this.transform = m;
  44802. // 应用父节点变换
  44803. if (this.parent && this.parent.needTransform) {
  44804. if (this.needLocalTransform) {
  44805. SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  44806. } else {
  44807. SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  44808. }
  44809. }
  44810. function isNotAroundZero(val) {
  44811. var EPSILON = 5e-5;
  44812. return val > EPSILON || val < -EPSILON;
  44813. }
  44814. }
  44815. /**
  44816. * @function SuperMap.LevelRenderer.Transformable.prototype.setTransform
  44817. * @description 将自己的 transform 应用到 context 上。
  44818. *
  44819. * @param {Context2D} ctx - Context2D 上下文。
  44820. */
  44821. setTransform(ctx) {
  44822. if (this.needTransform) {
  44823. var m = this.transform;
  44824. ctx.transform(
  44825. m[0], m[1],
  44826. m[2], m[3],
  44827. m[4], m[5]
  44828. );
  44829. }
  44830. }
  44831. /**
  44832. * @function SuperMap.LevelRenderer.Transformable.prototype.decomposeTransform
  44833. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  44834. */
  44835. decomposeTransform() {
  44836. if (!this.transform) {
  44837. return;
  44838. }
  44839. var m = this.transform;
  44840. var sx = m[0] * m[0] + m[1] * m[1];
  44841. var position = this.position;
  44842. var scale = this.scale;
  44843. var rotation = this.rotation;
  44844. if (isNotAroundZero(sx - 1)) {
  44845. sx = Math.sqrt(sx);
  44846. }
  44847. var sy = m[2] * m[2] + m[3] * m[3];
  44848. if (isNotAroundZero(sy - 1)) {
  44849. sy = Math.sqrt(sy);
  44850. }
  44851. position[0] = m[4];
  44852. position[1] = m[5];
  44853. scale[0] = sx;
  44854. scale[1] = sy;
  44855. scale[2] = scale[3] = 0;
  44856. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  44857. rotation[1] = rotation[2] = 0;
  44858. function isNotAroundZero(val) {
  44859. var EPSILON = 5e-5;
  44860. return val > EPSILON || val < -EPSILON;
  44861. }
  44862. }
  44863. }
  44864. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  44865. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  44866. * This program are made available under the terms of the Apache License, Version 2.0
  44867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44868. /**
  44869. * @private
  44870. * @class SuperMap.LevelRenderer.Shape
  44871. * @category Visualization Theme
  44872. * @classdesc 图形(shape)基类。
  44873. * @extends SuperMap.LevelRenderer.Eventful
  44874. * @extends SuperMap.LevelRenderer.Transformable
  44875. */
  44876. class Shape_Shape extends SuperMap.mixin(Eventful, Transformable_Transformable) {
  44877. /**
  44878. * @function SuperMap.LevelRenderer.Shape.constructor
  44879. * @description 构造函数。
  44880. *
  44881. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  44882. *
  44883. */
  44884. constructor(options) {
  44885. super(options);
  44886. options = options || {};
  44887. /**
  44888. * @member {string} SuperMap.LevelRenderer.Shape.prototype.id
  44889. * @description 唯一标识。
  44890. */
  44891. this.id = null;
  44892. /**
  44893. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style
  44894. * @description 基础绘制样式。
  44895. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  44896. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  44897. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  44898. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  44899. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  44900. * @param {number} style.opacity - 绘制透明度。默认值:1。
  44901. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  44902. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  44903. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  44904. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  44905. * @param {string} style.text - 图形中的附加文本。默认值:""。
  44906. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  44907. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  44908. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  44909. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  44910. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  44911. *
  44912. */
  44913. this.style = {};
  44914. /**
  44915. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style.__rect
  44916. * @description 包围图形的最小矩形盒子。
  44917. *
  44918. * @param {number} x - 左上角顶点x轴坐标。
  44919. * @param {number} y - 左上角顶点y轴坐标。
  44920. * @param {number} width - 包围盒矩形宽度。
  44921. * @param {number} height - 包围盒矩形高度。
  44922. */
  44923. /**
  44924. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.highlightStyle
  44925. * @description 高亮样式。
  44926. *
  44927. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  44928. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  44929. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  44930. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  44931. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  44932. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  44933. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  44934. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  44935. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  44936. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  44937. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  44938. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  44939. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  44940. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  44941. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  44942. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  44943. */
  44944. this.highlightStyle = null;
  44945. /**
  44946. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.parent
  44947. * @description 父节点,只读属性。<SuperMap.LevelRenderer.Group>
  44948. */
  44949. this.parent = null;
  44950. /**
  44951. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.__dirty
  44952. * @description {boolean}
  44953. */
  44954. this.__dirty = true;
  44955. /**
  44956. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.__clipShapes
  44957. * @description {Array}
  44958. *
  44959. */
  44960. this.__clipShapes = [];
  44961. /**
  44962. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.invisible
  44963. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  44964. */
  44965. this.invisible = false;
  44966. /**
  44967. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.ignore
  44968. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  44969. */
  44970. this.ignore = false;
  44971. /**
  44972. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.zlevel
  44973. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  44974. */
  44975. this.zlevel = 0;
  44976. /**
  44977. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.draggable
  44978. * @description 是否可拖拽。默认值:false。
  44979. */
  44980. this.draggable = false;
  44981. /**
  44982. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.clickable
  44983. * @description 是否可点击。默认值:false。
  44984. */
  44985. this.clickable = false;
  44986. /**
  44987. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.hoverable
  44988. * @description 是否可以 hover。默认值:true。
  44989. */
  44990. this.hoverable = true;
  44991. /**
  44992. * @member {number} SuperMap.LevelRenderer.Shape.prototype.z
  44993. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  44994. */
  44995. this.z = 0;
  44996. //地理扩展
  44997. /**
  44998. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.refOriginalPosition
  44999. * @description 图形参考原点位置,图形的参考中心位置。
  45000. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  45001. *
  45002. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  45003. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  45004. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  45005. *
  45006. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  45007. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  45008. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  45009. *
  45010. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  45011. *
  45012. * refOriginalPosition。默认值是: [0, 0]。
  45013. */
  45014. this.refOriginalPosition = [0, 0];
  45015. /**
  45016. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataID
  45017. * @description 图形所关联数据的 ID。
  45018. *
  45019. */
  45020. this.refDataID = null;
  45021. /**
  45022. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.isHoverByRefDataID
  45023. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  45024. *
  45025. */
  45026. this.isHoverByRefDataID = false;
  45027. /**
  45028. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataHoverGroup
  45029. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  45030. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  45031. *
  45032. */
  45033. this.refDataHoverGroup = null;
  45034. /**
  45035. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.dataInfo
  45036. * @description 图形的数据信息。
  45037. *
  45038. */
  45039. this.dataInfo = null;
  45040. Util_Util.extend(this, options);
  45041. this.id = this.id || Util_Util.createUniqueID("smShape_");
  45042. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  45043. /**
  45044. * @function SuperMap.LevelRenderer.Shape.prototype.getTansform
  45045. * @description 变换鼠标位置到 shape 的局部坐标空间
  45046. *
  45047. */
  45048. this.getTansform = (function () {
  45049. var invTransform = [];
  45050. return function (x, y) {
  45051. var originPos = [x, y];
  45052. // 对鼠标的坐标也做相同的变换
  45053. if (this.needTransform && this.transform) {
  45054. SUtil.Util_matrix.invert(invTransform, this.transform);
  45055. SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  45056. if (x == originPos[0] && y == originPos[1]) {
  45057. // 避免外部修改导致的 needTransform 不准确
  45058. this.updateNeedTransform();
  45059. }
  45060. }
  45061. return originPos;
  45062. };
  45063. })();
  45064. }
  45065. /**
  45066. * @function SuperMap.LevelRenderer.Shape.prototype.destroy
  45067. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45068. */
  45069. destroy() {
  45070. this.id = null;
  45071. this.style = null;
  45072. this.highlightStyle = null;
  45073. this.parent = null;
  45074. this.__dirty = null;
  45075. this.__clipShapes = null;
  45076. this.invisible = null;
  45077. this.ignore = null;
  45078. this.zlevel = null;
  45079. this.draggable = null;
  45080. this.clickable = null;
  45081. this.hoverable = null;
  45082. this.z = null;
  45083. this.refOriginalPosition = null;
  45084. this.refDataID = null;
  45085. this.refDataHoverGroup = null;
  45086. this.isHoverByRefDataID = null;
  45087. this.dataInfo = null;
  45088. super.destroy();
  45089. }
  45090. /**
  45091. * @function SuperMap.LevelRenderer.Shape.prototype.brush
  45092. * @description 绘制图形。
  45093. *
  45094. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45095. * @param {boolean} isHighlight - 是否使用高亮属性。
  45096. * @param {Function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  45097. */
  45098. brush(ctx, isHighlight) {
  45099. var style = this.beforeBrush(ctx, isHighlight);
  45100. ctx.beginPath();
  45101. this.buildPath(ctx, style);
  45102. switch (style.brushType) {
  45103. /* jshint ignore:start */
  45104. case 'both':
  45105. this.setCtxGlobalAlpha(ctx, "fill", style);
  45106. ctx.fill();
  45107. if (style.lineWidth > 0) {
  45108. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45109. ctx.stroke();
  45110. }
  45111. this.setCtxGlobalAlpha(ctx, "reset", style);
  45112. break;
  45113. case 'stroke':
  45114. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45115. style.lineWidth > 0 && ctx.stroke();
  45116. this.setCtxGlobalAlpha(ctx, "reset", style);
  45117. break;
  45118. /* jshint ignore:end */
  45119. default:
  45120. this.setCtxGlobalAlpha(ctx, "fill", style);
  45121. ctx.fill();
  45122. this.setCtxGlobalAlpha(ctx, "reset", style);
  45123. break;
  45124. }
  45125. this.drawText(ctx, style, this.style);
  45126. this.afterBrush(ctx);
  45127. }
  45128. /**
  45129. * @function SuperMap.LevelRenderer.Shape.prototype.beforeBrush
  45130. * @description 具体绘制操作前的一些公共操作。
  45131. *
  45132. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45133. * @param {boolean} isHighlight - 是否使用高亮属性。
  45134. * @return {Object} 处理后的样式。
  45135. */
  45136. beforeBrush(ctx, isHighlight) {
  45137. var style = this.style;
  45138. if (this.brushTypeOnly) {
  45139. style.brushType = this.brushTypeOnly;
  45140. }
  45141. if (isHighlight) {
  45142. // 根据style扩展默认高亮样式
  45143. style = this.getHighlightStyle(
  45144. style,
  45145. this.highlightStyle || {},
  45146. this.brushTypeOnly
  45147. );
  45148. }
  45149. if (this.brushTypeOnly == 'stroke') {
  45150. style.strokeColor = style.strokeColor || style.color;
  45151. }
  45152. ctx.save();
  45153. this.doClip(ctx);
  45154. this.setContext(ctx, style);
  45155. // 设置transform
  45156. this.setTransform(ctx);
  45157. return style;
  45158. }
  45159. /**
  45160. * @function SuperMap.LevelRenderer.Shape.prototype.afterBrush
  45161. * @description 绘制后的处理。
  45162. *
  45163. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45164. *
  45165. */
  45166. afterBrush(ctx) {
  45167. ctx.restore();
  45168. }
  45169. /**
  45170. * @function SuperMap.LevelRenderer.Shape.prototype.setContext
  45171. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  45172. *
  45173. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45174. * @param {Object} style - 样式。
  45175. *
  45176. */
  45177. setContext(ctx, style) {
  45178. var STYLE_CTX_MAP = [
  45179. ['color', 'fillStyle'],
  45180. ['strokeColor', 'strokeStyle'],
  45181. ['opacity', 'globalAlpha'],
  45182. ['lineCap', 'lineCap'],
  45183. ['lineJoin', 'lineJoin'],
  45184. ['miterLimit', 'miterLimit'],
  45185. ['lineWidth', 'lineWidth'],
  45186. ['shadowBlur', 'shadowBlur'],
  45187. ['shadowColor', 'shadowColor'],
  45188. ['shadowOffsetX', 'shadowOffsetX'],
  45189. ['shadowOffsetY', 'shadowOffsetY']
  45190. ];
  45191. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  45192. var styleProp = STYLE_CTX_MAP[i][0];
  45193. var styleValue = style[styleProp];
  45194. var ctxProp = STYLE_CTX_MAP[i][1];
  45195. if (typeof styleValue != 'undefined') {
  45196. ctx[ctxProp] = styleValue;
  45197. }
  45198. }
  45199. }
  45200. /**
  45201. * @function SuperMap.LevelRenderer.Shape.prototype.doClip
  45202. *
  45203. */
  45204. doClip(ctx) {
  45205. var clipShapeInvTransform = SUtil.Util_matrix.create();
  45206. if (this.__clipShapes) {
  45207. for (var i = 0; i < this.__clipShapes.length; i++) {
  45208. var clipShape = this.__clipShapes[i];
  45209. if (clipShape.needTransform) {
  45210. let m = clipShape.transform;
  45211. SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  45212. ctx.transform(
  45213. m[0], m[1],
  45214. m[2], m[3],
  45215. m[4], m[5]
  45216. );
  45217. }
  45218. ctx.beginPath();
  45219. clipShape.buildPath(ctx, clipShape.style);
  45220. ctx.clip();
  45221. // Transform back
  45222. if (clipShape.needTransform) {
  45223. let m = clipShapeInvTransform;
  45224. ctx.transform(
  45225. m[0], m[1],
  45226. m[2], m[3],
  45227. m[4], m[5]
  45228. );
  45229. }
  45230. }
  45231. }
  45232. }
  45233. /**
  45234. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightStyle
  45235. * @description 根据默认样式扩展高亮样式
  45236. *
  45237. * @param {Object} style - 样式。
  45238. * @param {Object} highlightStyle - 高亮样式。
  45239. * @param {string} brushTypeOnly - brushTypeOnly。
  45240. *
  45241. */
  45242. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  45243. var newStyle = {};
  45244. for (let k in style) {
  45245. newStyle[k] = style[k];
  45246. }
  45247. var highlightColor = SUtil.Util_color.getHighlightColor();
  45248. // 根据highlightStyle扩展
  45249. if (style.brushType != 'stroke') {
  45250. // 带填充则用高亮色加粗边线
  45251. newStyle.strokeColor = highlightColor;
  45252. // SMIC-方法修改 - start
  45253. newStyle.lineWidth = (style.lineWidth || 1);
  45254. // 原始代码
  45255. // newStyle.lineWidth = (style.lineWidth || 1)
  45256. // + this.getHighlightZoom();
  45257. // 修改代码1
  45258. // if(!style.lineType || style.lineType === "solid"){
  45259. // newStyle.lineWidth = (style.lineWidth || 1)
  45260. // + this.getHighlightZoom();
  45261. // }
  45262. // else{
  45263. // newStyle.lineWidth = (style.lineWidth || 1);
  45264. // }
  45265. // SMIC-方法修改 - end
  45266. newStyle.brushType = 'both';
  45267. } else {
  45268. if (brushTypeOnly != 'stroke') {
  45269. // 描边型的则用原色加工高亮
  45270. newStyle.strokeColor = highlightColor;
  45271. // SMIC-方法修改 - start
  45272. newStyle.lineWidth = (style.lineWidth || 1);
  45273. // 原始代码
  45274. // newStyle.lineWidth = (style.lineWidth || 1)
  45275. // + this.getHighlightZoom();
  45276. // 修改代码1
  45277. // if(!style.lineType || style.lineType === "solid"){
  45278. // newStyle.lineWidth = (style.lineWidth || 1)
  45279. // + this.getHighlightZoom();
  45280. // }
  45281. // else{
  45282. // newStyle.lineWidth = (style.lineWidth || 1);
  45283. // }
  45284. // SMIC-方法修改 - end
  45285. } else {
  45286. // 线型的则用原色加工高亮
  45287. newStyle.strokeColor = highlightStyle.strokeColor
  45288. || SUtil.Util_color.mix(
  45289. style.strokeColor,
  45290. SUtil.Util_color.toRGB(highlightColor)
  45291. );
  45292. }
  45293. }
  45294. // 可自定义覆盖默认值
  45295. for (let k in highlightStyle) {
  45296. if (typeof highlightStyle[k] != 'undefined') {
  45297. newStyle[k] = highlightStyle[k];
  45298. }
  45299. }
  45300. return newStyle;
  45301. }
  45302. /**
  45303. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightZoom
  45304. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  45305. *
  45306. */
  45307. getHighlightZoom() {
  45308. return this.type != 'text' ? 6 : 2;
  45309. }
  45310. /**
  45311. * @function SuperMap.LevelRenderer.Shape.prototype.drift
  45312. * @description 移动位置
  45313. *
  45314. * @param {Object} dx - 横坐标变化。
  45315. * @param {Object} dy - 纵坐标变化。
  45316. *
  45317. */
  45318. drift(dx, dy) {
  45319. this.position[0] += dx;
  45320. this.position[1] += dy;
  45321. }
  45322. /**
  45323. * @function SuperMap.LevelRenderer.Shape.prototype.buildPath
  45324. * @description 构建绘制的Path。子类必须重新实现此方法。
  45325. *
  45326. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45327. * @param {Object} style - 样式。
  45328. */
  45329. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  45330. SUtil.Util_log('buildPath not implemented in ' + this.type);
  45331. }
  45332. /**
  45333. * @function SuperMap.LevelRenderer.Shape.prototype.getRect
  45334. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  45335. *
  45336. * @param {Object} style - 样式。
  45337. */
  45338. getRect(style) { // eslint-disable-line no-unused-vars
  45339. SUtil.Util_log('getRect not implemented in ' + this.type);
  45340. }
  45341. /**
  45342. * @function SuperMap.LevelRenderer.Shape.prototype.isCover
  45343. * @description 判断鼠标位置是否在图形内。
  45344. *
  45345. * @param {number} x - x。
  45346. * @param {number} y - y。
  45347. */
  45348. isCover(x, y) {
  45349. var originPos = this.getTansform(x, y);
  45350. x = originPos[0];
  45351. y = originPos[1];
  45352. // 快速预判并保留判断矩形
  45353. var rect = this.style.__rect;
  45354. if (!rect) {
  45355. rect = this.style.__rect = this.getRect(this.style);
  45356. }
  45357. if (x >= rect.x
  45358. && x <= (rect.x + rect.width)
  45359. && y >= rect.y
  45360. && y <= (rect.y + rect.height)
  45361. ) {
  45362. // 矩形内
  45363. return SUtil.Util_area.isInside(this, this.style, x, y);
  45364. }
  45365. return false;
  45366. }
  45367. /**
  45368. * @function SuperMap.LevelRenderer.Shape.prototype.drawText
  45369. * @description 绘制附加文本。
  45370. *
  45371. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45372. * @param {string} style - 样式。
  45373. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  45374. */
  45375. drawText(ctx, style, normalStyle) {
  45376. if (typeof(style.text) == 'undefined' || style.text === false) {
  45377. return;
  45378. }
  45379. // 字体颜色策略
  45380. var textColor = style.textColor || style.color || style.strokeColor;
  45381. ctx.fillStyle = textColor;
  45382. // 文本与图形间空白间隙
  45383. var dd = 10;
  45384. var al; // 文本水平对齐
  45385. var bl; // 文本垂直对齐
  45386. var tx; // 文本横坐标
  45387. var ty; // 文本纵坐标
  45388. var textPosition = style.textPosition // 用户定义
  45389. || this.textPosition // shape默认
  45390. || 'top'; // 全局默认
  45391. // Smic 方法修改 -start
  45392. var __OP = [];
  45393. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45394. __OP = [0, 0];
  45395. } else {
  45396. __OP = this.refOriginalPosition;
  45397. }
  45398. //原代码:
  45399. // Smic 方法修改 -end
  45400. switch (textPosition) {
  45401. case 'inside':
  45402. case 'top':
  45403. case 'bottom':
  45404. case 'left':
  45405. case 'right':
  45406. if (this.getRect) {
  45407. var rect = (normalStyle || style).__rect
  45408. || this.getRect(normalStyle || style);
  45409. switch (textPosition) {
  45410. case 'inside':
  45411. tx = rect.x + rect.width / 2;
  45412. ty = rect.y + rect.height / 2;
  45413. al = 'center';
  45414. bl = 'middle';
  45415. if (style.brushType != 'stroke'
  45416. && textColor == style.color
  45417. ) {
  45418. ctx.fillStyle = '#fff';
  45419. }
  45420. break;
  45421. case 'left':
  45422. tx = rect.x - dd;
  45423. ty = rect.y + rect.height / 2;
  45424. al = 'end';
  45425. bl = 'middle';
  45426. break;
  45427. case 'right':
  45428. tx = rect.x + rect.width + dd;
  45429. ty = rect.y + rect.height / 2;
  45430. al = 'start';
  45431. bl = 'middle';
  45432. break;
  45433. case 'top':
  45434. tx = rect.x + rect.width / 2;
  45435. ty = rect.y - dd;
  45436. al = 'center';
  45437. bl = 'bottom';
  45438. break;
  45439. case 'bottom':
  45440. tx = rect.x + rect.width / 2;
  45441. ty = rect.y + rect.height + dd;
  45442. al = 'center';
  45443. bl = 'top';
  45444. break;
  45445. }
  45446. }
  45447. break;
  45448. case 'start':
  45449. case 'end':
  45450. var xStart = 0;
  45451. var xEnd = 0;
  45452. var yStart = 0;
  45453. var yEnd = 0;
  45454. if (typeof style.pointList != 'undefined') {
  45455. var pointList = style.pointList;
  45456. if (pointList.length < 2) {
  45457. // 少于2个点就不画了~
  45458. return;
  45459. }
  45460. var length = pointList.length;
  45461. switch (textPosition) {
  45462. // Smic 方法修改 -start
  45463. case 'start':
  45464. xStart = pointList[0][0] + __OP[0];
  45465. xEnd = pointList[1][0] + __OP[0];
  45466. yStart = pointList[0][1] + __OP[1];
  45467. yEnd = pointList[1][1] + __OP[1];
  45468. break;
  45469. case 'end':
  45470. xStart = pointList[length - 2][0] + __OP[0];
  45471. xEnd = pointList[length - 1][0] + __OP[0];
  45472. yStart = pointList[length - 2][1] + __OP[1];
  45473. yEnd = pointList[length - 1][1] + __OP[1];
  45474. break;
  45475. //原代码:
  45476. /*
  45477. case 'start':
  45478. xStart = pointList[0][0];
  45479. xEnd = pointList[1][0];
  45480. yStart = pointList[0][1];
  45481. yEnd = pointList[1][1];
  45482. break;
  45483. case 'end':
  45484. xStart = pointList[length - 2][0];
  45485. xEnd = pointList[length - 1][0];
  45486. yStart = pointList[length - 2][1];
  45487. yEnd = pointList[length - 1][1];
  45488. break;
  45489. */
  45490. // Smic 方法修改 -end
  45491. }
  45492. } else {
  45493. // Smic 方法修改 -start
  45494. xStart = (style.xStart + __OP[0]) || 0;
  45495. xEnd = (style.xEnd + __OP[0]) || 0;
  45496. yStart = (style.yStart + __OP[1]) || 0;
  45497. yEnd = (style.yEnd + __OP[1]) || 0;
  45498. //原代码:
  45499. /*
  45500. xStart = style.xStart || 0;
  45501. xEnd = style.xEnd || 0;
  45502. yStart = style.yStart || 0;
  45503. yEnd = style.yEnd || 0;
  45504. */
  45505. // Smic 方法修改 -end
  45506. }
  45507. switch (textPosition) {
  45508. case 'start':
  45509. al = xStart < xEnd ? 'end' : 'start';
  45510. bl = yStart < yEnd ? 'bottom' : 'top';
  45511. tx = xStart;
  45512. ty = yStart;
  45513. break;
  45514. case 'end':
  45515. al = xStart < xEnd ? 'start' : 'end';
  45516. bl = yStart < yEnd ? 'top' : 'bottom';
  45517. tx = xEnd;
  45518. ty = yEnd;
  45519. break;
  45520. }
  45521. dd -= 4;
  45522. if (xStart && xEnd && xStart != xEnd) {
  45523. tx -= (al == 'end' ? dd : -dd);
  45524. } else {
  45525. al = 'center';
  45526. }
  45527. if (yStart != yEnd) {
  45528. ty -= (bl == 'bottom' ? dd : -dd);
  45529. } else {
  45530. bl = 'middle';
  45531. }
  45532. break;
  45533. case 'specific':
  45534. tx = style.textX || 0;
  45535. ty = style.textY || 0;
  45536. al = 'start';
  45537. bl = 'middle';
  45538. break;
  45539. }
  45540. // Smic 方法修改 -start
  45541. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  45542. tx += style.labelXOffset;
  45543. }
  45544. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  45545. ty += style.labelYOffset;
  45546. }
  45547. //原代码:
  45548. // Smic 方法修改 -end
  45549. if (tx != null && ty != null) {
  45550. Shape_Shape._fillText(
  45551. ctx,
  45552. style.text,
  45553. tx, ty,
  45554. style.textFont,
  45555. style.textAlign || al,
  45556. style.textBaseline || bl
  45557. );
  45558. }
  45559. }
  45560. /**
  45561. * @function SuperMap.LevelRenderer.Shape.prototype.modSelf
  45562. * @description 图形发生改变
  45563. */
  45564. modSelf() {
  45565. this.__dirty = true;
  45566. if (this.style) {
  45567. this.style.__rect = null;
  45568. }
  45569. if (this.highlightStyle) {
  45570. this.highlightStyle.__rect = null;
  45571. }
  45572. }
  45573. /**
  45574. * @function SuperMap.LevelRenderer.Shape.prototype.isSilent
  45575. * @description 图形是否会触发事件,通过 bind 绑定的事件
  45576. */
  45577. isSilent() {
  45578. return !(
  45579. this.hoverable || this.draggable || this.clickable
  45580. || this.onmousemove || this.onmouseover || this.onmouseout
  45581. || this.onmousedown || this.onmouseup || this.onclick
  45582. || this.ondragenter || this.ondragover || this.ondragleave
  45583. || this.ondrop
  45584. );
  45585. }
  45586. /**
  45587. * @function SuperMap.LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  45588. * @description 设置 Cavans 上下文全局透明度
  45589. *
  45590. * @param {Object} _ctx - Cavans 上下文
  45591. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  45592. * @param {Object} style - Symbolizer hash
  45593. */
  45594. setCtxGlobalAlpha(_ctx, type, style) {
  45595. if (type === "fill") {
  45596. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  45597. } else if (type === "stroke") {
  45598. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  45599. } else {
  45600. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  45601. }
  45602. }
  45603. /**
  45604. * @function SuperMap.LevelRenderer.Shape.prototype._fillText
  45605. * @description 填充文本
  45606. */
  45607. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  45608. if (textFont) {
  45609. ctx.font = textFont;
  45610. }
  45611. ctx.textAlign = textAlign;
  45612. ctx.textBaseline = textBaseline;
  45613. var rect = Shape_Shape._getTextRect(
  45614. text, x, y, textFont, textAlign, textBaseline
  45615. );
  45616. text = (text + '').split('\n');
  45617. var lineHeight = SUtil.Util_area.getTextHeight('ZH', textFont);
  45618. switch (textBaseline) {
  45619. case 'top':
  45620. y = rect.y;
  45621. break;
  45622. case 'bottom':
  45623. y = rect.y + lineHeight;
  45624. break;
  45625. default:
  45626. y = rect.y + lineHeight / 2;
  45627. }
  45628. for (var i = 0, l = text.length; i < l; i++) {
  45629. ctx.fillText(text[i], x, y);
  45630. y += lineHeight;
  45631. }
  45632. }
  45633. /**
  45634. * @function SuperMap.LevelRenderer.Shape._getTextRect
  45635. * @description 返回矩形区域,用于局部刷新和文字定位
  45636. *
  45637. * @param {string} text - text。
  45638. * @param {number} x - x。
  45639. * @param {number} y - y。
  45640. * @param {string} textFont - textFont。
  45641. * @param {string} textAlign - textAlign。
  45642. * @param {string} textBaseline - textBaseline。
  45643. * @return {Object} 矩形区域。
  45644. */
  45645. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  45646. var width = SUtil.Util_area.getTextWidth(text, textFont);
  45647. var lineHeight = SUtil.Util_area.getTextHeight('ZH', textFont);
  45648. text = (text + '').split('\n');
  45649. switch (textAlign) {
  45650. case 'end':
  45651. case 'right':
  45652. x -= width;
  45653. break;
  45654. case 'center':
  45655. x -= (width / 2);
  45656. break;
  45657. }
  45658. switch (textBaseline) {
  45659. case 'top':
  45660. break;
  45661. case 'bottom':
  45662. y -= lineHeight * text.length;
  45663. break;
  45664. default:
  45665. y -= lineHeight * text.length / 2;
  45666. }
  45667. return {
  45668. x: x,
  45669. y: y,
  45670. width: width,
  45671. height: lineHeight * text.length
  45672. };
  45673. }
  45674. }
  45675. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  45676. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  45677. * This program are made available under the terms of the Apache License, Version 2.0
  45678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45679. /**
  45680. * @private
  45681. * @class SuperMap.LevelRenderer.Shape.SmicPoint
  45682. * @category Visualization Theme
  45683. * @classdesc 点。
  45684. * @extends SuperMap.LevelRenderer.Shape
  45685. * @example
  45686. * var shape = new SuperMap.LevelRenderer.Shape.SmicPoint({
  45687. * style: {
  45688. * x: 100,
  45689. * y: 100,
  45690. * r: 40,
  45691. * brushType: 'both',
  45692. * color: 'blue',
  45693. * strokeColor: 'red',
  45694. * lineWidth: 3,
  45695. * text: 'point'
  45696. * }
  45697. * });
  45698. * levelRenderer.addShape(shape);
  45699. *
  45700. *
  45701. */
  45702. class SmicPoint_SmicPoint extends Shape_Shape {
  45703. /**
  45704. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.style
  45705. * @description 绘制样式。
  45706. *
  45707. * @param {number} style.x - 圆心x坐标,必设参数。
  45708. * @param {number} style.y - 圆心y坐标,必设参数。
  45709. * @param {number} style.r - 半径,必设参数。
  45710. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45711. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  45712. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  45713. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  45714. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  45715. * @param {number} style.opacity - 绘制透明度。默认值:1。
  45716. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  45717. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  45718. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  45719. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  45720. * @param {string} style.text - 图形中的附加文本。默认值:""。
  45721. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  45722. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  45723. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  45724. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  45725. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  45726. */
  45727. //打开接口 style
  45728. /**
  45729. * @function SuperMap.LevelRenderer.Shape.SmicPoint.constructor
  45730. * @description 构造函数。
  45731. *
  45732. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  45733. *
  45734. */
  45735. constructor(options) {
  45736. super(options);
  45737. /**
  45738. * @member {string} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.type
  45739. * @description 图形类型。
  45740. */
  45741. this.type = 'smicpoint';
  45742. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45743. this.refOriginalPosition = [0, 0];
  45744. }
  45745. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  45746. }
  45747. /**
  45748. * @function cdestroy
  45749. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45750. */
  45751. destroy() {
  45752. this.type = null;
  45753. super.destroy();
  45754. }
  45755. /**
  45756. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.buildPath
  45757. * @description 创建点触。
  45758. *
  45759. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45760. * @param {Object} style - style。
  45761. *
  45762. */
  45763. buildPath(ctx, style) {
  45764. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45765. this.refOriginalPosition = [0, 0];
  45766. }
  45767. var __OP = this.refOriginalPosition;
  45768. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  45769. return;
  45770. }
  45771. /**
  45772. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.getRect
  45773. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  45774. *
  45775. * @param {Object} style - style
  45776. * @return {Object} 边框对象。包含属性:x,y,width,height。
  45777. */
  45778. getRect(style) {
  45779. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45780. this.refOriginalPosition = [0, 0];
  45781. }
  45782. var __OP = this.refOriginalPosition;
  45783. if (style.__rect) {
  45784. return style.__rect;
  45785. }
  45786. var lineWidth;
  45787. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  45788. lineWidth = style.lineWidth || 1;
  45789. } else {
  45790. lineWidth = 0;
  45791. }
  45792. style.__rect = {
  45793. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  45794. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  45795. width: style.r * 2 + lineWidth,
  45796. height: style.r * 2 + lineWidth
  45797. };
  45798. return style.__rect;
  45799. }
  45800. }
  45801. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  45802. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  45803. * This program are made available under the terms of the Apache License, Version 2.0
  45804. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45805. /**
  45806. * @private
  45807. * @class SuperMap.LevelRenderer.Shape.SmicText
  45808. * @category Visualization Theme
  45809. * @extends {SuperMap.LevelRenderer.Shape}
  45810. * @example
  45811. * var shape = new SuperMap.LevelRenderer.Shape.SmicText({
  45812. * style: {
  45813. * text: 'Label',
  45814. * x: 100,
  45815. * y: 100,
  45816. * textFont: '14px Arial'
  45817. * }
  45818. * });
  45819. * levelRenderer.addShape(shape);
  45820. *
  45821. */
  45822. class SmicText_SmicText extends Shape_Shape {
  45823. /**
  45824. * @member {Object} SuperMap.LevelRenderer.Shape.SmicText.prototype.style
  45825. * @description 绘制样式。
  45826. *
  45827. * @param {number} style.x - 横坐标,必设参数。
  45828. * @param {number} style.y - 纵坐标,必设参数。
  45829. * @param {string} style.text - 图形中的附加文本。默认值:""。
  45830. * @param {number} style.maxWidth - 最大宽度限制。默认值:null。
  45831. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  45832. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  45833. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  45834. * @param {string} style.brushType -画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45835. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  45836. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  45837. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  45838. * @param {number} style.opacity - 绘制透明度。默认值:1。
  45839. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  45840. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  45841. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  45842. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  45843. */
  45844. //打开接口 style
  45845. /**
  45846. * @function SuperMap.LevelRenderer.Shape.SmicText.constructor
  45847. * @description 构造函数。
  45848. *
  45849. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  45850. *
  45851. */
  45852. constructor(options) {
  45853. super(options);
  45854. /**
  45855. * @member {string} SuperMap.LevelRenderer.Shape.SmicText.prototype.type
  45856. * @description 图形类型.
  45857. */
  45858. this.type = 'smictext';
  45859. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45860. this.refOriginalPosition = [0, 0];
  45861. }
  45862. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  45863. }
  45864. /**
  45865. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.destroy
  45866. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45867. */
  45868. destroy() {
  45869. this.type = null;
  45870. super.destroy();
  45871. }
  45872. /**
  45873. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.brush
  45874. * @description 笔触。
  45875. *
  45876. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45877. * @param {boolean} isHighlight - 是否使用高亮属性。
  45878. *
  45879. */
  45880. brush(ctx, isHighlight) {
  45881. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45882. this.refOriginalPosition = [0, 0];
  45883. }
  45884. var __OP = this.refOriginalPosition;
  45885. var style = this.style;
  45886. if (isHighlight) {
  45887. // 根据style扩展默认高亮样式
  45888. style = this.getHighlightStyle(
  45889. style, this.highlightStyle || {}
  45890. );
  45891. }
  45892. if (typeof(style.text) == 'undefined' || style.text === false) {
  45893. return;
  45894. }
  45895. ctx.save();
  45896. this.doClip(ctx);
  45897. this.setContext(ctx, style);
  45898. // 设置transform
  45899. this.setTransform(ctx);
  45900. if (style.textFont) {
  45901. ctx.font = style.textFont;
  45902. }
  45903. ctx.textAlign = style.textAlign || 'start';
  45904. ctx.textBaseline = style.textBaseline || 'middle';
  45905. var text = (style.text + '').split('\n');
  45906. var lineHeight = SUtil.Util_area.getTextHeight('ZH', style.textFont);
  45907. var rect = this.getRectNoRotation(style);
  45908. // var x = style.x;
  45909. var x = style.x + __OP[0];
  45910. var y;
  45911. if (style.textBaseline == 'top') {
  45912. y = rect.y;
  45913. } else if (style.textBaseline == 'bottom') {
  45914. y = rect.y + lineHeight;
  45915. } else {
  45916. y = rect.y + lineHeight / 2;
  45917. }
  45918. var ox = style.x + __OP[0];
  45919. var oy = style.y + __OP[1];
  45920. //文本绘制
  45921. for (var i = 0, l = text.length; i < l; i++) {
  45922. //是否渲染矩形背景及颜色
  45923. if (style.labelRect) {
  45924. //+4,-2是为了让文字距边框左右边缘有点间隔
  45925. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  45926. ctx.fillStyle = style.strokeColor;
  45927. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  45928. ctx.fillStyle = style.textColor;
  45929. }
  45930. switch (style.brushType) {
  45931. case 'stroke':
  45932. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45933. if (style.textRotation && style.textRotation !== 0) {
  45934. ctx.save();
  45935. ctx.translate(ox, oy);
  45936. ctx.rotate(style.textRotation * Math.PI / 180);
  45937. if (style.textBaseline == 'top') {
  45938. if (style.maxWidth) {
  45939. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  45940. } else {
  45941. ctx.strokeText(text[i], 0, lineHeight * i);
  45942. }
  45943. } else if (style.textBaseline == 'bottom') {
  45944. if (style.maxWidth) {
  45945. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45946. } else {
  45947. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  45948. }
  45949. } else {
  45950. if (style.maxWidth) {
  45951. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  45952. } else {
  45953. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  45954. }
  45955. }
  45956. ctx.restore();
  45957. } else {
  45958. if (style.maxWidth) {
  45959. ctx.strokeText(text[i], x, y, style.maxWidth);
  45960. } else {
  45961. ctx.strokeText(text[i], x, y);
  45962. }
  45963. }
  45964. this.setCtxGlobalAlpha(ctx, "reset", style);
  45965. break;
  45966. case 'both':
  45967. if (style.textRotation && style.textRotation !== 0) {
  45968. ctx.save();
  45969. ctx.translate(ox, oy);
  45970. ctx.rotate(style.textRotation * Math.PI / 180);
  45971. if (style.textBaseline == 'top') {
  45972. if (style.maxWidth) {
  45973. this.setCtxGlobalAlpha(ctx, "fill", style);
  45974. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  45975. this.setCtxGlobalAlpha(ctx, "reset", style);
  45976. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45977. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  45978. this.setCtxGlobalAlpha(ctx, "reset", style);
  45979. } else {
  45980. this.setCtxGlobalAlpha(ctx, "fill", style);
  45981. ctx.fillText(text[i], 0, lineHeight * i);
  45982. this.setCtxGlobalAlpha(ctx, "reset", style);
  45983. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45984. ctx.strokeText(text[i], 0, lineHeight * i);
  45985. this.setCtxGlobalAlpha(ctx, "reset", style);
  45986. }
  45987. } else if (style.textBaseline == 'bottom') {
  45988. if (style.maxWidth) {
  45989. this.setCtxGlobalAlpha(ctx, "fill", style);
  45990. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45991. this.setCtxGlobalAlpha(ctx, "reset", style);
  45992. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45993. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45994. this.setCtxGlobalAlpha(ctx, "reset", style);
  45995. } else {
  45996. this.setCtxGlobalAlpha(ctx, "fill", style);
  45997. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  45998. this.setCtxGlobalAlpha(ctx, "reset", style);
  45999. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46000. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  46001. this.setCtxGlobalAlpha(ctx, "reset", style);
  46002. }
  46003. } else {
  46004. if (style.maxWidth) {
  46005. this.setCtxGlobalAlpha(ctx, "fill", style);
  46006. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46007. this.setCtxGlobalAlpha(ctx, "reset", style);
  46008. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46009. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46010. this.setCtxGlobalAlpha(ctx, "reset", style);
  46011. } else {
  46012. this.setCtxGlobalAlpha(ctx, "fill", style);
  46013. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46014. this.setCtxGlobalAlpha(ctx, "reset", style);
  46015. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46016. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46017. this.setCtxGlobalAlpha(ctx, "reset", style);
  46018. }
  46019. }
  46020. ctx.restore();
  46021. } else {
  46022. if (style.maxWidth) {
  46023. this.setCtxGlobalAlpha(ctx, "fill", style);
  46024. ctx.fillText(text[i], x, y, style.maxWidth);
  46025. this.setCtxGlobalAlpha(ctx, "reset", style);
  46026. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46027. ctx.strokeText(text[i], x, y, style.maxWidth);
  46028. this.setCtxGlobalAlpha(ctx, "reset", style);
  46029. } else {
  46030. this.setCtxGlobalAlpha(ctx, "fill", style);
  46031. ctx.fillText(text[i], x, y);
  46032. this.setCtxGlobalAlpha(ctx, "reset", style);
  46033. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46034. ctx.strokeText(text[i], x, y);
  46035. this.setCtxGlobalAlpha(ctx, "reset", style);
  46036. }
  46037. }
  46038. break;
  46039. default:
  46040. //fill or others
  46041. this.setCtxGlobalAlpha(ctx, "fill", style);
  46042. if (style.textRotation && style.textRotation !== 0) {
  46043. ctx.save();
  46044. ctx.translate(ox, oy);
  46045. ctx.rotate(style.textRotation * Math.PI / 180);
  46046. if (style.textBaseline == 'top') {
  46047. if (style.maxWidth) {
  46048. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  46049. } else {
  46050. ctx.fillText(text[i], 0, lineHeight * i);
  46051. }
  46052. } else if (style.textBaseline == 'bottom') {
  46053. if (style.maxWidth) {
  46054. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  46055. } else {
  46056. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  46057. }
  46058. } else {
  46059. if (style.maxWidth) {
  46060. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46061. } else {
  46062. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46063. }
  46064. }
  46065. ctx.restore();
  46066. } else {
  46067. if (style.maxWidth) {
  46068. ctx.fillText(text[i], x, y, style.maxWidth);
  46069. } else {
  46070. ctx.fillText(text[i], x, y);
  46071. }
  46072. }
  46073. this.setCtxGlobalAlpha(ctx, "reset", style);
  46074. }
  46075. y += lineHeight;
  46076. }
  46077. ctx.restore();
  46078. return;
  46079. }
  46080. /**
  46081. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRect
  46082. * @description 返回文字包围盒矩形
  46083. */
  46084. getRect(style) {
  46085. if (style.__rect) {
  46086. return style.__rect;
  46087. }
  46088. var left, top, right, bottom
  46089. var tbg = this.getTextBackground(style, true);
  46090. for (var i = 0, len = tbg.length; i < len; i++) {
  46091. var poi = tbg[i];
  46092. //用第一个点初始化
  46093. if (i == 0) {
  46094. left = poi[0];
  46095. right = poi[0];
  46096. top = poi[1];
  46097. bottom = poi[1];
  46098. } else {
  46099. if (poi[0] < left) {
  46100. left = poi[0]
  46101. }
  46102. if (poi[0] > right) {
  46103. right = poi[0]
  46104. }
  46105. if (poi[1] < top) {
  46106. top = poi[1]
  46107. }
  46108. if (poi[1] > bottom) {
  46109. bottom = poi[1]
  46110. }
  46111. }
  46112. }
  46113. style.__rect = {
  46114. x: left,
  46115. y: top,
  46116. width: right - left,
  46117. height: bottom - top
  46118. };
  46119. return style.__rect;
  46120. }
  46121. /**
  46122. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  46123. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  46124. */
  46125. getRectNoRotation(style) {
  46126. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46127. this.refOriginalPosition = [0, 0];
  46128. }
  46129. var __OP = this.refOriginalPosition;
  46130. var lineHeight = SUtil.Util_area.getTextHeight('ZH', style.textFont);
  46131. var width = SUtil.Util_area.getTextWidth(style.text, style.textFont);
  46132. var height = SUtil.Util_area.getTextHeight(style.text, style.textFont);
  46133. //处理文字位置,注:文本的绘制是由此 rect 决定
  46134. var textX = style.x + __OP[0]; // 默认start == left
  46135. if (style.textAlign == 'end' || style.textAlign == 'right') {
  46136. textX -= width;
  46137. } else if (style.textAlign == 'center') {
  46138. textX -= (width / 2);
  46139. }
  46140. var textY;
  46141. if (style.textBaseline == 'top') {
  46142. // textY = style.y;
  46143. textY = style.y + __OP[1];
  46144. } else if (style.textBaseline == 'bottom') {
  46145. textY = (style.y + __OP[1]) - height;
  46146. } else {
  46147. // middle
  46148. textY = (style.y + __OP[1]) - height / 2;
  46149. }
  46150. var isWidthChangeByMaxWidth = false;
  46151. var widthBeforeChangeByMaxWidth;
  46152. //处理 maxWidth
  46153. if (style.maxWidth) {
  46154. var maxWidth = parseInt(style.maxWidth);
  46155. if (maxWidth < width) {
  46156. widthBeforeChangeByMaxWidth = width;
  46157. isWidthChangeByMaxWidth = true;
  46158. width = maxWidth;
  46159. }
  46160. textX = style.x + __OP[0];
  46161. if (style.textAlign == 'end' || style.textAlign == 'right') {
  46162. textX -= width;
  46163. } else if (style.textAlign == 'center') {
  46164. textX -= (width / 2);
  46165. }
  46166. }
  46167. //处理斜体字
  46168. if (style.textFont) {
  46169. var textFont = style.textFont;
  46170. var textFontStr = textFont.toLowerCase()
  46171. if (textFontStr.indexOf("italic") > -1) {
  46172. if (isWidthChangeByMaxWidth === true) {
  46173. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  46174. } else {
  46175. width += lineHeight / 3;
  46176. }
  46177. }
  46178. }
  46179. var rect = {
  46180. x: textX,
  46181. y: textY,
  46182. width: width,
  46183. height: height
  46184. };
  46185. return rect;
  46186. }
  46187. /**
  46188. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getTextBackground
  46189. * @description 获取文本背景框范围
  46190. *
  46191. * @param {Object} style - 样式。
  46192. * @param {boolean} redo - 是否强制重新计算 textBackground。
  46193. */
  46194. getTextBackground(style, redo) {
  46195. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46196. this.refOriginalPosition = [0, 0];
  46197. }
  46198. var __OP = this.refOriginalPosition;
  46199. if ((!redo) && style.__textBackground) {
  46200. return style.__textBackground;
  46201. }
  46202. //不旋转时矩形框
  46203. var rect = this.getRectNoRotation(style);
  46204. //旋转中心点
  46205. var ox = style.x + __OP[0];
  46206. var oy = style.y + __OP[1];
  46207. //背景框
  46208. var background = [];
  46209. if (style.textRotation && style.textRotation !== 0) {
  46210. let textRotation = style.textRotation;
  46211. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  46212. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  46213. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  46214. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  46215. background.push(ltPoi);
  46216. background.push(rtPoi);
  46217. background.push(rbPoi);
  46218. background.push(lbPoi);
  46219. } else {
  46220. let ltPoi = [rect.x, rect.y];
  46221. let rtPoi = [rect.x + rect.width, rect.y];
  46222. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  46223. let lbPoi = [rect.x, rect.y + rect.height];
  46224. background.push(ltPoi);
  46225. background.push(rtPoi);
  46226. background.push(rbPoi);
  46227. background.push(lbPoi);
  46228. }
  46229. style.__textBackground = background;
  46230. return style.__textBackground;
  46231. }
  46232. /**
  46233. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  46234. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  46235. *
  46236. * @param {number} x - 旋转点横坐标。
  46237. * @param {number} y - 旋转点纵坐标。
  46238. * @param {number} rx - 旋转中心点横坐标。
  46239. * @param {number} ry - 旋转中心点纵坐标。
  46240. * @param {number} angle - 旋转角度(度)。
  46241. * @return {Array} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  46242. */
  46243. getRotatedLocation(x, y, rx, ry, angle) {
  46244. var loc = new Array(), x0, y0;
  46245. y = -y;
  46246. ry = -ry;
  46247. angle = -angle;//顺时针旋转
  46248. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  46249. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  46250. loc[0] = x0;
  46251. loc[1] = -y0;
  46252. return loc;
  46253. }
  46254. }
  46255. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  46256. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  46257. * This program are made available under the terms of the Apache License, Version 2.0
  46258. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46259. /**
  46260. * @private
  46261. * @class SuperMap.LevelRenderer.Shape.SmicCircle
  46262. * @category Visualization Theme
  46263. * @classdesc 圆形
  46264. * @extends SuperMap.LevelRenderer.Shape
  46265. * @example
  46266. * var shape = new SuperMap.LevelRenderer.Shape.SmicCircle({
  46267. * style: {
  46268. * x: 100,
  46269. * y: 100,
  46270. * r: 60,
  46271. * brushType: "both",
  46272. * color: "blue",
  46273. * strokeColor: "red",
  46274. * lineWidth: 3,
  46275. * text: "Circle"
  46276. * }
  46277. * });
  46278. * levelRenderer.addShape(shape);
  46279. *
  46280. *
  46281. */
  46282. class SmicCircle_SmicCircle extends Shape_Shape {
  46283. /**
  46284. * @member {Object} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.style
  46285. * @description 绘制样式。
  46286. *
  46287. * @param {number} x - 圆心x坐标,必设参数
  46288. * @param {number} y - 圆心y坐标,必设参数
  46289. * @param {number} r - 半径,必设参数
  46290. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46291. * @param {string} color - 填充颜色,默认值"#000000"
  46292. * @param {string} strokeColor - 描边颜色,默认值为'#000000'
  46293. * @param {string} lineCape — 线帽样式,可以是 butt, round, square,默认是butt
  46294. * @param {number} lineWidth - 描边宽度、默认是1
  46295. * @param {number} opacity - 绘制透明度、默认是1,不透明
  46296. * @param {number} shadowBlur - 阴影模糊度,大于0有效,默认是0
  46297. * @param {string} shadowColor - 阴影颜色,默认是'#000000'
  46298. * @param {number} shadowOffsetX - 阴影横向偏移,默认是0
  46299. * @param {number} shadowOffsetY - 阴影纵向偏移,默认是0
  46300. * @param {string} text - 图形中的附加文本,默认是0
  46301. * @param {string} textColor - 文本颜色,默认是'#000000'
  46302. * @param {string} textFont - 附加文本样式,eg:'bold 18px verdana'
  46303. * @param {string} textPosition - 附加文本位置, 可以是 inside, left, right, top, bottom
  46304. * @param {string} textAlign - 默认根据textPosition自动设置,附加文本水平对齐。可以是start, end, left, right, center
  46305. * @param {string} textBaseline 默认根据textPosition自动设置,附加文本垂直对齐。可以是top, bottom, middle, alphabetic, hanging, ideographic
  46306. */
  46307. //打开接口 style
  46308. /**
  46309. * @function SuperMap.LevelRenderer.Shape.SmicCircle.constructor
  46310. * @description 构造函数。
  46311. *
  46312. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46313. *
  46314. */
  46315. constructor(options) {
  46316. super(options);
  46317. /**
  46318. * @member {string} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.type
  46319. * @description 图形类型。
  46320. */
  46321. this.type = 'smiccircle';
  46322. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46323. this.refOriginalPosition = [0, 0];
  46324. }
  46325. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  46326. }
  46327. /**
  46328. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.destroy
  46329. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46330. */
  46331. destroy() {
  46332. this.type = null;
  46333. super.destroy();
  46334. }
  46335. /**
  46336. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.buildPath
  46337. * @description 创建图形路径。
  46338. *
  46339. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46340. * @param {Object} style - style。
  46341. *
  46342. */
  46343. buildPath(ctx, style) {
  46344. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46345. this.refOriginalPosition = [0, 0];
  46346. }
  46347. var __OP = this.refOriginalPosition;
  46348. var x = style.x + __OP[0]; // 圆心x
  46349. var y = style.y + __OP[1]; // 圆心y
  46350. ctx.moveTo(x + style.r, y);
  46351. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  46352. return true;
  46353. }
  46354. /**
  46355. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.getRect
  46356. * @description 返回圆形包围盒矩形
  46357. *
  46358. * @param {Object} style - style
  46359. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46360. *
  46361. */
  46362. getRect(style) {
  46363. if (style.__rect) {
  46364. return style.__rect;
  46365. }
  46366. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46367. this.refOriginalPosition = [0, 0];
  46368. }
  46369. var __OP = this.refOriginalPosition;
  46370. var x = style.x + __OP[0]; // 圆心x
  46371. var y = style.y + __OP[1]; // 圆心y
  46372. var r = style.r; // 圆r
  46373. var lineWidth;
  46374. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  46375. lineWidth = style.lineWidth || 1;
  46376. } else {
  46377. lineWidth = 0;
  46378. }
  46379. style.__rect = {
  46380. x: Math.round(x - r - lineWidth / 2),
  46381. y: Math.round(y - r - lineWidth / 2),
  46382. width: r * 2 + lineWidth,
  46383. height: r * 2 + lineWidth
  46384. };
  46385. return style.__rect;
  46386. }
  46387. }
  46388. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  46389. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  46390. * This program are made available under the terms of the Apache License, Version 2.0
  46391. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46392. /**
  46393. * @private
  46394. * @class SuperMap.LevelRenderer.Shape.SmicPolygon
  46395. * @category Visualization Theme
  46396. * @classdesc 多边形。
  46397. * @extends SuperMap.LevelRenderer.Shape
  46398. * @example
  46399. * var shape = new SuperMap.LevelRenderer.Shape.SmicPolygon({
  46400. * style: {
  46401. * // 100x100 的正方形
  46402. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  46403. * color: 'blue'
  46404. * }
  46405. * });
  46406. * levelRenderer.addShape(shape);
  46407. *
  46408. */
  46409. class SmicPolygon_SmicPolygon extends Shape_Shape {
  46410. /**
  46411. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.style
  46412. * @description 绘制样式。
  46413. *
  46414. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  46415. * (code)
  46416. * (start code)
  46417. * [
  46418. * [10, 20], //单个节点
  46419. * [30, 40],
  46420. * [25, 30]
  46421. * ]
  46422. * (end)
  46423. * @param {string} style.smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  46424. * @param {number} style.smoothConstraint - 平滑约束。
  46425. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46426. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  46427. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  46428. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46429. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  46430. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46431. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46432. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46433. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46434. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46435. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46436. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  46437. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46438. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46439. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46440. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46441. */
  46442. //打开接口 style
  46443. /**
  46444. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.constructor
  46445. * @description 构造函数。
  46446. *
  46447. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46448. *
  46449. */
  46450. constructor(options) {
  46451. super(options);
  46452. /**
  46453. * @member {string} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.type
  46454. * @description 图形类型.
  46455. */
  46456. this.type = 'smicpolygon';
  46457. /**
  46458. * @member {Array} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  46459. * @description 岛洞面多边形顶点数组(三维数组)
  46460. *
  46461. */
  46462. this.holePolygonPointLists = null;
  46463. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46464. this.refOriginalPosition = [0, 0];
  46465. }
  46466. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  46467. }
  46468. /**
  46469. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.destroy
  46470. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46471. */
  46472. destroy() {
  46473. this.type = null;
  46474. this.holePolygonPointLists = null;
  46475. super.destroy();
  46476. }
  46477. /**
  46478. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.brush
  46479. * @description 笔触。
  46480. *
  46481. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46482. * @param {boolean} isHighlight - 是否使用高亮属性。
  46483. *
  46484. */
  46485. brush(ctx, isHighlight) {
  46486. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46487. this.refOriginalPosition = [0, 0];
  46488. }
  46489. var style = this.style;
  46490. if (isHighlight) {
  46491. // 根据style扩展默认高亮样式
  46492. style = this.getHighlightStyle(
  46493. style,
  46494. this.highlightStyle || {}
  46495. );
  46496. }
  46497. ctx.save();
  46498. this.setContext(ctx, style);
  46499. // 设置 transform
  46500. this.setTransform(ctx);
  46501. // 先 fill 再stroke
  46502. var hasPath = false;
  46503. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  46504. ctx.beginPath();
  46505. if (style.lineType == 'dashed'
  46506. || style.lineType == 'dotted'
  46507. || style.lineType == 'dot'
  46508. || style.lineType == 'dash'
  46509. || style.lineType == 'dashdot'
  46510. || style.lineType == 'longdash'
  46511. || style.lineType == 'longdashdot'
  46512. ) {
  46513. // 特殊处理,虚线围不成path,实线再build一次
  46514. this.buildPath(ctx, {
  46515. lineType: 'solid',
  46516. lineWidth: style.lineWidth,
  46517. pointList: style.pointList
  46518. }
  46519. );
  46520. } else {
  46521. this.buildPath(ctx, style);
  46522. hasPath = true; // 这个path能用
  46523. }
  46524. ctx.closePath();
  46525. this.setCtxGlobalAlpha(ctx, "fill", style);
  46526. ctx.fill();
  46527. this.setCtxGlobalAlpha(ctx, "reset", style);
  46528. }
  46529. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  46530. if (!hasPath) {
  46531. ctx.beginPath();
  46532. this.buildPath(ctx, style);
  46533. }
  46534. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46535. ctx.stroke();
  46536. this.setCtxGlobalAlpha(ctx, "reset", style);
  46537. }
  46538. this.drawText(ctx, style, this.style);
  46539. //岛洞
  46540. var hpStyle = Util_Util.cloneObject(style);
  46541. if (hpStyle.pointList) {
  46542. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  46543. var holePLS = this.holePolygonPointLists;
  46544. var holePLSen = holePLS.length;
  46545. for (var i = 0; i < holePLSen; i++) {
  46546. var holePL = holePLS[i];
  46547. //岛洞面
  46548. hpStyle.pointList = holePL;
  46549. ctx.globalCompositeOperation = "destination-out";
  46550. // 先 fill 再stroke
  46551. hasPath = false;
  46552. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  46553. ctx.beginPath();
  46554. if (hpStyle.lineType == 'dashed'
  46555. || hpStyle.lineType == 'dotted'
  46556. || hpStyle.lineType == 'dot'
  46557. || hpStyle.lineType == 'dash'
  46558. || hpStyle.lineType == 'dashdot'
  46559. || hpStyle.lineType == 'longdash'
  46560. || hpStyle.lineType == 'longdashdot'
  46561. ) {
  46562. // 特殊处理,虚线围不成path,实线再build一次
  46563. this.buildPath(ctx, {
  46564. lineType: 'solid',
  46565. lineWidth: hpStyle.lineWidth,
  46566. pointList: hpStyle.pointList
  46567. }
  46568. );
  46569. } else {
  46570. this.buildPath(ctx, hpStyle);
  46571. hasPath = true; // 这个path能用
  46572. }
  46573. ctx.closePath();
  46574. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  46575. ctx.fill();
  46576. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  46577. }
  46578. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  46579. if (!hasPath) {
  46580. ctx.beginPath();
  46581. this.buildPath(ctx, hpStyle);
  46582. }
  46583. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  46584. ctx.globalCompositeOperation = "source-over";
  46585. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  46586. ctx.stroke();
  46587. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  46588. } else {
  46589. ctx.globalCompositeOperation = "source-over";
  46590. }
  46591. }
  46592. }
  46593. }
  46594. ctx.restore();
  46595. return;
  46596. }
  46597. /**
  46598. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  46599. * @description 创建多边形路径。
  46600. *
  46601. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46602. * @param {Object} style - style。
  46603. *
  46604. */
  46605. buildPath(ctx, style) {
  46606. if (style.showShadow) {
  46607. ctx.shadowBlur = style.shadowBlur;
  46608. ctx.shadowColor = style.shadowColor;
  46609. ctx.shadowOffsetX = style.shadowOffsetX;
  46610. ctx.shadowOffsetY = style.shadowOffsetY;
  46611. }
  46612. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46613. this.refOriginalPosition = [0, 0];
  46614. }
  46615. var __OP = this.refOriginalPosition;
  46616. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  46617. var pointList = style.pointList;
  46618. if (pointList.length < 2) {
  46619. // 少于2个点就不画了~
  46620. return;
  46621. }
  46622. if (style.smooth && style.smooth !== 'spline') {
  46623. var controlPoints = SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  46624. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46625. var cp1;
  46626. var cp2;
  46627. var p;
  46628. var len = pointList.length;
  46629. for (var i = 0; i < len; i++) {
  46630. cp1 = controlPoints[i * 2];
  46631. cp2 = controlPoints[i * 2 + 1];
  46632. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  46633. ctx.bezierCurveTo(
  46634. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  46635. );
  46636. }
  46637. } else {
  46638. if (style.smooth === 'spline') {
  46639. pointList = SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  46640. }
  46641. if (!style.lineType || style.lineType == 'solid') {
  46642. // 默认为实线
  46643. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46644. for (let i = 1; i < pointList.length; i++) {
  46645. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  46646. }
  46647. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46648. } else if (style.lineType === 'dashed'
  46649. || style.lineType === 'dotted'
  46650. || style.lineType === 'dot'
  46651. || style.lineType === 'dash'
  46652. || style.lineType === 'longdash'
  46653. ) {
  46654. // SMIC-方法修改 - start
  46655. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  46656. style._dashLength = dashLengthForStyle;
  46657. let dashLength = (style.lineWidth || 1);
  46658. let pattern1 = dashLength;
  46659. let pattern2 = dashLength;
  46660. //dashed
  46661. if (style.lineType === 'dashed') {
  46662. pattern1 *= 5;
  46663. pattern2 *= 5;
  46664. if (style.lineCap && style.lineCap !== "butt") {
  46665. pattern1 -= dashLength;
  46666. pattern2 += dashLength;
  46667. }
  46668. }
  46669. //dotted
  46670. if (style.lineType === 'dotted') {
  46671. if (style.lineCap && style.lineCap !== "butt") {
  46672. pattern1 = 1;
  46673. pattern2 += dashLength;
  46674. }
  46675. }
  46676. //dot
  46677. if (style.lineType === 'dot') {
  46678. pattern2 *= 4;
  46679. if (style.lineCap && style.lineCap !== "butt") {
  46680. pattern1 = 1;
  46681. pattern2 += dashLength;
  46682. }
  46683. }
  46684. //dash
  46685. if (style.lineType === 'dash') {
  46686. pattern1 *= 4;
  46687. pattern2 *= 4;
  46688. if (style.lineCap && style.lineCap !== "butt") {
  46689. pattern1 -= dashLength;
  46690. pattern2 += dashLength;
  46691. }
  46692. }
  46693. //longdash
  46694. if (style.lineType === 'longdash') {
  46695. pattern1 *= 8;
  46696. pattern2 *= 4;
  46697. if (style.lineCap && style.lineCap !== "butt") {
  46698. pattern1 -= dashLength;
  46699. pattern2 += dashLength;
  46700. }
  46701. }
  46702. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46703. for (let i = 1; i < pointList.length; i++) {
  46704. SUtil.SUtil_dashedLineTo(
  46705. ctx,
  46706. pointList[i - 1][0] + __OP[0],
  46707. pointList[i - 1][1] + __OP[1],
  46708. pointList[i][0] + __OP[0],
  46709. pointList[i][1] + __OP[1],
  46710. dashLength,
  46711. [pattern1, pattern2]
  46712. );
  46713. }
  46714. SUtil.SUtil_dashedLineTo(
  46715. ctx,
  46716. pointList[pointList.length - 1][0] + __OP[0],
  46717. pointList[pointList.length - 1][1] + __OP[1],
  46718. pointList[0][0] + __OP[0],
  46719. pointList[0][1] + __OP[1],
  46720. dashLength,
  46721. [pattern1, pattern2]
  46722. );
  46723. } else if (style.lineType === 'dashdot'
  46724. || style.lineType === 'longdashdot'
  46725. ) {
  46726. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  46727. style._dashLength = dashLengthForStyle;
  46728. let dashLength = (style.lineWidth || 1);
  46729. let pattern1 = dashLength;
  46730. let pattern2 = dashLength;
  46731. let pattern3 = dashLength;
  46732. let pattern4 = dashLength;
  46733. //dashdot
  46734. if (style.lineType === 'dashdot') {
  46735. pattern1 *= 4;
  46736. pattern2 *= 4;
  46737. pattern4 *= 4;
  46738. if (style.lineCap && style.lineCap !== "butt") {
  46739. pattern1 -= dashLength;
  46740. pattern2 += dashLength;
  46741. pattern3 = 1;
  46742. pattern4 += dashLength;
  46743. }
  46744. }
  46745. //longdashdot
  46746. if (style.lineType === 'longdashdot') {
  46747. pattern1 *= 8;
  46748. pattern2 *= 4;
  46749. pattern4 *= 4;
  46750. if (style.lineCap && style.lineCap !== "butt") {
  46751. pattern1 -= dashLength;
  46752. pattern2 += dashLength;
  46753. pattern3 = 1;
  46754. pattern4 += dashLength;
  46755. }
  46756. }
  46757. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46758. for (let i = 1; i < pointList.length; i++) {
  46759. SUtil.SUtil_dashedLineTo(
  46760. ctx,
  46761. pointList[i - 1][0] + __OP[0],
  46762. pointList[i - 1][1] + __OP[1],
  46763. pointList[i][0] + __OP[0],
  46764. pointList[i][1] + __OP[1],
  46765. dashLength,
  46766. [pattern1, pattern2, pattern3, pattern4]
  46767. );
  46768. }
  46769. SUtil.SUtil_dashedLineTo(
  46770. ctx,
  46771. pointList[pointList.length - 1][0] + __OP[0],
  46772. pointList[pointList.length - 1][1] + __OP[1],
  46773. pointList[0][0] + __OP[0],
  46774. pointList[0][1] + __OP[1],
  46775. dashLength,
  46776. [pattern1, pattern2, pattern3, pattern4]
  46777. );
  46778. }
  46779. }
  46780. return;
  46781. }
  46782. /**
  46783. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.getRect
  46784. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  46785. *
  46786. * @param {Object} style - style
  46787. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46788. *
  46789. */
  46790. getRect(style, refOriginalPosition) {
  46791. var __OP;
  46792. if (!refOriginalPosition) {
  46793. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46794. this.refOriginalPosition = [0, 0];
  46795. }
  46796. __OP = this.refOriginalPosition;
  46797. } else {
  46798. __OP = refOriginalPosition;
  46799. }
  46800. if (style.__rect) {
  46801. return style.__rect;
  46802. }
  46803. var minX = Number.MAX_VALUE;
  46804. var maxX = Number.MIN_VALUE;
  46805. var minY = Number.MAX_VALUE;
  46806. var maxY = Number.MIN_VALUE;
  46807. var pointList = style.pointList;
  46808. for (var i = 0, l = pointList.length; i < l; i++) {
  46809. if (pointList[i][0] + __OP[0] < minX) {
  46810. minX = pointList[i][0] + __OP[0];
  46811. }
  46812. if (pointList[i][0] + __OP[0] > maxX) {
  46813. maxX = pointList[i][0] + __OP[0];
  46814. }
  46815. if (pointList[i][1] + __OP[1] < minY) {
  46816. minY = pointList[i][1] + __OP[1];
  46817. }
  46818. if (pointList[i][1] + __OP[1] > maxY) {
  46819. maxY = pointList[i][1] + __OP[1];
  46820. }
  46821. }
  46822. var lineWidth;
  46823. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  46824. lineWidth = style.lineWidth || 1;
  46825. } else {
  46826. lineWidth = 0;
  46827. }
  46828. style.__rect = {
  46829. x: Math.round(minX - lineWidth / 2),
  46830. y: Math.round(minY - lineWidth / 2),
  46831. width: maxX - minX + lineWidth,
  46832. height: maxY - minY + lineWidth
  46833. };
  46834. return style.__rect;
  46835. }
  46836. }
  46837. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  46838. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  46839. * This program are made available under the terms of the Apache License, Version 2.0
  46840. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46841. /**
  46842. * @private
  46843. * @class SuperMap.LevelRenderer.Shape.SmicBrokenLine
  46844. * @category Visualization Theme
  46845. * @classdesc 折线(ic)。
  46846. * @extends SuperMap.LevelRenderer.Shape
  46847. * @example
  46848. * var shape = new SuperMap.LevelRenderer.Shape.SmicBrokenLine({
  46849. * style: {
  46850. * pointList: [[0, 0], [100, 100], [100, 0]],
  46851. * smooth: 'bezier',
  46852. * strokeColor: 'purple'
  46853. * }
  46854. * });
  46855. * levelRenderer.addShape(shape);
  46856. *
  46857. *
  46858. */
  46859. class SmicBrokenLine_SmicBrokenLine extends Shape_Shape {
  46860. /**
  46861. * @member {Object} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.style
  46862. * @description 绘制样式。
  46863. *
  46864. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  46865. * (code)
  46866. * (start code)
  46867. * [
  46868. * [10, 20], //单个节点
  46869. * [30, 40],
  46870. * [25, 30]
  46871. * ]
  46872. * (end)
  46873. * @param {string} smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  46874. * @param {number} smoothConstraint - 平滑约束。
  46875. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  46876. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46877. * @param {number} lineWidth - 描边宽度。默认值:1。
  46878. * @param {number} opacity - 绘制透明度。默认值:1。
  46879. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46880. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  46881. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  46882. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  46883. * @param {string} text - 图形中的附加文本。默认值:""。
  46884. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  46885. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  46886. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46887. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46888. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46889. */
  46890. //打开接口 style
  46891. /**
  46892. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.constructor
  46893. * @description 构造函数。
  46894. *
  46895. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46896. *
  46897. */
  46898. constructor(options) {
  46899. super(options);
  46900. /**
  46901. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  46902. * @description 线条只能描边。
  46903. */
  46904. this.brushTypeOnly = 'stroke';
  46905. /**
  46906. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  46907. * @description 文本位置。
  46908. */
  46909. this.textPosition = 'end';
  46910. /**
  46911. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.type
  46912. * @description 图形类型.
  46913. */
  46914. this.type = 'smicbroken-line';
  46915. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46916. this.refOriginalPosition = [0, 0];
  46917. }
  46918. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  46919. }
  46920. /**
  46921. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  46922. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46923. */
  46924. destroy() {
  46925. this.brushTypeOnly = null;
  46926. this.textPosition = null;
  46927. this.type = null;
  46928. super.destroy();
  46929. }
  46930. /**
  46931. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  46932. * @description 创建折线路径。
  46933. *
  46934. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46935. * @param {Object} style - style。
  46936. *
  46937. */
  46938. buildPath(ctx, style) {
  46939. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46940. this.refOriginalPosition = [0, 0];
  46941. }
  46942. var __OP = this.refOriginalPosition;
  46943. var pointList = style.pointList;
  46944. if (pointList.length < 2) {
  46945. // 少于2个点就不画了~
  46946. return;
  46947. }
  46948. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  46949. if (style.smooth && style.smooth !== 'spline') {
  46950. var controlPoints = SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  46951. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46952. var cp1;
  46953. var cp2;
  46954. var p;
  46955. for (let i = 0; i < len - 1; i++) {
  46956. cp1 = controlPoints[i * 2];
  46957. cp2 = controlPoints[i * 2 + 1];
  46958. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  46959. ctx.bezierCurveTo(
  46960. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  46961. );
  46962. }
  46963. } else {
  46964. if (style.smooth === 'spline') {
  46965. pointList = SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  46966. len = pointList.length;
  46967. }
  46968. if (!style.lineType || style.lineType === 'solid') {
  46969. // 默认为实线
  46970. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46971. for (let i = 1; i < len; i++) {
  46972. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  46973. }
  46974. } else if (style.lineType === 'dashed'
  46975. || style.lineType === 'dotted'
  46976. || style.lineType === 'dot'
  46977. || style.lineType === 'dash'
  46978. || style.lineType === 'longdash'
  46979. ) {
  46980. let dashLength = (style.lineWidth || 1);
  46981. let pattern1 = dashLength;
  46982. let pattern2 = dashLength;
  46983. //dashed
  46984. if (style.lineType === 'dashed') {
  46985. pattern1 *= 5;
  46986. pattern2 *= 5;
  46987. if (style.lineCap && style.lineCap !== "butt") {
  46988. pattern1 -= dashLength;
  46989. pattern2 += dashLength;
  46990. }
  46991. }
  46992. //dotted
  46993. if (style.lineType === 'dotted') {
  46994. if (style.lineCap && style.lineCap !== "butt") {
  46995. pattern1 = 1;
  46996. pattern2 += dashLength;
  46997. }
  46998. }
  46999. //dot
  47000. if (style.lineType === 'dot') {
  47001. pattern2 *= 4;
  47002. if (style.lineCap && style.lineCap !== "butt") {
  47003. pattern1 = 1;
  47004. pattern2 += dashLength;
  47005. }
  47006. }
  47007. //dash
  47008. if (style.lineType === 'dash') {
  47009. pattern1 *= 4;
  47010. pattern2 *= 4;
  47011. if (style.lineCap && style.lineCap !== "butt") {
  47012. pattern1 -= dashLength;
  47013. pattern2 += dashLength;
  47014. }
  47015. }
  47016. //longdash
  47017. if (style.lineType === 'longdash') {
  47018. pattern1 *= 8;
  47019. pattern2 *= 4;
  47020. if (style.lineCap && style.lineCap !== "butt") {
  47021. pattern1 -= dashLength;
  47022. pattern2 += dashLength;
  47023. }
  47024. }
  47025. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47026. for (var i = 1; i < len; i++) {
  47027. SUtil.SUtil_dashedLineTo(
  47028. ctx,
  47029. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  47030. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  47031. dashLength,
  47032. [pattern1, pattern2]
  47033. );
  47034. }
  47035. } else if (style.lineType === 'dashdot'
  47036. || style.lineType === 'longdashdot'
  47037. ) {
  47038. let dashLength = (style.lineWidth || 1);
  47039. let pattern1 = dashLength;
  47040. let pattern2 = dashLength;
  47041. let pattern3 = dashLength;
  47042. let pattern4 = dashLength;
  47043. //dashdot
  47044. if (style.lineType === 'dashdot') {
  47045. pattern1 *= 4;
  47046. pattern2 *= 4;
  47047. pattern4 *= 4;
  47048. if (style.lineCap && style.lineCap !== "butt") {
  47049. pattern1 -= dashLength;
  47050. pattern2 += dashLength;
  47051. pattern3 = 1;
  47052. pattern4 += dashLength;
  47053. }
  47054. }
  47055. //longdashdot
  47056. if (style.lineType === 'longdashdot') {
  47057. pattern1 *= 8;
  47058. pattern2 *= 4;
  47059. pattern4 *= 4;
  47060. if (style.lineCap && style.lineCap !== "butt") {
  47061. pattern1 -= dashLength;
  47062. pattern2 += dashLength;
  47063. pattern3 = 1;
  47064. pattern4 += dashLength;
  47065. }
  47066. }
  47067. dashLength = (style.lineWidth || 1)
  47068. * (style.lineType === 'dashed' ? 5 : 1);
  47069. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47070. for (let i = 1; i < len; i++) {
  47071. SUtil.SUtil_dashedLineTo(
  47072. ctx,
  47073. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  47074. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  47075. dashLength,
  47076. [pattern1, pattern2, pattern3, pattern4]
  47077. );
  47078. }
  47079. }
  47080. }
  47081. return;
  47082. }
  47083. /**
  47084. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  47085. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  47086. *
  47087. * @param {Object} style - style
  47088. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47089. */
  47090. getRect(style) {
  47091. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47092. this.refOriginalPosition = [0, 0];
  47093. }
  47094. var __OP = this.refOriginalPosition;
  47095. return SmicPolygon_SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  47096. }
  47097. }
  47098. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  47099. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  47100. * This program are made available under the terms of the Apache License, Version 2.0
  47101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47102. /**
  47103. * @private
  47104. * @class SuperMap.LevelRenderer.Shape.SmicImage
  47105. * @category Visualization Theme
  47106. * @classdesc 图片绘制。
  47107. * @extends SuperMap.LevelRenderer.Shape
  47108. * @example
  47109. * var shape = new SuperMap.LevelRenderer.Shape.SmicImage({
  47110. * style: {
  47111. * image: 'test.jpg',
  47112. * x: 100,
  47113. * y: 100
  47114. * }
  47115. * });
  47116. * levelRenderer.addShape(shape);
  47117. *
  47118. *
  47119. */
  47120. class SmicImage_SmicImage extends Shape_Shape {
  47121. /**
  47122. * @member {Object} SuperMap.LevelRenderer.Shape.SmicImage.prototype.style
  47123. * @description 绘制样式。
  47124. *
  47125. * @param {number} style.x - 左上角横坐标,必设参数。
  47126. * @param {number} style.y - 左上角纵坐标,必设参数。
  47127. * @param {(string/Cavans)} style.image - 图片地址或cavans对象,必设参数。
  47128. * @param {number} style.width - 绘制到画布上的宽度,默认为图片高度。
  47129. * @param {number} style.height - 绘制到画布上的高度,默认为图片高度。
  47130. * @param {number} style.sx - 从图片中裁剪的左上角横坐标。
  47131. * @param {number} style.sy - 从图片中裁剪的左上角纵坐标。
  47132. * @param {number} style.sWidth - 从图片中裁剪的宽度,默认为图片高度。
  47133. * @param {number} style.sHeight - 绘制到画布上的高度,默认为图片高度。
  47134. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47135. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47136. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47137. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47138. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47139. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47140. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47141. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47142. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47143. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47144. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47145. */
  47146. //打开接口 style
  47147. /**
  47148. * @function SuperMap.LevelRenderer.Shape.SmicImage.constructor
  47149. * @description 构造函数。
  47150. *
  47151. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47152. *
  47153. */
  47154. constructor(options) {
  47155. super(options);
  47156. /**
  47157. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype.type
  47158. * @description 图形类型。
  47159. */
  47160. this.type = 'smicimage';
  47161. /**
  47162. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype._imageCache
  47163. * @description 图片缓存。
  47164. */
  47165. this._imageCache = {};
  47166. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47167. this.refOriginalPosition = [0, 0];
  47168. }
  47169. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  47170. }
  47171. /**
  47172. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.destroy
  47173. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47174. */
  47175. destroy() {
  47176. this.type = null;
  47177. this._imageCache = null;
  47178. super.destroy();
  47179. }
  47180. /**
  47181. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.buildPath
  47182. * @description 创建图片。
  47183. *
  47184. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47185. * @param {Object} style - style。
  47186. *
  47187. */
  47188. brush(ctx, isHighlight, refresh) {
  47189. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47190. this.refOriginalPosition = [0, 0];
  47191. }
  47192. var __OP = this.refOriginalPosition;
  47193. var style = this.style || {};
  47194. if (isHighlight) {
  47195. // 根据style扩展默认高亮样式
  47196. style = this.getHighlightStyle(
  47197. style, this.highlightStyle || {}
  47198. );
  47199. }
  47200. var image = style.image;
  47201. var me = this;
  47202. if (typeof(image) === 'string') {
  47203. var src = image;
  47204. if (this._imageCache[src]) {
  47205. image = this._imageCache[src];
  47206. } else {
  47207. image = new Image();
  47208. image.onload = function () {
  47209. image.onload = null;
  47210. clearTimeout(SmicImage_SmicImage._refreshTimeout);
  47211. SmicImage_SmicImage._needsRefresh.push(me);
  47212. // 防止因为缓存短时间内触发多次onload事件
  47213. SmicImage_SmicImage._refreshTimeout = setTimeout(function () {
  47214. refresh && refresh(SmicImage_SmicImage._needsRefresh);
  47215. // 清空 needsRefresh
  47216. SmicImage_SmicImage._needsRefresh = [];
  47217. }, 10);
  47218. };
  47219. image.src = src;
  47220. this._imageCache[src] = image;
  47221. }
  47222. }
  47223. if (image) {
  47224. // 图片已经加载完成
  47225. if (image.nodeName.toUpperCase() == 'IMG') {
  47226. if (window.ActiveXObject) {
  47227. if (image.readyState != 'complete') {
  47228. return;
  47229. }
  47230. } else {
  47231. if (!image.complete) {
  47232. return;
  47233. }
  47234. }
  47235. }
  47236. // Else is canvas
  47237. var width = style.width || image.width;
  47238. var height = style.height || image.height;
  47239. var x = style.x + __OP[0];
  47240. var y = style.y + __OP[1];
  47241. // 图片加载失败
  47242. if (!image.width || !image.height) {
  47243. return;
  47244. }
  47245. ctx.save();
  47246. this.doClip(ctx);
  47247. this.setContext(ctx, style);
  47248. // 设置transform
  47249. this.setTransform(ctx);
  47250. if (style.sWidth && style.sHeight) {
  47251. let sx = (style.sx + __OP[0]) || 0;
  47252. let sy = (style.sy + __OP[1]) || 0;
  47253. ctx.drawImage(
  47254. image,
  47255. sx, sy, style.sWidth, style.sHeight,
  47256. x, y, width, height
  47257. );
  47258. } else if (style.sx && style.sy) {
  47259. let sx = style.sx + __OP[0];
  47260. let sy = style.sy + __OP[1];
  47261. var sWidth = width - sx;
  47262. var sHeight = height - sy;
  47263. ctx.drawImage(
  47264. image,
  47265. sx, sy, sWidth, sHeight,
  47266. x, y, width, height
  47267. );
  47268. } else {
  47269. ctx.drawImage(image, x, y, width, height);
  47270. }
  47271. // 如果没设置宽和高的话自动根据图片宽高设置
  47272. if (!style.width) {
  47273. style.width = width;
  47274. }
  47275. if (!style.height) {
  47276. style.height = height;
  47277. }
  47278. if (!this.style.width) {
  47279. this.style.width = width;
  47280. }
  47281. if (!this.style.height) {
  47282. this.style.height = height;
  47283. }
  47284. this.drawText(ctx, style, this.style);
  47285. ctx.restore();
  47286. }
  47287. }
  47288. /**
  47289. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.getRect
  47290. * @description 计算返回图片的包围盒矩形。
  47291. *
  47292. * @param {Object} style - style
  47293. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47294. */
  47295. getRect(style) {
  47296. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47297. this.refOriginalPosition = [0, 0];
  47298. }
  47299. var __OP = this.refOriginalPosition;
  47300. return {
  47301. x: style.x + __OP[0],
  47302. y: style.y + __OP[1],
  47303. width: style.width,
  47304. height: style.height
  47305. };
  47306. }
  47307. /**
  47308. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.clearCache
  47309. * @description 清除图片缓存。
  47310. *
  47311. * @param {Object} style - style
  47312. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47313. *
  47314. */
  47315. clearCache() {
  47316. this._imageCache = {};
  47317. }
  47318. }
  47319. SmicImage_SmicImage._needsRefresh = [];
  47320. SmicImage_SmicImage._refreshTimeout = null;
  47321. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  47322. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  47323. * This program are made available under the terms of the Apache License, Version 2.0
  47324. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47325. /**
  47326. * @private
  47327. * @class SuperMap.LevelRenderer.Shape.SmicRectangle
  47328. * @category Visualization Theme
  47329. * @classdesc 矩形。
  47330. * @extends SuperMap.LevelRenderer.Shape
  47331. * @example
  47332. * var shape = new SuperMap.LevelRenderer.Shape.SmicRectangle({
  47333. * style: {
  47334. * x: 0,
  47335. * y: 0,
  47336. * width: 100,
  47337. * height: 100,
  47338. * radius: 20
  47339. * }
  47340. * });
  47341. * levelRenderer.addShape(shape);
  47342. *
  47343. */
  47344. class SmicRectangle_SmicRectangle extends Shape_Shape {
  47345. /**
  47346. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.style
  47347. * @description 绘制样式。
  47348. *
  47349. * @param {number} style.x - 左上角 x 坐标,必设参数。
  47350. * @param {number} style.y - 左上角 y 坐标,必设参数。
  47351. * @param {number} style.width - 宽度,必设参数。
  47352. * @param {number} style.height - 高度,必设参数。
  47353. * @param {Array} style.radius - 矩形圆角,可以用数组分别指定四个角的圆角,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 则 radius为 [r1、r2、r3、r4 ]。
  47354. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47355. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  47356. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  47357. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  47358. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  47359. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47360. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47361. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47362. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47363. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47364. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47365. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47366. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47367. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47368. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47369. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47370. */
  47371. //打开接口 style
  47372. /**
  47373. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.constructor
  47374. * @description 构造函数。
  47375. *
  47376. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47377. *
  47378. */
  47379. constructor(options) {
  47380. super(options);
  47381. /**
  47382. * @member {string} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.type
  47383. * @description 图形类型.
  47384. */
  47385. this.type = 'smicrectangle';
  47386. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47387. this.refOriginalPosition = [0, 0];
  47388. }
  47389. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  47390. }
  47391. /**
  47392. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.destroy
  47393. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47394. */
  47395. destroy() {
  47396. this.type = null;
  47397. super.destroy();
  47398. }
  47399. /**
  47400. * APIMethod: _buildRadiusPath
  47401. * 创建矩形的圆角路径。
  47402. *
  47403. * Parameters:
  47404. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  47405. * style - {Object} style。
  47406. *
  47407. */
  47408. _buildRadiusPath(ctx, style) {
  47409. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47410. this.refOriginalPosition = [0, 0];
  47411. }
  47412. var __OP = this.refOriginalPosition;
  47413. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  47414. // r缩写为1 相当于 [1, 1, 1, 1]
  47415. // r缩写为[1] 相当于 [1, 1, 1, 1]
  47416. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  47417. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  47418. var x = style.x + __OP[0];
  47419. var y = style.y + __OP[1];
  47420. var width = style.width;
  47421. var height = style.height;
  47422. var r = style.radius;
  47423. var r1;
  47424. var r2;
  47425. var r3;
  47426. var r4;
  47427. if (typeof r === 'number') {
  47428. r1 = r2 = r3 = r4 = r;
  47429. } else if (r instanceof Array) {
  47430. if (r.length === 1) {
  47431. r1 = r2 = r3 = r4 = r[0];
  47432. } else if (r.length === 2) {
  47433. r1 = r3 = r[0];
  47434. r2 = r4 = r[1];
  47435. } else if (r.length === 3) {
  47436. r1 = r[0];
  47437. r2 = r4 = r[1];
  47438. r3 = r[2];
  47439. } else {
  47440. r1 = r[0];
  47441. r2 = r[1];
  47442. r3 = r[2];
  47443. r4 = r[3];
  47444. }
  47445. } else {
  47446. r1 = r2 = r3 = r4 = 0;
  47447. }
  47448. var total;
  47449. if (r1 + r2 > width) {
  47450. total = r1 + r2;
  47451. r1 *= width / total;
  47452. r2 *= width / total;
  47453. }
  47454. if (r3 + r4 > width) {
  47455. total = r3 + r4;
  47456. r3 *= width / total;
  47457. r4 *= width / total;
  47458. }
  47459. if (r2 + r3 > height) {
  47460. total = r2 + r3;
  47461. r2 *= height / total;
  47462. r3 *= height / total;
  47463. }
  47464. if (r1 + r4 > height) {
  47465. total = r1 + r4;
  47466. r1 *= height / total;
  47467. r4 *= height / total;
  47468. }
  47469. ctx.moveTo(x + r1, y);
  47470. ctx.lineTo(x + width - r2, y);
  47471. r2 !== 0 && ctx.quadraticCurveTo(
  47472. x + width, y, x + width, y + r2
  47473. );
  47474. ctx.lineTo(x + width, y + height - r3);
  47475. r3 !== 0 && ctx.quadraticCurveTo(
  47476. x + width, y + height, x + width - r3, y + height
  47477. );
  47478. ctx.lineTo(x + r4, y + height);
  47479. r4 !== 0 && ctx.quadraticCurveTo(
  47480. x, y + height, x, y + height - r4
  47481. );
  47482. ctx.lineTo(x, y + r1);
  47483. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  47484. }
  47485. /**
  47486. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  47487. * @description 创建矩形路径。
  47488. *
  47489. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47490. * @param {Object} style - style。
  47491. *
  47492. */
  47493. buildPath(ctx, style) {
  47494. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47495. this.refOriginalPosition = [0, 0];
  47496. }
  47497. var __OP = this.refOriginalPosition;
  47498. if (!style.radius) {
  47499. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  47500. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  47501. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  47502. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  47503. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  47504. // ctx.rect(style.x, style.y, style.width, style.height);
  47505. } else {
  47506. this._buildRadiusPath(ctx, style);
  47507. }
  47508. ctx.closePath();
  47509. return;
  47510. }
  47511. /**
  47512. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.getRect
  47513. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  47514. *
  47515. * @param {Object} style - style
  47516. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47517. */
  47518. getRect(style) {
  47519. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47520. this.refOriginalPosition = [0, 0];
  47521. }
  47522. var __OP = this.refOriginalPosition;
  47523. if (style.__rect) {
  47524. return style.__rect;
  47525. }
  47526. var lineWidth;
  47527. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  47528. lineWidth = style.lineWidth || 1;
  47529. } else {
  47530. lineWidth = 0;
  47531. }
  47532. style.__rect = {
  47533. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  47534. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  47535. width: style.width + lineWidth,
  47536. height: style.height + lineWidth
  47537. };
  47538. return style.__rect;
  47539. }
  47540. }
  47541. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  47542. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  47543. * This program are made available under the terms of the Apache License, Version 2.0
  47544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47545. /**
  47546. * @private
  47547. * @class SuperMap.LevelRenderer.Shape.SmicSector
  47548. * @category Visualization Theme
  47549. * @classdesc 扇形。
  47550. * @extends SuperMap.LevelRenderer.Shape
  47551. * @example
  47552. * var shape = new SuperMap.LevelRenderer.Shape.SmicSector({
  47553. * style: {
  47554. * x: 100,
  47555. * y: 100,
  47556. * r: 60,
  47557. * r0: 30,
  47558. * startAngle: 0,
  47559. * endEngle: 180
  47560. * }
  47561. * });
  47562. * levelRenderer.addShape(shape);
  47563. *
  47564. *
  47565. */
  47566. class SmicSector_SmicSector extends Shape_Shape {
  47567. /**
  47568. * @member {Object} SuperMap.LevelRenderer.Shape.SmicSector.prototype.style
  47569. * @description 绘制样式。
  47570. *
  47571. * @param {number} style.x - 圆心 x 坐标,必设参数。
  47572. * @param {number} style.y - 圆心 y 坐标,必设参数。
  47573. * @param {number} style.r - 外圆半径,必设参数。
  47574. * @param {number} style.r0 - 内圆半径,指定后将出现内弧,同时扇边长度为`r - r0`。取值范围[0, r),默认值:0。
  47575. * @param {number} style.startAngle - 起始角度,必设参数。取值范围[0, 360)。
  47576. * @param {number} style.endAngle - 结束角度,必设参数。取值范围(0, 360。
  47577. * @param {boolean} style.clockWise - 是否是顺时针。默认值:false。
  47578. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47579. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  47580. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  47581. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  47582. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  47583. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47584. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47585. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47586. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47587. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47588. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47589. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47590. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47591. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47592. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47593. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47594. */
  47595. //打开接口 style
  47596. /**
  47597. * @function SuperMap.LevelRenderer.Shape.SmicSector.constructor
  47598. * @description 构造函数。
  47599. *
  47600. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47601. *
  47602. */
  47603. constructor(options) {
  47604. super(options);
  47605. /**
  47606. * @member {string} SuperMap.LevelRenderer.Shape.SmicSector.protptype.type
  47607. * @description 图形类型。
  47608. */
  47609. this.type = 'smicsector';
  47610. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47611. this.refOriginalPosition = [0, 0];
  47612. }
  47613. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  47614. }
  47615. /**
  47616. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.destroy
  47617. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47618. */
  47619. destroy() {
  47620. this.type = null;
  47621. super.destroy();
  47622. }
  47623. /**
  47624. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.buildPath
  47625. * @description 创建扇形路径。
  47626. *
  47627. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47628. * @param {Object} style - style。
  47629. *
  47630. */
  47631. buildPath(ctx, style) {
  47632. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47633. this.refOriginalPosition = [0, 0];
  47634. }
  47635. var __OP = this.refOriginalPosition;
  47636. var x = style.x + __OP[0]; // 圆心x
  47637. var y = style.y + __OP[1]; // 圆心y
  47638. var r0 = style.r0 || 0; // 形内半径[0,r)
  47639. var r = style.r; // 扇形外半径(0,r]
  47640. var startAngle = style.startAngle; // 起始角度[0,360)
  47641. var endAngle = style.endAngle; // 结束角度(0,360]
  47642. var clockWise = style.clockWise || false;
  47643. startAngle = SUtil.Util_math.degreeToRadian(startAngle);
  47644. endAngle = SUtil.Util_math.degreeToRadian(endAngle);
  47645. if (!clockWise) {
  47646. // 扇形默认是逆时针方向,Y轴向上
  47647. // 这个跟arc的标准不一样,为了兼容echarts
  47648. startAngle = -startAngle;
  47649. endAngle = -endAngle;
  47650. }
  47651. var unitX = SUtil.Util_math.cos(startAngle);
  47652. var unitY = SUtil.Util_math.sin(startAngle);
  47653. ctx.moveTo(
  47654. unitX * r0 + x,
  47655. unitY * r0 + y
  47656. );
  47657. ctx.lineTo(
  47658. unitX * r + x,
  47659. unitY * r + y
  47660. );
  47661. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  47662. ctx.lineTo(
  47663. SUtil.Util_math.cos(endAngle) * r0 + x,
  47664. SUtil.Util_math.sin(endAngle) * r0 + y
  47665. );
  47666. if (r0 !== 0) {
  47667. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  47668. }
  47669. ctx.closePath();
  47670. return;
  47671. }
  47672. /**
  47673. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.getRect
  47674. * @description 返回扇形包围盒矩形
  47675. *
  47676. * @param {Object} style - style
  47677. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47678. *
  47679. */
  47680. getRect(style) {
  47681. if (style.__rect) {
  47682. return style.__rect;
  47683. }
  47684. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47685. this.refOriginalPosition = [0, 0];
  47686. }
  47687. var __OP = this.refOriginalPosition;
  47688. var min0 = SUtil.Util_vector.create();
  47689. var min1 = SUtil.Util_vector.create();
  47690. var max0 = SUtil.Util_vector.create();
  47691. var max1 = SUtil.Util_vector.create();
  47692. var x = style.x + __OP[0]; // 圆心x
  47693. var y = style.y + __OP[1]; // 圆心y
  47694. var r0 = style.r0 || 0; // 形内半径[0,r)
  47695. var r = style.r; // 扇形外半径(0,r]
  47696. var startAngle = SUtil.Util_math.degreeToRadian(style.startAngle);
  47697. var endAngle = SUtil.Util_math.degreeToRadian(style.endAngle);
  47698. var clockWise = style.clockWise;
  47699. if (!clockWise) {
  47700. startAngle = -startAngle;
  47701. endAngle = -endAngle;
  47702. }
  47703. if (r0 > 1) {
  47704. SUtil.Util_computeBoundingBox.arc(
  47705. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  47706. );
  47707. } else {
  47708. min0[0] = max0[0] = x;
  47709. min0[1] = max0[1] = y;
  47710. }
  47711. SUtil.Util_computeBoundingBox.arc(
  47712. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  47713. );
  47714. SUtil.Util_vector.min(min0, min0, min1);
  47715. SUtil.Util_vector.max(max0, max0, max1);
  47716. style.__rect = {
  47717. x: min0[0],
  47718. y: min0[1],
  47719. width: max0[0] - min0[0],
  47720. height: max0[1] - min0[1]
  47721. };
  47722. return style.__rect;
  47723. }
  47724. }
  47725. // CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  47726. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  47727. * This program are made available under the terms of the Apache License, Version 2.0
  47728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47729. /**
  47730. * @class SuperMap.Feature.ShapeFactory
  47731. * @category Visualization Theme
  47732. * @classdesc 图形工厂类。
  47733. * 目前支持创建的图形有:<br>
  47734. * 用于统计专题图:<br>
  47735. * 点 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Point}> <br>
  47736. * 线 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Line}> <br>
  47737. * 面 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Polygon}> <br>
  47738. * 矩形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Rectangle}> <br>
  47739. * 扇形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Sector}> <br>
  47740. * 标签 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Label}> <br>
  47741. * 图片 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Image}> <br>
  47742. * 用于符号专题图:<br>
  47743. * 圆形 - 参数对象:<{@link SuperMap.Feature.ShapeParameters.Cilcle}>
  47744. */
  47745. class ShapeFactory_ShapeFactory {
  47746. /**
  47747. * @function SuperMap.Feature.ShapeFactory.prototype.constructor
  47748. * @description 构建图形工厂对象。
  47749. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象,可选参数。
  47750. * @returns {SuperMap.Feature.ShapeFactory} 返回图形工厂类对象。
  47751. */
  47752. constructor(shapeParameters) {
  47753. /**
  47754. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.shapeParameters
  47755. * @description 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。必设参数,默认值 null。
  47756. */
  47757. this.shapeParameters = shapeParameters;
  47758. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  47759. }
  47760. /**
  47761. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  47762. * @description 销毁图形工厂类对象。
  47763. */
  47764. destroy() {
  47765. this.shapeParameters = null;
  47766. }
  47767. /**
  47768. * @function SuperMap.Feature.ShapeParameters.prototype.createShape
  47769. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  47770. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。
  47771. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  47772. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  47773. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  47774. */
  47775. createShape(shapeParameters) {
  47776. if (shapeParameters) {
  47777. this.shapeParameters = shapeParameters;
  47778. }
  47779. if (!this.shapeParameters) {
  47780. return null;
  47781. }
  47782. var sps = this.shapeParameters;
  47783. if (sps instanceof feature_Point_Point) { // 点
  47784. //设置style
  47785. let style = new Object();
  47786. style["x"] = sps.x;
  47787. style["y"] = sps.y;
  47788. style["r"] = sps.r;
  47789. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  47790. //创建图形
  47791. let shape = new SmicPoint_SmicPoint();
  47792. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47793. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47794. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  47795. return shape;
  47796. } else if (sps instanceof Line_Line) { // 线
  47797. //检查参数 pointList 是否存在
  47798. if (!sps.pointList) {
  47799. return null;
  47800. }
  47801. // 设置style
  47802. let style = new Object();
  47803. style["pointList"] = sps.pointList;
  47804. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  47805. // 创建图形
  47806. let shape = new SmicBrokenLine_SmicBrokenLine();
  47807. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47808. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47809. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  47810. return shape;
  47811. } else if (sps instanceof feature_Polygon_Polygon) { // 面
  47812. //检查参数 pointList 是否存在
  47813. if (!sps.pointList) {
  47814. return null;
  47815. }
  47816. //设置style
  47817. let style = new Object();
  47818. style["pointList"] = sps.pointList;
  47819. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  47820. //创建图形
  47821. let shape = new SmicPolygon_SmicPolygon();
  47822. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47823. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47824. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  47825. return shape;
  47826. } else if (sps instanceof feature_Rectangle_Rectangle) { // 矩形
  47827. //检查参数 pointList 是否存在
  47828. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  47829. return null;
  47830. }
  47831. //设置style
  47832. let style = new Object();
  47833. style["x"] = sps.x;
  47834. style["y"] = sps.y;
  47835. style["width"] = sps.width;
  47836. style["height"] = sps.height;
  47837. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  47838. //创建图形
  47839. let shape = new SmicRectangle_SmicRectangle();
  47840. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47841. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47842. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  47843. return shape;
  47844. } else if (sps instanceof Sector_Sector) { // 扇形
  47845. //设置style
  47846. let style = new Object();
  47847. style["x"] = sps.x;
  47848. style["y"] = sps.y;
  47849. style["r"] = sps.r;
  47850. style["startAngle"] = sps.startAngle;
  47851. style["endAngle"] = sps.endAngle;
  47852. if (sps["r0"]) {
  47853. style["r0"] = sps.r0
  47854. }
  47855. if (sps["clockWise"]) {
  47856. style["clockWise"] = sps.clockWise
  47857. }
  47858. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  47859. //创建图形
  47860. let shape = new SmicSector_SmicSector();
  47861. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47862. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47863. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  47864. return shape;
  47865. } else if (sps instanceof Label_Label) { // 标签
  47866. //设置style
  47867. let style = new Object();
  47868. style["x"] = sps.x;
  47869. style["y"] = sps.y;
  47870. style["text"] = sps.text;
  47871. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  47872. //创建图形
  47873. let shape = new SmicText_SmicText();
  47874. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47875. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47876. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  47877. return shape;
  47878. } else if (sps instanceof Image_Image) { // 图片
  47879. //设置style
  47880. let style = new Object();
  47881. style["x"] = sps.x;
  47882. style["y"] = sps.y;
  47883. if (sps["image"]) {
  47884. style["image"] = sps.image;
  47885. }
  47886. if (sps["width"]) {
  47887. style["width"] = sps.width;
  47888. }
  47889. if (sps["height"]) {
  47890. style["height"] = sps.height;
  47891. }
  47892. if (sps["sx"]) {
  47893. style["sx"] = sps.sx;
  47894. }
  47895. if (sps["sy"]) {
  47896. style["sy"] = sps.sy;
  47897. }
  47898. if (sps["sWidth"]) {
  47899. style["sWidth"] = sps.sWidth
  47900. }
  47901. if (sps["sHeight"]) {
  47902. style["sHeight"] = sps.sHeight
  47903. }
  47904. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  47905. //创建图形
  47906. let shape = new SmicImage_SmicImage();
  47907. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47908. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47909. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  47910. return shape;
  47911. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  47912. //设置stytle
  47913. let style = new Object();
  47914. style["x"] = sps.x;
  47915. style["r"] = sps.r;
  47916. style["y"] = sps.y;
  47917. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  47918. //创建图形
  47919. let shape = new SmicCircle_SmicCircle();
  47920. shape.style = ShapeFactory_ShapeFactory.transformStyle(style);
  47921. shape.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(sps.highlightStyle);
  47922. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  47923. return shape;
  47924. }
  47925. return null
  47926. }
  47927. /**
  47928. * @function SuperMap.Feature.ShapeParameters.prototype.transformStyle
  47929. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  47930. * @param {Object} style - 用户 style。
  47931. * @returns {Object} 符合 levelRenderer 的 style。
  47932. */
  47933. static transformStyle(style) {
  47934. var newStyle = {};
  47935. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  47936. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  47937. //画笔类型 ["fill", "stroke"];
  47938. var brushType = [true, false];
  47939. for (var ss in style) {
  47940. switch (ss) {
  47941. case "fill":
  47942. brushType[0] = style[ss];
  47943. break;
  47944. case "fillColor":
  47945. newStyle["color"] = style[ss];
  47946. break;
  47947. case "stroke":
  47948. brushType[1] = style[ss];
  47949. break;
  47950. case "strokeWidth":
  47951. newStyle["lineWidth"] = style[ss];
  47952. break;
  47953. case "strokeLinecap":
  47954. newStyle["lineCap"] = style[ss];
  47955. break;
  47956. case "strokeLineJoin":
  47957. newStyle["lineJoin"] = style[ss];
  47958. break;
  47959. case "strokeDashstyle":
  47960. newStyle["lineType"] = style[ss];
  47961. break;
  47962. case "pointRadius":
  47963. newStyle["r"] = style[ss];
  47964. break;
  47965. case "label":
  47966. newStyle["text"] = style[ss];
  47967. break;
  47968. case "labelRect":
  47969. newStyle["labelRect"] = style[ss];
  47970. break;
  47971. case "fontColor":
  47972. newStyle["textColor"] = style[ss];
  47973. break;
  47974. case "fontStyle":
  47975. fontStr[0] = style[ss];
  47976. break;
  47977. case "fontVariant":
  47978. fontStr[1] = style[ss];
  47979. break;
  47980. case "fontWeight":
  47981. fontStr[2] = style[ss];
  47982. break;
  47983. case "fontSize":
  47984. var unit = "";
  47985. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  47986. unit = "px";
  47987. }
  47988. fontStr[3] = style[ss] + unit;
  47989. break;
  47990. case "fontFamily":
  47991. fontStr[4] = style[ss];
  47992. break;
  47993. case "fontOpacity":
  47994. newStyle["opacity"] = style[ss];
  47995. break;
  47996. case "labelPosition":
  47997. newStyle["textPosition"] = style[ss];
  47998. break;
  47999. case "labelAlign":
  48000. newStyle["textAlign"] = style[ss];
  48001. break;
  48002. case "labelBaseline":
  48003. newStyle["textBaseline"] = style[ss];
  48004. break;
  48005. case "labelRotation":
  48006. newStyle["textRotation"] = style[ss];
  48007. break;
  48008. default:
  48009. newStyle[ss] = style[ss];
  48010. break;
  48011. }
  48012. }
  48013. //拼接字体字符串
  48014. newStyle["textFont"] = fontStr.join(" ");
  48015. //画笔类型
  48016. if (brushType[0] === true && brushType[1] === false) {
  48017. newStyle["brushType"] = "fill";
  48018. } else if (brushType[0] === false && brushType[1] === true) {
  48019. newStyle["brushType"] = "stroke";
  48020. } else if (brushType[0] === true && brushType[1] === true) {
  48021. newStyle["brushType"] = "both";
  48022. } else {
  48023. newStyle["brushType"] = "fill";
  48024. }
  48025. //默认线宽 1
  48026. if (newStyle["lineWidth"] == null) {
  48027. newStyle["lineWidth"] = 1;
  48028. }
  48029. return newStyle;
  48030. }
  48031. /**
  48032. * @function SuperMap.Feature.ShapeParameters.prototype.Background
  48033. * @description 创建一个矩形背景框图形对象。
  48034. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  48035. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  48036. * @param {Object} setting - 图表配置参数,必设参数。本函数中图形配置对象 setting 可设属性:
  48037. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Rectangle#style>。
  48038. * @param {Array} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  48039. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  48040. */
  48041. static Background(shapeFactory, box, setting) {
  48042. var sets = setting ? setting : {};
  48043. // 背景框图形参数对象
  48044. var bgSP = new feature_Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  48045. // 默认样式
  48046. bgSP.style = {
  48047. fillColor: "#f3f3f3"
  48048. };
  48049. // 设置用户 style
  48050. if (sets.backgroundStyle) {
  48051. Util_Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  48052. }
  48053. // 设置背景框圆角参数
  48054. if (sets.backgroundRadius) {
  48055. bgSP.style["radius"] = sets.backgroundRadius;
  48056. }
  48057. // 禁止背景框响应事件
  48058. bgSP.clickable = false;
  48059. bgSP.hoverable = false;
  48060. return shapeFactory.createShape(bgSP);
  48061. }
  48062. /**
  48063. * @function SuperMap.Feature.ShapeParameters.prototype.GraphAxis
  48064. * @description 创建一个统计图表坐标轴图形对象组。
  48065. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  48066. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  48067. * @param {Object} setting - 图表配置参数,必设参数。
  48068. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  48069. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  48070. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  48071. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  48072. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  48073. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  48074. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  48075. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  48076. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  48077. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  48078. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  48079. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  48080. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  48081. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  48082. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  48083. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  48084. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  48085. */
  48086. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  48087. var dvb = dataViewBox;
  48088. var sets = setting ? setting : {};
  48089. // 参考线图形对象组
  48090. var refLines = [];
  48091. //坐标轴箭头对象组
  48092. var arrows = [];
  48093. // 是否使用参水平考线,默认不使用
  48094. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  48095. // y 轴上的刻度
  48096. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  48097. // 坐标轴节点数组
  48098. var pois = [];
  48099. //z 轴箭头数组
  48100. var zArrowPois = [];
  48101. // x,y 轴主干节点数组
  48102. var xMainPois = [];
  48103. if (axisytick == 0) {
  48104. xMainPois.push([dvb[0], dvb[3] - 5]);
  48105. xMainPois.push([dvb[0], dvb[1]]);
  48106. // 3D 坐标轴 第三象限平分线
  48107. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  48108. let axis3DParameter = parseInt(sets.axis3DParameter);
  48109. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  48110. // 添加 3D 轴节点
  48111. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  48112. //箭头坐标
  48113. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  48114. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  48115. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  48116. //3D轴
  48117. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48118. } else {
  48119. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48120. }
  48121. xMainPois.push([dvb[0], dvb[1]]);
  48122. }
  48123. xMainPois.push([dvb[2] + 5, dvb[1]]);
  48124. } else {
  48125. // 单位刻度长度
  48126. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  48127. // 刻度 y 坐标
  48128. var thckY = dvb[3];
  48129. xMainPois.push([dvb[0], thckY - 5]);
  48130. for (var i = 0; i < axisytick; i++) {
  48131. xMainPois.push([dvb[0], thckY]);
  48132. xMainPois.push([dvb[0] - 5, thckY]);
  48133. xMainPois.push([dvb[0], thckY]);
  48134. // 参考线
  48135. if (isAddRefLine) {
  48136. // 参考线参数对象
  48137. var refLineSP = new Line_Line([
  48138. [dvb[0], thckY],
  48139. [dvb[2], thckY]
  48140. ]);
  48141. // 参考线默认样式对象
  48142. refLineSP.style = {
  48143. strokeColor: "#cfcfcf",
  48144. strokeLinecap: "butt",
  48145. strokeLineJoin: "round",
  48146. strokeWidth: 1
  48147. };
  48148. // 禁止事件
  48149. refLineSP.clickable = false;
  48150. refLineSP.hoverable = false;
  48151. // 用户style
  48152. if (sets.xReferenceLineStyle) {
  48153. Util_Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  48154. }
  48155. // 生成参考线图形对象
  48156. refLines.push(shapeFactory.createShape(refLineSP))
  48157. }
  48158. // y 刻度增量
  48159. thckY += unitTick;
  48160. }
  48161. xMainPois.push([dvb[0], dvb[1]]);
  48162. // 3D 坐标轴 第三象限平分线
  48163. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  48164. let axis3DParameter = parseInt(sets.axis3DParameter);
  48165. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  48166. /*
  48167. // 箭头计算过程
  48168. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  48169. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  48170. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  48171. if(sets.axisUseArrow){
  48172. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48173. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  48174. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48175. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  48176. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48177. }
  48178. else{
  48179. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48180. }
  48181. */
  48182. // 添加 3D 轴节点
  48183. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  48184. //箭头坐标
  48185. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  48186. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  48187. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  48188. //3D轴
  48189. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48190. } else {
  48191. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48192. }
  48193. xMainPois.push([dvb[0], dvb[1]]);
  48194. }
  48195. xMainPois.push([dvb[2] + 5, dvb[1]]);
  48196. }
  48197. // 坐标轴箭头
  48198. if (sets.axisUseArrow) {
  48199. // x 轴箭头节点数组
  48200. var xArrowPois = [
  48201. [dvb[2] + 5, dvb[1] + 4],
  48202. [dvb[2] + 13, dvb[1]],
  48203. [dvb[2] + 5, dvb[1] - 4]
  48204. ];
  48205. // y 轴箭头节点数组
  48206. var yArrowPois = [
  48207. [dvb[0] - 4, dvb[3] - 5],
  48208. [dvb[0], dvb[3] - 13],
  48209. [dvb[0] + 4, dvb[3] - 5]
  48210. ];
  48211. //x轴箭头
  48212. var xSP = new feature_Polygon_Polygon(xArrowPois);
  48213. xSP.style = {fillColor: "#008acd"};
  48214. Util_Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  48215. arrows.push(shapeFactory.createShape(xSP));
  48216. //y轴箭头
  48217. var ySP = new feature_Polygon_Polygon(yArrowPois);
  48218. ySP.style = {fillColor: "#008acd"};
  48219. Util_Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  48220. arrows.push(shapeFactory.createShape(ySP));
  48221. // z轴箭头 坐标轴箭头是否要使用
  48222. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  48223. var zSP = new feature_Polygon_Polygon(zArrowPois);
  48224. zSP.style = {fillColor: "#008acd"};
  48225. Util_Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  48226. arrows.push(shapeFactory.createShape(zSP));
  48227. }
  48228. }
  48229. //不带箭头的坐标轴
  48230. pois = xMainPois;
  48231. // 坐标轴参数对象
  48232. var axisSP = new Line_Line(pois);
  48233. // 坐标轴默认style
  48234. axisSP.style = {
  48235. strokeLinecap: "butt",
  48236. strokeLineJoin: "round",
  48237. strokeColor: "#008acd",
  48238. strokeWidth: 1
  48239. };
  48240. // 用户 style
  48241. if (sets.axisStyle) {
  48242. Util_Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  48243. }
  48244. // 禁止事件
  48245. axisSP.clickable = false;
  48246. axisSP.hoverable = false;
  48247. // 创建坐标轴图形对象
  48248. var axisMain = [shapeFactory.createShape(axisSP)];
  48249. // Y 轴标签
  48250. var yLabels = [];
  48251. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  48252. var axisYLabels = sets.axisYLabels;
  48253. let len = axisYLabels.length;
  48254. // 标签偏移量
  48255. var ylOffset = [0, 0];
  48256. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  48257. ylOffset = sets.axisYLabelsOffset;
  48258. }
  48259. if (len == 1) {
  48260. // 标签参数对象
  48261. let labelYSP = new Label_Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  48262. labelYSP.style = {
  48263. labelAlign: "right"
  48264. };
  48265. // 用户 style
  48266. if (sets.axisYLabelsStyle) {
  48267. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  48268. }
  48269. // 禁止事件
  48270. labelYSP.clickable = false;
  48271. labelYSP.hoverable = false;
  48272. // 制作标签
  48273. yLabels.push(shapeFactory.createShape(labelYSP));
  48274. } else {
  48275. var labelY = dvb[3];
  48276. // y 轴标签单位距离
  48277. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  48278. for (var j = 0; j < len; j++) {
  48279. // 标签参数对象
  48280. let labelYSP = new Label_Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  48281. labelYSP.style = {
  48282. labelAlign: "right"
  48283. };
  48284. // 用户 style
  48285. if (sets.axisYLabelsStyle) {
  48286. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  48287. }
  48288. // 禁止事件
  48289. labelYSP.clickable = false;
  48290. labelYSP.hoverable = false;
  48291. // 制作标签
  48292. yLabels.push(shapeFactory.createShape(labelYSP));
  48293. // y 轴标签 y 方向增量
  48294. labelY += yUnit;
  48295. }
  48296. }
  48297. }
  48298. // X 轴标签
  48299. var xLabels = [];
  48300. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  48301. let axisXLabels = sets.axisXLabels;
  48302. let len = axisXLabels.length;
  48303. // 标签偏移量
  48304. let xlOffset = [0, 0];
  48305. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  48306. xlOffset = sets.axisXLabelsOffset;
  48307. }
  48308. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  48309. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  48310. let xsCenter = xShapeInfo.xPositions;
  48311. for (let K = 0; K < len; K++) {
  48312. // 标签参数对象
  48313. let labelXSP = new Label_Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  48314. // 默认 style
  48315. labelXSP.style = {
  48316. labelAlign: "center",
  48317. labelBaseline: "top"
  48318. };
  48319. // 用户 style
  48320. if (sets.axisXLabelsStyle) {
  48321. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  48322. }
  48323. // 禁止事件
  48324. labelXSP.clickable = false;
  48325. labelXSP.hoverable = false;
  48326. // 创建标签对象
  48327. xLabels.push(shapeFactory.createShape(labelXSP));
  48328. }
  48329. } else {
  48330. if (len == 1) {
  48331. // 标签参数对象
  48332. let labelXSP = new Label_Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  48333. // 默认 style
  48334. labelXSP.style = {
  48335. labelAlign: "center",
  48336. labelBaseline: "top"
  48337. };
  48338. // 用户 style
  48339. if (sets.axisXLabelsStyle) {
  48340. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  48341. }
  48342. // 禁止事件
  48343. labelXSP.clickable = false;
  48344. labelXSP.hoverable = false;
  48345. // 创建标签对象
  48346. xLabels.push(shapeFactory.createShape(labelXSP));
  48347. } else {
  48348. let labelX = dvb[0];
  48349. // x 轴标签单位距离
  48350. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  48351. for (let m = 0; m < len; m++) {
  48352. // 标签参数对象
  48353. let labelXSP = new Label_Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  48354. // 默认 style
  48355. labelXSP.style = {
  48356. labelAlign: "center",
  48357. labelBaseline: "top"
  48358. };
  48359. // 用户 style
  48360. if (sets.axisXLabelsStyle) {
  48361. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  48362. }
  48363. // 禁止事件
  48364. labelXSP.clickable = false;
  48365. labelXSP.hoverable = false;
  48366. // 创建标签对象
  48367. xLabels.push(shapeFactory.createShape(labelXSP));
  48368. // x 轴标签 x 方向增量
  48369. labelX += xUnit;
  48370. }
  48371. }
  48372. }
  48373. }
  48374. // 组装并返回构成坐标轴的图形
  48375. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  48376. }
  48377. /**
  48378. * @function SuperMap.Feature.ShapeParameters.prototype.ShapeStyleTool
  48379. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  48380. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。
  48381. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  48382. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  48383. * 其可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  48384. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  48385. * (start code)
  48386. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  48387. * // start: 值域值下限(包含);
  48388. * // end: 值域值上限(不包含);
  48389. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <SuperMap.Feature.ShapeParameters> 子类对象的 style 属性。。
  48390. * // dataStyleByCodomain 数组形如:
  48391. * [
  48392. * {
  48393. * start:0,
  48394. * end:250,
  48395. * style:{
  48396. * fillColor:"#00CD00"
  48397. * }
  48398. * },
  48399. * {
  48400. * start:250,
  48401. * end:500,
  48402. * style:{
  48403. * fillColor:"#00EE00"
  48404. * }
  48405. * },
  48406. * {
  48407. * start:500,
  48408. * end:750,
  48409. * style:{
  48410. * fillColor:"#00FF7F"
  48411. * }
  48412. * },
  48413. * {
  48414. * start:750,
  48415. * end:1500,
  48416. * style:{
  48417. * fillColor:"#00FF00"
  48418. * }
  48419. * }
  48420. * ]
  48421. * (end)
  48422. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  48423. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  48424. * @returns {Object} 合并后的样式 (style) 对象。
  48425. */
  48426. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  48427. // 用 defaultStyle 初始化 style 对象
  48428. var finalStyle = defaultStyle ? defaultStyle : {};
  48429. // 基础 style
  48430. if (style) {
  48431. Util_Util.copyAttributesWithClip(finalStyle, style);
  48432. }
  48433. // 按索引赋 style
  48434. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  48435. if (styleGroup[index]) {
  48436. Util_Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  48437. }
  48438. }
  48439. // 按值域赋 style
  48440. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  48441. var dsc = styleByCodomain;
  48442. var dscLen = dsc.length;
  48443. var v = parseFloat(value);
  48444. for (var i = 0; i < dscLen; i++) {
  48445. if (dsc[i].start <= v && v < dsc[i].end) {
  48446. Util_Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  48447. break;
  48448. }
  48449. }
  48450. }
  48451. return finalStyle;
  48452. }
  48453. }
  48454. SuperMap.Feature = SuperMap.Feature || {};
  48455. SuperMap.Feature.ShapeFactory = ShapeFactory_ShapeFactory;
  48456. // CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  48457. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  48458. * This program are made available under the terms of the Apache License, Version 2.0
  48459. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48460. /**
  48461. * @class SuperMap.Feature.Theme
  48462. * @category Visualization Theme
  48463. * @classdesc 专题要素基类,此类不可实例化。
  48464. */
  48465. class feature_Theme_Theme {
  48466. /**
  48467. * @function SuperMap.Feature.Theme.prototype.constructor
  48468. * @description 构造函数。
  48469. * @param {Object} data - 用户数据,用于生成可视化 shape,必设参数。
  48470. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层,必设参数。
  48471. * @returns {SuperMap.Feature.Theme} 返回一个专题要素。
  48472. */
  48473. constructor(data, layer) {
  48474. if (!data) {
  48475. return;
  48476. }
  48477. // layer 必须已经添加到地图, 且已初始化渲染器
  48478. if (!layer || !layer.map || !layer.renderer) {
  48479. return;
  48480. }
  48481. /**
  48482. * @member {string} SuperMap.Feature.Theme.prototype.id
  48483. * @description 专题要素唯一标识。
  48484. */
  48485. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  48486. /**
  48487. * @member {SuperMap.LonLat} SuperMap.Feature.Theme.prototype.lonlat
  48488. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  48489. */
  48490. this.lonlat = null;
  48491. /**
  48492. * @member {Array} SuperMap.Feature.Theme.prototype.location
  48493. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48494. */
  48495. this.location = [];
  48496. /**
  48497. * @readonly
  48498. * @member {Object} SuperMap.Feature.Theme.prototype.data
  48499. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<SuperMap.Feature.Vector>。
  48500. */
  48501. this.data = data;
  48502. /**
  48503. * @readonly
  48504. * @member {Array} SuperMap.Feature.Theme.prototype.shapes
  48505. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  48506. */
  48507. this.shapes = [];
  48508. /**
  48509. * @readonly
  48510. * @member {SuperMap.Layer.Theme} SuperMap.Feature.Theme.prototype.layer
  48511. * @description 此专题要素所在专题图层。
  48512. */
  48513. this.layer = layer;
  48514. this.CLASS_NAME = "SuperMap.Feature.Theme";
  48515. }
  48516. /**
  48517. * @function SuperMap.Feature.Theme.prototype.destroy
  48518. * @description 销毁专题要素。
  48519. */
  48520. destroy() {
  48521. this.data = null;
  48522. this.id = null;
  48523. this.lonlat = null;
  48524. this.location = null;
  48525. this.shapes = null;
  48526. this.layer = null;
  48527. }
  48528. /**
  48529. * @function SuperMap.Feature.Theme.prototype.getLocalXY
  48530. * @description 地理坐标转为像素坐标。
  48531. * @param {(SuperMap.Geometry.Point|SuperMap.Geometry.GeoText|SuperMap.LonLat)} coordinate - 地理坐标点。
  48532. * @returns {Array} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48533. */
  48534. getLocalXY(coordinate) {
  48535. var resolution = this.layer.map.getResolution();
  48536. var extent = this.layer.map.getExtent();
  48537. if (coordinate instanceof Point_Point || coordinate instanceof GeoText_GeoText) {
  48538. let x = (coordinate.x / resolution + (-extent.left / resolution));
  48539. let y = ((extent.top / resolution) - coordinate.y / resolution);
  48540. return [x, y];
  48541. } else if (coordinate instanceof LonLat_LonLat) {
  48542. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  48543. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  48544. return [x, y];
  48545. } else {
  48546. return null;
  48547. }
  48548. }
  48549. }
  48550. SuperMap.Feature = SuperMap.Feature || {};
  48551. SuperMap.Feature.Theme = feature_Theme_Theme;
  48552. // CONCATENATED MODULE: ./src/common/overlay/Graph.js
  48553. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  48554. * This program are made available under the terms of the Apache License, Version 2.0
  48555. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48556. /**
  48557. * @class SuperMap.Feature.Theme.Graph
  48558. * @classdesc 统计专题要素基类。
  48559. * @category Visualization Theme
  48560. * @description 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  48561. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.Graph.setting> 的基础属性只有 7 个,
  48562. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  48563. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  48564. * @extends SuperMap.Feature.Theme
  48565. * @param {SuperMap.Feature.Vector} data - 用户数据。
  48566. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  48567. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  48568. * @param {Object} setting - 图表配置对象。
  48569. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  48570. */
  48571. class Graph_Graph extends feature_Theme_Theme {
  48572. constructor(data, layer, fields, setting, lonlat, options) {
  48573. super(data, layer, fields, setting, lonlat, options);
  48574. /**
  48575. * @member {SuperMap.Feature.ShapeFactory} SuperMap.Feature.Theme.Graph.prototype.shapeFactory
  48576. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  48577. */
  48578. this.shapeFactory = new ShapeFactory_ShapeFactory();
  48579. /**
  48580. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.shapeParameters
  48581. * @description 当前图形参数对象,<SuperMap.Feature.ShapeParameters> 的子类对象。
  48582. */
  48583. this.shapeParameters = null;
  48584. /**
  48585. * @member {boolean} [SuperMap.Feature.Theme.Graph.prototype.RelativeCoordinate]
  48586. * @description 图形是否已经计算了相对坐标。
  48587. */
  48588. this.RelativeCoordinate = false;
  48589. /**
  48590. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.setting
  48591. * @description 图表配置对象,该对象控制着图表的可视化显示。
  48592. * @param {number} width - 专题要素(图表)宽度。
  48593. * @param {number} height - 专题要素(图表)高度。
  48594. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  48595. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  48596. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  48597. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  48598. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  48599. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  48600. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  48601. *
  48602. */
  48603. this.setting = null;
  48604. /**
  48605. * @readonly
  48606. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPoint
  48607. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48608. */
  48609. this.origonPoint = null;
  48610. /**
  48611. * @readonly
  48612. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.chartBox
  48613. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  48614. * 下端 y坐标值、 右端 x坐标值、 上端 y 坐标值;[left, bottom, right, top]。
  48615. */
  48616. this.chartBox = null;
  48617. /**
  48618. * @readonly
  48619. * @member {SuperMap.Bounds} SuperMap.Feature.Theme.Graph.prototype.chartBounds
  48620. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  48621. */
  48622. this.chartBounds = null;
  48623. /**
  48624. * @readonly
  48625. * @member {number} SuperMap.Feature.Theme.Graph.prototype.width
  48626. * @description 专题要素(图表)宽度 。
  48627. */
  48628. this.width = null;
  48629. /**
  48630. * @readonly
  48631. * @member {number} SuperMap.Feature.Theme.Graph.prototype.height
  48632. * @description 专题要素(图表)高度 。
  48633. */
  48634. this.height = null;
  48635. /**
  48636. * @readonly
  48637. * @member {number} SuperMap.Feature.Theme.Graph.prototype.XOffset
  48638. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  48639. */
  48640. this.XOffset = 0;
  48641. /**
  48642. * @readonly
  48643. * @member {number} SuperMap.Feature.Theme.Graph.prototype.YOffset
  48644. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  48645. */
  48646. this.YOffset = 0;
  48647. /**
  48648. * @readonly
  48649. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBParameter
  48650. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  48651. * 此属性用于指定数据视图框 dataViewBox 的范围。
  48652. */
  48653. this.DVBParameter = null;
  48654. /**
  48655. * @readonly
  48656. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataViewBox
  48657. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  48658. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  48659. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  48660. */
  48661. this.dataViewBox = null;
  48662. /**
  48663. * @readonly
  48664. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCodomain
  48665. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  48666. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  48667. */
  48668. this.DVBCodomain = null;
  48669. /**
  48670. * @readonly
  48671. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCenterPoint
  48672. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48673. */
  48674. this.DVBCenterPoint = null;
  48675. /**
  48676. * @readonly
  48677. * @member {string} SuperMap.Feature.Theme.Graph.prototype.DVBUnitValue
  48678. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  48679. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  48680. */
  48681. this.DVBUnitValue = null;
  48682. /**
  48683. * @readonly
  48684. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBOrigonPoint
  48685. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48686. */
  48687. this.DVBOrigonPoint = null;
  48688. /**
  48689. * @readonly
  48690. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBWidth
  48691. * @description 数据视图框宽度。
  48692. */
  48693. this.DVBWidth = null;
  48694. /**
  48695. * @readonly
  48696. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBHeight
  48697. * @description 数据视图框高度。
  48698. */
  48699. this.DVBHeight = null;
  48700. /**
  48701. * @readonly
  48702. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPointOffset
  48703. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  48704. */
  48705. this.origonPointOffset = null;
  48706. /**
  48707. * @readonly
  48708. * @member {Array.<string>} SuperMap.Feature.Theme.Graph.prototype.fields
  48709. * @description 数据{SuperMap.Feature.Vector}属性字段。
  48710. */
  48711. this.fields = fields || [];
  48712. /**
  48713. * @readonly
  48714. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataValues
  48715. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  48716. */
  48717. this.dataValues = null;
  48718. // 图表位置
  48719. if (lonlat) {
  48720. this.lonlat = lonlat;
  48721. } else {
  48722. // 默认使用 bounds 中心
  48723. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  48724. }
  48725. // 配置项检测与赋值
  48726. if (setting && setting.width && setting.height && setting.codomain) {
  48727. this.setting = setting;
  48728. }
  48729. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  48730. }
  48731. /**
  48732. * @function SuperMap.Feature.Theme.Graph.prototype.destroy
  48733. * @description 销毁专题要素。
  48734. */
  48735. destroy() {
  48736. this.shapeFactory = null;
  48737. this.shapeParameters = null;
  48738. this.width = null;
  48739. this.height = null;
  48740. this.origonPoint = null;
  48741. this.chartBox = null;
  48742. this.dataViewBox = null;
  48743. this.chartBounds = null;
  48744. this.DVBParameter = null;
  48745. this.DVBOrigonPoint = null;
  48746. this.DVBCenterPoint = null;
  48747. this.DVBWidth = null;
  48748. this.DVBHeight = null;
  48749. this.DVBCodomain = null;
  48750. this.DVBUnitValue = null;
  48751. this.origonPointOffset = null;
  48752. this.XOffset = null;
  48753. this.YOffset = null;
  48754. this.fields = null;
  48755. this.dataValues = null;
  48756. this.setting = null;
  48757. super.destroy();
  48758. }
  48759. /**
  48760. * @function SuperMap.Feature.Theme.Graph.prototype.initBaseParameter
  48761. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  48762. * 调用此函数关系到 setting 对象的以下属性。
  48763. * @param {number} width - 专题要素(图表)宽度。
  48764. * @param {number} height - 专题要素(图表)高度。
  48765. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  48766. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  48767. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  48768. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  48769. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  48770. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  48771. * @returns {boolean} 初始化参数是否成功。
  48772. */
  48773. initBaseParameter() {
  48774. // 参数初始化是否成功
  48775. var isSuccess = true;
  48776. // setting 属性是否已成功赋值
  48777. if (!this.setting) {
  48778. return false;
  48779. }
  48780. var sets = this.setting;
  48781. // 检测 setting 的必设参数
  48782. if (!(sets.width && sets.height && sets.codomain)) {
  48783. return false;
  48784. }
  48785. // 数据
  48786. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  48787. var dataEffective = feature_Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  48788. this.dataValues = dataEffective ? dataEffective : [];
  48789. // 基础参数 width, height, codomain
  48790. this.width = parseFloat(sets.width);
  48791. this.height = parseFloat(sets.height);
  48792. this.DVBCodomain = sets.codomain;
  48793. // 图表偏移
  48794. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  48795. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  48796. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  48797. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  48798. // 其他默认值
  48799. this.origonPoint = [];
  48800. this.chartBox = [];
  48801. this.dataViewBox = [];
  48802. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  48803. this.DVBOrigonPoint = [];
  48804. this.DVBCenterPoint = [];
  48805. this.origonPointOffset = [];
  48806. // 图表位置
  48807. this.resetLocation();
  48808. // 专题要素宽度 w
  48809. var w = this.width;
  48810. // 专题要素高度 h
  48811. var h = this.height;
  48812. // 专题要素像素位置 loc
  48813. var loc = this.location;
  48814. // 专题要素像素位置 loc
  48815. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  48816. // 专题要素原点(左上角)
  48817. var op = this.origonPoint;
  48818. // 图表框([left, bottom, right, top])
  48819. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  48820. // 图表框
  48821. var cb = this.chartBox;
  48822. // 数据视图框参数,它是图表框各方向对应的内偏距
  48823. var dbbP = this.DVBParameter;
  48824. // 数据视图框 ([left, bottom, right, top])
  48825. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  48826. // 数据视图框
  48827. var dvb = this.dataViewBox;
  48828. //检查数据视图框是否合法
  48829. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  48830. return false;
  48831. }
  48832. // 数据视图框原点
  48833. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  48834. // 数据视图框宽度
  48835. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  48836. // 数据视图框高度
  48837. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  48838. // 数据视图框中心点
  48839. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  48840. // 数据视图框原点与图表框的原点偏移量
  48841. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  48842. return isSuccess;
  48843. }
  48844. /**
  48845. * @function SuperMap.Feature.Theme.Graph.prototype.resetLocation
  48846. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  48847. * @param {SuperMap.LonLat} lonlat - 专题要素新的像素中心位置。
  48848. * @returns {Array.<number>} - 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48849. */
  48850. resetLocation(lonlat) {
  48851. if (lonlat) {
  48852. this.lonlat = lonlat;
  48853. }
  48854. // 获取地理位置对应的像素坐标 newLocalLX
  48855. var newLocalLX = this.getLocalXY(this.lonlat);
  48856. // 处理偏移量 XOffset, YOffset
  48857. newLocalLX[0] += this.XOffset;
  48858. newLocalLX[1] += this.YOffset;
  48859. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  48860. this.location = newLocalLX;
  48861. // 更新图表像素 Bounds
  48862. var w = this.width;
  48863. var h = this.height;
  48864. var loc = this.location;
  48865. this.chartBounds = new Bounds_Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  48866. //重新计算当前渐变色
  48867. this.resetLinearGradient();
  48868. return loc;
  48869. }
  48870. /**
  48871. * @function SuperMap.Feature.Theme.Graph.prototype.resetLinearGradient
  48872. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  48873. */
  48874. resetLinearGradient() {
  48875. //子类实现此方法
  48876. }
  48877. /**
  48878. * @function SuperMap.Feature.Theme.Graph.prototype.shapesConvertToRelativeCoordinate
  48879. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  48880. */
  48881. shapesConvertToRelativeCoordinate() {
  48882. var shapes = this.shapes;
  48883. var shapeROP = this.location;
  48884. for (var i = 0, len = shapes.length; i < len; i++) {
  48885. shapes[i].refOriginalPosition = shapeROP;
  48886. var style = shapes[i].style;
  48887. for (var sty in style) {
  48888. switch (sty) {
  48889. case "pointList":
  48890. var pl = style[sty];
  48891. for (var j = 0, len2 = pl.length; j < len2; j++) {
  48892. pl[j][0] -= shapeROP[0];
  48893. pl[j][1] -= shapeROP[1];
  48894. }
  48895. break;
  48896. case "x":
  48897. style[sty] -= shapeROP[0];
  48898. break;
  48899. case "y":
  48900. style[sty] -= shapeROP[1];
  48901. break;
  48902. default:
  48903. break;
  48904. }
  48905. }
  48906. }
  48907. this.RelativeCoordinate = true;
  48908. }
  48909. /**
  48910. * @function SuperMap.Feature.Theme.Graph.prototype.assembleShapes
  48911. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  48912. * 重写此方法的步骤:<br>
  48913. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  48914. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  48915. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  48916. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  48917. * @example
  48918. * //子类实现 assembleShapes() 接口的步骤示例:
  48919. * assembleShapes: function(){
  48920. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  48921. *
  48922. * // 图表配置对象
  48923. * var sets = this.setting;
  48924. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  48925. * if(!sets.dataViewBoxParameter){
  48926. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  48927. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  48928. * }
  48929. * else{
  48930. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  48931. * }
  48932. * }
  48933. *
  48934. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  48935. * if(!this.initBaseParameter()) return;
  48936. *
  48937. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  48938. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  48939. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  48940. * var uv = this.DVBUnitValue;
  48941. *
  48942. * // 图形参数计算代码......
  48943. *
  48944. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  48945. * var barParams = new SuperMap.Feature.ShapeParameters.Polygon(poiLists);
  48946. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  48947. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  48948. * // 图形携带数据ID信息
  48949. * barParams.refDataID = this.data.id;
  48950. * // 创建图形并添加到图表图形数组中
  48951. * this.shapes.push(this.shapeFactory.createShape(barParams));
  48952. *
  48953. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  48954. * this.shapesConvertToRelativeCoordinate();
  48955. * },
  48956. */
  48957. assembleShapes() {
  48958. //子类必须实现此方法
  48959. }
  48960. /**
  48961. * @function SuperMap.Feature.Theme.Graph.prototype.getLocalXY
  48962. * @description 地理坐标转为像素坐标。
  48963. * @param {SuperMap.Lonlat} lonlat - 带转换的地理坐标。
  48964. * @returns 屏幕像素坐标。
  48965. */
  48966. getLocalXY(lonlat) {
  48967. return this.layer.getLocalXY(lonlat);
  48968. }
  48969. }
  48970. /**
  48971. * @function SuperMap.Feature.Theme.getDataValues
  48972. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  48973. * @param {SuperMap.Feature.Vector} data - 数据。
  48974. * @param {Array.<string>} [fields] - 字段名数组。
  48975. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  48976. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  48977. */
  48978. feature_Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  48979. if (!data.attributes) {
  48980. return false;
  48981. }
  48982. var fieldsValue = [];
  48983. var attrs = data.attributes;
  48984. for (var i = 0; i < fields.length; i++) {
  48985. for (var field in attrs) {
  48986. if (field !== fields[i]) {
  48987. continue
  48988. }
  48989. // 数字转换判断
  48990. try {
  48991. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  48992. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  48993. } else {
  48994. fieldsValue.push(parseFloat(attrs[field].toString()));
  48995. }
  48996. } catch (e) {
  48997. throw new Error("not a number")
  48998. }
  48999. }
  49000. }
  49001. if (fieldsValue.length === fields.length) {
  49002. return fieldsValue;
  49003. } else {
  49004. return false;
  49005. }
  49006. };
  49007. SuperMap.Feature.Theme.Graph = Graph_Graph;
  49008. // CONCATENATED MODULE: ./src/common/overlay/Bar.js
  49009. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  49010. * This program are made available under the terms of the Apache License, Version 2.0
  49011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49012. /**
  49013. * @class SuperMap.Feature.Theme.Bar
  49014. * @classdesc 柱状图 。
  49015. * @category Visualization Theme
  49016. * @example
  49017. * // barStyleByCodomain参数用法如下:
  49018. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49019. * // start: 值域值下限(包含);
  49020. * // end: 值域值上限(不包含);
  49021. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  49022. * // barStyleByCodomain 数组形如:
  49023. * [
  49024. * {
  49025. * start:0,
  49026. * end:250,
  49027. * style:{
  49028. * fillColor:"#00CD00"
  49029. * }
  49030. * },
  49031. * {
  49032. * start:250,
  49033. * end:500,
  49034. * style:{
  49035. * fillColor:"#00EE00"
  49036. * }
  49037. * },
  49038. * {
  49039. * start:500,
  49040. * end:750,
  49041. * style:{
  49042. * fillColor:"#00FF7F"
  49043. * }
  49044. * },
  49045. * {
  49046. * start:750,
  49047. * end:1500,
  49048. * style:{
  49049. * fillColor:"#00FF00"
  49050. * }
  49051. * }
  49052. * ]
  49053. * @extends SuperMap.Feature.Theme.Graph
  49054. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49055. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49056. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  49057. * @param {SuperMap.Feature.Theme.Bar.setting} setting - 图表配置对象。
  49058. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49059. */
  49060. class Bar_Bar extends Graph_Graph {
  49061. constructor(data, layer, fields, setting, lonlat) {
  49062. super(data, layer, fields, setting, lonlat);
  49063. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  49064. }
  49065. /**
  49066. * @function SuperMap.Feature.Theme.Bar.prototype.destroy
  49067. * @override
  49068. */
  49069. destroy() {
  49070. super.destroy();
  49071. }
  49072. /**
  49073. * @function SuperMap.Feature.Theme.Bar.prototype.assembleShapes
  49074. * @description 图表图形装配函数。
  49075. */
  49076. assembleShapes() {
  49077. //默认渐变颜色数组
  49078. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  49079. //默认阴影
  49080. var deafaultShawdow = {
  49081. showShadow: true,
  49082. shadowBlur: 8,
  49083. shadowColor: "rgba(100,100,100,0.8)",
  49084. shadowOffsetX: 2,
  49085. shadowOffsetY: 2
  49086. };
  49087. // 图表配置对象
  49088. var sets = this.setting;
  49089. if (!sets.barLinearGradient) {
  49090. sets.barLinearGradient = deafaultColors;
  49091. }
  49092. // 默认数据视图框
  49093. if (!sets.dataViewBoxParameter) {
  49094. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49095. sets.dataViewBoxParameter = [45, 15, 15, 15];
  49096. } else {
  49097. sets.dataViewBoxParameter = [5, 5, 5, 5];
  49098. }
  49099. }
  49100. // 重要步骤:初始化参数
  49101. if (!this.initBaseParameter()) {
  49102. return;
  49103. }
  49104. // 值域
  49105. var codomain = this.DVBCodomain;
  49106. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  49107. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  49108. // 数据视图域
  49109. var dvb = this.dataViewBox;
  49110. // 用户数据值
  49111. var fv = this.dataValues;
  49112. if (fv.length < 1) {
  49113. return;
  49114. } // 没有数据
  49115. // 数据溢出值域范围处理
  49116. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  49117. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49118. return;
  49119. }
  49120. }
  49121. // 获取 x 轴上的图形信息
  49122. var xShapeInfo = this.calculateXShapeInfo();
  49123. if (!xShapeInfo) {
  49124. return;
  49125. }
  49126. // 每个柱条 x 位置
  49127. var xsLoc = xShapeInfo.xPositions;
  49128. // 柱条宽度
  49129. var xsWdith = xShapeInfo.width;
  49130. // 背景框,默认启用
  49131. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  49132. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  49133. this.shapes.push(ShapeFactory_ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49134. }
  49135. // 坐标轴, 默认启用
  49136. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49137. // 添加坐标轴图形数组
  49138. this.shapes = this.shapes.concat(ShapeFactory_ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  49139. }
  49140. for (var i = 0; i < fv.length; i++) {
  49141. // 计算柱条 top 边的 y 轴坐标值
  49142. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  49143. // 柱条节点数组
  49144. var poiLists = [
  49145. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  49146. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  49147. [xsLoc[i] + xsWdith / 2, yPx],
  49148. [xsLoc[i] - xsWdith / 2, yPx]
  49149. ];
  49150. // 柱条参数对象(一个面参数对象)
  49151. var barParams = new feature_Polygon_Polygon(poiLists);
  49152. // 柱条 阴影 style
  49153. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  49154. if (sets.barShadowStyle) {
  49155. var sss = sets.barShadowStyle;
  49156. if (sss.shadowBlur) {
  49157. deafaultShawdow.shadowBlur = sss.shadowBlur;
  49158. }
  49159. if (sss.shadowColor) {
  49160. deafaultShawdow.shadowColor = sss.shadowColor;
  49161. }
  49162. if (sss.shadowOffsetX) {
  49163. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  49164. }
  49165. if (sss.shadowOffsetY) {
  49166. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  49167. }
  49168. }
  49169. barParams.style = {};
  49170. Util_Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  49171. }
  49172. // 图形携带的数据信息
  49173. barParams.refDataID = this.data.id;
  49174. barParams.dataInfo = {
  49175. field: this.fields[i],
  49176. value: fv[i]
  49177. };
  49178. // 柱条 hover click
  49179. if (typeof(sets.barHoverAble) !== "undefined") {
  49180. barParams.hoverable = sets.barHoverAble;
  49181. }
  49182. if (typeof(sets.barClickAble) !== "undefined") {
  49183. barParams.clickable = sets.barClickAble;
  49184. }
  49185. // 创建柱条并添加到图表图形数组中
  49186. this.shapes.push(this.shapeFactory.createShape(barParams));
  49187. }
  49188. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49189. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49190. this.shapesConvertToRelativeCoordinate();
  49191. }
  49192. /**
  49193. * @function SuperMap.Feature.Theme.Bar.prototype.calculateXShapeInfo
  49194. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  49195. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  49196. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49197. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49198. * 本函数中图形配置对象 setting 可设属性:
  49199. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  49200. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  49201. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  49202. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  49203. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49204. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49205. *
  49206. */
  49207. calculateXShapeInfo() {
  49208. var dvb = this.dataViewBox; // 数据视图框
  49209. var sets = this.setting; // 图表配置对象
  49210. var fvc = this.dataValues.length; // 数组值个数
  49211. if (fvc < 1) {
  49212. return null;
  49213. }
  49214. var xBlank; // x 轴空白间隔参数
  49215. var xShapePositions = []; // x 轴上图形的位置
  49216. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  49217. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  49218. // x 轴空白间隔参数处理
  49219. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  49220. xBlank = sets.xShapeBlank;
  49221. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  49222. if (xsLen <= fvc) {
  49223. return null;
  49224. }
  49225. xShapeWidth = xsLen / fvc
  49226. } else {
  49227. // 默认使用等距离空白间隔,空白间隔为图形宽度
  49228. xShapeWidth = dvbWidth / (2 * fvc + 1);
  49229. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  49230. }
  49231. // 图形 x 轴上的位置计算
  49232. var xOffset = 0
  49233. for (var i = 0; i < fvc; i++) {
  49234. if (i == 0) {
  49235. xOffset = xBlank[0] + xShapeWidth / 2;
  49236. } else {
  49237. xOffset += (xShapeWidth + xBlank[1]);
  49238. }
  49239. xShapePositions.push(dvb[0] + xOffset);
  49240. }
  49241. return {
  49242. "xPositions": xShapePositions,
  49243. "width": xShapeWidth
  49244. };
  49245. }
  49246. /**
  49247. * @function SuperMap.Feature.Theme.Bar.prototype.resetLinearGradient
  49248. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  49249. */
  49250. resetLinearGradient() {
  49251. if (this.RelativeCoordinate) {
  49252. var shpelength = this.shapes.length;
  49253. var barLinearGradient = this.setting.barLinearGradient;
  49254. var index = -1;
  49255. for (var i = 0; i < shpelength; i++) {
  49256. var shape = this.shapes[i];
  49257. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  49258. var style = shape.style;
  49259. //计算出当前的绝对 x y
  49260. var x1 = this.location[0] + style.pointList[0][0];
  49261. var x2 = this.location[0] + style.pointList[1][0];
  49262. //渐变颜色
  49263. index++;
  49264. //以防定义的颜色数组不够用
  49265. if (index >= barLinearGradient.length) {
  49266. index = index % barLinearGradient.length;
  49267. }
  49268. var color1 = barLinearGradient[index][0];
  49269. var color2 = barLinearGradient[index][1];
  49270. //颜色
  49271. var zcolor = new Color_Color();
  49272. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  49273. [[0, color1], [1, color2]]);
  49274. //赋值
  49275. shape.style.color = linearGradient;
  49276. }
  49277. }
  49278. }
  49279. }
  49280. }
  49281. /**
  49282. * @typedef {Object} SuperMap.Feature.Theme.Bar.setting
  49283. * @property {number} width - 专题要素(图表)宽度。
  49284. * @property {number} height - 专题要素(图表)高度。
  49285. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49286. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49287. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49288. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)
  49289. * 在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];
  49290. * 不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  49291. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49292. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  49293. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  49294. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  49295. * 则 backgroundRadius 为 [r1、r2、r3、r4]。
  49296. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  49297. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  49298. * @property {boolean} [showShadow=true] - 阴影开关。
  49299. * @property {Object} [barShadowStyle] - 阴影样式,如:{shadowBlur : 8, shadowOffsetX: 2 , shadowOffsetY : 2,shadowColor : "rgba(100,100,100,0.8)"}
  49300. * @property {Array.<string>} [barLinearGradient] - 按字段设置柱条样式[渐变开始颜色,渐变终止颜色] 与 themeLayer.themeFields 中的字段一一对应),
  49301. * 如:[["#00FF00","#00CD00"],["#00CCFF","#5E87A2"],["#00FF66","#669985"],["#CCFF00","#94A25E"],["#FF9900","#A2945E"]]
  49302. * @property {boolean} [useAxis=true] - 是否使用坐标轴。</br>
  49303. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  49304. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  49305. * @property {number} [axisYTick=0] - y 轴刻度数量。
  49306. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  49307. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  49308. * @property {Array.<number>} [axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  49309. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  49310. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  49311. * @property {Array.<number>} [axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  49312. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  49313. * @property {SuperMap.Feature.ShapeParameters.Line.style} xReferenceLineStyle - 水平参考线样式。
  49314. * @property {Object} barStyle - 柱状图柱条基础 style,此参数控制柱条基础样式,优先级低于 barStyleByFields 和 barStyleByCodomain。
  49315. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} barStyleByFields - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields|L.supermap.graphThemeLayer.themeFields|ol.source.Graph.themeFields|mapboxgl.supermap.GraphThemeLayer.themeFields>)为柱条赋 style,此参数按字段控制柱条样式,优先级低于 barStyleByCodomain,高于 barStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条使用 style1,字段 POP_1995 对应的柱条使用 style2 ,字段 POP_1999 对应的柱条使用 style3。
  49316. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} barStyleByCodomain - 按柱条代表的数据值所在值域范围控制柱条样式,优先级高于 barStyle 和 barStyleByFields。
  49317. * @property {Object} [barHoverStyle] - 柱条 hover 状态时的样式,barHoverAble 为 true 时有效。
  49318. * @property {Object} [barHoverAble] - 是否允许柱条使用 hover 状态,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  49319. * @property {Object} [barClickAble] - 是否允许柱条被点击,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  49320. */
  49321. SuperMap.Feature.Theme.Bar = Bar_Bar;
  49322. // CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  49323. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  49324. * This program are made available under the terms of the Apache License, Version 2.0
  49325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49326. /**
  49327. * @class SuperMap.Feature.Theme.Bar3D
  49328. * @classdesc 三维柱状图 。
  49329. * @category Visualization Theme
  49330. * @extends SuperMap.Feature.Theme.Graph
  49331. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49332. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49333. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49334. * @param {SuperMap.Feature.Theme.Bar3D.setting} setting - 图表配置对象。
  49335. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  49336. *
  49337. *
  49338. * @example
  49339. * // barFaceStyleByCodomain 用法示例如下:
  49340. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49341. * // start: 值域值下限(包含);
  49342. * // end: 值域值上限(不包含);
  49343. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  49344. * // barFaceStyleByCodomain 数组形如:
  49345. * [
  49346. * {
  49347. * start:0,
  49348. * end:250,
  49349. * style:{
  49350. * fillColor:"#00CD00"
  49351. * }
  49352. * },
  49353. * {
  49354. * start:250,
  49355. * end:500,
  49356. * style:{
  49357. * fillColor:"#00EE00"
  49358. * }
  49359. * },
  49360. * {
  49361. * start:500,
  49362. * end:750,
  49363. * style:{
  49364. * fillColor:"#00FF7F"
  49365. * }
  49366. * },
  49367. * {
  49368. * start:750,
  49369. * end:1500,
  49370. * style:{
  49371. * fillColor:"#00FF00"
  49372. * }
  49373. * }
  49374. * ]
  49375. *
  49376. * @example
  49377. * // barSideStyleByCodomain 用法示例如下:
  49378. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49379. * // start: 值域值下限(包含);
  49380. * // end: 值域值上限(不包含);
  49381. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  49382. * // barSideStyleByCodomain 数组形如:
  49383. * [
  49384. * {
  49385. * start:0,
  49386. * end:250,
  49387. * style:{
  49388. * fillColor:"#00CD00"
  49389. * }
  49390. * },
  49391. * {
  49392. * start:250,
  49393. * end:500,
  49394. * style:{
  49395. * fillColor:"#00EE00"
  49396. * }
  49397. * },
  49398. * {
  49399. * start:500,
  49400. * end:750,
  49401. * style:{
  49402. * fillColor:"#00FF7F"
  49403. * }
  49404. * },
  49405. * {
  49406. * start:750,
  49407. * end:1500,
  49408. * style:{
  49409. * fillColor:"#00FF00"
  49410. * }
  49411. * }
  49412. * ]
  49413. *
  49414. * @example
  49415. * // barTopStyleByCodomain 用法示例如下:
  49416. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49417. * // start: 值域值下限(包含);
  49418. * // end: 值域值上限(不包含);
  49419. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<SuperMap.Feature.ShapeParameters.Polygon.style> 。
  49420. * // barTopStyleByCodomain 数组形如:
  49421. * [
  49422. * {
  49423. * start:0,
  49424. * end:250,
  49425. * style:{
  49426. * fillColor:"#00CD00"
  49427. * }
  49428. * },
  49429. * {
  49430. * start:250,
  49431. * end:500,
  49432. * style:{
  49433. * fillColor:"#00EE00"
  49434. * }
  49435. * },
  49436. * {
  49437. * start:500,
  49438. * end:750,
  49439. * style:{
  49440. * fillColor:"#00FF7F"
  49441. * }
  49442. * },
  49443. * {
  49444. * start:750,
  49445. * end:1500,
  49446. * style:{
  49447. * fillColor:"#00FF00"
  49448. * }
  49449. * }
  49450. * ]
  49451. */
  49452. class Bar3D_Bar3D extends Graph_Graph {
  49453. constructor(data, layer, fields, setting, lonlat) {
  49454. super(data, layer, fields, setting, lonlat);
  49455. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  49456. }
  49457. /**
  49458. * @function SuperMap.Feature.Theme.Bar3D.prototype.destroy
  49459. * @override
  49460. */
  49461. destroy() {
  49462. super.destroy();
  49463. }
  49464. /**
  49465. * @function SuperMap.Feature.Theme.Bar3D.prototype.assembleShapes
  49466. * @description 图形装配实现(扩展接口)。
  49467. */
  49468. assembleShapes() {
  49469. // 图表配置对象
  49470. var sets = this.setting;
  49471. // 默认数据视图框
  49472. if (!sets.dataViewBoxParameter) {
  49473. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49474. sets.dataViewBoxParameter = [45, 25, 20, 20];
  49475. } else {
  49476. sets.dataViewBoxParameter = [5, 5, 5, 5];
  49477. }
  49478. }
  49479. // 3d 柱图的坐标轴默认使用坐标轴箭头
  49480. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  49481. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  49482. // 重要步骤:初始化参数
  49483. if (!this.initBaseParameter()) {
  49484. return;
  49485. }
  49486. // 值域
  49487. var codomain = this.DVBCodomain;
  49488. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  49489. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  49490. // 数据视图域
  49491. var dvb = this.dataViewBox;
  49492. // 用户数据值
  49493. var fv = this.dataValues;
  49494. if (fv.length < 1) {
  49495. return;
  49496. } // 没有数据
  49497. // 数据溢出值域范围处理
  49498. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  49499. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49500. return;
  49501. }
  49502. }
  49503. // 获取 x 轴上的图形信息
  49504. var xShapeInfo = this.calculateXShapeInfo();
  49505. if (!xShapeInfo) {
  49506. return;
  49507. }
  49508. // 每个柱条 x 位置
  49509. var xsLoc = xShapeInfo.xPositions;
  49510. // 柱条宽度
  49511. var xsWdith = xShapeInfo.width;
  49512. // 坐标轴, 默认启用
  49513. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  49514. this.shapes.push(ShapeFactory_ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49515. }
  49516. // 坐标轴
  49517. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  49518. sets.axis3DParameter = 20;
  49519. }
  49520. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49521. this.shapes = this.shapes.concat(ShapeFactory_ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  49522. }
  49523. // 3d 偏移量, 默认值 10;
  49524. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  49525. for (let i = 0; i < fv.length; i++) {
  49526. // 无 3d 偏移量时的柱面顶部 y 坐标
  49527. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  49528. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  49529. var iPoiL = xsLoc[i] - xsWdith / 2;
  49530. var iPoiR = xsLoc[i] + xsWdith / 2;
  49531. // 3d 柱顶面节点
  49532. var bar3DTopPois = [
  49533. [iPoiL, yPx],
  49534. [iPoiR, yPx],
  49535. [iPoiR - offset3d, yPx + offset3d],
  49536. [iPoiL - offset3d, yPx + offset3d]
  49537. ];
  49538. // 3d 柱侧面节点
  49539. var bar3DSidePois = [
  49540. [iPoiR, yPx],
  49541. [iPoiR - offset3d, yPx + offset3d],
  49542. [iPoiR - offset3d, dvb[1] + offset3d],
  49543. [iPoiR, dvb[1]]
  49544. ];
  49545. // 3d 柱正面节点
  49546. var bar3DFacePois = [
  49547. [iPoiL - offset3d, dvb[1] + offset3d],
  49548. [iPoiR - offset3d, dvb[1] + offset3d],
  49549. [iPoiR - offset3d, yPx + offset3d],
  49550. [iPoiL - offset3d, yPx + offset3d]
  49551. ];
  49552. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  49553. bar3DFacePois = [
  49554. [iPoiL, dvb[1]],
  49555. [iPoiR, dvb[1]],
  49556. [iPoiR, yPx],
  49557. [iPoiL, yPx]
  49558. ];
  49559. }
  49560. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  49561. var polyTopSP = new feature_Polygon_Polygon(bar3DTopPois);
  49562. var polySideSP = new feature_Polygon_Polygon(bar3DSidePois);
  49563. var polyFaceSP = new feature_Polygon_Polygon(bar3DFacePois);
  49564. // 侧面、正面图形 style 默认值
  49565. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  49566. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  49567. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  49568. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  49569. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  49570. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  49571. // 顶面、侧面、正面图形 style
  49572. polyFaceSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool({
  49573. stroke: true,
  49574. strokeColor: "#ffffff",
  49575. fillColor: "#ee9900"
  49576. },
  49577. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  49578. polySideSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool({
  49579. stroke: true,
  49580. strokeColor: "#ffffff",
  49581. fillColor: "#ee9900"
  49582. },
  49583. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  49584. polyTopSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool({
  49585. stroke: true,
  49586. strokeColor: "#ffffff",
  49587. fillColor: "#ee9900"
  49588. },
  49589. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  49590. // 3d 柱条高亮样式
  49591. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  49592. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  49593. polyFaceSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  49594. polySideSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  49595. polyTopSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  49596. // 图形携带的数据 id 信息 & 高亮模式
  49597. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  49598. // hover 模式(组合)
  49599. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  49600. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  49601. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util_Util.createUniqueID("lr_shg");
  49602. // 图形携带的数据信息
  49603. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  49604. field: this.fields[i],
  49605. value: fv[i]
  49606. };
  49607. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  49608. if (typeof(sets.barHoverAble) !== "undefined") {
  49609. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  49610. }
  49611. if (typeof(sets.barClickAble) !== "undefined") {
  49612. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  49613. }
  49614. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  49615. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  49616. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  49617. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  49618. }
  49619. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49620. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49621. this.shapesConvertToRelativeCoordinate();
  49622. }
  49623. /**
  49624. * @function SuperMap.Feature.Theme.Bar3D.prototype.calculateXShapeInfo
  49625. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  49626. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  49627. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49628. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49629. * 本函数中图形配置对象 setting 可设属性:
  49630. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  49631. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  49632. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  49633. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  49634. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49635. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49636. */
  49637. calculateXShapeInfo() {
  49638. var dvb = this.dataViewBox; // 数据视图框
  49639. var sets = this.setting; // 图表配置对象
  49640. var fvc = this.dataValues.length; // 数组值个数
  49641. if (fvc < 1) {
  49642. return null;
  49643. }
  49644. var xBlank; // x 轴空白间隔参数
  49645. var xShapePositions = []; // x 轴上图形的位置
  49646. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  49647. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  49648. // x 轴空白间隔参数处理
  49649. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  49650. xBlank = sets.xShapeBlank;
  49651. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  49652. if (xsLen <= fvc) {
  49653. return null;
  49654. }
  49655. xShapeWidth = xsLen / fvc
  49656. } else {
  49657. // 默认使用等距离空白间隔,空白间隔为图形宽度
  49658. xShapeWidth = dvbWidth / (2 * fvc + 1);
  49659. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  49660. }
  49661. // 图形 x 轴上的位置计算
  49662. var xOffset = 0
  49663. for (var i = 0; i < fvc; i++) {
  49664. if (i == 0) {
  49665. xOffset = xBlank[0] + xShapeWidth / 2;
  49666. } else {
  49667. xOffset += (xShapeWidth + xBlank[1]);
  49668. }
  49669. xShapePositions.push(dvb[0] + xOffset);
  49670. }
  49671. return {
  49672. "xPositions": xShapePositions,
  49673. "width": xShapeWidth
  49674. };
  49675. }
  49676. }
  49677. /**
  49678. * @typedef {Object} SuperMap.Feature.Theme.Bar3D.setting
  49679. * @property {number} width - 专题要素(图表)宽度。
  49680. * @property {number} height - 专题要素(图表)高度。
  49681. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49682. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49683. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49684. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 25, 20, 20];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  49685. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49686. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  49687. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  49688. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  49689. * @property {Array.<number>} [xShapeBlank] - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  49690. * @property {number} [bar3DParameter=10] - 3D 柱状参数,3d柱形正面相对于背面向 x 轴和 y 轴负方向偏移的绝对值。
  49691. * @property {boolean} [useAxis=true] - 是否使用坐标轴。
  49692. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  49693. * @property {boolean} [axisUseArrow=true] -坐标轴是否使用箭头。
  49694. * @property {number} [axisYTick=0] - y 轴刻度数量。
  49695. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  49696. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  49697. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  49698. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  49699. * @property {SuperMap.Feature.ShapeParameters.Label.style} axisXLabelsStyle - x 轴上的标签组样式。
  49700. * @property {Array.<number>} axisXLabelsOffset - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:-10;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:10。
  49701. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  49702. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  49703. * @property {number} [axis3DParameter=20] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  49704. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} barFaceStyle - 3d 柱状图柱条正面基础 style,此参数控制柱条正面基础样式,优先级低于 barFaceStyleByFields 和 barFaceStyleByCodomain。
  49705. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} [barFaceStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为柱条正面赋 style,此参数按字段控制柱条正面样式,优先级低于 barFaceStyleByCodomain,高于 barFaceStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barFaceStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条正面使用 style1,字段 POP_1995 对应的柱条正面使用 style2 ,字段 POP_1999 对应的柱条正面使用 style3。
  49706. * @property {Array.<Object>} [barFaceStyleByCodomain] - 按柱条正面代表的数据值所在值域范围控制柱条正面样式,优先级高于 barFaceStyle 和 barFaceStyleByFields。
  49707. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barSideStyle=barFaceStyle] - 3d 柱状图柱条侧面基础 style,此参数控制柱条侧面基础样式,优先级低于 barSideStyleByFields 和 barSideStyleByCodomain。
  49708. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} [barSideStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为柱条侧面赋style,此数按字段控制柱条侧面样式,优先级低于 barSideStyleByCodomain,高于 barSideStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barSideStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条侧面使用 style1,字段 POP_1995对应的柱条侧面使用style2,字段POP_1999对应的柱条侧面使用style3。默认值:barFaceStyleByFields。
  49709. * @property {Array.<Object>} [barSideStyleByCodomain=barFaceStyleByCodomain] - 按柱条侧面代表的数据值所在值域范围控制柱条侧面样式,优先级高于 barSideStyle 和 barSideStyleByFields。
  49710. * @property {Object} [barFaceHoverStyle] - 3d 柱条正面 hover 状态时的样式,barHoverAble 为 true 时有效。
  49711. * @property {Object} [barSideHoverStyle=barFaceHoverStyle] - 3d 柱条侧面 hover 状态时的样式,barHoverAble 为 true 时有效。
  49712. * @property {Object} [barTopHoverStyle=barFaceHoverStyle] - 3d 柱条顶面 hover 状态时的样式,barHoverAble 为 true 时有效。
  49713. * @property {boolean} [barHoverAble=true] - 是否允许柱条使用 hover 状态。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  49714. * @property {boolean} [barClickAble=true] - 是否允许柱条被点击。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  49715. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barTopStyle=barFaceStyle] - 3d 柱状图柱条顶面基础 style,此参数控制柱条顶面基础样式,优先级低于 barTopStyleByFields 和 barTopStyleByCodomain。
  49716. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} [barTopStyleByFields=barFaceStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为柱条顶面赋 style,此参数按字段控制柱条顶面样式,优先级低于 barTopStyleByCodomain,高于 barTopStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barTopStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条顶面使用 style1,字段 POP_1995 对应的柱条顶面使用 style2 ,字段 POP_1999 对应的柱条顶面使用 style3。
  49717. * @property {Array.<Object>} [barTopStyleByCodomain=barFaceStyleByCodomain] - 按柱条顶面代表的数据值所在值域范围控制柱条顶面样式,优先级高于 barTopStyle 和 barTopStyleByFields。
  49718. */
  49719. SuperMap.Feature.Theme.Bar3D = Bar3D_Bar3D;
  49720. // CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  49721. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  49722. * This program are made available under the terms of the Apache License, Version 2.0
  49723. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49724. /**
  49725. * @class SuperMap.Feature.Theme.RankSymbol
  49726. * @classdesc 符号专题要素基类。
  49727. * @category Visualization Theme
  49728. * @description 此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  49729. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.RankSymbol.setting> 的基础属性只有 5 个,
  49730. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  49731. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  49732. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49733. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  49734. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49735. * @param {Object} setting - 图表配置对象。
  49736. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49737. *
  49738. * @extends SuperMap.Feature.Theme.Graph
  49739. *
  49740. */
  49741. class RankSymbol_RankSymbol extends Graph_Graph {
  49742. constructor(data, layer, fields, setting, lonlat, options) {
  49743. super(data, layer, fields, setting, lonlat, options);
  49744. /**
  49745. * @member SuperMap.Feature.Theme.RankSymbol.prototype.setting -{Object}
  49746. * @description 符号配置对象,该对象控制着图表的可视化显示。
  49747. * 下面是此配置对象的 5 个基础可设属性:<br>
  49748. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49749. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49750. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49751. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49752. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49753. * 除了以上 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同。
  49754. * 请在此类的子类中查看 setting 对象的可设属性和属性含义。
  49755. */
  49756. this.setting = null;
  49757. // 配置项检测与赋值
  49758. if (setting && setting.codomain) {
  49759. this.setting = setting;
  49760. this.DVBCodomain = this.setting.codomain;
  49761. }
  49762. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  49763. }
  49764. /**
  49765. * @function SuperMap.Feature.Theme.RankSymbol.prototype.destroy
  49766. * @description 销毁专题要素。
  49767. */
  49768. destroy() {
  49769. this.setting = null;
  49770. super.destroy();
  49771. }
  49772. /**
  49773. * @function SuperMap.Feature.Theme.RankSymbol.prototype.initBaseParameter
  49774. * @description 初始化专题要素(图形)基础参数。
  49775. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  49776. * 调用此函数关系到 setting 对象的以下属性。
  49777. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49778. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  49779. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  49780. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49781. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49782. * @returns {boolean} 初始化参数是否成功。
  49783. */
  49784. initBaseParameter() {
  49785. // 参数初始化是否成功
  49786. var isSuccess = true;
  49787. // setting 属性是否已成功赋值
  49788. if (!this.setting) {
  49789. return false;
  49790. }
  49791. var sets = this.setting;
  49792. // 图表偏移
  49793. if (sets.XOffset) {
  49794. this.XOffset = sets.XOffset;
  49795. }
  49796. if (sets.YOffset) {
  49797. this.YOffset = sets.YOffset;
  49798. }
  49799. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  49800. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  49801. // 其他默认值
  49802. this.origonPoint = [];
  49803. this.chartBox = [];
  49804. this.dataViewBox = [];
  49805. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  49806. this.DVBOrigonPoint = [];
  49807. this.DVBCenterPoint = [];
  49808. this.origonPointOffset = [];
  49809. // 图表位置
  49810. this.resetLocation();
  49811. // 专题要素宽度 w
  49812. var w = this.width;
  49813. // 专题要素高度 h
  49814. var h = this.height;
  49815. // 专题要素像素位置 loc
  49816. var loc = this.location;
  49817. // 专题要素像素位置 loc
  49818. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  49819. // 专题要素原点(左上角)
  49820. var op = this.origonPoint;
  49821. // 图表框([left, bottom, right, top])
  49822. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  49823. // 图表框
  49824. var cb = this.chartBox;
  49825. // 数据视图框参数,它是图表框各方向对应的内偏距
  49826. var dbbP = this.DVBParameter;
  49827. // 数据视图框 ([left, bottom, right, top])
  49828. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  49829. // 数据视图框
  49830. var dvb = this.dataViewBox;
  49831. //检查数据视图框是否合法
  49832. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  49833. return false;
  49834. }
  49835. // 数据视图框原点
  49836. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  49837. // 数据视图框宽度
  49838. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  49839. // 数据视图框高度
  49840. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  49841. // 数据视图框中心点
  49842. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  49843. // 数据视图框原点与图表框的原点偏移量
  49844. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  49845. return isSuccess;
  49846. }
  49847. }
  49848. SuperMap.Feature.Theme.RankSymbol = RankSymbol_RankSymbol;
  49849. // CONCATENATED MODULE: ./src/common/overlay/Circle.js
  49850. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  49851. * This program are made available under the terms of the Apache License, Version 2.0
  49852. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49853. /**
  49854. * @class SuperMap.Feature.Theme.Circle
  49855. * @classdesc 圆类。
  49856. * @category Visualization Theme
  49857. * @extends SuperMap.Feature.Theme.RankSymbol
  49858. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49859. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  49860. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49861. * @param {SuperMap.Feature.Theme.Circle.setting} setting - 图表配置对象。
  49862. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  49863. */
  49864. class overlay_Circle_Circle extends RankSymbol_RankSymbol {
  49865. constructor(data, layer, fields, setting, lonlat) {
  49866. super(data, layer, fields, setting, lonlat);
  49867. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  49868. }
  49869. /**
  49870. * @function SuperMap.Feature.Theme.Circle.prototype.destroy
  49871. * @override
  49872. */
  49873. destroy() {
  49874. super.destroy();
  49875. }
  49876. /**
  49877. * @function SuperMap.Feature.Theme.Circle.prototype.assembleShapes
  49878. * @description 装配图形(扩展接口)。
  49879. */
  49880. assembleShapes() {
  49881. //默认填充颜色
  49882. var defaultFillColor = "#ff9277";
  49883. // setting 属性是否已成功赋值
  49884. if (!this.setting) {
  49885. return false;
  49886. }
  49887. var sets = this.setting;
  49888. // 检测 setting 的必设参数
  49889. if (!(sets.codomain)) {
  49890. return false;
  49891. }
  49892. // 数据
  49893. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  49894. var dataEffective = feature_Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  49895. this.dataValues = dataEffective ? dataEffective : [];
  49896. // 数据值数组
  49897. var fv = this.dataValues;
  49898. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  49899. //if(fv[0] < 0) return; //数据为负值
  49900. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  49901. if (!sets.maxR) {
  49902. sets.maxR = 100;
  49903. }
  49904. if (!sets.minR) {
  49905. sets.minR = 0;
  49906. }
  49907. // 值域范围
  49908. var codomain = this.DVBCodomain;
  49909. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  49910. // 用户定义了值域范围
  49911. if (codomain && codomain[1] - codomain[0] > 0) {
  49912. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  49913. } else {
  49914. //this.DVBUnitValue = sets.maxR / maxValue;
  49915. this.DVBUnitValue = sets.maxR;
  49916. }
  49917. var uv = this.DVBUnitValue;
  49918. //圆半径
  49919. var r = fv[0] * uv + sets.minR;
  49920. this.width = 2 * r;
  49921. this.height = 2 * r;
  49922. // 重要步骤:初始化参数
  49923. if (!this.initBaseParameter()) {
  49924. return;
  49925. }
  49926. //假如用户设置了值域范围 没有在值域范围直接返回
  49927. if (codomain) {
  49928. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  49929. return;
  49930. }
  49931. }
  49932. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  49933. //圆形对象参数
  49934. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  49935. //circleSP.sytle 初始化
  49936. circleSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  49937. //图形的填充颜色
  49938. if (typeof (sets.fillColor) !== "undefined") {
  49939. //用户自定义
  49940. circleSP.style.fillColor = sets.fillColor;
  49941. } else {
  49942. //当前默认
  49943. circleSP.style.fillColor = defaultFillColor;
  49944. }
  49945. //圆形 Hover样式
  49946. circleSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  49947. //圆形 Hover 与 click 设置
  49948. if (typeof(sets.circleHoverAble) !== "undefined") {
  49949. circleSP.hoverable = sets.circleHoverAble;
  49950. }
  49951. if (typeof(sets.circleClickAble) !== "undefined") {
  49952. circleSP.clickable = sets.circleClickAble;
  49953. }
  49954. //图形携带的数据信息
  49955. circleSP.refDataID = this.data.id;
  49956. circleSP.dataInfo = {
  49957. field: this.fields[0],
  49958. r: r,
  49959. value: fv[0]
  49960. };
  49961. // 创建扇形并把此扇形添加到图表图形数组
  49962. this.shapes.push(this.shapeFactory.createShape(circleSP));
  49963. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49964. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49965. this.shapesConvertToRelativeCoordinate();
  49966. }
  49967. }
  49968. /**
  49969. * @typedef {Object} SuperMap.Feature.Theme.Circle.setting
  49970. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49971. * @property {number} [maxR] - 圆形的最大半径。
  49972. * @property {number} [minR] - 圆形的最小半径。
  49973. * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  49974. * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  49975. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49976. * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  49977. * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  49978. * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  49979. *
  49980. */
  49981. SuperMap.Feature.Theme.Circle = overlay_Circle_Circle;
  49982. // CONCATENATED MODULE: ./src/common/overlay/Line.js
  49983. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  49984. * This program are made available under the terms of the Apache License, Version 2.0
  49985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49986. /**
  49987. * @class SuperMap.Feature.Theme.Line
  49988. * @classdesc 折线图。
  49989. * @category Visualization Theme
  49990. * @example
  49991. * // pointStyleByCodomain 参数用法示例
  49992. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49993. * // start: 值域值下限(包含);
  49994. * // end: 值域值上限(不包含);
  49995. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  49996. * // pointStyleByCodomain 数组形如:
  49997. * [
  49998. * {
  49999. * start:0,
  50000. * end:250,
  50001. * style:{
  50002. * fillColor:"#00CD00"
  50003. * }
  50004. * },
  50005. * {
  50006. * start:250,
  50007. * end:500,
  50008. * style:{
  50009. * fillColor:"#00EE00"
  50010. * }
  50011. * },
  50012. * {
  50013. * start:500,
  50014. * end:750,
  50015. * style:{
  50016. * fillColor:"#00FF7F"
  50017. * }
  50018. * },
  50019. * {
  50020. * start:750,
  50021. * end:1500,
  50022. * style:{
  50023. * fillColor:"#00FF00"
  50024. * }
  50025. * }
  50026. * ]
  50027. *
  50028. * @extends SuperMap.Feature.Theme.Graph
  50029. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50030. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50031. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50032. * @param {SuperMap.Feature.Theme.Line.setting} setting - 图表配置对象。
  50033. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50034. */
  50035. class overlay_Line_Line extends Graph_Graph {
  50036. constructor(data, layer, fields, setting, lonlat, options) {
  50037. super(data, layer, fields, setting, lonlat, options);
  50038. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  50039. }
  50040. /**
  50041. * @function SuperMap.Feature.Theme.Line.prototype.destroy
  50042. * @override
  50043. */
  50044. destroy() {
  50045. super.destroy();
  50046. }
  50047. /**
  50048. * @function SuperMap.Feature.Theme.Line.prototype.assembleShapes
  50049. * @description 装配图形(扩展接口)。
  50050. */
  50051. assembleShapes() {
  50052. // 图表配置对象
  50053. var sets = this.setting;
  50054. // 默认数据视图框
  50055. if (!sets.dataViewBoxParameter) {
  50056. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50057. sets.dataViewBoxParameter = [45, 15, 15, 15];
  50058. } else {
  50059. sets.dataViewBoxParameter = [5, 5, 5, 5];
  50060. }
  50061. }
  50062. // 重要步骤:初始化参数
  50063. if (!this.initBaseParameter()) {
  50064. return;
  50065. }
  50066. var dvb = this.dataViewBox;
  50067. // 值域
  50068. var codomain = this.DVBCodomain;
  50069. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  50070. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  50071. var uv = this.DVBUnitValue;
  50072. // 数据值数组
  50073. var fv = this.dataValues;
  50074. if (fv.length < 1) {
  50075. return;
  50076. } // 没有数据
  50077. // 获取 x 轴上的图形信息
  50078. var xShapeInfo = this.calculateXShapeInfo();
  50079. if (!xShapeInfo) {
  50080. return;
  50081. }
  50082. // 折线每个节点的 x 位置
  50083. var xsLoc = xShapeInfo.xPositions;
  50084. // 背景框,默认启用
  50085. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  50086. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  50087. this.shapes.push(ShapeFactory_ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50088. }
  50089. // 折线图必须使用坐标轴
  50090. this.shapes = this.shapes.concat(ShapeFactory_ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  50091. // var isDataEffective = true;
  50092. var xPx; // 折线节点 x 坐标
  50093. var yPx; // 折线节点 y 坐标
  50094. var poiLists = []; // 折线节点数组
  50095. var shapePois = []; // 折线节点图形数组
  50096. for (var i = 0, len = fv.length; i < len; i++) {
  50097. // 数据溢出值域检查
  50098. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50099. // isDataEffective = false;
  50100. return null;
  50101. }
  50102. xPx = xsLoc[i];
  50103. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  50104. // 折线节点参数对象
  50105. var poiSP = new feature_Point_Point(xPx, yPx);
  50106. // 折线节点 style
  50107. poiSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  50108. // 折线节点 hover 样式
  50109. poiSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  50110. // 折线节点 hover click
  50111. if (typeof(sets.pointHoverAble) !== "undefined") {
  50112. poiSP.hoverable = sets.pointHoverAble;
  50113. }
  50114. if (typeof(sets.pointClickAble) !== "undefined") {
  50115. poiSP.clickable = sets.pointClickAble;
  50116. }
  50117. // 图形携带的数据信息
  50118. poiSP.refDataID = this.data.id;
  50119. poiSP.dataInfo = {
  50120. field: this.fields[i],
  50121. value: fv[i]
  50122. };
  50123. // 创建图形并把此图形添加到折线节点图形数组
  50124. shapePois.push(this.shapeFactory.createShape(poiSP));
  50125. // 添加折线节点到折线节点数组
  50126. var poi = [xPx, yPx];
  50127. poiLists.push(poi);
  50128. }
  50129. // 折线参数对象
  50130. var lineSP = new Line_Line(poiLists);
  50131. lineSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  50132. // 禁止事件响应
  50133. lineSP.clickable = false;
  50134. lineSP.hoverable = false;
  50135. var shapeLine = this.shapeFactory.createShape(lineSP);
  50136. this.shapes.push(shapeLine);
  50137. // 添加节点到图表图形数组
  50138. this.shapes = this.shapes.concat(shapePois);
  50139. // // 数据范围检测未通过,清空图形
  50140. // if (isDataEffective === false) {
  50141. // this.shapes = [];
  50142. // }
  50143. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50144. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50145. this.shapesConvertToRelativeCoordinate();
  50146. }
  50147. /**
  50148. * @function SuperMap.Feature.Theme.Line.prototype.calculateXShapeInfo
  50149. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  50150. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  50151. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50152. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50153. * 本函数中图形配置对象 setting 可设属性:<br>
  50154. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  50155. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  50156. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  50157. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  50158. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50159. */
  50160. calculateXShapeInfo() {
  50161. var dvb = this.dataViewBox; // 数据视图框
  50162. var sets = this.setting; // 图表配置对象
  50163. var fvc = this.dataValues.length; // 数组值个数
  50164. if (fvc < 1) {
  50165. return null;
  50166. }
  50167. var xBlank; // x 轴空白间隔参数
  50168. var xShapePositions = []; // x 轴上图形的位置
  50169. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  50170. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  50171. var unitOffset = 0; // 单位偏移量
  50172. // x 轴空白间隔参数处理
  50173. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  50174. xBlank = sets.xShapeBlank;
  50175. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  50176. if (xsLen <= fvc) {
  50177. return null;
  50178. }
  50179. unitOffset = xsLen / (fvc - 1);
  50180. } else {
  50181. // 默认使用等距离空白间隔,空白间隔为图形宽度
  50182. unitOffset = dvbWidth / (fvc + 1);
  50183. xBlank = [unitOffset, unitOffset, unitOffset];
  50184. }
  50185. // 图形 x 轴上的位置计算
  50186. var xOffset = 0
  50187. for (var i = 0; i < fvc; i++) {
  50188. if (i == 0) {
  50189. xOffset = xBlank[0];
  50190. } else {
  50191. xOffset += unitOffset;
  50192. }
  50193. xShapePositions.push(dvb[0] + xOffset);
  50194. }
  50195. return {
  50196. "xPositions": xShapePositions,
  50197. "width": xShapeWidth
  50198. };
  50199. }
  50200. }
  50201. /**
  50202. * @typedef {Object} SuperMap.Feature.Theme.Line.setting
  50203. * @property {number} width - 专题要素(图表)宽度。
  50204. * @property {number} height - 专题要素(图表)高度。
  50205. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50206. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50207. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50208. * @property {Array.<number>} [dataViewBoxParameter] - {Array.<number>} 数据视图框 dataViewBox 参数,
  50209. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50210. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  50211. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50212. * @property {boolean} [useBackground] - 是否使用图表背景框。
  50213. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  50214. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  50215. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50216. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 2 的数组,第一元素表示折线左端点与数据视图框左端的空白间距,
  50217. * 第二个元素表示折线右端点右端与数据视图框右端端的空白间距。
  50218. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  50219. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  50220. * @property {number} [axisYTick=0] - y 轴刻度数量。
  50221. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  50222. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  50223. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正。
  50224. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  50225. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  50226. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  50227. * 否则沿数据视图框下面条边等距排布标签。
  50228. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  50229. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;
  50230. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正;
  50231. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  50232. * @property {SuperMap.Feature.ShapeParameters.Line.style} ]xReferenceLineStyle] - 水平参考线样式。
  50233. * @property {SuperMap.Feature.ShapeParameters.Line.style} [lineStyle] - 折线图中折线 style。
  50234. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 折线图中折线节点基础 style,此参数控制折线节点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  50235. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为折线节点赋 style,此参数按字段控制折线节点样式,
  50236. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  50237. * 此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields|L.supermap.graphThemeLayer.themeFields|ol.source.Graph.themeFields|mapboxgl.supermap.GraphThemeLayer.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  50238. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的折线节点使用 style1,字段 POP_1995 对应的折线节点使用 style2 ,字段 POP_1999 对应的折线节点使用 style3。
  50239. * @property {Array.<Object>} pointStyleByCodomain - 按折线节点代表的数据值所在值域范围控制折线节点样式,优先级高于 pointStyle 和 pointStyleByFields。
  50240. * @property {Object} [pointHoverStyle=true] - 折线节点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  50241. * @property {boolean} [pointHoverAble=true] - 是否允许折线节点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  50242. * @property {boolean} [pointClickAble=true] - 是否允许折线节点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  50243. */
  50244. SuperMap.Feature.Theme.Line = overlay_Line_Line;
  50245. // CONCATENATED MODULE: ./src/common/overlay/Pie.js
  50246. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  50247. * This program are made available under the terms of the Apache License, Version 2.0
  50248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50249. /**
  50250. * @class SuperMap.Feature.Theme.Pie
  50251. * @classdesc 饼图。
  50252. * @category Visualization Theme
  50253. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50254. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50255. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50256. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  50257. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50258. * @extends SuperMap.Feature.Theme.Graph
  50259. * @example
  50260. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50261. * // start: 值域值下限(包含);
  50262. * // end: 值域值上限(不包含);
  50263. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  50264. * // sectorStyleByCodomain 数组形如:
  50265. * [
  50266. * {
  50267. * start:0,
  50268. * end:250,
  50269. * style:{
  50270. * fillColor:"#00CD00"
  50271. * }
  50272. * },
  50273. * {
  50274. * start:250,
  50275. * end:500,
  50276. * style:{
  50277. * fillColor:"#00EE00"
  50278. * }
  50279. * },
  50280. * {
  50281. * start:500,
  50282. * end:750,
  50283. * style:{
  50284. * fillColor:"#00FF7F"
  50285. * }
  50286. * },
  50287. * {
  50288. * start:750,
  50289. * end:1500,
  50290. * style:{
  50291. * fillColor:"#00FF00"
  50292. * }
  50293. * }
  50294. * ]
  50295. * @extends {SuperMap.Feature.Theme.Graph}
  50296. */
  50297. class Pie_Pie extends Graph_Graph {
  50298. constructor(data, layer, fields, setting, lonlat) {
  50299. super(data, layer, fields, setting, lonlat);
  50300. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  50301. }
  50302. /**
  50303. * @function SuperMap.Feature.Theme.Pie.prototype.destroy
  50304. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  50305. */
  50306. destroy() {
  50307. super.destroy();
  50308. }
  50309. /**
  50310. * @function SuperMap.Feature.Theme.Pie.prototype.assembleShapes
  50311. * @description 装配图形(扩展接口)。
  50312. */
  50313. assembleShapes() {
  50314. // 图表配置对象
  50315. var sets = this.setting;
  50316. // 一个默认 style 组
  50317. var defaultStyleGroup = [
  50318. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  50319. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  50320. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  50321. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  50322. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  50323. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  50324. ];
  50325. // 重要步骤:初始化参数
  50326. if (!this.initBaseParameter()) {
  50327. return;
  50328. }
  50329. // 背景框,默认不启用
  50330. if (sets.useBackground) {
  50331. this.shapes.push(ShapeFactory_ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50332. }
  50333. // 数据值数组
  50334. var fv = this.dataValues;
  50335. if (fv.length < 1) {
  50336. return;
  50337. } // 没有数据
  50338. // 值域范围
  50339. var codomain = this.DVBCodomain;
  50340. // 值域范围检测
  50341. for (let i = 0; i < fv.length; i++) {
  50342. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50343. return;
  50344. }
  50345. }
  50346. // 值的绝对值总和
  50347. var valueSum = 0;
  50348. for (let i = 0; i < fv.length; i++) {
  50349. valueSum += Math.abs(fv[i]);
  50350. }
  50351. // 重要步骤:定义图表 Pie 数据视图框中单位值的含义,单位值:每度代表的数值
  50352. this.DVBUnitValue = 360 / valueSum;
  50353. var uv = this.DVBUnitValue;
  50354. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  50355. var startAngle = 0; // 扇形起始边角度
  50356. var endAngle = 0; // 扇形终止边角度
  50357. var startAngleTmp = startAngle; // 扇形临时起始边角度
  50358. // 扇形(自适应)半径
  50359. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  50360. for (var i = 0; i < fv.length; i++) {
  50361. var fvi = Math.abs(fv[i]);
  50362. //计算终止角
  50363. if (i === 0) {
  50364. endAngle = startAngle + fvi * uv;
  50365. } else if (i === fvi.length - 1) {
  50366. endAngle = startAngleTmp;
  50367. } else {
  50368. endAngle = startAngle + fvi * uv;
  50369. }
  50370. //矫正误差计算
  50371. if ((endAngle - startAngle) >= 360) {
  50372. endAngle = 359.9999999;
  50373. }
  50374. // 扇形参数对象
  50375. var sectorSP = new Sector_Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  50376. // 扇形样式
  50377. if (typeof(sets.sectorStyleByFields) === "undefined") {
  50378. // 使用默认 style 组
  50379. var colorIndex = i % defaultStyleGroup.length;
  50380. sectorSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  50381. } else {
  50382. sectorSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  50383. }
  50384. // 扇形 hover 样式
  50385. sectorSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  50386. // 扇形 hover 与 click 设置
  50387. if (typeof(sets.sectorHoverAble) !== "undefined") {
  50388. sectorSP.hoverable = sets.sectorHoverAble;
  50389. }
  50390. if (typeof(sets.sectorClickAble) !== "undefined") {
  50391. sectorSP.clickable = sets.sectorClickAble;
  50392. }
  50393. // 图形携带的数据信息
  50394. sectorSP.refDataID = this.data.id;
  50395. sectorSP.dataInfo = {
  50396. field: this.fields[i],
  50397. value: fv[i]
  50398. };
  50399. // 创建扇形并把此扇形添加到图表图形数组
  50400. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  50401. // 把上一次的结束角度作为下一次的起始角度
  50402. startAngle = endAngle;
  50403. }
  50404. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50405. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50406. this.shapesConvertToRelativeCoordinate();
  50407. }
  50408. }
  50409. /**
  50410. * @typedef {Object} SuperMap.Feature.Theme.Pie.setting
  50411. * @property {number} width - 专题要素(图表)宽度。
  50412. * @property {number} height - 专题要素(图表)高度。
  50413. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50414. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50415. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50416. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,
  50417. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50418. * @property {Array.<number>} decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50419. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  50420. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  50421. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50422. * @property {SuperMap.Feature.ShapeParameters.Sector.style} sectorStyle - 饼图中扇形的基础 style,此参数控制饼图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  50423. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} sectorStyleByFields - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为饼图扇形赋 style,此参数按字段控制饼图扇形样式,优先级低于 sectorStyleByCodomain,高于 sectorStyle。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  50424. * sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的饼图扇形使用 style1,字段 POP_1995 对应的饼图扇形使用 style2 ,字段 POP_1999 对应的饼图扇形使用 style3。
  50425. * @property {Array.<Object>} sectorStyleByCodomain - 按饼图扇形代表的数据值所在值域范围控制饼图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  50426. * @property {Object} [sectorHoverStyle] 饼图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  50427. * @property {boolean} [sectorHoverAble=true] 是否允许饼图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  50428. * @property {boolean} [sectorClickAble=true] 是否允许饼图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  50429. */
  50430. SuperMap.Feature.Theme.Pie = Pie_Pie;
  50431. // CONCATENATED MODULE: ./src/common/overlay/Point.js
  50432. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  50433. * This program are made available under the terms of the Apache License, Version 2.0
  50434. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50435. /**
  50436. * @class SuperMap.Feature.Theme.Point
  50437. * @classdesc 点状图。
  50438. * @category Visualization Theme
  50439. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50440. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50441. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50442. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  50443. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50444. * @example
  50445. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50446. * // start: 值域值下限(包含);
  50447. * // end: 值域值上限(不包含);
  50448. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  50449. * // pointStyleByCodomain 数组形如:
  50450. * [
  50451. * {
  50452. * start:0,
  50453. * end:250,
  50454. * style:{
  50455. * fillColor:"#00CD00"
  50456. * }
  50457. * },
  50458. * {
  50459. * start:250,
  50460. * end:500,
  50461. * style:{
  50462. * fillColor:"#00EE00"
  50463. * }
  50464. * },
  50465. * {
  50466. * start:500,
  50467. * end:750,
  50468. * style:{
  50469. * fillColor:"#00FF7F"
  50470. * }
  50471. * },
  50472. * {
  50473. * start:750,
  50474. * end:1500,
  50475. * style:{
  50476. * fillColor:"#00FF00"
  50477. * }
  50478. * }
  50479. * ]
  50480. *@extends {SuperMap.Feature.Theme.Graph}
  50481. */
  50482. class overlay_Point_Point extends Graph_Graph {
  50483. constructor(data, layer, fields, setting, lonlat, options) {
  50484. super(data, layer, fields, setting, lonlat, options);
  50485. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  50486. }
  50487. /**
  50488. * @function SuperMap.Feature.Theme.Point.prototype.destroy
  50489. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  50490. */
  50491. destroy() {
  50492. super.destroy();
  50493. }
  50494. /**
  50495. * @function SuperMap.Feature.Theme.prototype.Point.assembleShapes
  50496. * @description 装配图形(扩展接口)。
  50497. */
  50498. assembleShapes() {
  50499. // 图表配置对象
  50500. var sets = this.setting;
  50501. // 默认数据视图框
  50502. if (!sets.dataViewBoxParameter) {
  50503. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50504. sets.dataViewBoxParameter = [45, 15, 15, 15];
  50505. } else {
  50506. sets.dataViewBoxParameter = [5, 5, 5, 5];
  50507. }
  50508. }
  50509. // 重要步骤:初始化参数
  50510. if (!this.initBaseParameter()) {
  50511. return;
  50512. }
  50513. var dvb = this.dataViewBox;
  50514. // 值域
  50515. var codomain = this.DVBCodomain;
  50516. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  50517. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  50518. var uv = this.DVBUnitValue;
  50519. var fv = this.dataValues;
  50520. // 获取 x 轴上的图形信息
  50521. var xShapeInfo = this.calculateXShapeInfo();
  50522. if (!xShapeInfo) {
  50523. return;
  50524. }
  50525. // 折线每个节点的 x 位置
  50526. var xsLoc = xShapeInfo.xPositions;
  50527. // 背景框,默认启用
  50528. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  50529. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  50530. this.shapes.push(ShapeFactory_ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50531. }
  50532. // 点状图必须使用坐标轴
  50533. this.shapes = this.shapes.concat(ShapeFactory_ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  50534. var xPx; // 图形点 x 坐标
  50535. var yPx; // 图形点 y 坐标
  50536. for (var i = 0, len = fv.length; i < len; i++) {
  50537. // 数据溢出值域检查
  50538. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50539. //isDataEffective = false;
  50540. return null;
  50541. }
  50542. xPx = xsLoc[i];
  50543. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  50544. // 图形点参数对象
  50545. var poiSP = new feature_Point_Point(xPx, yPx);
  50546. // 图形点 style
  50547. poiSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  50548. // 图形点 hover 样式
  50549. poiSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  50550. // 图形点 hover click
  50551. if (typeof(sets.pointHoverAble) !== "undefined") {
  50552. poiSP.hoverable = sets.pointHoverAble;
  50553. }
  50554. if (typeof(sets.pointClickAble) !== "undefined") {
  50555. poiSP.clickable = sets.pointClickAble;
  50556. }
  50557. // 图形携带的数据信息
  50558. poiSP.refDataID = this.data.id;
  50559. poiSP.dataInfo = {
  50560. field: this.fields[i],
  50561. value: fv[i]
  50562. };
  50563. // 创建图形点并把此图形添加到图表图形数组
  50564. this.shapes.push(this.shapeFactory.createShape(poiSP));
  50565. }
  50566. // 数据范围检测未通过,清空图形
  50567. // if (isDataEffective === false) {
  50568. // this.shapes = [];
  50569. // }
  50570. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50571. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50572. this.shapesConvertToRelativeCoordinate();
  50573. }
  50574. /**
  50575. * @function SuperMap.Feature.Theme.Point.prototype.calculateXShapeInfo
  50576. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  50577. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  50578. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50579. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50580. * 本函数中图形配置对象 setting 可设属性:<br>
  50581. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  50582. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  50583. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  50584. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50585. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50586. */
  50587. calculateXShapeInfo() {
  50588. var dvb = this.dataViewBox; // 数据视图框
  50589. var sets = this.setting; // 图表配置对象
  50590. var fvc = this.dataValues.length; // 数组值个数
  50591. if (fvc < 1) {
  50592. return null;
  50593. }
  50594. var xBlank; // x 轴空白间隔参数
  50595. var xShapePositions = []; // x 轴上图形的位置
  50596. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  50597. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  50598. var unitOffset = 0; // 单位偏移量
  50599. // x 轴空白间隔参数处理
  50600. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  50601. xBlank = sets.xShapeBlank;
  50602. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  50603. if (xsLen <= fvc) {
  50604. return null;
  50605. }
  50606. unitOffset = xsLen / (fvc - 1);
  50607. } else {
  50608. // 默认使用等距离空白间隔,空白间隔为图形宽度
  50609. unitOffset = dvbWidth / (fvc + 1);
  50610. xBlank = [unitOffset, unitOffset, unitOffset];
  50611. }
  50612. // 图形 x 轴上的位置计算
  50613. var xOffset = 0
  50614. for (var i = 0; i < fvc; i++) {
  50615. if (i == 0) {
  50616. xOffset = xBlank[0];
  50617. } else {
  50618. xOffset += unitOffset;
  50619. }
  50620. xShapePositions.push(dvb[0] + xOffset);
  50621. }
  50622. return {
  50623. "xPositions": xShapePositions,
  50624. "width": xShapeWidth
  50625. };
  50626. }
  50627. }
  50628. /**
  50629. * @typedef {Object} SuperMap.Feature.Theme.Point.setting
  50630. * @property {number} width - 专题要素(图表)宽度。
  50631. * @property {number} height - 专题要素(图表)高度。
  50632. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50633. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50634. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50635. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,
  50636. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50637. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  50638. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50639. * @property {boolean} [useBackground] - 是否使用图表背景框。
  50640. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  50641. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  50642. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50643. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。
  50644. * 长度为 2 的数组,第一个元素表示第一个(沿 x 轴方向)图形点与数据视图框左端的空白间距,第二个元素表示最后一个(沿 x 轴方向)图形点与数据视图框右端端的空白间距 。
  50645. * @property {Object} axisStyle - 坐标轴样式。
  50646. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  50647. * @property {number} [axisYTick=0] - y 轴刻度数量。
  50648. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  50649. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  50650. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;
  50651. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  50652. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  50653. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  50654. * 否则沿数据视图框下面条边等距排布标签。
  50655. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  50656. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,
  50657. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  50658. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  50659. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  50660. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 点状图中图形点基础 style,此参数控制图形点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  50661. * @property {Array.<SuperMap.Feature.ShapeParameters.Point.style>} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为图形点赋 style,此参数按字段控制图形点样式,
  50662. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  50663. * 此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  50664. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的图形点使用 style1,字段 POP_1995 对应的图形点使用 style2 ,字段 POP_1999 对应的图形点使用 style3。
  50665. * @property {Array.<Object>} pointStyleByCodomain - 按图形点代表的数据值所在值域范围控制图形点样式,优先级高于 pointStyle 和 pointStyleByFields。
  50666. * @property {Object} [pointHoverStyle] - 图形点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  50667. * @property {Object} [pointHoverAble=true] - 是否允许图形点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  50668. * @property {Object} [pointClickAble=true] - 是否允许图形点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  50669. */
  50670. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  50671. // CONCATENATED MODULE: ./src/common/overlay/Ring.js
  50672. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  50673. * This program are made available under the terms of the Apache License, Version 2.0
  50674. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50675. /**
  50676. * @class SuperMap.Feature.Theme.Ring
  50677. * @classdesc 环状图。
  50678. * @category Visualization Theme
  50679. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  50680. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50681. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50682. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50683. * @param {SuperMap.Feature.Theme.Ring.setting} setting - 图表配置对象。
  50684. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50685. * @example
  50686. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50687. * // start: 值域值下限(包含);
  50688. * // end: 值域值上限(不包含);
  50689. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  50690. * // sectorStyleByCodomain 数组形如:
  50691. * [
  50692. * {
  50693. * start:0,
  50694. * end:250,
  50695. * style:{
  50696. * fillColor:"#00CD00"
  50697. * }
  50698. * },
  50699. * {
  50700. * start:250,
  50701. * end:500,
  50702. * style:{
  50703. * fillColor:"#00EE00"
  50704. * }
  50705. * },
  50706. * {
  50707. * start:500,
  50708. * end:750,
  50709. * style:{
  50710. * fillColor:"#00FF7F"
  50711. * }
  50712. * },
  50713. * {
  50714. * start:750,
  50715. * end:1500,
  50716. * style:{
  50717. * fillColor:"#00FF00"
  50718. * }
  50719. * }
  50720. * ]
  50721. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  50722. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  50723. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  50724. *
  50725. * @extends {SuperMap.Feature.Theme.Graph}
  50726. */
  50727. class Ring_Ring extends Graph_Graph {
  50728. constructor(data, layer, fields, setting, lonlat) {
  50729. super(data, layer, fields, setting, lonlat);
  50730. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  50731. }
  50732. /**
  50733. * @function SuperMap.Feature.Theme.Ring.prototype.destroy
  50734. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  50735. */
  50736. destroy() {
  50737. super.destroy();
  50738. }
  50739. /**
  50740. * @function SuperMap.Feature.Theme.Ring.prototype.assembleShapes
  50741. * @description 装配图形(扩展接口)。
  50742. */
  50743. assembleShapes() {
  50744. // 重要步骤:初始化参数
  50745. if (!this.initBaseParameter()) {
  50746. return;
  50747. }
  50748. // 一个默认 style 组
  50749. var defaultStyleGroup = [
  50750. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  50751. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  50752. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  50753. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  50754. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  50755. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  50756. ];
  50757. // 图表配置对象
  50758. var sets = this.setting;
  50759. // 背景框,默认不启用
  50760. if (sets.useBackground) {
  50761. this.shapes.push(ShapeFactory_ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50762. }
  50763. // 数据值数组
  50764. var fv = this.dataValues;
  50765. if (fv.length < 1) {
  50766. return;
  50767. } // 没有数据
  50768. // 值域范围
  50769. var codomain = this.DVBCodomain;
  50770. // 值域范围检测
  50771. for (let i = 0; i < fv.length; i++) {
  50772. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50773. return;
  50774. }
  50775. }
  50776. // 值的绝对值总和
  50777. var valueSum = 0;
  50778. for (let i = 0; i < fv.length; i++) {
  50779. valueSum += Math.abs(fv[i]);
  50780. }
  50781. // 重要步骤:定义图表 Ring 数据视图框中单位值的含义,单位值:每度代表的数值
  50782. this.DVBUnitValue = 360 / valueSum;
  50783. var uv = this.DVBUnitValue;
  50784. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  50785. var startAngle = 0; // 扇形起始边角度
  50786. var endAngle = 0; // 扇形终止边角度
  50787. var startAngleTmp = startAngle; // 扇形临时起始边角度
  50788. // 扇形外环(自适应)半径
  50789. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  50790. // 扇形内环(自适应)半径
  50791. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  50792. var r0 = (
  50793. typeof(sets.innerRingRadius) !== "undefined"
  50794. && !isNaN(sets.innerRingRadius)
  50795. && isInRange
  50796. ) ? sets.innerRingRadius : 0;
  50797. for (var i = 0; i < fv.length; i++) {
  50798. var fvi = Math.abs(fv[i]);
  50799. // 计算结束角度
  50800. if (i === 0) {
  50801. endAngle = startAngle + fvi * uv;
  50802. } else if (i === fvi.length - 1) {
  50803. endAngle = startAngleTmp;
  50804. } else {
  50805. endAngle = startAngle + fvi * uv;
  50806. }
  50807. // 扇形参数对象
  50808. var sectorSP = new Sector_Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  50809. // 扇形样式
  50810. if (typeof(sets.sectorStyleByFields) === "undefined") {
  50811. // 使用默认 style 组
  50812. var colorIndex = i % defaultStyleGroup.length;
  50813. sectorSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  50814. } else {
  50815. sectorSP.style = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  50816. }
  50817. // 扇形 hover 样式
  50818. sectorSP.highlightStyle = ShapeFactory_ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  50819. // 扇形 hover 与 click 设置
  50820. if (typeof(sets.sectorHoverAble) !== "undefined") {
  50821. sectorSP.hoverable = sets.sectorHoverAble;
  50822. }
  50823. if (typeof(sets.sectorClickAble) !== "undefined") {
  50824. sectorSP.clickable = sets.sectorClickAble;
  50825. }
  50826. // 图形携带的数据信息
  50827. sectorSP.refDataID = this.data.id;
  50828. sectorSP.dataInfo = {
  50829. field: this.fields[i],
  50830. value: fv[i]
  50831. };
  50832. // 创建扇形并把此扇形添加到图表图形数组
  50833. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  50834. // 把上一次的结束角度作为下一次的起始角度
  50835. startAngle = endAngle;
  50836. }
  50837. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50838. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50839. this.shapesConvertToRelativeCoordinate();
  50840. }
  50841. }
  50842. /**
  50843. * @typedef {Object} SuperMap.Feature.Theme.Ring.setting
  50844. * @property {number} width - 专题要素(图表)宽度。
  50845. * @property {number} height - 专题要素(图表)高度。
  50846. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50847. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50848. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50849. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50850. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50851. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  50852. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式,此样式对象对象可设属性。
  50853. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50854. * @property {number} [innerRingRadius=0] - 环状图内环半径,取值范围大于 0,小于外环半径(外环半径:数据视图框长和宽中较小值的二分之一)。
  50855. * @property {SuperMap.Feature.ShapeParameters.Sector.style} [sectorStyle] - 环状图中扇形的基础 style,此参数控制环状图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  50856. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} [sectorStyleByFields] - 按专题字段 themeFields({@link SuperMap.Layer.Graph.themeFields}|{@link L.supermap.graphThemeLayer.themeFields}|{@link ol.source.Graph.themeFields}|{@link mapboxgl.supermap.GraphThemeLayer.themeFields})为环状图扇形赋 style,此参数按字段控制环状图扇形样式,优先级低于 sectorStyleByCodomain,高于 sectorStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的环状图扇形使用 style1,字段 POP_1995 对应的环状图扇形使用 style2 ,字段 POP_1999 对应的环状图扇形使用 style3。
  50857. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} [sectorStyleByCodomain] - 按环状图扇形代表的数据值所在值域范围控制环状图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  50858. */
  50859. SuperMap.Feature.Theme.Ring = Ring_Ring;
  50860. // CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  50861. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  50862. * This program are made available under the terms of the Apache License, Version 2.0
  50863. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50864. /**
  50865. * @class SuperMap.Feature.Theme.Vector
  50866. * @classdesc 矢量专题要素类。
  50867. * @category Visualization Theme
  50868. * @extends SuperMap.Feature.Theme
  50869. * @param {SuperMap.Feature.Vector} data - 用户数据,的类型为矢量数据 feature。
  50870. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  50871. * @param {Object} style - 样式。
  50872. * @param {Object} options - 创建专题要素时的可选参数。
  50873. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离, 单位:像素。
  50874. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  50875. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  50876. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  50877. * @param {Object} [options.highlightStyle] - 高亮样式。
  50878. */
  50879. class ThemeVector_ThemeVector extends feature_Theme_Theme {
  50880. constructor(data, layer, style, options, shapeOptions) {
  50881. super(data, layer);
  50882. //数据的 geometry 属性必须存在且类型是 SuperMap.Geometry 或其子类的类型
  50883. if (!data.geometry) {
  50884. return;
  50885. }
  50886. if (!(data.geometry instanceof Geometry_Geometry)) {
  50887. return;
  50888. }
  50889. /**
  50890. * @member {SuperMap.Bounds} [SuperMap.Feature.Theme.Vector.prototype.dataBounds]
  50891. * @description 用户数据的(feature.geometry)地理范围。
  50892. */
  50893. this.dataBounds = data.geometry.getBounds();
  50894. /**
  50895. * @member {number} [SuperMap.Feature.Theme.Vector.prototype.nodesClipPixel=2]
  50896. * @description 节点抽稀像素距离。
  50897. */
  50898. this.nodesClipPixel = 2;
  50899. /**
  50900. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isHoverAble=true]
  50901. * @description 图形是否可 hover。
  50902. */
  50903. this.isHoverAble = true;
  50904. /**
  50905. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isMultiHover=true]
  50906. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  50907. */
  50908. this.isMultiHover = true;
  50909. /**
  50910. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isClickAble=true]
  50911. * @description 图形是否可点击。
  50912. */
  50913. this.isClickAble = true;
  50914. /**
  50915. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.highlightStyle]
  50916. * @description 高亮样式。
  50917. */
  50918. this.highlightStyle = null;
  50919. /**
  50920. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.shapeOptions]
  50921. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  50922. */
  50923. this.shapeOptions = {};
  50924. /**
  50925. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.style]
  50926. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  50927. */
  50928. this.style = style || {};
  50929. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  50930. this.style = style ? style : {};
  50931. if (options) {
  50932. Util_Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  50933. }
  50934. if (shapeOptions) {
  50935. Util_Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  50936. }
  50937. //设置基础参数 dataBounds、lonlat、location
  50938. var geometry = data.geometry;
  50939. this.lonlat = this.dataBounds.getCenterLonLat();
  50940. this.location = this.getLocalXY(this.lonlat);
  50941. //将地理要素转为专题要素
  50942. if (geometry instanceof LinearRing_LinearRing) {
  50943. this.lineToTF(geometry);
  50944. } else if (geometry instanceof LineString_LineString) {
  50945. this.lineToTF(geometry);
  50946. } else if (geometry instanceof Curve_Curve) {
  50947. //独立几何体
  50948. } else if (geometry instanceof MultiPoint_MultiPoint) {
  50949. this.multiPointToTF(geometry);
  50950. } else if (geometry instanceof MultiLineString_MultiLineString) {
  50951. this.multiLineStringToTF(geometry);
  50952. } else if (geometry instanceof MultiPolygon_MultiPolygon) {
  50953. this.multiPolygonToTF(geometry);
  50954. } else if (geometry instanceof Polygon_Polygon) {
  50955. this.polygonToTF(geometry);
  50956. } else if (geometry instanceof Collection_Collection) {
  50957. //独立几何体
  50958. } else if (geometry instanceof Point_Point) {
  50959. this.pointToTF(geometry);
  50960. } else if (geometry instanceof Rectangle_Rectangle) {
  50961. this.rectangleToTF(geometry);
  50962. } else if (geometry instanceof GeoText_GeoText) {
  50963. this.geoTextToTF(geometry);
  50964. }
  50965. }
  50966. /**
  50967. * @function SuperMap.Feature.Theme.Vector.prototype.destroy
  50968. * @override
  50969. */
  50970. destroy() {
  50971. this.style = null;
  50972. this.dataBounds = null;
  50973. this.nodesClipPixel = null;
  50974. this.isHoverAble = null;
  50975. this.isMultiHover = null;
  50976. this.isClickAble = null;
  50977. this.highlightStyle = null;
  50978. this.shapeOptions = null;
  50979. super.destroy();
  50980. }
  50981. /**
  50982. * @function SuperMap.Feature.Theme.Vector.prototype.lineToTF
  50983. * @description 转换线和线环要素。
  50984. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 LineString 或 LineRing。
  50985. */
  50986. lineToTF(geometry) {
  50987. var components = geometry.components;
  50988. //节点像素坐标
  50989. var localLX = [];
  50990. //参考位置,参考中心为
  50991. var refLocal = [];
  50992. var location = this.location;
  50993. var pointList = [];
  50994. //节点抽稀距离
  50995. var nCPx = this.nodesClipPixel;
  50996. for (var i = 0; i < components.length; i++) {
  50997. var components_i = components[i];
  50998. refLocal = [];
  50999. localLX = this.getLocalXY(components_i);
  51000. refLocal[0] = localLX[0] - location[0];
  51001. refLocal[1] = localLX[1] - location[1];
  51002. //抽稀 - 2 px
  51003. if (pointList.length > 0) {
  51004. var lastLocalXY = pointList[pointList.length - 1];
  51005. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  51006. continue;
  51007. }
  51008. }
  51009. //使用参考点
  51010. pointList.push(refLocal);
  51011. }
  51012. if (pointList.length < 2) {
  51013. return null;
  51014. }
  51015. //赋 style
  51016. var style = new Object();
  51017. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  51018. style.pointList = pointList;
  51019. //创建图形
  51020. var shape = new SmicBrokenLine_SmicBrokenLine({
  51021. style: style,
  51022. clickable: this.isClickAble,
  51023. hoverable: this.isHoverAble
  51024. });
  51025. //设置高亮样式
  51026. if (this.highlightStyle) {
  51027. shape.highlightStyle = this.highlightStyle;
  51028. }
  51029. //设置参考中心,指定图形位置
  51030. shape.refOriginalPosition = this.location;
  51031. //储存数据 id 属性,用于事件
  51032. shape.refDataID = this.data.id;
  51033. //储存数据 id 属性,用于事件-多图形同时高亮
  51034. shape.isHoverByRefDataID = this.isMultiHover;
  51035. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  51036. if (this.shapeOptions) {
  51037. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  51038. }
  51039. this.shapes.push(shape);
  51040. }
  51041. /**
  51042. * @function SuperMap.Feature.Theme.Vector.prototype.multiPointToTF
  51043. * @description 转多点要素。
  51044. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  51045. */
  51046. multiPointToTF(geometry) {
  51047. /* //-- 不抽稀
  51048. var components = geometry.components;
  51049. for(var i = 0; i < components.length; i++){
  51050. var components_i = components[i];
  51051. this.pointToTF(components_i);
  51052. }
  51053. */
  51054. var components = geometry.components;
  51055. //节点像素坐标
  51056. var localLX = [];
  51057. //参考位置,参考中心为
  51058. var refLocal = [];
  51059. var location = this.location;
  51060. var pointList = [];
  51061. //节点抽稀距离
  51062. var nCPx = this.nodesClipPixel;
  51063. for (var i = 0; i < components.length; i++) {
  51064. var components_i = components[i];
  51065. refLocal = [];
  51066. localLX = this.getLocalXY(components_i);
  51067. refLocal[0] = localLX[0] - location[0];
  51068. refLocal[1] = localLX[1] - location[1];
  51069. //抽稀
  51070. if (pointList.length > 0) {
  51071. var lastLocalXY = pointList[pointList.length - 1];
  51072. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  51073. continue;
  51074. }
  51075. }
  51076. //使用参考点
  51077. pointList.push(refLocal);
  51078. //赋 style
  51079. var style = new Object();
  51080. style.r = 6; //防止漏设此参数,默认 6 像素
  51081. style = Util_Util.copyAttributesWithClip(style, this.style);
  51082. style.x = refLocal[0];
  51083. style.y = refLocal[1];
  51084. //创建图形
  51085. var shape = new SmicPoint_SmicPoint({
  51086. style: style,
  51087. clickable: this.isClickAble,
  51088. hoverable: this.isHoverAble
  51089. });
  51090. //设置高亮样式
  51091. if (this.highlightStyle) {
  51092. shape.highlightStyle = this.highlightStyle;
  51093. }
  51094. //设置参考中心,指定图形位置
  51095. shape.refOriginalPosition = location;
  51096. //储存数据 id 属性,用于事件
  51097. shape.refDataID = this.data.id;
  51098. //储存数据 id 属性,用于事件-多图形同时高亮
  51099. shape.isHoverByRefDataID = this.isMultiHover;
  51100. //修改一些 shape 可选属性,通常不需要这么做
  51101. if (this.shapeOptions) {
  51102. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  51103. }
  51104. this.shapes.push(shape);
  51105. }
  51106. }
  51107. /**
  51108. * @function SuperMap.Feature.Theme.Vector.prototype.multiLineStringToTF
  51109. * @description 转换多线要素。
  51110. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  51111. */
  51112. multiLineStringToTF(geometry) {
  51113. var components = geometry.components;
  51114. for (var i = 0; i < components.length; i++) {
  51115. var components_i = components[i];
  51116. this.lineToTF(components_i);
  51117. }
  51118. }
  51119. /**
  51120. * @function SuperMap.Feature.Theme.Vector.prototype.multiPolygonToTF
  51121. * @description 转换多面要素。
  51122. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  51123. */
  51124. multiPolygonToTF(geometry) {
  51125. var components = geometry.components;
  51126. for (var i = 0; i < components.length; i++) {
  51127. var components_i = components[i];
  51128. this.polygonToTF(components_i);
  51129. }
  51130. }
  51131. /**
  51132. * @function SuperMap.Feature.Theme.Vector.prototype.pointToTF
  51133. * @description 转换点要素。
  51134. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  51135. */
  51136. pointToTF(geometry) {
  51137. //参考位置,参考中心为
  51138. var location = this.location;
  51139. //geometry 像素坐标
  51140. var localLX = this.getLocalXY(geometry);
  51141. //赋 style
  51142. var style = new Object();
  51143. style.r = 6; //防止漏设此参数,默认 6 像素
  51144. style = Util_Util.copyAttributesWithClip(style, this.style);
  51145. style.x = localLX[0] - location[0];
  51146. style.y = localLX[1] - location[1];
  51147. //创建图形
  51148. var shape = new SmicPoint_SmicPoint({
  51149. style: style,
  51150. clickable: this.isClickAble,
  51151. hoverable: this.isHoverAble
  51152. });
  51153. //设置高亮样式
  51154. if (this.highlightStyle) {
  51155. shape.highlightStyle = this.highlightStyle;
  51156. }
  51157. //设置参考中心,指定图形位置
  51158. shape.refOriginalPosition = location;
  51159. //储存数据 id 属性,用于事件
  51160. shape.refDataID = this.data.id;
  51161. //储存数据 id 属性,用于事件-多图形同时高亮
  51162. shape.isHoverByRefDataID = this.isMultiHover;
  51163. //修改一些 shape 可选属性,通常不需要这么做
  51164. if (this.shapeOptions) {
  51165. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  51166. }
  51167. this.shapes.push(shape);
  51168. }
  51169. /**
  51170. * @function SuperMap.Feature.Theme.Vector.prototype.polygonToThemeFeature
  51171. * @description 转换面要素。
  51172. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  51173. */
  51174. polygonToTF(geometry) {
  51175. var components = geometry.components;
  51176. //节点像素坐标
  51177. var localLX = [];
  51178. //参考位置,参考中心为
  51179. var refLocal = [];
  51180. var location = this.location;
  51181. var pointList = [];
  51182. //岛洞
  51183. var holePolygonPointList = [];
  51184. var holePolygonPointLists = [];
  51185. //节点抽稀距离
  51186. var nCPx = this.nodesClipPixel;
  51187. for (var i = 0; i < components.length; i++) {
  51188. var components_i = components[i].components;
  51189. if (i === 0) {
  51190. // 第一个 component 正常绘制
  51191. pointList = [];
  51192. for (var j = 0; j < components_i.length; j++) {
  51193. refLocal = [];
  51194. localLX = this.getLocalXY(components_i[j]);
  51195. refLocal[0] = localLX[0] - location[0];
  51196. refLocal[1] = localLX[1] - location[1];
  51197. //抽稀 - 2 px
  51198. if (pointList.length > 0) {
  51199. var lastLocalXY = pointList[pointList.length - 1];
  51200. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  51201. continue;
  51202. }
  51203. }
  51204. //使用参考点
  51205. pointList.push(refLocal);
  51206. }
  51207. } else {
  51208. // 其它 component 作为岛洞
  51209. holePolygonPointList = [];
  51210. for (var k = 0; k < components_i.length; k++) {
  51211. refLocal = [];
  51212. localLX = this.getLocalXY(components_i[k]);
  51213. refLocal[0] = localLX[0] - location[0];
  51214. refLocal[1] = localLX[1] - location[1];
  51215. //抽稀 - 2 px
  51216. if (holePolygonPointList.length > 0) {
  51217. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  51218. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  51219. continue;
  51220. }
  51221. }
  51222. //使用参考点
  51223. holePolygonPointList.push(refLocal);
  51224. }
  51225. }
  51226. if (holePolygonPointList.length < 2) {
  51227. continue;
  51228. }
  51229. holePolygonPointLists.push(holePolygonPointList);
  51230. }
  51231. if (pointList.length < 2) {
  51232. return;
  51233. }
  51234. //赋 style
  51235. var style = {};
  51236. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  51237. style.pointList = pointList;
  51238. //创建图形
  51239. var shape = new SmicPolygon_SmicPolygon({
  51240. style: style,
  51241. clickable: this.isClickAble,
  51242. hoverable: this.isHoverAble
  51243. });
  51244. //设置高亮样式
  51245. if (this.highlightStyle) {
  51246. shape.highlightStyle = this.highlightStyle;
  51247. }
  51248. //设置参考中心,指定图形位置
  51249. shape.refOriginalPosition = this.location;
  51250. //储存数据 id 属性,用于事件
  51251. shape.refDataID = this.data.id;
  51252. //储存数据 id 属性,用于事件-多图形同时高亮
  51253. shape.isHoverByRefDataID = this.isMultiHover;
  51254. //岛洞面
  51255. if (holePolygonPointLists.length > 0) {
  51256. shape.holePolygonPointLists = holePolygonPointLists;
  51257. }
  51258. //修改一些 shape 可选属性,通常不需要这么做
  51259. if (this.shapeOptions) {
  51260. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  51261. }
  51262. this.shapes.push(shape);
  51263. }
  51264. /**
  51265. * @function SuperMap.Feature.Theme.Vector.prototype.rectangleToTF
  51266. * @description 转换矩形要素。
  51267. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  51268. */
  51269. rectangleToTF(geometry) {
  51270. //参考位置,参考中心为
  51271. var location = this.location;
  51272. var ll = new LonLat_LonLat(geometry.x, geometry.y);
  51273. //地图分辨率
  51274. var res = this.layer.map.getResolution();
  51275. //geometry 像素坐标
  51276. var localLX = this.getLocalXY(ll);
  51277. //赋 style
  51278. var style = new Object();
  51279. style.r = 6; //防止漏设此参数,默认 6 像素
  51280. style = Util_Util.copyAttributesWithClip(style, this.style);
  51281. style.x = localLX[0] - location[0];
  51282. // SuperMap.Geometry.Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  51283. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  51284. style.width = geometry.width / res;
  51285. style.height = geometry.height / res;
  51286. //创建图形
  51287. var shape = new SmicRectangle_SmicRectangle({
  51288. style: style,
  51289. clickable: this.isClickAble,
  51290. hoverable: this.isHoverAble
  51291. });
  51292. //设置高亮样式
  51293. if (this.highlightStyle) {
  51294. shape.highlightStyle = this.highlightStyle;
  51295. }
  51296. //设置参考中心,指定图形位置
  51297. shape.refOriginalPosition = location;
  51298. //储存数据 id 属性,用于事件
  51299. shape.refDataID = this.data.id;
  51300. //储存数据 id 属性,用于事件-多图形同时高亮
  51301. shape.isHoverByRefDataID = this.isMultiHover;
  51302. //修改一些 shape 可选属性,通常不需要这么做
  51303. if (this.shapeOptions) {
  51304. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  51305. }
  51306. this.shapes.push(shape);
  51307. }
  51308. /**
  51309. * @function SuperMap.Feature.Theme.Vector.prototype.geoTextToTF
  51310. * @description 转换文本要素。
  51311. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  51312. */
  51313. geoTextToTF(geometry) {
  51314. //参考位置,参考中心为
  51315. var location = this.location;
  51316. //geometry 像素坐标
  51317. var localLX = this.getLocalXY(geometry);
  51318. //赋 style
  51319. var style = new Object();
  51320. style.r = 6; //防止漏设此参数,默认 6 像素
  51321. style = Util_Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  51322. style.x = localLX[0] - location[0];
  51323. style.y = localLX[1] - location[1];
  51324. style.text = geometry.text;
  51325. //创建图形
  51326. var shape = new SmicText_SmicText({
  51327. style: style,
  51328. clickable: this.isClickAble,
  51329. hoverable: this.isHoverAble
  51330. });
  51331. //设置高亮样式
  51332. if (this.highlightStyle) {
  51333. shape.highlightStyle = this.highlightStyle;
  51334. }
  51335. //设置参考中心,指定图形位置
  51336. shape.refOriginalPosition = location;
  51337. //储存数据 id 属性,用于事件
  51338. shape.refDataID = this.data.id;
  51339. //储存数据 id 属性,用于事件-多图形同时高亮
  51340. shape.isHoverByRefDataID = this.isMultiHover;
  51341. //修改一些 shape 可选属性,通常不需要这么做
  51342. if (this.shapeOptions) {
  51343. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  51344. }
  51345. this.shapes.push(shape);
  51346. }
  51347. /**
  51348. * @function SuperMap.Feature.Theme.Vector.prototype.updateAndAddShapes
  51349. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  51350. */
  51351. updateAndAddShapes() {
  51352. var newLocalLX = this.getLocalXY(this.lonlat);
  51353. this.location = newLocalLX;
  51354. var render = this.layer.renderer;
  51355. for (var i = 0, len = this.shapes.length; i < len; i++) {
  51356. var shape = this.shapes[i];
  51357. //设置参考中心,指定图形位置
  51358. shape.refOriginalPosition = newLocalLX;
  51359. render.addShape(shape);
  51360. }
  51361. }
  51362. /**
  51363. * @function SuperMap.Feature.Theme.Vector.prototype.getShapesCount
  51364. * @description 获得专题要素中可视化图形的数量。
  51365. * @returns {number} 可视化图形的数量。
  51366. */
  51367. getShapesCount() {
  51368. return this.shapes.length;
  51369. }
  51370. /**
  51371. * @function SuperMap.Feature.Theme.Vector.prototype.getLocalXY
  51372. * @description 地理坐标转为像素坐标。
  51373. * @param {SuperMap.LonLat} lonlat - 专题要素地理位置。
  51374. */
  51375. getLocalXY(lonlat) {
  51376. return this.layer.getLocalXY(lonlat);
  51377. }
  51378. }
  51379. SuperMap.Feature.Theme.ThemeVector = ThemeVector_ThemeVector;
  51380. // CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  51381. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  51382. * This program are made available under the terms of the Apache License, Version 2.0
  51383. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51384. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  51385. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  51386. * This program are made available under the terms of the Apache License, Version 2.0
  51387. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51388. /**
  51389. * @class SuperMap.LevelRenderer.Group
  51390. * @category Visualization Theme
  51391. * @private
  51392. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  51393. * @extends {SuperMap.LevelRenderer.Transformable}
  51394. * (code)
  51395. * var g = new SuperMap.LevelRenderer.Group();
  51396. * var Circle = new SuperMap.LevelRenderer.Shape.Circle();
  51397. * g.position[0] = 100;
  51398. * g.position[1] = 100;
  51399. * g.addChild(new Circle({
  51400. * style: {
  51401. * x: 100,
  51402. * y: 100,
  51403. * r: 20,
  51404. * brushType: 'fill'
  51405. * }
  51406. * }));
  51407. * LR.addGroup(g);
  51408. * (end)
  51409. */
  51410. class Group_Group extends SuperMap.mixin(Eventful, Transformable_Transformable) {
  51411. /**
  51412. * @function SuperMap.LevelRenderer.Group.prototype.constructor
  51413. * @description 构造函数。
  51414. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  51415. */
  51416. constructor(options) {
  51417. super(options)
  51418. options = options || {};
  51419. /**
  51420. * @member {string} SuperMap.LevelRenderer.Group.prototype.id
  51421. * @description Group 的唯一标识。
  51422. */
  51423. this.id = null;
  51424. /**
  51425. * @readonly
  51426. * @member {string} [SuperMap.LevelRenderer.Group.prototype.type='group']
  51427. * @description 类型。
  51428. */
  51429. this.type = 'group';
  51430. //http://www.w3.org/TR/2dcontext/#clipping-region
  51431. /**
  51432. * @member {string} SuperMap.LevelRenderer.Group.prototype.clipShape
  51433. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  51434. */
  51435. this.clipShape = null;
  51436. /**
  51437. * @member {Array} SuperMap.LevelRenderer.Group.prototype._children
  51438. * @description _children。
  51439. */
  51440. this._children = [];
  51441. /**
  51442. * @member {Array} SuperMap.LevelRenderer.Group.prototype._storage
  51443. * @description _storage。
  51444. */
  51445. this._storage = null;
  51446. /**
  51447. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.__dirty=true]
  51448. * @description __dirty。
  51449. */
  51450. this.__dirty = true;
  51451. /**
  51452. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.ignore=false]
  51453. * @description 是否忽略该 Group 及其所有子节点。
  51454. */
  51455. this.ignore = false;
  51456. Util_Util.extend(this, options);
  51457. this.id = this.id || Util_Util.createUniqueID("smShapeGroup_");
  51458. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  51459. }
  51460. /**
  51461. * @function SuperMap.LevelRenderer.Group.prototype.destroy
  51462. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  51463. */
  51464. destroy() {
  51465. this.id = null;
  51466. this.type = null;
  51467. this.clipShape = null;
  51468. this._children = null;
  51469. this._storage = null;
  51470. this.__dirty = null;
  51471. this.ignore = null;
  51472. super.destroy();
  51473. }
  51474. /**
  51475. * @function SuperMap.LevelRenderer.Group.prototype.children
  51476. * @description 复制并返回一份新的包含所有儿子节点的数组。
  51477. * @returns {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  51478. */
  51479. children() {
  51480. return this._children.slice();
  51481. }
  51482. /**
  51483. * @function SuperMap.LevelRenderer.Group.prototype.childAt
  51484. * @description 获取指定 index 的儿子节点
  51485. * @param {number} idx - 节点索引。
  51486. * @returns {SuperMap.LevelRenderer.Shape} 图形。
  51487. */
  51488. childAt(idx) {
  51489. return this._children[idx];
  51490. }
  51491. /**
  51492. * @function SuperMap.LevelRenderer.Group.prototype.addChild
  51493. * @description 添加子节点,可以是 Shape 或者 Group。
  51494. * @param {(SuperMap.LevelRenderer.Shape|SuperMap.LevelRenderer.Group)} child - 节点图形。
  51495. */
  51496. // TODO Type Check
  51497. addChild(child) {
  51498. if (child == this) {
  51499. return;
  51500. }
  51501. if (child.parent == this) {
  51502. return;
  51503. }
  51504. if (child.parent) {
  51505. child.parent.removeChild(child);
  51506. }
  51507. this._children.push(child);
  51508. child.parent = this;
  51509. if (this._storage && this._storage !== child._storage) {
  51510. this._storage.addToMap(child);
  51511. if (child instanceof Group_Group) {
  51512. child.addChildrenToStorage(this._storage);
  51513. }
  51514. }
  51515. }
  51516. /**
  51517. * @function SuperMap.LevelRenderer.Group.prototype.removeChild
  51518. * @description 移除子节点。
  51519. * @param {SuperMap.LevelRenderer.Shape} child - 需要移除的子节点图形。
  51520. */
  51521. removeChild(child) {
  51522. var idx = Util_Util.indexOf(this._children, child);
  51523. this._children.splice(idx, 1);
  51524. child.parent = null;
  51525. if (this._storage) {
  51526. this._storage.delFromMap(child.id);
  51527. if (child instanceof Group_Group) {
  51528. child.delChildrenFromStorage(this._storage);
  51529. }
  51530. }
  51531. }
  51532. /**
  51533. * @function SuperMap.LevelRenderer.Group.prototype.eachChild
  51534. * @description 遍历所有子节点。
  51535. * @param {function} cb - 回调函数。
  51536. * @param {Object} context - 上下文。
  51537. */
  51538. eachChild(cb, context) {
  51539. var haveContext = !!context;
  51540. for (var i = 0; i < this._children.length; i++) {
  51541. var child = this._children[i];
  51542. if (haveContext) {
  51543. cb.call(context, child);
  51544. } else {
  51545. cb(child);
  51546. }
  51547. }
  51548. }
  51549. /**
  51550. * @function SuperMap.LevelRenderer.Group.prototype.traverse
  51551. * @description 深度优先遍历所有子孙节点。
  51552. * @param {function} cb - 回调函数。
  51553. * @param {Object} context - 上下文。
  51554. */
  51555. traverse(cb, context) {
  51556. var haveContext = !!context;
  51557. for (var i = 0; i < this._children.length; i++) {
  51558. var child = this._children[i];
  51559. if (haveContext) {
  51560. cb.call(context, child);
  51561. } else {
  51562. cb(child);
  51563. }
  51564. if (child.type === 'group') {
  51565. child.traverse(cb, context);
  51566. }
  51567. }
  51568. }
  51569. /**
  51570. * @function SuperMap.LevelRenderer.Group.prototype.addChildrenToStorage
  51571. * @description 把子图形添加到仓库。
  51572. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  51573. */
  51574. addChildrenToStorage(storage) {
  51575. for (var i = 0; i < this._children.length; i++) {
  51576. var child = this._children[i];
  51577. storage.addToMap(child);
  51578. if (child.type === 'group') {
  51579. child.addChildrenToStorage(storage);
  51580. }
  51581. }
  51582. }
  51583. /**
  51584. * @function SuperMap.LevelRenderer.Group.prototype.delChildrenFromStorage
  51585. * @description 从仓库把子图形删除。
  51586. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  51587. */
  51588. delChildrenFromStorage(storage) {
  51589. for (var i = 0; i < this._children.length; i++) {
  51590. var child = this._children[i];
  51591. storage.delFromMap(child.id);
  51592. if (child.type === 'group') {
  51593. child.delChildrenFromStorage(storage);
  51594. }
  51595. }
  51596. }
  51597. /**
  51598. * @function SuperMap.LevelRenderer.Group.prototype.modSelf
  51599. * @description 是否修改。
  51600. */
  51601. modSelf() {
  51602. this.__dirty = true;
  51603. }
  51604. }
  51605. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  51606. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  51607. * This program are made available under the terms of the Apache License, Version 2.0
  51608. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51609. /**
  51610. * @private
  51611. * @class SuperMap.LevelRenderer.Storage
  51612. * @category Visualization Theme
  51613. * @classdesc 内容(图像)仓库 (M) 。
  51614. */
  51615. class Storage_Storage {
  51616. /**
  51617. * @function SuperMap.LevelRenderer.Storage.constructor
  51618. * @description 构造函数。
  51619. */
  51620. constructor() {
  51621. /**
  51622. * @member {Object} SuperMap.LevelRenderer.Storage.prototype._elements
  51623. * @description 所有常规形状,id 索引的 map。
  51624. */
  51625. this._elements = {};
  51626. /**
  51627. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._hoverElements
  51628. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  51629. *
  51630. */
  51631. this._hoverElements = [];
  51632. /**
  51633. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._roots
  51634. * @description _roots。
  51635. *
  51636. */
  51637. this._roots = [];
  51638. /**
  51639. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._shapeList
  51640. * @description _shapeList。
  51641. *
  51642. */
  51643. this._shapeList = [];
  51644. /**
  51645. * @member {number} SuperMap.LevelRenderer.Storage.prototype._shapeListOffset
  51646. * @description _shapeListOffset。默认值:0。
  51647. *
  51648. */
  51649. this._shapeListOffset = 0;
  51650. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  51651. }
  51652. /**
  51653. * @function SuperMap.LevelRenderer.Storage.prototype.destroy
  51654. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  51655. */
  51656. destroy() {
  51657. this.dispose();
  51658. this._shapeList = null;
  51659. this._shapeListOffset = null;
  51660. }
  51661. /**
  51662. * @function SuperMap.LevelRenderer.Storage.prototype.iterShape
  51663. * @description 遍历迭代器。
  51664. *
  51665. * @param {Function} fun - 迭代回调函数,return true终止迭代。
  51666. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  51667. * @param {boolean} [hover=true] - 是否是高亮层图形。
  51668. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  51669. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  51670. * @return {SuperMap.LevelRenderer.Storage} this。
  51671. */
  51672. iterShape(fun, option) {
  51673. if (!option) {
  51674. var defaultIterateOption = {
  51675. hover: false,
  51676. normal: 'down',
  51677. update: false
  51678. };
  51679. option = defaultIterateOption;
  51680. }
  51681. if (option.hover) {
  51682. // 高亮层数据遍历
  51683. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  51684. var el = this._hoverElements[i];
  51685. el.updateTransform();
  51686. if (fun(el)) {
  51687. return this;
  51688. }
  51689. }
  51690. }
  51691. if (option.update) {
  51692. this.updateShapeList();
  51693. }
  51694. // 遍历: 'down' | 'up'
  51695. switch (option.normal) {
  51696. case 'down':
  51697. {
  51698. // 降序遍历,高层优先
  51699. let l = this._shapeList.length;
  51700. while (l--) {
  51701. if (fun(this._shapeList[l])) {
  51702. return this;
  51703. }
  51704. }
  51705. break;
  51706. }
  51707. // case 'up':
  51708. default:
  51709. {
  51710. // 升序遍历,底层优先
  51711. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  51712. if (fun(this._shapeList[i])) {
  51713. return this;
  51714. }
  51715. }
  51716. break;
  51717. }
  51718. }
  51719. return this;
  51720. }
  51721. /**
  51722. * @function SuperMap.LevelRenderer.Storage.prototype.getHoverShapes
  51723. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  51724. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  51725. */
  51726. getHoverShapes(update) {
  51727. // hoverConnect
  51728. var hoverElements = [], len = this._hoverElements.length;
  51729. for (let i = 0; i < len; i++) {
  51730. hoverElements.push(this._hoverElements[i]);
  51731. var target = this._hoverElements[i].hoverConnect;
  51732. if (target) {
  51733. var shape;
  51734. target = target instanceof Array ? target : [target];
  51735. for (var j = 0, k = target.length; j < k; j++) {
  51736. shape = target[j].id ? target[j] : this.get(target[j]);
  51737. if (shape) {
  51738. hoverElements.push(shape);
  51739. }
  51740. }
  51741. }
  51742. }
  51743. hoverElements.sort(Storage_Storage.shapeCompareFunc);
  51744. if (update) {
  51745. for (let i = 0, l = hoverElements.length; i < l; i++) {
  51746. hoverElements[i].updateTransform();
  51747. }
  51748. }
  51749. return hoverElements;
  51750. }
  51751. /**
  51752. * @function SuperMap.LevelRenderer.Storage.prototype.getShapeList
  51753. * @description 返回所有图形的绘制队列。
  51754. *
  51755. * @param {boolean} [update=false] - 是否在返回前更新该数组。 详见:<SuperMap.LevelRenderer.Shape> updateShapeList。
  51756. * @return {SuperMap.LevelRenderer.Shape} 图形。
  51757. */
  51758. getShapeList(update) {
  51759. if (update) {
  51760. this.updateShapeList();
  51761. }
  51762. return this._shapeList;
  51763. }
  51764. /**
  51765. * @function SuperMap.LevelRenderer.Storage.prototype.updateShapeList
  51766. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  51767. */
  51768. updateShapeList() {
  51769. this._shapeListOffset = 0;
  51770. var rootsLen = this._roots.length;
  51771. for (let i = 0; i < rootsLen; i++) {
  51772. let root = this._roots[i];
  51773. this._updateAndAddShape(root);
  51774. }
  51775. this._shapeList.length = this._shapeListOffset;
  51776. var shapeListLen = this._shapeList.length;
  51777. for (let i = 0; i < shapeListLen; i++) {
  51778. this._shapeList[i].__renderidx = i;
  51779. }
  51780. this._shapeList.sort(Storage_Storage.shapeCompareFunc);
  51781. }
  51782. /**
  51783. * @function SuperMap.LevelRenderer.Storage.prototype._updateAndAddShape
  51784. * @description 更新并添加图形。
  51785. *
  51786. */
  51787. _updateAndAddShape(el, clipShapes) {
  51788. if (el.ignore) {
  51789. return;
  51790. }
  51791. el.updateTransform();
  51792. if (el.type == 'group') {
  51793. if (el.clipShape) {
  51794. // clipShape 的变换是基于 group 的变换
  51795. el.clipShape.parent = el;
  51796. el.clipShape.updateTransform();
  51797. // PENDING 效率影响
  51798. if (clipShapes) {
  51799. clipShapes = clipShapes.slice();
  51800. clipShapes.push(el.clipShape);
  51801. } else {
  51802. clipShapes = [el.clipShape];
  51803. }
  51804. }
  51805. for (var i = 0; i < el._children.length; i++) {
  51806. var child = el._children[i];
  51807. // Force to mark as dirty if group is dirty
  51808. child.__dirty = el.__dirty || child.__dirty;
  51809. this._updateAndAddShape(child, clipShapes);
  51810. }
  51811. // Mark group clean here
  51812. el.__dirty = false;
  51813. } else {
  51814. el.__clipShapes = clipShapes;
  51815. this._shapeList[this._shapeListOffset++] = el;
  51816. }
  51817. }
  51818. /**
  51819. * @function SuperMap.LevelRenderer.Storage.prototype.mod
  51820. * @description 修改图形(Shape)或者组(Group)。
  51821. *
  51822. * @param {string} elId - 唯一标识。
  51823. * @param {Object} params - 参数。
  51824. * @return {SuperMap.LevelRenderer.Storage} this。
  51825. */
  51826. mod(elId, params) {
  51827. var el = this._elements[elId];
  51828. if (el) {
  51829. el.modSelf();
  51830. if (params) {
  51831. // 如果第二个参数直接使用 shape
  51832. // parent, _storage, __startClip 三个属性会有循环引用
  51833. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  51834. if (params.parent || params._storage || params.__startClip) {
  51835. var target = {};
  51836. for (var name in params) {
  51837. if (
  51838. name == 'parent'
  51839. || name == '_storage'
  51840. || name == '__startClip'
  51841. ) {
  51842. continue;
  51843. }
  51844. if (params.hasOwnProperty(name)) {
  51845. target[name] = params[name];
  51846. }
  51847. }
  51848. new levelRenderer_Util_Util().merge(el, target, true);
  51849. } else {
  51850. new levelRenderer_Util_Util().merge(el, params, true);
  51851. }
  51852. }
  51853. }
  51854. return this;
  51855. }
  51856. /**
  51857. * @function SuperMap.LevelRenderer.Storage.prototype.drift
  51858. * @description 移动指定的图形(Shape)的位置。
  51859. * @param {string} shapeId - 唯一标识。
  51860. * @param {number} dx
  51861. * @param {number} dy
  51862. * @return {SuperMap.LevelRenderer.Storage} this。
  51863. */
  51864. drift(shapeId, dx, dy) {
  51865. var shape = this._elements[shapeId];
  51866. if (shape) {
  51867. shape.needTransform = true;
  51868. if (shape.draggable === 'horizontal') {
  51869. dy = 0;
  51870. } else if (shape.draggable === 'vertical') {
  51871. dx = 0;
  51872. }
  51873. if (!shape.ondrift // ondrift
  51874. // 有onbrush并且调用执行返回false或undefined则继续
  51875. || (shape.ondrift && !shape.ondrift(dx, dy))
  51876. ) {
  51877. shape.drift(dx, dy);
  51878. }
  51879. }
  51880. return this;
  51881. }
  51882. /**
  51883. * @function SuperMap.LevelRenderer.Storage.prototype.addHover
  51884. * @description 添加高亮层数据。
  51885. * @param {SuperMap.LevelRenderer.Shape} shape - 图形。
  51886. * @return {SuperMap.LevelRenderer.Storage} this。
  51887. */
  51888. addHover(shape) {
  51889. shape.updateNeedTransform();
  51890. this._hoverElements.push(shape);
  51891. return this;
  51892. }
  51893. /**
  51894. * @function SuperMap.LevelRenderer.Storage.prototype.delHover
  51895. * @description 清空高亮层数据。
  51896. * @return {SuperMap.LevelRenderer.Storage} this。
  51897. */
  51898. delHover() {
  51899. this._hoverElements = [];
  51900. return this;
  51901. }
  51902. /**
  51903. * @function SuperMap.LevelRenderer.Storage.prototype.hasHoverShape
  51904. * @description 是否有图形在高亮层里。
  51905. * @return {boolean} 是否有图形在高亮层里。
  51906. */
  51907. hasHoverShape() {
  51908. return this._hoverElements.length > 0;
  51909. }
  51910. /**
  51911. * @function SuperMap.LevelRenderer.Storage.prototype.addRoot
  51912. * @description 添加图形(Shape)或者组(Group)到根节点。
  51913. *
  51914. * @param {(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)} el - 图形。
  51915. *
  51916. */
  51917. addRoot(el) {
  51918. if (el instanceof Group_Group) {
  51919. el.addChildrenToStorage(this);
  51920. }
  51921. this.addToMap(el);
  51922. this._roots.push(el);
  51923. }
  51924. /**
  51925. * @function SuperMap.LevelRenderer.Storage.prototype.delRoot
  51926. * @description 删除指定的图形(Shape)或者组(Group)。
  51927. *
  51928. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 id 数组。如果为空清空整个Storage。
  51929. *
  51930. */
  51931. delRoot(elId) {
  51932. if (typeof(elId) == 'undefined') {
  51933. // 不指定elId清空
  51934. for (var i = 0; i < this._roots.length; i++) {
  51935. var root = this._roots[i];
  51936. if (root instanceof Group_Group) {
  51937. root.delChildrenFromStorage(this);
  51938. }
  51939. }
  51940. this._elements = {};
  51941. this._hoverElements = [];
  51942. this._roots = [];
  51943. return;
  51944. }
  51945. if (elId instanceof Array) {
  51946. var elIdLen = elId.length;
  51947. for (let i = 0; i < elIdLen; i++) {
  51948. this.delRoot(elId[i]);
  51949. }
  51950. return;
  51951. }
  51952. var el;
  51953. if (typeof(elId) == 'string') {
  51954. el = this._elements[elId];
  51955. } else {
  51956. el = elId;
  51957. }
  51958. var idx = new levelRenderer_Util_Util().indexOf(this._roots, el);
  51959. if (idx >= 0) {
  51960. this.delFromMap(el.id);
  51961. this._roots.splice(idx, 1);
  51962. if (el instanceof Group_Group) {
  51963. el.delChildrenFromStorage(this);
  51964. }
  51965. }
  51966. }
  51967. /**
  51968. * @function SuperMap.LevelRenderer.Storage.prototype.addToMap
  51969. * @description 添加图形到 map。
  51970. *
  51971. * @param {SuperMap.LevelRenderer.Shape} el - 图形。
  51972. * @return {SuperMap.LevelRenderer.Storage} this。
  51973. */
  51974. addToMap(el) {
  51975. if (el instanceof Group_Group) {
  51976. el._storage = this;
  51977. }
  51978. el.modSelf();
  51979. this._elements[el.id] = el;
  51980. return this;
  51981. }
  51982. /**
  51983. * @function SuperMap.LevelRenderer.Storage.prototype.get
  51984. * @description 获取指定图形。
  51985. *
  51986. * @param {string} elId - 图形 id。
  51987. * @return {SuperMap.LevelRenderer.Shape} 图形。
  51988. */
  51989. get(elId) {
  51990. return this._elements[elId];
  51991. }
  51992. /**
  51993. * @function SuperMap.LevelRenderer.Storage.prototype.delFromMap
  51994. * @description 从 map 中删除指定图形。
  51995. *
  51996. * @param {string} elId - 图形id。
  51997. * @return {SuperMap.LevelRenderer.Storage} this。
  51998. */
  51999. delFromMap(elId) {
  52000. var el = this._elements[elId];
  52001. if (el) {
  52002. delete this._elements[elId];
  52003. if (el instanceof Group_Group) {
  52004. el._storage = null;
  52005. }
  52006. }
  52007. return this;
  52008. }
  52009. /**
  52010. * @function SuperMap.LevelRenderer.Storage.prototype.dispose
  52011. * @description 清空并且释放 Storage。
  52012. */
  52013. dispose() {
  52014. this._elements = null;
  52015. // this._renderList = null;
  52016. this._roots = null;
  52017. this._hoverElements = null;
  52018. }
  52019. static shapeCompareFunc(a, b) {
  52020. if (a.zlevel == b.zlevel) {
  52021. if (a.z == b.z) {
  52022. return a.__renderidx - b.__renderidx;
  52023. }
  52024. return a.z - b.z;
  52025. }
  52026. return a.zlevel - b.zlevel;
  52027. }
  52028. }
  52029. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  52030. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  52031. * This program are made available under the terms of the Apache License, Version 2.0
  52032. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52033. /**
  52034. * @private
  52035. * @class SuperMap.LevelRenderer.Painter
  52036. * @category Visualization Theme
  52037. * @classdesc Painter 绘图模块。
  52038. */
  52039. class Painter_Painter {
  52040. /**
  52041. * @function SuperMap.LevelRenderer.Painter.constructor
  52042. * @description 构造函数。
  52043. *
  52044. * @param {HTMLElement} root - 绘图区域(DIV)。
  52045. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  52046. *
  52047. */
  52048. constructor(root, storage) {
  52049. /**
  52050. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype.root
  52051. * @description 绘图容器。
  52052. *
  52053. */
  52054. this.root = root;
  52055. /**
  52056. * @member {Array} SuperMap.LevelRenderer.Painter.prototype.storage
  52057. * @description 图形仓库。
  52058. *
  52059. */
  52060. this.storage = storage;
  52061. /**
  52062. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype._domRoot
  52063. * @description 容器根 dom 对象。
  52064. *
  52065. */
  52066. this._domRoot = null;
  52067. /**
  52068. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layers
  52069. * @description 绘制层对象。
  52070. *
  52071. */
  52072. this._layers = {};
  52073. /**
  52074. * @member {Array} SuperMap.LevelRenderer.Painter.prototype._zlevelList
  52075. * @description 层列表。
  52076. *
  52077. */
  52078. this._zlevelList = [];
  52079. /**
  52080. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layerConfig
  52081. * @description 绘制层配置对象。
  52082. *
  52083. */
  52084. this._layerConfig = {};
  52085. /**
  52086. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._bgDom
  52087. * @description 背景层 Canvas (Dom)。
  52088. *
  52089. */
  52090. this._bgDom = null;
  52091. /**
  52092. * @member {Function} SuperMap.LevelRenderer.Painter.prototype.shapeToImage
  52093. * @description 形状转图像函数。
  52094. *
  52095. */
  52096. this.shapeToImage = null;
  52097. // retina 屏幕优化
  52098. Painter_Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  52099. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  52100. this.root.innerHTML = '';
  52101. this._width = this._getWidth(); // 宽,缓存记录
  52102. this._height = this._getHeight(); // 高,缓存记录
  52103. var domRoot = document.createElement('div');
  52104. this._domRoot = domRoot;
  52105. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  52106. domRoot.style.position = 'relative';
  52107. domRoot.style.overflow = 'hidden';
  52108. domRoot.style.width = this._width + 'px';
  52109. domRoot.style.height = this._height + 'px';
  52110. this.root.appendChild(domRoot);
  52111. this.shapeToImage = this._createShapeToImageProcessor();
  52112. // 创建各层canvas
  52113. // 背景
  52114. //this._bgDom = Painter.createDom('bg', 'div', this);
  52115. this._bgDom = Painter_Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  52116. domRoot.appendChild(this._bgDom);
  52117. this._bgDom.onselectstart = returnFalse;
  52118. this._bgDom.style['-webkit-user-select'] = 'none';
  52119. this._bgDom.style['user-select'] = 'none';
  52120. this._bgDom.style['-webkit-touch-callout'] = 'none';
  52121. // 高亮
  52122. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  52123. var hoverLayer = new Painter_PaintLayer(Util_Util.createUniqueID("_highLightLayer_"), this);
  52124. this._layers['hover'] = hoverLayer;
  52125. domRoot.appendChild(hoverLayer.dom);
  52126. hoverLayer.initContext();
  52127. hoverLayer.dom.onselectstart = returnFalse;
  52128. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  52129. hoverLayer.dom.style['user-select'] = 'none';
  52130. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  52131. var me = this;
  52132. this.updatePainter = function (shapeList, callback) {
  52133. me.refreshShapes(shapeList, callback);
  52134. };
  52135. // 返回false的方法,用于避免页面被选中
  52136. function returnFalse() {
  52137. return false;
  52138. }
  52139. /* eslint-disable */
  52140. // 什么都不干的空方法
  52141. function doNothing() { //NOSONAR
  52142. }
  52143. /* eslint-enable */
  52144. }
  52145. /**
  52146. * @function SuperMap.LevelRenderer.Painter.prototype.destroy
  52147. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52148. */
  52149. destroy() {
  52150. this.dispose();
  52151. this._zlevelList = null;
  52152. this._layerConfig = null;
  52153. this._bgDom = null;
  52154. this.shapeToImage = null;
  52155. }
  52156. /**
  52157. * @function SuperMap.LevelRenderer.Painter.prototype.render
  52158. * @description 渲染。首次绘图,创建各种 dom 和 context。
  52159. *
  52160. * @param {Function} callback - 绘画结束后的回调函数。
  52161. * @return {SuperMap.LevelRenderer.Painter} this。
  52162. */
  52163. render(callback) {
  52164. // TODO
  52165. this.refresh(callback, true);
  52166. return this;
  52167. }
  52168. /**
  52169. * @function SuperMap.LevelRenderer.Painter.prototype.refresh
  52170. * @description 刷新。
  52171. *
  52172. * @param {Function} callback - 刷新结束后的回调函数。
  52173. * @param {boolean} paintAll - 强制绘制所有 shape。
  52174. * @return {SuperMap.LevelRenderer.Painter} this。
  52175. */
  52176. refresh(callback, paintAll) {
  52177. var list = this.storage.getShapeList(true);
  52178. this._paintList(list, paintAll);
  52179. if (typeof callback == 'function') {
  52180. callback();
  52181. }
  52182. return this;
  52183. }
  52184. /**
  52185. * Method: _paintList
  52186. * 按列表绘制图形。
  52187. */
  52188. _paintList(list, paintAll) {
  52189. if (typeof(paintAll) == 'undefined') {
  52190. paintAll = false;
  52191. }
  52192. this._updateLayerStatus(list);
  52193. var currentLayer;
  52194. var currentZLevel;
  52195. var ctx;
  52196. for (var id in this._layers) {
  52197. if (id !== 'hover') {
  52198. this._layers[id].unusedCount++;
  52199. this._layers[id].updateTransform();
  52200. }
  52201. }
  52202. var invTransform = [];
  52203. for (var i = 0, l = list.length; i < l; i++) {
  52204. var shape = list[i];
  52205. if (currentZLevel !== shape.zlevel) {
  52206. if (currentLayer && currentLayer.needTransform) {
  52207. ctx.restore();
  52208. }
  52209. currentLayer = this.getLayer(shape.zlevel);
  52210. ctx = currentLayer.ctx;
  52211. currentZLevel = shape.zlevel;
  52212. // Reset the count
  52213. currentLayer.unusedCount = 0;
  52214. if (currentLayer.dirty || paintAll) {
  52215. currentLayer.clear();
  52216. }
  52217. if (currentLayer.needTransform) {
  52218. ctx.save();
  52219. currentLayer.setTransform(ctx);
  52220. }
  52221. }
  52222. // Start group clipping
  52223. if (ctx && shape.__startClip) {
  52224. var clipShape = shape.__startClip;
  52225. ctx.save();
  52226. // Set transform
  52227. if (clipShape.needTransform) {
  52228. let m = clipShape.transform;
  52229. SUtil.Util_matrix.invert(invTransform, m);
  52230. ctx.transform(
  52231. m[0], m[1],
  52232. m[2], m[3],
  52233. m[4], m[5]
  52234. );
  52235. }
  52236. ctx.beginPath();
  52237. clipShape.buildPath(ctx, clipShape.style);
  52238. ctx.clip();
  52239. // Transform back
  52240. if (clipShape.needTransform) {
  52241. let m = invTransform;
  52242. ctx.transform(
  52243. m[0], m[1],
  52244. m[2], m[3],
  52245. m[4], m[5]
  52246. );
  52247. }
  52248. }
  52249. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  52250. if (
  52251. !shape.onbrush
  52252. || (shape.onbrush && !shape.onbrush(ctx, false))
  52253. ) {
  52254. if (Config.catchBrushException) {
  52255. try {
  52256. shape.brush(ctx, false, this.updatePainter);
  52257. } catch (error) {
  52258. SUtil.Util_log(
  52259. error,
  52260. 'brush error of ' + shape.type,
  52261. shape
  52262. );
  52263. }
  52264. } else {
  52265. shape.brush(ctx, false, this.updatePainter);
  52266. }
  52267. }
  52268. }
  52269. // Stop group clipping
  52270. if (ctx && shape.__stopClip) {
  52271. ctx.restore();
  52272. }
  52273. shape.__dirty = false;
  52274. }
  52275. if (ctx && currentLayer && currentLayer.needTransform) {
  52276. ctx.restore();
  52277. }
  52278. for (let id in this._layers) {
  52279. if (id !== 'hover') {
  52280. var layer = this._layers[id];
  52281. layer.dirty = false;
  52282. // 删除过期的层
  52283. // PENDING
  52284. // if (layer.unusedCount >= 500) {
  52285. // this.delLayer(id);
  52286. // }
  52287. if (layer.unusedCount == 1) {
  52288. layer.clear();
  52289. }
  52290. }
  52291. }
  52292. }
  52293. /**
  52294. * @function SuperMap.LevelRenderer.Painter.prototype.getLayer
  52295. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  52296. *
  52297. * @param {number} zlevel - zlevel。
  52298. * @return {SuperMap.LevelRenderer.Painter} this。
  52299. */
  52300. getLayer(zlevel) {
  52301. // Change draw layer
  52302. var currentLayer = this._layers[zlevel];
  52303. if (!currentLayer) {
  52304. var len = this._zlevelList.length;
  52305. var prevLayer = null;
  52306. var i = -1;
  52307. if (len > 0 && zlevel > this._zlevelList[0]) {
  52308. for (i = 0; i < len - 1; i++) {
  52309. if (
  52310. this._zlevelList[i] < zlevel
  52311. && this._zlevelList[i + 1] > zlevel
  52312. ) {
  52313. break;
  52314. }
  52315. }
  52316. prevLayer = this._layers[this._zlevelList[i]];
  52317. }
  52318. this._zlevelList.splice(i + 1, 0, zlevel);
  52319. // Create a new layer
  52320. //currentLayer = new PaintLayer(zlevel, this);
  52321. currentLayer = new Painter_PaintLayer(Util_Util.createUniqueID("_levelLayer_" + zlevel), this);
  52322. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  52323. if (prevDom.nextSibling) {
  52324. prevDom.parentNode.insertBefore(
  52325. currentLayer.dom,
  52326. prevDom.nextSibling
  52327. );
  52328. } else {
  52329. prevDom.parentNode.appendChild(
  52330. currentLayer.dom
  52331. );
  52332. }
  52333. currentLayer.initContext();
  52334. this._layers[zlevel] = currentLayer;
  52335. if (this._layerConfig[zlevel]) {
  52336. new levelRenderer_Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  52337. }
  52338. currentLayer.updateTransform();
  52339. }
  52340. return currentLayer;
  52341. }
  52342. /**
  52343. * @function SuperMap.LevelRenderer.Painter.prototype.getLayers
  52344. * @description 获取所有已创建的层。
  52345. * @return {Array.<Painter.Layer>} 已创建的层
  52346. */
  52347. getLayers() {
  52348. return this._layers;
  52349. }
  52350. /**
  52351. * Method: _updateLayerStatus
  52352. * 更新绘制层状态。
  52353. */
  52354. _updateLayerStatus(list) {
  52355. var layers = this._layers;
  52356. var elCounts = {};
  52357. for (let z in layers) {
  52358. if (z !== 'hover') {
  52359. elCounts[z] = layers[z].elCount;
  52360. layers[z].elCount = 0;
  52361. }
  52362. }
  52363. for (let i = 0; i < list.length; i++) {
  52364. var shape = list[i];
  52365. var zlevel = shape.zlevel;
  52366. var layer = layers[zlevel];
  52367. if (layer) {
  52368. layer.elCount++;
  52369. // 已经被标记为需要刷新
  52370. if (layer.dirty) {
  52371. continue;
  52372. }
  52373. layer.dirty = shape.__dirty;
  52374. }
  52375. }
  52376. // 层中的元素数量有发生变化
  52377. for (let z in layers) {
  52378. if (z !== 'hover') {
  52379. if (elCounts[z] !== layers[z].elCount) {
  52380. layers[z].dirty = true;
  52381. }
  52382. }
  52383. }
  52384. }
  52385. /**
  52386. * @function SuperMap.LevelRenderer.Painter.prototype.refreshShapes
  52387. * @description 更新的图形元素列表。
  52388. *
  52389. * @param {number} shapeList - 需要更新的图形元素列表。
  52390. * @param {number} callback - 视图更新后回调函数。
  52391. * @return {SuperMap.LevelRenderer.Painter} this。
  52392. */
  52393. refreshShapes(shapeList, callback) {
  52394. for (var i = 0, l = shapeList.length; i < l; i++) {
  52395. var shape = shapeList[i];
  52396. this.storage.mod(shape.id);
  52397. }
  52398. this.refresh(callback);
  52399. return this;
  52400. }
  52401. /**
  52402. * @function SuperMap.LevelRenderer.Painter.prototype.clear
  52403. * @description 清除 hover 层外所有内容。
  52404. * @return {SuperMap.LevelRenderer.Painter} this。
  52405. */
  52406. clear() {
  52407. for (var k in this._layers) {
  52408. if (k == 'hover') {
  52409. continue;
  52410. }
  52411. this._layers[k].clear();
  52412. }
  52413. return this;
  52414. }
  52415. /**
  52416. * @function SuperMap.LevelRenderer.Painter.prototype.modLayer
  52417. * @description 修改指定 zlevel 的绘制参数。
  52418. *
  52419. * @param {string} zlevel - zlevel。
  52420. * @param {Object} config - 配置对象。
  52421. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  52422. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  52423. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  52424. * @param {Array.<number>} config.position - 层的平移。
  52425. * @param {Array.<number>} config.rotation - 层的旋转。
  52426. * @param {Array.<number>} config.scale - 层的缩放。
  52427. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  52428. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  52429. *
  52430. */
  52431. modLayer(zlevel, config) {
  52432. if (config) {
  52433. if (!this._layerConfig[zlevel]) {
  52434. this._layerConfig[zlevel] = config;
  52435. } else {
  52436. new levelRenderer_Util_Util().merge(this._layerConfig[zlevel], config, true);
  52437. }
  52438. var layer = this._layers[zlevel];
  52439. if (layer) {
  52440. new levelRenderer_Util_Util().merge(layer, this._layerConfig[zlevel], true);
  52441. }
  52442. }
  52443. }
  52444. /**
  52445. * @function SuperMap.LevelRenderer.Painter.prototype.delLayer
  52446. * @description 删除指定层。
  52447. *
  52448. * @param {string} zlevel - 层所在的 zlevel。
  52449. */
  52450. delLayer(zlevel) {
  52451. var layer = this._layers[zlevel];
  52452. if (!layer) {
  52453. return;
  52454. }
  52455. // Save config
  52456. this.modLayer(zlevel, {
  52457. position: layer.position,
  52458. rotation: layer.rotation,
  52459. scale: layer.scale
  52460. });
  52461. layer.dom.parentNode.removeChild(layer.dom);
  52462. delete this._layers[zlevel];
  52463. this._zlevelList.splice(new levelRenderer_Util_Util().indexOf(this._zlevelList, zlevel), 1);
  52464. }
  52465. /**
  52466. * @function SuperMap.LevelRenderer.Painter.prototype.refreshHover
  52467. * @description 刷新 hover 层。
  52468. * @return {SuperMap.LevelRenderer.Painter} this。
  52469. */
  52470. refreshHover() {
  52471. this.clearHover();
  52472. var list = this.storage.getHoverShapes(true);
  52473. for (var i = 0, l = list.length; i < l; i++) {
  52474. this._brushHover(list[i]);
  52475. }
  52476. this.storage.delHover();
  52477. return this;
  52478. }
  52479. /**
  52480. * @function SuperMap.LevelRenderer.Painter.prototype.clearHover
  52481. * @description 清除 hover 层所有内容。
  52482. * @return {SuperMap.LevelRenderer.Painter} this。
  52483. */
  52484. clearHover() {
  52485. var hover = this._layers.hover;
  52486. hover && hover.clear();
  52487. return this;
  52488. }
  52489. /**
  52490. * @function SuperMap.LevelRenderer.Painter.prototype.resize
  52491. * @description 区域大小变化后重绘。
  52492. * @return {SuperMap.LevelRenderer.Painter} this。
  52493. */
  52494. resize() {
  52495. var domRoot = this._domRoot;
  52496. domRoot.style.display = 'none';
  52497. var width = this._getWidth();
  52498. var height = this._getHeight();
  52499. domRoot.style.display = '';
  52500. // 优化没有实际改变的resize
  52501. if (this._width != width || height != this._height) {
  52502. this._width = width;
  52503. this._height = height;
  52504. domRoot.style.width = width + 'px';
  52505. domRoot.style.height = height + 'px';
  52506. for (var id in this._layers) {
  52507. this._layers[id].resize(width, height);
  52508. }
  52509. this.refresh(null, true);
  52510. }
  52511. return this;
  52512. }
  52513. /**
  52514. * @function SuperMap.LevelRenderer.Painter.prototype.clearLayer
  52515. * @description 清除指定的一个层。
  52516. * @param {number} zLevel - 层。
  52517. */
  52518. clearLayer(zLevel) {
  52519. var layer = this._layers[zLevel];
  52520. if (layer) {
  52521. layer.clear();
  52522. }
  52523. }
  52524. /**
  52525. * @function SuperMap.LevelRenderer.Painter.prototype.dispose
  52526. * @description 释放。
  52527. *
  52528. */
  52529. dispose() {
  52530. this.root.innerHTML = '';
  52531. this.root = null;
  52532. this.storage = null;
  52533. this._domRoot = null;
  52534. this._layers = null;
  52535. }
  52536. /**
  52537. * @function SuperMap.LevelRenderer.Painter.prototype.getDomHover
  52538. * @description 获取 Hover 层的 Dom。
  52539. */
  52540. getDomHover() {
  52541. return this._layers.hover.dom;
  52542. }
  52543. /**
  52544. * @function SuperMap.LevelRenderer.Painter.prototype.toDataURL
  52545. * @description 图像导出。
  52546. * @param {string} type - 图片类型。
  52547. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  52548. * @param {Object} args
  52549. * @return {string} 图片的Base64 url。
  52550. */
  52551. toDataURL(type, backgroundColor, args) {
  52552. //var imageDom = Painter.createDom('image', 'canvas', this);
  52553. var imageDom = Painter_Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  52554. this._bgDom.appendChild(imageDom);
  52555. var ctx = imageDom.getContext('2d');
  52556. Painter_Painter.devicePixelRatio != 1
  52557. && ctx.scale(Painter_Painter.devicePixelRatio, Painter_Painter.devicePixelRatio);
  52558. ctx.fillStyle = backgroundColor || '#fff';
  52559. ctx.rect(
  52560. 0, 0,
  52561. this._width * Painter_Painter.devicePixelRatio,
  52562. this._height * Painter_Painter.devicePixelRatio
  52563. );
  52564. ctx.fill();
  52565. var self = this;
  52566. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  52567. this.storage.iterShape(
  52568. function (shape) {
  52569. if (!shape.invisible) {
  52570. if (!shape.onbrush // 没有onbrush
  52571. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  52572. || (shape.onbrush && !shape.onbrush(ctx, false))
  52573. ) {
  52574. if (Config.catchBrushException) {
  52575. try {
  52576. shape.brush(ctx, false, self.updatePainter);
  52577. } catch (error) {
  52578. SUtil.Util_log(
  52579. error,
  52580. 'brush error of ' + shape.type,
  52581. shape
  52582. );
  52583. }
  52584. } else {
  52585. shape.brush(ctx, false, self.updatePainter);
  52586. }
  52587. }
  52588. }
  52589. },
  52590. {normal: 'up', update: true}
  52591. );
  52592. var image = imageDom.toDataURL(type, args);
  52593. ctx = null;
  52594. this._bgDom.removeChild(imageDom);
  52595. return image;
  52596. }
  52597. /**
  52598. * @function SuperMap.LevelRenderer.Painter.prototype.getWidth
  52599. * @description 获取绘图区域宽度。
  52600. * @return {number} 绘图区域宽度。
  52601. */
  52602. getWidth() {
  52603. return this._width;
  52604. }
  52605. /**
  52606. * @function SuperMap.LevelRenderer.Painter.prototype.getHeight
  52607. * @description 获取绘图区域高度。
  52608. * @return {number} 绘图区域高度。
  52609. */
  52610. getHeight() {
  52611. return this._height;
  52612. }
  52613. /**
  52614. * Method: _getWidth
  52615. *
  52616. */
  52617. _getWidth() {
  52618. var root = this.root;
  52619. var stl = root.currentStyle
  52620. || document.defaultView.getComputedStyle(root);
  52621. return ((root.clientWidth || parseInt(stl.width, 10))
  52622. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  52623. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  52624. }
  52625. /**
  52626. * Method: _getHeight
  52627. *
  52628. */
  52629. _getHeight() {
  52630. var root = this.root;
  52631. var stl = root.currentStyle
  52632. || document.defaultView.getComputedStyle(root);
  52633. return ((root.clientHeight || parseInt(stl.height, 10))
  52634. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  52635. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  52636. }
  52637. /**
  52638. * Method: _brushHover
  52639. *
  52640. */
  52641. _brushHover(shape) {
  52642. var ctx = this._layers.hover.ctx;
  52643. if (!shape.onbrush // 没有onbrush
  52644. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  52645. || (shape.onbrush && !shape.onbrush(ctx, true))
  52646. ) {
  52647. var layer = this.getLayer(shape.zlevel);
  52648. if (layer.needTransform) {
  52649. ctx.save();
  52650. layer.setTransform(ctx);
  52651. }
  52652. // Retina 优化
  52653. if (Config.catchBrushException) {
  52654. try {
  52655. shape.brush(ctx, true, this.updatePainter);
  52656. } catch (error) {
  52657. SUtil.Util_log(
  52658. error, 'hoverBrush error of ' + shape.type, shape
  52659. );
  52660. }
  52661. } else {
  52662. shape.brush(ctx, true, this.updatePainter);
  52663. }
  52664. if (layer.needTransform) {
  52665. ctx.restore();
  52666. }
  52667. }
  52668. }
  52669. /**
  52670. * Method: _shapeToImage
  52671. *
  52672. */
  52673. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  52674. var canvas = document.createElement('canvas');
  52675. var ctx = canvas.getContext('2d');
  52676. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  52677. canvas.style.width = width + 'px';
  52678. canvas.style.height = height + 'px';
  52679. canvas.setAttribute('width', width * _devicePixelRatio);
  52680. canvas.setAttribute('height', height * _devicePixelRatio);
  52681. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  52682. var shapeTransform = {
  52683. position: shape.position,
  52684. rotation: shape.rotation,
  52685. scale: shape.scale
  52686. };
  52687. shape.position = [0, 0, 0];
  52688. shape.rotation = 0;
  52689. shape.scale = [1, 1];
  52690. if (shape) {
  52691. shape.brush(ctx, false);
  52692. }
  52693. var imgShape = new SmicImage_SmicImage({
  52694. id: id,
  52695. style: {
  52696. x: 0,
  52697. y: 0,
  52698. image: canvas
  52699. }
  52700. });
  52701. if (shapeTransform.position != null) {
  52702. imgShape.position = shape.position = shapeTransform.position;
  52703. }
  52704. if (shapeTransform.rotation != null) {
  52705. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  52706. }
  52707. if (shapeTransform.scale != null) {
  52708. imgShape.scale = shape.scale = shapeTransform.scale;
  52709. }
  52710. return imgShape;
  52711. }
  52712. /**
  52713. * Method: _createShapeToImageProcessor
  52714. *
  52715. */
  52716. _createShapeToImageProcessor() {
  52717. var me = this;
  52718. return function (id, e, width, height) {
  52719. return me._shapeToImage(
  52720. id, e, width, height, Painter_Painter.devicePixelRatio
  52721. );
  52722. };
  52723. }
  52724. // SMIC-方法扩展 - start
  52725. /**
  52726. * @function SuperMap.LevelRenderer.Painter.prototype.updateHoverLayer
  52727. * @description 更新设置显示高亮图层。
  52728. * @param {Array} shapes - 图形数组。
  52729. */
  52730. updateHoverLayer(shapes) {
  52731. if (!(shapes instanceof Array)) {
  52732. return this;
  52733. }
  52734. //清除高亮
  52735. this.clearHover();
  52736. this.storage.delHover();
  52737. for (var i = 0; i < shapes.length; i++) {
  52738. this.storage.addHover(shapes[i]);
  52739. this._brushHover(shapes[i]);
  52740. }
  52741. }
  52742. /**
  52743. * @function SuperMap.LevelRenderer.Painter.prototype.createDom
  52744. * @description 创建 Dom。
  52745. *
  52746. * @param {string} id - Dom id
  52747. * @param {string} type - Dom type
  52748. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  52749. * @return {Object} Dom
  52750. */
  52751. static createDom(id, type, painter) {
  52752. var newDom = document.createElement(type);
  52753. var width = painter._width;
  52754. var height = painter._height;
  52755. // 没append呢,请原谅我这样写,清晰~
  52756. newDom.style.position = 'absolute';
  52757. newDom.style.left = 0;
  52758. newDom.style.top = 0;
  52759. newDom.style.width = width + 'px';
  52760. newDom.style.height = height + 'px';
  52761. newDom.setAttribute('width', width * Painter_Painter.devicePixelRatio);
  52762. newDom.setAttribute('height', height * Painter_Painter.devicePixelRatio);
  52763. // id不作为索引用,避免可能造成的重名,定义为私有属性
  52764. //newDom.setAttribute('data-zr-dom-id', id);
  52765. newDom.setAttribute('id', id);
  52766. return newDom;
  52767. }
  52768. }
  52769. /**
  52770. * @private
  52771. * @class Painter.Layer
  52772. * @classdesc 绘制层类。
  52773. * @extends SuperMap.LevelRenderer.Transformable
  52774. */
  52775. class Painter_PaintLayer extends Transformable_Transformable {
  52776. /**
  52777. * @function Painter.Layer.constructor
  52778. * @description 构造函数。
  52779. *
  52780. * @param {string} id - id。
  52781. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  52782. *
  52783. */
  52784. constructor(id, painter) {
  52785. super(id, painter);
  52786. /**
  52787. * @member {Object} Painter.Layer.prototype.dom
  52788. * @description dom。
  52789. */
  52790. this.dom = null;
  52791. /**
  52792. * @member {Object} Painter.Layer.prototype.domBack
  52793. * @description domBack。
  52794. */
  52795. this.domBack = null;
  52796. /**
  52797. * @member {Object} Painter.Layer.prototype.ctxBack
  52798. * @description ctxBack。
  52799. */
  52800. this.ctxBack = null;
  52801. /**
  52802. * @member {SuperMap.LevelRenderer.Painter} Painter.Layer.prototype.painter
  52803. * @description painter。
  52804. */
  52805. this.painter = painter;
  52806. /**
  52807. * @member {number} Painter.Layer.prototype.unusedCount
  52808. * @description unusedCount。
  52809. */
  52810. this.unusedCount = 0;
  52811. /**
  52812. * @member {Object} Painter.Layer.prototype.config
  52813. * @description config。
  52814. */
  52815. this.config = null;
  52816. /**
  52817. * @member {boolean} Painter.Layer.prototype.dirty
  52818. * @description dirty。
  52819. */
  52820. this.dirty = true;
  52821. /**
  52822. * @member {number} Painter.Layer.prototype.elCount
  52823. * @description elCount。
  52824. */
  52825. this.elCount = 0;
  52826. // Configs
  52827. /**
  52828. * @member {string} Painter.Layer.prototype.clearColor
  52829. * @description 每次清空画布的颜色。默认值:0;
  52830. */
  52831. this.clearColor = 0;
  52832. /**
  52833. * @member {boolean} Painter.Layer.prototype.motionBlur
  52834. * @description 是否开启动态模糊。默认值:false;
  52835. */
  52836. this.motionBlur = false;
  52837. /**
  52838. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  52839. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  52840. */
  52841. this.lastFrameAlpha = 0.7;
  52842. /**
  52843. * @member {boolean} Painter.Layer.prototype.zoomable
  52844. * @description 层是否支持鼠标平移操作。默认值:false;
  52845. */
  52846. this.zoomable = false;
  52847. /**
  52848. * @member {boolean} Painter.Layer.prototype.panable
  52849. * @description 层是否支持鼠标缩放操作。默认值:false;
  52850. */
  52851. this.panable = false;
  52852. /**
  52853. * @member {number} Painter.Layer.prototype.maxZoom
  52854. * @description maxZoom。默认值:Infinity。
  52855. */
  52856. this.maxZoom = Infinity;
  52857. /**
  52858. * @member {number} Painter.Layer.prototype.minZoom
  52859. * @description minZoom。默认值:0。
  52860. */
  52861. this.minZoom = 0;
  52862. /**
  52863. * @member {number} Painter.Layer.prototype.ctx
  52864. * @description Canvas 上下文。
  52865. */
  52866. this.ctx = null;
  52867. this.dom = Painter_Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  52868. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  52869. this.dom.style['-webkit-user-select'] = 'none';
  52870. this.dom.style['user-select'] = 'none';
  52871. this.dom.style['-webkit-touch-callout'] = 'none';
  52872. // Function
  52873. // 返回false的方法,用于避免页面被选中
  52874. function returnFalse() {
  52875. return false;
  52876. }
  52877. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  52878. }
  52879. /**
  52880. * @function Painter.Layer.prototype.destroy
  52881. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52882. */
  52883. destroy() {
  52884. this.dom = null;
  52885. this.domBack = null;
  52886. this.ctxBack = null;
  52887. this.painter = null;
  52888. this.unusedCount = null;
  52889. this.config = null;
  52890. this.dirty = null;
  52891. this.elCount = null;
  52892. this.clearColor = null;
  52893. this.motionBlur = null;
  52894. this.lastFrameAlpha = null;
  52895. this.zoomable = null;
  52896. this.panable = null;
  52897. this.maxZoom = null;
  52898. this.minZoom = null;
  52899. this.ctx = null;
  52900. Transformable_Transformable.destroy.apply(this, arguments);
  52901. }
  52902. /**
  52903. * @function Painter.Layer.prototype.initContext
  52904. * @description 初始化 Canvan 2D 上下文。
  52905. */
  52906. initContext() {
  52907. this.ctx = this.dom.getContext('2d');
  52908. if (Painter_Painter.devicePixelRatio != 1) {
  52909. this.ctx.scale(Painter_Painter.devicePixelRatio, Painter_Painter.devicePixelRatio);
  52910. }
  52911. }
  52912. /**
  52913. * @function Painter.Layer.prototype.createBackBuffer
  52914. * @description 创建备份缓冲。
  52915. */
  52916. createBackBuffer() {
  52917. this.domBack = Painter_Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  52918. this.ctxBack = this.domBack.getContext('2d');
  52919. if (Painter_Painter.devicePixelRatio != 1) {
  52920. this.ctxBack.scale(Painter_Painter.devicePixelRatio, Painter_Painter.devicePixelRatio);
  52921. }
  52922. }
  52923. /**
  52924. * @function Painter.Layer.prototype.resize
  52925. * @description 改变大小。
  52926. *
  52927. * @param {number} width - 宽。
  52928. * @param {number} height - 高。
  52929. */
  52930. resize(width, height) {
  52931. this.dom.style.width = width + 'px';
  52932. this.dom.style.height = height + 'px';
  52933. this.dom.setAttribute('width', width * Painter_Painter.devicePixelRatio);
  52934. this.dom.setAttribute('height', height * Painter_Painter.devicePixelRatio);
  52935. if (Painter_Painter.devicePixelRatio != 1) {
  52936. this.ctx.scale(Painter_Painter.devicePixelRatio, Painter_Painter.devicePixelRatio);
  52937. }
  52938. if (this.domBack) {
  52939. this.domBack.setAttribute('width', width * Painter_Painter.devicePixelRatio);
  52940. this.domBack.setAttribute('height', height * Painter_Painter.devicePixelRatio);
  52941. if (Painter_Painter.devicePixelRatio != 1) {
  52942. this.ctxBack.scale(Painter_Painter.devicePixelRatio, Painter_Painter.devicePixelRatio);
  52943. }
  52944. }
  52945. }
  52946. /**
  52947. * @function Painter.Layer.prototype.clear
  52948. * @description 清空该层画布。
  52949. */
  52950. clear() {
  52951. var dom = this.dom;
  52952. var ctx = this.ctx;
  52953. var width = dom.width;
  52954. var height = dom.height;
  52955. var haveClearColor = this.clearColor;
  52956. var haveMotionBLur = this.motionBlur;
  52957. var lastFrameAlpha = this.lastFrameAlpha;
  52958. if (haveMotionBLur) {
  52959. if (!this.domBack) {
  52960. this.createBackBuffer();
  52961. }
  52962. this.ctxBack.globalCompositeOperation = 'copy';
  52963. this.ctxBack.drawImage(
  52964. dom, 0, 0,
  52965. width / Painter_Painter.devicePixelRatio,
  52966. height / Painter_Painter.devicePixelRatio
  52967. );
  52968. }
  52969. if (haveClearColor) {
  52970. ctx.save();
  52971. ctx.fillStyle = this.config.clearColor;
  52972. ctx.fillRect(
  52973. 0, 0,
  52974. width / Painter_Painter.devicePixelRatio,
  52975. height / Painter_Painter.devicePixelRatio
  52976. );
  52977. ctx.restore();
  52978. } else {
  52979. ctx.clearRect(
  52980. 0, 0,
  52981. width / Painter_Painter.devicePixelRatio,
  52982. height / Painter_Painter.devicePixelRatio
  52983. );
  52984. }
  52985. if (haveMotionBLur) {
  52986. var domBack = this.domBack;
  52987. ctx.save();
  52988. ctx.globalAlpha = lastFrameAlpha;
  52989. ctx.drawImage(
  52990. domBack, 0, 0,
  52991. width / Painter_Painter.devicePixelRatio,
  52992. height / Painter_Painter.devicePixelRatio
  52993. );
  52994. ctx.restore();
  52995. }
  52996. }
  52997. }
  52998. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  52999. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  53000. * This program are made available under the terms of the Apache License, Version 2.0
  53001. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53002. /**
  53003. * @private
  53004. * @class SuperMap.LevelRenderer.Handler
  53005. * @category Visualization Theme
  53006. * @classdesc Handler控制模块。
  53007. * @extends {SuperMap.LevelRenderer.Eventful}
  53008. */
  53009. class Handler_Handler extends Eventful {
  53010. /**
  53011. * @function SuperMap.LevelRenderer.Handler.constructor
  53012. * @description 构造函数。
  53013. * @param {HTMLElement} root - 绘图区域。
  53014. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  53015. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  53016. */
  53017. constructor(root, storage, painter) {
  53018. super(root, storage, painter);
  53019. /**
  53020. * @member {HTMLElement} SuperMap.LevelRenderer.Handler.prototype.root
  53021. * @description 绘图区域
  53022. */
  53023. this.root = root;
  53024. /**
  53025. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Handler.prototype.storage
  53026. * @description Storage 实例
  53027. */
  53028. this.storage = storage;
  53029. /**
  53030. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Handler.prototype.Painter
  53031. * @description Painter 实例
  53032. */
  53033. this.painter = painter;
  53034. /**
  53035. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastX=0]
  53036. * @description 上一次鼠标位置x坐标值
  53037. */
  53038. this._lastX = 0;
  53039. /**
  53040. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastY=0]
  53041. * @description 上一次鼠标位置y坐标值
  53042. */
  53043. this._lastY = 0;
  53044. /**
  53045. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseX=0]
  53046. * @description 当前鼠标位置x坐标值
  53047. */
  53048. this._mouseX = 0;
  53049. /**
  53050. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseY=0]
  53051. * @description 当前鼠标位置y坐标值
  53052. */
  53053. this._mouseY = 0;
  53054. /**
  53055. * @member {Function} SuperMap.LevelRenderer.Handler.prototype._findHover
  53056. * @description 查找 Hover 图形
  53057. */
  53058. this._findHover = null;
  53059. /**
  53060. * @member {Object} SuperMap.LevelRenderer.Handler.prototype._domHover
  53061. * @description 高亮 DOM
  53062. */
  53063. this._domHover = null;
  53064. // 各种事件标识的私有变量
  53065. // this._hasfound = false; // 是否找到 hover 图形元素
  53066. // this._lastHover = null; // 最后一个 hover 图形元素
  53067. // this._mouseDownTarget = null;
  53068. // this._draggingTarget = null; // 当前被拖拽的图形元素
  53069. // this._isMouseDown = false;
  53070. // this._isDragging = false;
  53071. // this._lastMouseDownMoment;
  53072. // this._lastTouchMoment;
  53073. // this._lastDownButton;
  53074. this._findHover = bind3Arg(findHover, this);
  53075. this._domHover = painter.getDomHover();
  53076. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  53077. var domHandlers = {
  53078. /**
  53079. * Method: resize
  53080. * 窗口大小改变响应函数。
  53081. *
  53082. * Parameters:
  53083. * event - {Event} event。
  53084. *
  53085. */
  53086. resize: function (event) {
  53087. event = event || window.event;
  53088. this._lastHover = null;
  53089. this._isMouseDown = 0;
  53090. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  53091. this.dispatch(Config.EVENT.RESIZE, event);
  53092. },
  53093. /**
  53094. * Method: click
  53095. * 点击响应函数。
  53096. *
  53097. * Parameters:
  53098. * event - {Event} event。
  53099. *
  53100. */
  53101. click: function (event) {
  53102. event = this._zrenderEventFixed(event);
  53103. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  53104. var _lastHover = this._lastHover;
  53105. if ((_lastHover && _lastHover.clickable)
  53106. || !_lastHover
  53107. ) {
  53108. // 判断没有发生拖拽才触发click事件
  53109. if (this._clickThreshold < 10) {
  53110. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  53111. }
  53112. }
  53113. this._mousemoveHandler(event);
  53114. },
  53115. /**
  53116. * Method: dblclick
  53117. * 双击响应函数。
  53118. *
  53119. * Parameters:
  53120. * event - {Event} event。
  53121. *
  53122. */
  53123. dblclick: function (event) {
  53124. event = event || window.event;
  53125. event = this._zrenderEventFixed(event);
  53126. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  53127. var _lastHover = this._lastHover;
  53128. if ((_lastHover && _lastHover.clickable)
  53129. || !_lastHover
  53130. ) {
  53131. // 判断没有发生拖拽才触发dblclick事件
  53132. if (this._clickThreshold < 5) {
  53133. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  53134. }
  53135. }
  53136. this._mousemoveHandler(event);
  53137. },
  53138. /**
  53139. * Method: mousewheel
  53140. * 鼠标滚轮响应函数。
  53141. *
  53142. * Parameters:
  53143. * event - {Event} event。
  53144. *
  53145. */
  53146. mousewheel: function (event) {
  53147. event = this._zrenderEventFixed(event);
  53148. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  53149. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  53150. var delta = event.wheelDelta // Webkit
  53151. || -event.detail; // Firefox
  53152. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  53153. var layers = this.painter.getLayers();
  53154. var needsRefresh = false;
  53155. for (var z in layers) {
  53156. if (z !== 'hover') {
  53157. var layer = layers[z];
  53158. var pos = layer.position;
  53159. if (layer.zoomable) {
  53160. layer.__zoom = layer.__zoom || 1;
  53161. var newZoom = layer.__zoom;
  53162. newZoom *= scale;
  53163. newZoom = Math.max(
  53164. Math.min(layer.maxZoom, newZoom),
  53165. layer.minZoom
  53166. );
  53167. scale = newZoom / layer.__zoom;
  53168. layer.__zoom = newZoom;
  53169. // Keep the mouse center when scaling
  53170. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  53171. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  53172. layer.scale[0] *= scale;
  53173. layer.scale[1] *= scale;
  53174. layer.dirty = true;
  53175. needsRefresh = true;
  53176. }
  53177. }
  53178. }
  53179. if (needsRefresh) {
  53180. this.painter.refresh();
  53181. }
  53182. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  53183. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  53184. this._mousemoveHandler(event);
  53185. },
  53186. /**
  53187. * Method: mousemove
  53188. * 鼠标(手指)移动响应函数。
  53189. *
  53190. * Parameters:
  53191. * event - {Event} event。
  53192. *
  53193. */
  53194. mousemove: function (event) {
  53195. // 拖拽不触发click事件
  53196. this._clickThreshold++;
  53197. event = this._zrenderEventFixed(event);
  53198. this._lastX = this._mouseX;
  53199. this._lastY = this._mouseY;
  53200. this._mouseX = SUtil.Util_event.getX(event);
  53201. this._mouseY = SUtil.Util_event.getY(event);
  53202. var dx = this._mouseX - this._lastX;
  53203. var dy = this._mouseY - this._lastY;
  53204. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  53205. // 避免手抖点击误认为拖拽
  53206. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  53207. this._processDragStart(event);
  53208. // }
  53209. this._hasfound = 0;
  53210. this._event = event;
  53211. this._iterateAndFindHover();
  53212. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  53213. if (!this._hasfound) {
  53214. // 过滤首次拖拽产生的mouseout和dragLeave
  53215. if (!this._draggingTarget
  53216. || (this._lastHover && this._lastHover != this._draggingTarget)
  53217. ) {
  53218. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  53219. this._processOutShape(event);
  53220. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  53221. this._processDragLeave(event);
  53222. }
  53223. this._lastHover = null;
  53224. this.storage.delHover();
  53225. this.painter.clearHover();
  53226. }
  53227. // set cursor for root element
  53228. var cursor = '';
  53229. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  53230. if (this._draggingTarget) {
  53231. this.storage.drift(this._draggingTarget.id, dx, dy);
  53232. this._draggingTarget.modSelf();
  53233. this.storage.addHover(this._draggingTarget);
  53234. } else if (this._isMouseDown) {
  53235. // Layer dragging
  53236. var layers = this.painter.getLayers();
  53237. var needsRefresh = false;
  53238. for (var z in layers) {
  53239. if (z !== 'hover') {
  53240. var layer = layers[z];
  53241. if (layer.panable) {
  53242. // PENDING
  53243. cursor = 'move';
  53244. // Keep the mouse center when scaling
  53245. layer.position[0] += dx;
  53246. layer.position[1] += dy;
  53247. needsRefresh = true;
  53248. layer.dirty = true;
  53249. }
  53250. }
  53251. }
  53252. if (needsRefresh) {
  53253. this.painter.refresh();
  53254. }
  53255. }
  53256. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  53257. cursor = 'move';
  53258. } else if (this._hasfound && this._lastHover.clickable) {
  53259. cursor = 'pointer';
  53260. }
  53261. this.root.style.cursor = cursor;
  53262. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  53263. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  53264. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  53265. this.painter.refreshHover();
  53266. }
  53267. },
  53268. /**
  53269. * Method: mouseout
  53270. * 鼠标(手指)离开响应函数。
  53271. *
  53272. * Parameters:
  53273. * event - {Event} event。
  53274. *
  53275. */
  53276. mouseout: function (event) {
  53277. event = this._zrenderEventFixed(event);
  53278. var element = event.toElement || event.relatedTarget;
  53279. if (element != this.root) {
  53280. while (element && element.nodeType != 9) {
  53281. // 忽略包含在root中的dom引起的mouseOut
  53282. if (element == this.root) {
  53283. this._mousemoveHandler(event);
  53284. return;
  53285. }
  53286. element = element.parentNode;
  53287. }
  53288. }
  53289. event.zrenderX = this._lastX;
  53290. event.zrenderY = this._lastY;
  53291. this.root.style.cursor = '';
  53292. this._isMouseDown = 0;
  53293. this._processOutShape(event);
  53294. this._processDrop(event);
  53295. this._processDragEnd(event);
  53296. this.painter.refreshHover();
  53297. this.dispatch(Config.EVENT.GLOBALOUT, event);
  53298. },
  53299. /**
  53300. * Method: mousedown
  53301. * 鼠标(手指)按下响应函数。
  53302. *
  53303. * Parameters:
  53304. * event - {Event} event。
  53305. *
  53306. */
  53307. mousedown: function (event) {
  53308. // 重置 clickThreshold
  53309. this._clickThreshold = 0;
  53310. if (this._lastDownButton == 2) {
  53311. this._lastDownButton = event.button;
  53312. this._mouseDownTarget = null;
  53313. // 仅作为关闭右键菜单使用
  53314. return;
  53315. }
  53316. this._lastMouseDownMoment = new Date();
  53317. event = this._zrenderEventFixed(event);
  53318. this._isMouseDown = 1;
  53319. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  53320. this._mouseDownTarget = this._lastHover;
  53321. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  53322. this._lastDownButton = event.button;
  53323. },
  53324. /**
  53325. * Method: mouseup
  53326. * 鼠标(手指)抬起响应函数。
  53327. *
  53328. * Parameters:
  53329. * event - {Event} event。
  53330. *
  53331. */
  53332. mouseup: function (event) {
  53333. event = this._zrenderEventFixed(event);
  53334. this.root.style.cursor = '';
  53335. this._isMouseDown = 0;
  53336. this._mouseDownTarget = null;
  53337. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  53338. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  53339. this._processDrop(event);
  53340. this._processDragEnd(event);
  53341. },
  53342. /**
  53343. * Method: touchstart
  53344. * Touch 开始响应函数。
  53345. *
  53346. * Parameters:
  53347. * event - {Event} event。
  53348. *
  53349. */
  53350. touchstart: function (event) {
  53351. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  53352. event = this._zrenderEventFixed(event, true);
  53353. this._lastTouchMoment = new Date();
  53354. // 平板补充一次findHover
  53355. this._mobildFindFixed(event);
  53356. this._mousedownHandler(event);
  53357. },
  53358. /**
  53359. * Method: touchmove
  53360. * Touch 移动响应函数。
  53361. *
  53362. * Parameters:
  53363. * event - {Event} event。
  53364. *
  53365. */
  53366. touchmove: function (event) {
  53367. event = this._zrenderEventFixed(event, true);
  53368. this._mousemoveHandler(event);
  53369. if (this._isDragging) {
  53370. SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  53371. }
  53372. },
  53373. /**
  53374. * Method: touchend
  53375. * Touch 结束响应函数。
  53376. *
  53377. * Parameters:
  53378. * event - {Event} event。
  53379. *
  53380. */
  53381. touchend: function (event) {
  53382. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  53383. event = this._zrenderEventFixed(event, true);
  53384. this._mouseupHandler(event);
  53385. var now = new Date();
  53386. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  53387. this._mobildFindFixed(event);
  53388. this._clickHandler(event);
  53389. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  53390. this._dblclickHandler(event);
  53391. if (this._lastHover && this._lastHover.clickable) {
  53392. SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  53393. }
  53394. }
  53395. this._lastClickMoment = now;
  53396. }
  53397. this.painter.clearHover();
  53398. }
  53399. };
  53400. initDomHandler(this);
  53401. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  53402. if (window.addEventListener) {
  53403. window.addEventListener('resize', this._resizeHandler);
  53404. if (SUtil.Util_env.os.tablet || SUtil.Util_env.os.phone) {
  53405. // mobile支持
  53406. root.addEventListener('touchstart', this._touchstartHandler);
  53407. root.addEventListener('touchmove', this._touchmoveHandler);
  53408. root.addEventListener('touchend', this._touchendHandler);
  53409. } else {
  53410. // mobile的click/move/up/down自己模拟
  53411. root.addEventListener('click', this._clickHandler);
  53412. root.addEventListener('dblclick', this._dblclickHandler);
  53413. root.addEventListener('mousewheel', this._mousewheelHandler);
  53414. root.addEventListener('mousemove', this._mousemoveHandler);
  53415. root.addEventListener('mousedown', this._mousedownHandler);
  53416. root.addEventListener('mouseup', this._mouseupHandler);
  53417. }
  53418. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  53419. root.addEventListener('mouseout', this._mouseoutHandler);
  53420. } else {
  53421. window.attachEvent('onresize', this._resizeHandler);
  53422. root.attachEvent('onclick', this._clickHandler);
  53423. //root.attachEvent('ondblclick ', this._dblclickHandler);
  53424. root.ondblclick = this._dblclickHandler;
  53425. root.attachEvent('onmousewheel', this._mousewheelHandler);
  53426. root.attachEvent('onmousemove', this._mousemoveHandler);
  53427. root.attachEvent('onmouseout', this._mouseoutHandler);
  53428. root.attachEvent('onmousedown', this._mousedownHandler);
  53429. root.attachEvent('onmouseup', this._mouseupHandler);
  53430. }
  53431. // 辅助函数 start
  53432. /**
  53433. * Method: bind1Arg
  53434. * bind 一个参数的 function。
  53435. *
  53436. * Parameters:
  53437. * handler - {Function} 要 bind 的 function。
  53438. * context - {Object} 运行时 this 环境。
  53439. *
  53440. * Returns:
  53441. * {Function}
  53442. */
  53443. function bind1Arg(handler, context) {
  53444. return function (e) {
  53445. return handler.call(context, e);
  53446. };
  53447. }
  53448. /*
  53449. // bind 两个参数的 function
  53450. function bind2Arg(handler, context) {
  53451. return function (arg1, arg2) {
  53452. return handler.call(context, arg1, arg2);
  53453. };
  53454. }
  53455. */
  53456. // bind 三个参数的 function
  53457. function bind3Arg(handler, context) {
  53458. return function (arg1, arg2, arg3) {
  53459. return handler.call(context, arg1, arg2, arg3);
  53460. };
  53461. }
  53462. /**
  53463. * Method: initDomHandler
  53464. * 为控制类实例初始化 dom 事件处理函数。
  53465. *
  53466. * Parameters:
  53467. * instance - {<SuperMap.LevelRenderer.Handler>} 控制类实例 。
  53468. *
  53469. * Returns:
  53470. * {Function}
  53471. */
  53472. function initDomHandler(instance) {
  53473. var domHandlerNames = [
  53474. 'resize', 'click', 'dblclick',
  53475. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  53476. 'touchstart', 'touchend', 'touchmove'
  53477. ];
  53478. var len = domHandlerNames.length;
  53479. while (len--) {
  53480. var name = domHandlerNames[len];
  53481. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  53482. }
  53483. }
  53484. /**
  53485. * Method: findHover
  53486. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  53487. *
  53488. * Parameters:
  53489. * shape - {Object} 图形。
  53490. * x - {number} 鼠标 x。
  53491. * y - {number} 鼠标 y。
  53492. *
  53493. * Returns:
  53494. * {boolean} 是否找到图形。
  53495. *
  53496. */
  53497. function findHover(shape, x, y) {
  53498. var me = this;
  53499. if (
  53500. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  53501. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  53502. ) {
  53503. return false;
  53504. }
  53505. var event = me._event;
  53506. if (shape.isCover(x, y)) {
  53507. if (shape.hoverable) {
  53508. // SMIC-修改 - start
  53509. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  53510. if (shape.refDataID) {
  53511. var fid = shape.refDataID;
  53512. //me.painter.clearHover();
  53513. //me.storage.delHover();
  53514. var hoverGroup = null;
  53515. if (shape.refDataHoverGroup) {
  53516. hoverGroup = shape.refDataHoverGroup;
  53517. }
  53518. //查找同一个用户数据 feature 的所有图形
  53519. var shapeList = me.storage._shapeList;
  53520. for (var i = 0, len = shapeList.length; i < len; i++) {
  53521. var si = shapeList[i];
  53522. if (si.refDataID && fid === si.refDataID) {
  53523. if (hoverGroup) {
  53524. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  53525. me.storage.addHover(si);
  53526. }
  53527. } else {
  53528. me.storage.addHover(si);
  53529. }
  53530. }
  53531. }
  53532. }
  53533. } else {
  53534. me.storage.addHover(shape);
  53535. }
  53536. //初始代码:
  53537. // me.storage.addHover(shape);
  53538. // SMIC-修改 - end
  53539. }
  53540. // 查找是否在 clipShape 中
  53541. var p = shape.parent;
  53542. while (p) {
  53543. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  53544. // 已经被祖先 clip 掉了
  53545. return false;
  53546. }
  53547. p = p.parent;
  53548. }
  53549. if (me._lastHover != shape) {
  53550. me._processOutShape(event);
  53551. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  53552. me._processDragLeave(event);
  53553. me._lastHover = shape;
  53554. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  53555. me._processDragEnter(event);
  53556. }
  53557. me._processOverShape(event);
  53558. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  53559. me._processDragOver(event);
  53560. me._hasfound = 1;
  53561. return true; // 找到则中断迭代查找
  53562. }
  53563. return false;
  53564. }
  53565. // 辅助函数 end
  53566. }
  53567. /**
  53568. * @function SuperMap.LevelRenderer.Handler.prototype.destroy
  53569. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  53570. */
  53571. destroy() {
  53572. this.dispose();
  53573. this._lastX = null;
  53574. this._lastY = null;
  53575. this._mouseX = null;
  53576. this._mouseY = null;
  53577. this._findHover = null;
  53578. Eventful.prototype.destroy.apply(this, arguments);
  53579. }
  53580. /**
  53581. * @function SuperMap.LevelRenderer.Handler.prototype.on
  53582. * @description 自定义事件绑定。
  53583. * @param {string} eventName - 事件名称,resize、hover、drag等。
  53584. * @param {function} handler - 响应函数。
  53585. * @returns {SuperMap.LevelRenderer.Handler} this。
  53586. */
  53587. on(eventName, handler) {
  53588. this.bind(eventName, handler);
  53589. return this;
  53590. }
  53591. /**
  53592. * @function SuperMap.LevelRenderer.Handler.prototype.un
  53593. * @description 自定义事件解除绑定。
  53594. * @param {string} eventName - 事件名称,resize、hover、drag等。
  53595. * @param {function} handler - 响应函数。
  53596. * @returns {SuperMap.LevelRenderer.Handler} this。
  53597. */
  53598. un(eventName, handler) {
  53599. this.unbind(eventName, handler);
  53600. return this;
  53601. }
  53602. /**
  53603. * @function SuperMap.LevelRenderer.Handler.prototype.trigger
  53604. * @description 事件触发。
  53605. * @param {string} eventName - 事件名称,resize、hover、drag等。
  53606. * @param {event} eventArgs - dom事件对象。
  53607. */
  53608. trigger(eventName, eventArgs) {
  53609. var EVENT = Config.EVENT;
  53610. switch (eventName) {
  53611. case EVENT.RESIZE:
  53612. case EVENT.CLICK:
  53613. case EVENT.DBLCLICK:
  53614. case EVENT.MOUSEWHEEL:
  53615. case EVENT.MOUSEMOVE:
  53616. case EVENT.MOUSEDOWN:
  53617. case EVENT.MOUSEUP:
  53618. case EVENT.MOUSEOUT:
  53619. this['_' + eventName + 'Handler'](eventArgs);
  53620. break;
  53621. }
  53622. }
  53623. /**
  53624. * @function SuperMap.LevelRenderer.Handler.prototype.dispose
  53625. * @description 释放,解绑所有事件。
  53626. */
  53627. dispose() {
  53628. var root = this.root;
  53629. if (window.removeEventListener) {
  53630. window.removeEventListener('resize', this._resizeHandler);
  53631. if (SUtil.Util_env.os.tablet || SUtil.Util_env.os.phone) {
  53632. // mobile支持
  53633. root.removeEventListener('touchstart', this._touchstartHandler);
  53634. root.removeEventListener('touchmove', this._touchmoveHandler);
  53635. root.removeEventListener('touchend', this._touchendHandler);
  53636. } else {
  53637. // mobile的click自己模拟
  53638. root.removeEventListener('click', this._clickHandler);
  53639. root.removeEventListener('dblclick', this._dblclickHandler);
  53640. root.removeEventListener('mousewheel', this._mousewheelHandler);
  53641. root.removeEventListener('mousemove', this._mousemoveHandler);
  53642. root.removeEventListener('mousedown', this._mousedownHandler);
  53643. root.removeEventListener('mouseup', this._mouseupHandler);
  53644. }
  53645. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  53646. root.removeEventListener('mouseout', this._mouseoutHandler);
  53647. } else {
  53648. window.detachEvent('onresize', this._resizeHandler);
  53649. root.detachEvent('onclick', this._clickHandler);
  53650. root.detachEvent('dblclick', this._dblclickHandler);
  53651. root.detachEvent('onmousewheel', this._mousewheelHandler);
  53652. root.detachEvent('onmousemove', this._mousemoveHandler);
  53653. root.detachEvent('onmouseout', this._mouseoutHandler);
  53654. root.detachEvent('onmousedown', this._mousedownHandler);
  53655. root.detachEvent('onmouseup', this._mouseupHandler);
  53656. }
  53657. this.root = null;
  53658. this._domHover = null;
  53659. this.storage = null;
  53660. this.painter = null;
  53661. this.un();
  53662. }
  53663. /**
  53664. * Method: _processDragStart
  53665. * 拖拽开始。
  53666. *
  53667. * Parameters:
  53668. * event - {Object} 事件对象。
  53669. *
  53670. */
  53671. _processDragStart(event) {
  53672. var _lastHover = this._lastHover;
  53673. if (this._isMouseDown
  53674. && _lastHover
  53675. && _lastHover.draggable
  53676. && !this._draggingTarget
  53677. && this._mouseDownTarget == _lastHover
  53678. ) {
  53679. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  53680. if (_lastHover.dragEnableTime &&
  53681. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  53682. ) {
  53683. return;
  53684. }
  53685. var _draggingTarget = _lastHover;
  53686. this._draggingTarget = _draggingTarget;
  53687. this._isDragging = 1;
  53688. _draggingTarget.invisible = true;
  53689. this.storage.mod(_draggingTarget.id);
  53690. // 分发 Config.EVENT.DRAGSTART事件
  53691. this._dispatchAgency(
  53692. _draggingTarget,
  53693. Config.EVENT.DRAGSTART,
  53694. event
  53695. );
  53696. this.painter.refresh();
  53697. }
  53698. }
  53699. /**
  53700. * Method: _processDragEnter
  53701. * 拖拽进入目标元素。
  53702. *
  53703. * Parameters:
  53704. * event - {Object} 事件对象。
  53705. *
  53706. */
  53707. _processDragEnter(event) {
  53708. if (this._draggingTarget) {
  53709. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  53710. this._dispatchAgency(
  53711. this._lastHover,
  53712. Config.EVENT.DRAGENTER,
  53713. event,
  53714. this._draggingTarget
  53715. );
  53716. }
  53717. }
  53718. /**
  53719. * Method: _processDragOver
  53720. * 拖拽在目标元素上移动。
  53721. *
  53722. * Parameters:
  53723. * event - {Object} 事件对象。
  53724. *
  53725. */
  53726. _processDragOver(event) {
  53727. if (this._draggingTarget) {
  53728. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  53729. this._dispatchAgency(
  53730. this._lastHover,
  53731. Config.EVENT.DRAGOVER,
  53732. event,
  53733. this._draggingTarget
  53734. );
  53735. }
  53736. }
  53737. /**
  53738. * Method: _processDragLeave
  53739. * 拖拽离开目标元素。
  53740. *
  53741. * Parameters:
  53742. * event - {Object} 事件对象。
  53743. *
  53744. */
  53745. _processDragLeave(event) {
  53746. if (this._draggingTarget) {
  53747. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  53748. this._dispatchAgency(
  53749. this._lastHover,
  53750. Config.EVENT.DRAGLEAVE,
  53751. event,
  53752. this._draggingTarget
  53753. );
  53754. }
  53755. }
  53756. /**
  53757. * Method: _processDrop
  53758. * 拖拽在目标元素上完成。
  53759. *
  53760. * Parameters:
  53761. * event - {Object} 事件对象。
  53762. *
  53763. */
  53764. _processDrop(event) {
  53765. if (this._draggingTarget) {
  53766. this._draggingTarget.invisible = false;
  53767. this.storage.mod(this._draggingTarget.id);
  53768. this.painter.refresh();
  53769. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  53770. this._dispatchAgency(
  53771. this._lastHover,
  53772. Config.EVENT.DROP,
  53773. event,
  53774. this._draggingTarget
  53775. );
  53776. }
  53777. }
  53778. /**
  53779. * Method: _processDragEnd
  53780. * 拖拽结束。
  53781. *
  53782. * Parameters:
  53783. * event - {Object} 事件对象。
  53784. *
  53785. */
  53786. _processDragEnd(event) {
  53787. if (this._draggingTarget) {
  53788. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  53789. this._dispatchAgency(
  53790. this._draggingTarget,
  53791. Config.EVENT.DRAGEND,
  53792. event
  53793. );
  53794. this._lastHover = null;
  53795. }
  53796. this._isDragging = 0;
  53797. this._draggingTarget = null;
  53798. }
  53799. /**
  53800. * Method: _processOverShape
  53801. * 鼠标在某个图形元素上移动。
  53802. *
  53803. * Parameters:
  53804. * event - {Object} 事件对象。
  53805. *
  53806. */
  53807. _processOverShape(event) {
  53808. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  53809. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  53810. }
  53811. /**
  53812. * Method: _processOutShape
  53813. * 鼠标离开某个图形元素。
  53814. *
  53815. * Parameters:
  53816. * event - {Object} 事件对象。
  53817. *
  53818. */
  53819. _processOutShape(event) {
  53820. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  53821. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  53822. }
  53823. /**
  53824. * Method: _dispatchAgency
  53825. * 鼠标离开某个图形元素。
  53826. *
  53827. * Parameters:
  53828. * targetShape - {Object} 目标图形元素。
  53829. * eventName - {Object} 事件名称。
  53830. * event - {Object} 事件对象。
  53831. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  53832. *
  53833. */
  53834. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  53835. var eventHandler = 'on' + eventName;
  53836. var eventPacket = {
  53837. type: eventName,
  53838. event: event,
  53839. target: targetShape,
  53840. cancelBubble: false
  53841. };
  53842. var el = targetShape;
  53843. if (draggedShape) {
  53844. eventPacket.dragged = draggedShape;
  53845. }
  53846. while (el) {
  53847. el[eventHandler]
  53848. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  53849. el.dispatch(eventName, eventPacket);
  53850. el = el.parent;
  53851. if (eventPacket.cancelBubble) {
  53852. break;
  53853. }
  53854. }
  53855. if (targetShape) {
  53856. // 冒泡到顶级 zrender 对象
  53857. if (!eventPacket.cancelBubble) {
  53858. this.dispatch(eventName, eventPacket);
  53859. }
  53860. } else if (!draggedShape) {
  53861. // 无hover目标,无拖拽对象,原生事件分发
  53862. this.dispatch(eventName, {
  53863. type: eventName,
  53864. event: event
  53865. });
  53866. }
  53867. }
  53868. /**
  53869. * Method: _iterateAndFindHover
  53870. * 迭代寻找 hover shape。
  53871. *
  53872. */
  53873. _iterateAndFindHover() {
  53874. var invTransform = SUtil.Util_matrix.create();
  53875. var list = this.storage.getShapeList();
  53876. var currentZLevel;
  53877. var currentLayer;
  53878. var tmp = [0, 0];
  53879. for (var i = list.length - 1; i >= 0; i--) {
  53880. var shape = list[i];
  53881. if (currentZLevel !== shape.zlevel) {
  53882. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  53883. tmp[0] = this._mouseX;
  53884. tmp[1] = this._mouseY;
  53885. if (currentLayer.needTransform) {
  53886. SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  53887. SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  53888. }
  53889. }
  53890. if (this._findHover(shape, tmp[0], tmp[1])) {
  53891. break;
  53892. }
  53893. }
  53894. }
  53895. /**
  53896. * Method: _mobildFindFixed
  53897. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  53898. *
  53899. * Parameters:
  53900. * event - {Object} 事件对象。
  53901. *
  53902. */
  53903. _mobildFindFixed(event) {
  53904. // touch指尖错觉的尝试偏移量配置
  53905. var MOBILE_TOUCH_OFFSETS = [
  53906. {x: 10},
  53907. {x: -20},
  53908. {x: 10, y: 10},
  53909. {y: -20}
  53910. ];
  53911. this._lastHover = null;
  53912. this._mouseX = event.zrenderX;
  53913. this._mouseY = event.zrenderY;
  53914. this._event = event;
  53915. this._iterateAndFindHover();
  53916. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  53917. var offset = MOBILE_TOUCH_OFFSETS[i];
  53918. offset.x && (this._mouseX += offset.x);
  53919. offset.y && (this._mouseX += offset.y);
  53920. this._iterateAndFindHover();
  53921. }
  53922. if (this._lastHover) {
  53923. event.zrenderX = this._mouseX;
  53924. event.zrenderY = this._mouseY;
  53925. }
  53926. }
  53927. /**
  53928. * Method: _zrenderEventFixed
  53929. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  53930. *
  53931. * Parameters:
  53932. * event - {Object} 事件。
  53933. * isTouch - {boolean} 是否触摸。
  53934. *
  53935. */
  53936. _zrenderEventFixed(event, isTouch) {
  53937. if (event.zrenderFixed) {
  53938. return event;
  53939. }
  53940. if (!isTouch) {
  53941. event = event || window.event;
  53942. // 进入对象优先~
  53943. var target = event.toElement
  53944. || event.relatedTarget
  53945. || event.srcElement
  53946. || event.target;
  53947. if (target && target != this._domHover) {
  53948. event.zrenderX = (typeof event.offsetX != 'undefined'
  53949. ? event.offsetX
  53950. : event.layerX)
  53951. + target.offsetLeft;
  53952. event.zrenderY = (typeof event.offsetY != 'undefined'
  53953. ? event.offsetY
  53954. : event.layerY)
  53955. + target.offsetTop;
  53956. }
  53957. } else {
  53958. var touch = event.type != 'touchend'
  53959. ? event.targetTouches[0]
  53960. : event.changedTouches[0];
  53961. if (touch) {
  53962. var rBounding = this.root.getBoundingClientRect();
  53963. // touch事件坐标是全屏的~
  53964. event.zrenderX = touch.clientX - rBounding.left;
  53965. event.zrenderY = touch.clientY - rBounding.top;
  53966. }
  53967. }
  53968. event.zrenderFixed = 1;
  53969. return event;
  53970. }
  53971. // SMIC-方法扩展 - start
  53972. /**
  53973. * @function SuperMap.LevelRenderer.Handler.prototype.getLastHoverOne
  53974. * @description 获取单个高亮图形
  53975. */
  53976. getLastHoverOne() {
  53977. if (this._lastHover) {
  53978. return this._lastHover;
  53979. }
  53980. return null;
  53981. }
  53982. // SMIC-方法扩展 - end
  53983. }
  53984. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  53985. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  53986. * This program are made available under the terms of the Apache License, Version 2.0
  53987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53988. /**
  53989. * @class SuperMap.LevelRenderer.Animation.easing
  53990. * @category Visualization Theme
  53991. * @classdesc 缓动
  53992. * @private
  53993. */
  53994. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  53995. // http://sole.github.io/tween.js/examples/03_graphs.html
  53996. class Easing {
  53997. /**
  53998. * @function SuperMap.LevelRenderer.Animation.easing.constructor
  53999. * @description 构造函数。
  54000. */
  54001. constructor() {
  54002. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  54003. }
  54004. /**
  54005. * @function SuperMap.LevelRenderer.Animation.easing.destroy
  54006. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  54007. */
  54008. destroy() {
  54009. }
  54010. /**
  54011. * @function SuperMap.LevelRenderer.Animation.easing.Linear
  54012. * @description 线性缓动
  54013. * @param {number} k - 参数
  54014. * @return {number} 输入值
  54015. */
  54016. Linear(k) {
  54017. return k;
  54018. }
  54019. /**
  54020. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticIn
  54021. * @description 二次方的缓动(t^2)
  54022. * @param {number} k - 参数
  54023. * @return {number} 二次方的缓动的值
  54024. */
  54025. QuadraticIn(k) {
  54026. return k * k;
  54027. }
  54028. /**
  54029. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticOut
  54030. * @description 返回按二次方缓动退出的值
  54031. * @param {number} k - 参数
  54032. * @return {number} 按二次方缓动退出的值
  54033. */
  54034. QuadraticOut(k) {
  54035. return k * (2 - k);
  54036. }
  54037. /**
  54038. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticInOut
  54039. * @description 返回按二次方缓动进入和退出的值
  54040. * @param {number} k - 参数
  54041. * @return {number} 按二次方缓动进入和退出的值
  54042. */
  54043. QuadraticInOut(k) {
  54044. if ((k *= 2) < 1) {
  54045. return 0.5 * k * k;
  54046. }
  54047. return -0.5 * (--k * (k - 2) - 1);
  54048. }
  54049. /**
  54050. * @function SuperMap.LevelRenderer.Animation.easing.CubicIn
  54051. * @description 三次方的缓动(t^3)
  54052. * @param {number} k - 参数
  54053. * @return {number} 按三次方缓动的值
  54054. */
  54055. CubicIn(k) {
  54056. return k * k * k;
  54057. }
  54058. /**
  54059. * @function SuperMap.LevelRenderer.Animation.easing.CubicOut
  54060. * @description 返回按三次方缓动退出的值
  54061. * @param {number} k - 参数
  54062. * @return {number} 按三次方缓动退出的值
  54063. */
  54064. CubicOut(k) {
  54065. return --k * k * k + 1;
  54066. }
  54067. /**
  54068. * @function SuperMap.LevelRenderer.Animation.easing.CubicInOut
  54069. * @description 返回按三次方缓动进入退出的值
  54070. * @param {number} k - 参数
  54071. * @return {number} 按三次方缓动进入退出的值
  54072. */
  54073. CubicInOut(k) {
  54074. if ((k *= 2) < 1) {
  54075. return 0.5 * k * k * k;
  54076. }
  54077. return 0.5 * ((k -= 2) * k * k + 2);
  54078. }
  54079. /**
  54080. * @function SuperMap.LevelRenderer.Animation.easing.QuarticIn
  54081. * @description 返回按四次方缓动进入的值
  54082. * @param {number} k - 参数
  54083. * @return {number} 按四次方缓动进入的值
  54084. */
  54085. QuarticIn(k) {
  54086. return k * k * k * k;
  54087. }
  54088. /**
  54089. * @function SuperMap.LevelRenderer.Animation.easing.QuarticOut
  54090. * @description 返回按四次方缓动退出的值
  54091. * @param {number} k - 参数
  54092. * @return {number} 按四次方缓动退出的值
  54093. */
  54094. QuarticOut(k) {
  54095. return 1 - (--k * k * k * k);
  54096. }
  54097. /**
  54098. * @function SuperMap.LevelRenderer.Animation.easing.QuarticInOut
  54099. * @description 返回按四次方缓动进入退出的值
  54100. * @param {number} k - 参数
  54101. * @return {number} 按四次方缓动进入退出的值
  54102. */
  54103. QuarticInOut(k) {
  54104. if ((k *= 2) < 1) {
  54105. return 0.5 * k * k * k * k;
  54106. }
  54107. return -0.5 * ((k -= 2) * k * k * k - 2);
  54108. }
  54109. // 五次方的缓动(t^5)
  54110. /**
  54111. * @function SuperMap.LevelRenderer.Animation.easing.QuinticIn
  54112. * @description 返回按五次方缓动的值
  54113. * @param {number} k - 参数
  54114. * @return {number} 按五次方缓动的值
  54115. */
  54116. QuinticIn(k) {
  54117. return k * k * k * k * k;
  54118. }
  54119. /**
  54120. * @function SuperMap.LevelRenderer.Animation.easing.QuinticOut
  54121. * @description 返回按五次方缓动退出的值
  54122. * @param {number} k - 参数
  54123. * @return {number} 按五次方缓动退出的值
  54124. */
  54125. QuinticOut(k) {
  54126. return --k * k * k * k * k + 1;
  54127. }
  54128. /**
  54129. * @function SuperMap.LevelRenderer.Animation.easing.QuinticInOut
  54130. * @description 返回按五次方缓动进入退出的值
  54131. * @param {number} k - 参数
  54132. * @return {number} 按五次方缓动进入退出的值
  54133. */
  54134. QuinticInOut(k) {
  54135. if ((k *= 2) < 1) {
  54136. return 0.5 * k * k * k * k * k;
  54137. }
  54138. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  54139. }
  54140. // 正弦曲线的缓动(sin(t))
  54141. /**
  54142. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalIn
  54143. * @description 返回按正弦曲线的缓动进入的值
  54144. * @param {number} k - 参数
  54145. * @return {number} 按正弦曲线的缓动进入的值
  54146. */
  54147. SinusoidalIn(k) {
  54148. return 1 - Math.cos(k * Math.PI / 2);
  54149. }
  54150. /**
  54151. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalOut
  54152. * @description 返回按正弦曲线的缓动退出的值
  54153. * @param {number} k - 参数
  54154. * @return {number} 按正弦曲线的缓动退出的值
  54155. */
  54156. SinusoidalOut(k) {
  54157. return Math.sin(k * Math.PI / 2);
  54158. }
  54159. /**
  54160. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalInOut
  54161. * @description 返回按正弦曲线的缓动进入退出的值
  54162. * @param {number} k - 参数
  54163. * @return {number} 按正弦曲线的缓动进入退出的值
  54164. */
  54165. SinusoidalInOut(k) {
  54166. return 0.5 * (1 - Math.cos(Math.PI * k));
  54167. }
  54168. // 指数曲线的缓动(2^t)
  54169. /**
  54170. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialIn
  54171. * @description 返回按指数曲线的缓动进入的值
  54172. * @param {number} k - 参数
  54173. * @return {number} 按指数曲线的缓动进入的值
  54174. */
  54175. ExponentialIn(k) {
  54176. return k === 0 ? 0 : Math.pow(1024, k - 1);
  54177. }
  54178. /**
  54179. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialOut
  54180. * @description 返回按指数曲线的缓动退出的值
  54181. * @param {number} k - 参数
  54182. * @return {number} 按指数曲线的缓动退出的值
  54183. */
  54184. ExponentialOut(k) {
  54185. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  54186. }
  54187. /**
  54188. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialInOut
  54189. * @description 返回按指数曲线的缓动进入退出的值
  54190. * @param {number} k - 参数
  54191. * @return {number} 按指数曲线的缓动进入退出的值
  54192. */
  54193. ExponentialInOut(k) {
  54194. if (k === 0) {
  54195. return 0;
  54196. }
  54197. if (k === 1) {
  54198. return 1;
  54199. }
  54200. if ((k *= 2) < 1) {
  54201. return 0.5 * Math.pow(1024, k - 1);
  54202. }
  54203. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  54204. }
  54205. // 圆形曲线的缓动(sqrt(1-t^2))
  54206. /**
  54207. * @function SuperMap.LevelRenderer.Animation.easing.CircularIn
  54208. * @description 返回按圆形曲线的缓动进入的值
  54209. * @param {number} k - 参数
  54210. * @return {number} 按圆形曲线的缓动进入的值
  54211. */
  54212. CircularIn(k) {
  54213. return 1 - Math.sqrt(1 - k * k);
  54214. }
  54215. /**
  54216. * @function SuperMap.LevelRenderer.Animation.easing.CircularOut
  54217. * @description 返回按圆形曲线的缓动退出的值
  54218. * @param {number} k - 参数
  54219. * @return {number} 按圆形曲线的缓动退出的值
  54220. */
  54221. CircularOut(k) {
  54222. return Math.sqrt(1 - (--k * k));
  54223. }
  54224. /**
  54225. * @function SuperMap.LevelRenderer.Animation.easing.CircularInOut
  54226. * @description 返回按圆形曲线的缓动进入退出的值
  54227. * @param {number} k - 参数
  54228. * @return {number} 按圆形曲线的缓动进入退出的值
  54229. */
  54230. CircularInOut(k) {
  54231. if ((k *= 2) < 1) {
  54232. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  54233. }
  54234. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  54235. }
  54236. // 创建类似于弹簧在停止前来回振荡的动画
  54237. /**
  54238. * @function SuperMap.LevelRenderer.Animation.easing.ElasticIn
  54239. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  54240. * @param {number} k - 参数
  54241. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  54242. */
  54243. ElasticIn(k) {
  54244. var s;
  54245. var a = 0.1;
  54246. var p = 0.4;
  54247. if (k === 0) {
  54248. return 0;
  54249. }
  54250. if (k === 1) {
  54251. return 1;
  54252. }
  54253. if (a < 1) {
  54254. a = 1;
  54255. s = p / 4;
  54256. } else {
  54257. s = p * Math.asin(1 / a) / (2 * Math.PI);
  54258. }
  54259. return -(a * Math.pow(2, 10 * (k -= 1)) *
  54260. Math.sin((k - s) * (2 * Math.PI) / p));
  54261. }
  54262. /**
  54263. * @function SuperMap.LevelRenderer.Animation.easing.ElasticOut
  54264. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  54265. * @param {number} k - 参数
  54266. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  54267. */
  54268. ElasticOut(k) {
  54269. var s;
  54270. var a = 0.1;
  54271. var p = 0.4;
  54272. if (k === 0) {
  54273. return 0;
  54274. }
  54275. if (k === 1) {
  54276. return 1;
  54277. }
  54278. if (a < 1) {
  54279. a = 1;
  54280. s = p / 4;
  54281. } else {
  54282. s = p * Math.asin(1 / a) / (2 * Math.PI);
  54283. }
  54284. return (a * Math.pow(2, -10 * k) *
  54285. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  54286. }
  54287. /**
  54288. * @function SuperMap.LevelRenderer.Animation.easing.ElasticInOut
  54289. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  54290. * @param {number} k - 参数
  54291. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  54292. */
  54293. ElasticInOut(k) {
  54294. var s;
  54295. var a = 0.1;
  54296. var p = 0.4;
  54297. if (k === 0) {
  54298. return 0;
  54299. }
  54300. if (k === 1) {
  54301. return 1;
  54302. }
  54303. if (a < 1) {
  54304. a = 1;
  54305. s = p / 4;
  54306. } else {
  54307. s = p * Math.asin(1 / a) / (2 * Math.PI);
  54308. }
  54309. if ((k *= 2) < 1) {
  54310. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  54311. * Math.sin((k - s) * (2 * Math.PI) / p));
  54312. }
  54313. return a * Math.pow(2, -10 * (k -= 1))
  54314. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  54315. }
  54316. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  54317. /**
  54318. * @function SuperMap.LevelRenderer.Animation.easing.BackIn
  54319. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  54320. * @param {number} k - 参数
  54321. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  54322. */
  54323. BackIn(k) {
  54324. var s = 1.70158;
  54325. return k * k * ((s + 1) * k - s);
  54326. }
  54327. /**
  54328. * @function SuperMap.LevelRenderer.Animation.easing.BackOut
  54329. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  54330. * @param {number} k - 参数
  54331. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  54332. */
  54333. BackOut(k) {
  54334. var s = 1.70158;
  54335. return --k * k * ((s + 1) * k + s) + 1;
  54336. }
  54337. /**
  54338. * @function SuperMap.LevelRenderer.Animation.easing.BackInOut
  54339. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  54340. * @param {number} k - 参数
  54341. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  54342. */
  54343. BackInOut(k) {
  54344. var s = 1.70158 * 1.525;
  54345. if ((k *= 2) < 1) {
  54346. return 0.5 * (k * k * ((s + 1) * k - s));
  54347. }
  54348. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  54349. }
  54350. // 创建弹跳效果
  54351. /**
  54352. * @function SuperMap.LevelRenderer.Animation.easing.BounceIn
  54353. * @description 返回按弹跳效果的缓动进入的值
  54354. * @param {number} k - 参数
  54355. * @return {number} 按弹跳效果的缓动进入的值
  54356. */
  54357. BounceIn(k) {
  54358. return 1 - this.BounceOut(1 - k);
  54359. }
  54360. /**
  54361. * @function SuperMap.LevelRenderer.Animation.easing.BounceOut
  54362. * @description 返回按弹跳效果的缓动退出的值
  54363. * @param {number} k - 参数
  54364. * @return {number} 按弹跳效果的缓动退出的值
  54365. */
  54366. BounceOut(k) {
  54367. if (k < (1 / 2.75)) {
  54368. return 7.5625 * k * k;
  54369. } else if (k < (2 / 2.75)) {
  54370. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  54371. } else if (k < (2.5 / 2.75)) {
  54372. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  54373. } else {
  54374. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  54375. }
  54376. }
  54377. /**
  54378. * @function SuperMap.LevelRenderer.Animation.easing.BounceInOut
  54379. * @description 返回按弹跳效果的缓动进入退出的值
  54380. * @param {number} k - 参数
  54381. * @return {number} 按弹跳效果的缓动进入退出的值
  54382. */
  54383. BounceInOut(k) {
  54384. if (k < 0.5) {
  54385. return this.BounceIn(k * 2) * 0.5;
  54386. }
  54387. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  54388. }
  54389. }
  54390. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  54391. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  54392. * This program are made available under the terms of the Apache License, Version 2.0
  54393. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54394. /**
  54395. * @class SuperMap.LevelRenderer.Animation.Clip
  54396. * @category Visualization Theme
  54397. * @classdec 动画片段
  54398. * @private
  54399. */
  54400. class Clip_Clip {
  54401. /**
  54402. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.constructor
  54403. * @description 构造函数。
  54404. * @param {Object} options - 参数。
  54405. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  54406. * @param {number} [options.life=1000] - 动画时长。
  54407. * @param {number} [options.delay=0] - 动画延迟时间。
  54408. * @param {boolean} [options.loop=true] - 是否循环。
  54409. * @param {number} [options.gap=0] - 循环的间隔时间。
  54410. * @param {Object} options.onframe - 帧。
  54411. * @param {boolean} options.easing - 是否消除。
  54412. * @param {boolean} options.ondestroy - 是否销毁。
  54413. * @param {boolean} options.onrestart - 是否重播。
  54414. */
  54415. constructor(options) {
  54416. this._targetPool = options.target || {};
  54417. if (!(this._targetPool instanceof Array)) {
  54418. this._targetPool = [this._targetPool];
  54419. }
  54420. // 生命周期
  54421. this._life = options.life || 1000;
  54422. // 延时
  54423. this._delay = options.delay || 0;
  54424. // 开始时间
  54425. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  54426. // 结束时间
  54427. this._endTime = this._startTime + this._life * 1000;
  54428. // 是否循环
  54429. this.loop = typeof options.loop == 'undefined'
  54430. ? false : options.loop;
  54431. this.gap = options.gap || 0;
  54432. this.easing = options.easing || 'Linear';
  54433. this.onframe = options.onframe;
  54434. this.ondestroy = options.ondestroy;
  54435. this.onrestart = options.onrestart;
  54436. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  54437. }
  54438. /**
  54439. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.destroy
  54440. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  54441. */
  54442. destroy() {
  54443. }
  54444. step(time) {
  54445. var easing = new Easing();
  54446. var percent = (time - this._startTime) / this._life;
  54447. // 还没开始
  54448. if (percent < 0) {
  54449. return;
  54450. }
  54451. percent = Math.min(percent, 1);
  54452. var easingFunc = typeof this.easing == 'string'
  54453. ? easing[this.easing]
  54454. : this.easing;
  54455. var schedule = typeof easingFunc === 'function'
  54456. ? easingFunc(percent)
  54457. : percent;
  54458. this.fire('frame', schedule);
  54459. // 结束
  54460. if (percent == 1) {
  54461. if (this.loop) {
  54462. this.restart();
  54463. // 重新开始周期
  54464. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  54465. return 'restart';
  54466. }
  54467. // 动画完成将这个控制器标识为待删除
  54468. // 在Animation.update中进行批量删除
  54469. this._needsRemove = true;
  54470. return 'destroy';
  54471. }
  54472. return null;
  54473. }
  54474. restart() {
  54475. var time = new Date().getTime();
  54476. var remainder = (time - this._startTime) % this._life;
  54477. this._startTime = new Date().getTime() - remainder + this.gap;
  54478. }
  54479. fire(eventType, arg) {
  54480. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  54481. if (this['on' + eventType]) {
  54482. this['on' + eventType](this._targetPool[i], arg);
  54483. }
  54484. }
  54485. }
  54486. }
  54487. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  54488. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  54489. * This program are made available under the terms of the Apache License, Version 2.0
  54490. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54491. /**
  54492. * @class SuperMap.LevelRenderer.Animation
  54493. * @classdesc 动画主类, 调度和管理所有动画控制器
  54494. * @category Visualization Theme
  54495. * @extends {SuperMap.LevelRenderer.Eventful}
  54496. * @private
  54497. */
  54498. class Animation_Animation extends Eventful {
  54499. /**
  54500. * @function SuperMap.LevelRenderer.Animation.prototype.constructor
  54501. * @description 构造函数。
  54502. * @param {Object} options - 动画参数。
  54503. * @param {Object} options.onframe - onframe。
  54504. * @param {Object} options.stage - stage。
  54505. * (start code)
  54506. * var animation = new SuperMap.LevelRenderer.Animation();
  54507. * var obj = {
  54508. * x: 100,
  54509. * y: 100
  54510. * };
  54511. * animation.animate(node.position)
  54512. * .when(1000, {
  54513. * x: 500,
  54514. * y: 500
  54515. * })
  54516. * .when(2000, {
  54517. * x: 100,
  54518. * y: 100
  54519. * })
  54520. * .start('spline');
  54521. * (end)
  54522. */
  54523. constructor(options) {
  54524. super(options);
  54525. options = options || {};
  54526. /**
  54527. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.stage
  54528. * @description stage。
  54529. */
  54530. this.stage = {};
  54531. /**
  54532. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.onframe
  54533. * @description onframe。
  54534. */
  54535. this.onframe = function () {
  54536. };
  54537. /**
  54538. * @member {Array} SuperMap.LevelRenderer.Animation.prototype._clips
  54539. * @description _clips。
  54540. */
  54541. this._clips = [];
  54542. /**
  54543. * @member {boolean} SuperMap.LevelRenderer.Animation.prototype._running
  54544. * @description _running。
  54545. */
  54546. this._running = false;
  54547. /**
  54548. * @member {number} SuperMap.LevelRenderer.Animation.prototype._time
  54549. * @description _time。
  54550. */
  54551. this._time = 0;
  54552. Util_Util.extend(this, options);
  54553. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  54554. }
  54555. /**
  54556. * @function SuperMap.LevelRenderer.Animation.prototype.add
  54557. * @description 添加动画片段。
  54558. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  54559. */
  54560. add(clip) {
  54561. this._clips.push(clip);
  54562. }
  54563. /**
  54564. * @function SuperMap.LevelRenderer.Animation.prototype.remove
  54565. * @description 删除动画片段。
  54566. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  54567. */
  54568. remove(clip) {
  54569. var idx = new levelRenderer_Util_Util().indexOf(this._clips, clip);
  54570. if (idx >= 0) {
  54571. this._clips.splice(idx, 1);
  54572. }
  54573. }
  54574. /**
  54575. * @function SuperMap.LevelRenderer.Animation.prototype.update
  54576. * @description 更新动画片段。
  54577. */
  54578. _update() {
  54579. var time = new Date().getTime();
  54580. var delta = time - this._time;
  54581. var clips = this._clips;
  54582. var len = clips.length;
  54583. var deferredEvents = [];
  54584. var deferredClips = [];
  54585. for (let i = 0; i < len; i++) {
  54586. var clip = clips[i];
  54587. var e = clip.step(time);
  54588. // Throw out the events need to be called after
  54589. // stage.update, like destroy
  54590. if (e) {
  54591. deferredEvents.push(e);
  54592. deferredClips.push(clip);
  54593. }
  54594. }
  54595. if (this.stage.update) {
  54596. this.stage.update();
  54597. }
  54598. // Remove the finished clip
  54599. for (let i = 0; i < len;) {
  54600. if (clips[i]._needsRemove) {
  54601. clips[i] = clips[len - 1];
  54602. clips.pop();
  54603. len--;
  54604. } else {
  54605. i++;
  54606. }
  54607. }
  54608. len = deferredEvents.length;
  54609. for (let i = 0; i < len; i++) {
  54610. deferredClips[i].fire(deferredEvents[i]);
  54611. }
  54612. this._time = time;
  54613. this.onframe(delta);
  54614. this.dispatch('frame', delta);
  54615. }
  54616. /**
  54617. * @function SuperMap.LevelRenderer.Animation.prototype.start
  54618. * @description 开始运行动画。
  54619. */
  54620. start() {
  54621. var requestAnimationFrame = window.requestAnimationFrame
  54622. || window.msRequestAnimationFrame
  54623. || window.mozRequestAnimationFrame
  54624. || window.webkitRequestAnimationFrame
  54625. || function (func) {
  54626. setTimeout(func, 16);
  54627. };
  54628. var self = this;
  54629. this._running = true;
  54630. function step() {
  54631. if (self._running) {
  54632. self._update();
  54633. requestAnimationFrame(step);
  54634. }
  54635. }
  54636. this._time = new Date().getTime();
  54637. requestAnimationFrame(step);
  54638. }
  54639. /**
  54640. * @function SuperMap.LevelRenderer.Animation.prototype.stop
  54641. * @description 停止运行动画。
  54642. */
  54643. stop() {
  54644. this._running = false;
  54645. }
  54646. /**
  54647. * @function SuperMap.LevelRenderer.Animation.prototype.clear
  54648. * @description 清除所有动画片段。
  54649. */
  54650. clear() {
  54651. this._clips = [];
  54652. }
  54653. /**
  54654. * @function SuperMap.LevelRenderer.Animation.prototype.animate
  54655. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  54656. * @param {Object} target - 目标对象。
  54657. * @param {Object} options - 动画参数选项。
  54658. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  54659. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  54660. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  54661. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator。
  54662. */
  54663. animate(target, options) {
  54664. options = options || {};
  54665. var deferred = new Animation_Animator(
  54666. target,
  54667. options.loop,
  54668. options.getter,
  54669. options.setter
  54670. );
  54671. deferred.animation = this;
  54672. return deferred;
  54673. }
  54674. static _interpolateNumber(p0, p1, percent) {
  54675. return (p1 - p0) * percent + p0;
  54676. }
  54677. static _interpolateArray(p0, p1, percent, out, arrDim) {
  54678. var len = p0.length;
  54679. if (arrDim == 1) {
  54680. for (let i = 0; i < len; i++) {
  54681. out[i] = Animation_Animation._interpolateNumber(p0[i], p1[i], percent);
  54682. }
  54683. } else {
  54684. var len2 = p0[0].length;
  54685. for (let i = 0; i < len; i++) {
  54686. for (let j = 0; j < len2; j++) {
  54687. out[i][j] = Animation_Animation._interpolateNumber(
  54688. p0[i][j], p1[i][j], percent
  54689. );
  54690. }
  54691. }
  54692. }
  54693. }
  54694. static _isArrayLike(data) {
  54695. switch (typeof data) {
  54696. case 'undefined':
  54697. case 'string':
  54698. return false;
  54699. }
  54700. return typeof data.length !== 'undefined';
  54701. }
  54702. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  54703. var len = p0.length;
  54704. if (arrDim == 1) {
  54705. for (let i = 0; i < len; i++) {
  54706. out[i] = Animation_Animation._catmullRomInterpolate(
  54707. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  54708. );
  54709. }
  54710. } else {
  54711. var len2 = p0[0].length;
  54712. for (let i = 0; i < len; i++) {
  54713. for (var j = 0; j < len2; j++) {
  54714. out[i][j] = Animation_Animation._catmullRomInterpolate(
  54715. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  54716. t, t2, t3
  54717. );
  54718. }
  54719. }
  54720. }
  54721. }
  54722. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  54723. var v0 = (p2 - p0) * 0.5;
  54724. var v1 = (p3 - p1) * 0.5;
  54725. return (2 * (p1 - p2) + v0 + v1) * t3
  54726. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  54727. + v0 * t + p1;
  54728. }
  54729. static _cloneValue(value) {
  54730. var arraySlice = Array.prototype.slice;
  54731. if (Animation_Animation._isArrayLike(value)) {
  54732. var len = value.length;
  54733. if (Animation_Animation._isArrayLike(value[0])) {
  54734. var ret = [];
  54735. for (var i = 0; i < len; i++) {
  54736. ret.push(arraySlice.call(value[i]));
  54737. }
  54738. return ret;
  54739. } else {
  54740. return arraySlice.call(value);
  54741. }
  54742. } else {
  54743. return value;
  54744. }
  54745. }
  54746. static rgba2String(rgba) {
  54747. rgba[0] = Math.floor(rgba[0]);
  54748. rgba[1] = Math.floor(rgba[1]);
  54749. rgba[2] = Math.floor(rgba[2]);
  54750. return 'rgba(' + rgba.join(',') + ')';
  54751. }
  54752. }
  54753. /**
  54754. * @class SuperMap.LevelRenderer.Animation.Animator
  54755. */
  54756. class Animation_Animator {
  54757. /**
  54758. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.animate
  54759. * @description 构造函数
  54760. * @param {Object} target - 目标对象。
  54761. * @param {Object} options - 动画参数选项。
  54762. * @param {boolean} [loop=false] - 是否循环播放动画。
  54763. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  54764. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  54765. */
  54766. constructor(target, loop, getter, setter) {
  54767. /**
  54768. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._tracks
  54769. * @description _tracks。
  54770. */
  54771. this._tracks = {};
  54772. /**
  54773. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._target
  54774. * @description _target。
  54775. */
  54776. this._target = target;
  54777. /**
  54778. * @member {boolean} SuperMap.LevelRenderer.Animation.Animator.prototype._loop
  54779. * @description _loop。
  54780. */
  54781. this._loop = loop || false;
  54782. /**
  54783. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._getter
  54784. * @description _getter。
  54785. */
  54786. this._getter = getter || _defaultGetter;
  54787. /**
  54788. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._setter
  54789. * @description _setter。
  54790. */
  54791. this._setter = setter || _defaultSetter;
  54792. /**
  54793. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._clipCount
  54794. * @description _clipCount。
  54795. */
  54796. this._clipCount = 0;
  54797. /**
  54798. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._delay
  54799. * @description _delay。
  54800. */
  54801. this._delay = 0;
  54802. /**
  54803. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._doneList
  54804. * @description _doneList。
  54805. */
  54806. this._doneList = [];
  54807. /**
  54808. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._onframeList
  54809. * @description _onframeList。
  54810. */
  54811. this._onframeList = [];
  54812. /**
  54813. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._clipList
  54814. * @description _clipList。
  54815. */
  54816. this._clipList = [];
  54817. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  54818. //Function
  54819. function _defaultGetter(target, key) {
  54820. return target[key];
  54821. }
  54822. function _defaultSetter(target, key, value) {
  54823. target[key] = value;
  54824. }
  54825. }
  54826. /**
  54827. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.when
  54828. * @description 设置动画关键帧
  54829. * @param {number} time - 关键帧时间,单位是ms
  54830. * @param {Object} props - 关键帧的属性值,key-value表示
  54831. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54832. */
  54833. when(time /* ms */, props) {
  54834. for (var propName in props) {
  54835. if (!this._tracks[propName]) {
  54836. this._tracks[propName] = [];
  54837. // If time is 0
  54838. // Then props is given initialize value
  54839. // Else
  54840. // Initialize value from current prop value
  54841. if (time !== 0) {
  54842. this._tracks[propName].push({
  54843. time: 0,
  54844. value: Animation_Animation._cloneValue(
  54845. this._getter(this._target, propName)
  54846. )
  54847. });
  54848. }
  54849. }
  54850. this._tracks[propName].push({
  54851. time: parseInt(time, 10),
  54852. value: props[propName]
  54853. });
  54854. }
  54855. return this;
  54856. }
  54857. /**
  54858. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.during
  54859. * @description 添加动画每一帧的回调函数
  54860. * @param {RequestCallback} callback - 回调函数
  54861. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54862. */
  54863. during(callback) {
  54864. this._onframeList.push(callback);
  54865. return this;
  54866. }
  54867. /**
  54868. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.start
  54869. * @description 开始执行动画
  54870. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link SuperMap.LevelRenderer.Animation.easing}>。
  54871. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54872. */
  54873. start(easing) {
  54874. var self = this;
  54875. var setter = this._setter;
  54876. var getter = this._getter;
  54877. var onFrameListLen = self._onframeList.length;
  54878. var useSpline = easing === 'spline';
  54879. var ondestroy = function () {
  54880. self._clipCount--;
  54881. if (self._clipCount === 0) {
  54882. // Clear all tracks
  54883. self._tracks = {};
  54884. var len = self._doneList.length;
  54885. for (var i = 0; i < len; i++) {
  54886. self._doneList[i].call(self);
  54887. }
  54888. }
  54889. };
  54890. var createTrackClip = function (keyframes, propName) {
  54891. var trackLen = keyframes.length;
  54892. if (!trackLen) {
  54893. return;
  54894. }
  54895. // Guess data type
  54896. var firstVal = keyframes[0].value;
  54897. var isValueArray = Animation_Animation._isArrayLike(firstVal);
  54898. var isValueColor = false;
  54899. // For vertices morphing
  54900. var arrDim = (
  54901. isValueArray
  54902. && Animation_Animation._isArrayLike(firstVal[0])
  54903. )
  54904. ? 2 : 1;
  54905. // Sort keyframe as ascending
  54906. keyframes.sort(function (a, b) {
  54907. return a.time - b.time;
  54908. });
  54909. var trackMaxTime = keyframes[trackLen - 1].time;
  54910. // Percents of each keyframe
  54911. var kfPercents = [];
  54912. // Value of each keyframe
  54913. var kfValues = [];
  54914. for (let i = 0; i < trackLen; i++) {
  54915. kfPercents.push(keyframes[i].time / trackMaxTime);
  54916. // Assume value is a color when it is a string
  54917. var value = keyframes[i].value;
  54918. if (typeof(value) == 'string') {
  54919. value = SUtil.Util_color.toArray(value);
  54920. if (value.length === 0) { // Invalid color
  54921. value[0] = value[1] = value[2] = 0;
  54922. value[3] = 1;
  54923. }
  54924. isValueColor = true;
  54925. }
  54926. kfValues.push(value);
  54927. }
  54928. // Cache the key of last frame to speed up when
  54929. // animation playback is sequency
  54930. var cacheKey = 0;
  54931. var cachePercent = 0;
  54932. var start;
  54933. var i;
  54934. var w;
  54935. var p0;
  54936. var p1;
  54937. var p2;
  54938. var p3;
  54939. if (isValueColor) {
  54940. var rgba = [0, 0, 0, 0];
  54941. }
  54942. var onframe = function (target, percent) {
  54943. // Find the range keyframes
  54944. // kf1-----kf2---------current--------kf3
  54945. // find kf2 and kf3 and do interpolation
  54946. if (percent < cachePercent) {
  54947. // Start from next key
  54948. start = Math.min(cacheKey + 1, trackLen - 1);
  54949. for (i = start; i >= 0; i--) {
  54950. if (kfPercents[i] <= percent) {
  54951. break;
  54952. }
  54953. }
  54954. i = Math.min(i, trackLen - 2);
  54955. } else {
  54956. for (i = cacheKey; i < trackLen; i++) {
  54957. if (kfPercents[i] > percent) {
  54958. break;
  54959. }
  54960. }
  54961. i = Math.min(i - 1, trackLen - 2);
  54962. }
  54963. cacheKey = i;
  54964. cachePercent = percent;
  54965. var range = (kfPercents[i + 1] - kfPercents[i]);
  54966. if (range === 0) {
  54967. return;
  54968. } else {
  54969. w = (percent - kfPercents[i]) / range;
  54970. }
  54971. if (useSpline) {
  54972. p1 = kfValues[i];
  54973. p0 = kfValues[i === 0 ? i : i - 1];
  54974. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  54975. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  54976. if (isValueArray) {
  54977. Animation_Animation._catmullRomInterpolateArray(
  54978. p0, p1, p2, p3, w, w * w, w * w * w,
  54979. getter(target, propName),
  54980. arrDim
  54981. );
  54982. } else {
  54983. let value;
  54984. if (isValueColor) {
  54985. // value = SuperMap.LevelRenderer.Animation._catmullRomInterpolateArray(
  54986. // p0, p1, p2, p3, w, w * w, w * w * w,
  54987. // rgba, 1
  54988. // );
  54989. value = Animation_Animation.rgba2String(rgba);
  54990. } else {
  54991. value = Animation_Animation._catmullRomInterpolate(
  54992. p0, p1, p2, p3, w, w * w, w * w * w
  54993. );
  54994. }
  54995. setter(
  54996. target,
  54997. propName,
  54998. value
  54999. );
  55000. }
  55001. } else {
  55002. if (isValueArray) {
  55003. Animation_Animation._interpolateArray(
  55004. kfValues[i], kfValues[i + 1], w,
  55005. getter(target, propName),
  55006. arrDim
  55007. );
  55008. } else {
  55009. let value;
  55010. if (isValueColor) {
  55011. Animation_Animation._interpolateArray(
  55012. kfValues[i], kfValues[i + 1], w,
  55013. rgba, 1
  55014. );
  55015. value = Animation_Animation.rgba2String(rgba);
  55016. } else {
  55017. value = Animation_Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  55018. }
  55019. setter(
  55020. target,
  55021. propName,
  55022. value
  55023. );
  55024. }
  55025. }
  55026. for (i = 0; i < onFrameListLen; i++) {
  55027. self._onframeList[i](target, percent);
  55028. }
  55029. };
  55030. var clip = new Clip_Clip({
  55031. target: self._target,
  55032. life: trackMaxTime,
  55033. loop: self._loop,
  55034. delay: self._delay,
  55035. onframe: onframe,
  55036. ondestroy: ondestroy
  55037. });
  55038. if (easing && easing !== 'spline') {
  55039. clip.easing = easing;
  55040. }
  55041. self._clipList.push(clip);
  55042. self._clipCount++;
  55043. self.animation.add(clip);
  55044. };
  55045. for (var propName in this._tracks) {
  55046. createTrackClip(this._tracks[propName], propName);
  55047. }
  55048. return this;
  55049. }
  55050. /**
  55051. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.stop
  55052. * @description 停止动画
  55053. */
  55054. stop() {
  55055. for (var i = 0; i < this._clipList.length; i++) {
  55056. var clip = this._clipList[i];
  55057. this.animation.remove(clip);
  55058. }
  55059. this._clipList = [];
  55060. }
  55061. /**
  55062. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.delay
  55063. * @description 设置动画延迟开始的时间
  55064. * @param {number} time - 时间,单位ms
  55065. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55066. */
  55067. delay(time) {
  55068. this._delay = time;
  55069. return this;
  55070. }
  55071. /**
  55072. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.done
  55073. * @description 添加动画结束的回调
  55074. * @param {function} cb - Function
  55075. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55076. */
  55077. done(cb) {
  55078. if (cb) {
  55079. this._doneList.push(cb);
  55080. }
  55081. return this;
  55082. }
  55083. }
  55084. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  55085. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  55086. * This program are made available under the terms of the Apache License, Version 2.0
  55087. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55088. /**
  55089. * @private
  55090. * @class SuperMap.LevelRenderer.Render
  55091. * @category Visualization Theme
  55092. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  55093. */
  55094. class Render_Render {
  55095. /**
  55096. * @function SuperMap.LevelRenderer.Render.constructor
  55097. * @description 构造函数。
  55098. *
  55099. * @param {string} id - 唯一标识。
  55100. * @param {HTMLElement} dom - Dom 对象。
  55101. */
  55102. constructor(id, dom) {
  55103. /**
  55104. * @member {string} SuperMap.LevelRenderer.Render.prototype.id
  55105. * @description 唯一标识。
  55106. */
  55107. this.id = id;
  55108. /**
  55109. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Render.prototype.storage
  55110. * @description 图形仓库对象。
  55111. */
  55112. this.storage = new Storage_Storage();
  55113. /**
  55114. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Render.prototype.painter
  55115. * @description 绘制器对象。
  55116. *
  55117. */
  55118. this.painter = new Painter_Painter(dom, this.storage);
  55119. /**
  55120. * @member {SuperMap.LevelRenderer.Handler} SuperMap.LevelRenderer.Render.prototype.handler
  55121. * @description 事件处理对象。
  55122. *
  55123. */
  55124. this.handler = new Handler_Handler(dom, this.storage, this.painter);
  55125. /**
  55126. * @member {Array} SuperMap.LevelRenderer.Render.prototype.animatingElements
  55127. * @description 动画控制数组。
  55128. *
  55129. */
  55130. this.animatingElements = [];
  55131. /**
  55132. * @member {SuperMap.LevelRenderer.animation.Animation} SuperMap.LevelRenderer.Render.prototype.animation
  55133. * @description 动画对象。
  55134. *
  55135. */
  55136. this.animation = new Animation_Animation({
  55137. stage: {
  55138. update: Render_Render.getFrameCallback(this)
  55139. }
  55140. });
  55141. /**
  55142. * @member {boolean} SuperMap.LevelRenderer.Render.prototype._needsRefreshNextFrame
  55143. * @description 是否需要刷新下一帧。
  55144. *
  55145. */
  55146. this._needsRefreshNextFrame = false;
  55147. this.animation.start();
  55148. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  55149. }
  55150. /**
  55151. * @function SuperMap.LevelRenderer.Render.prototype.destory
  55152. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55153. */
  55154. destroy() {
  55155. this.id = null;
  55156. this.storage = null;
  55157. this.painter = null;
  55158. this.handler = null;
  55159. this.animatingElements = null;
  55160. this.animation = null;
  55161. this._needsRefreshNextFrame = null;
  55162. }
  55163. /**
  55164. * @function SuperMap.LevelRenderer.Render.prototype.getId
  55165. * @description 获取实例唯一标识。
  55166. * @return {string} 实例唯一标识。
  55167. */
  55168. getId() {
  55169. return this.id;
  55170. }
  55171. /**
  55172. * @function SuperMap.LevelRenderer.Render.prototype.addShape
  55173. * @description 添加图形形状到根节点。
  55174. *
  55175. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  55176. * @return {SuperMap.LevelRenderer.Render} this。
  55177. */
  55178. addShape(shape) {
  55179. this.storage.addRoot(shape);
  55180. return this;
  55181. }
  55182. /**
  55183. * @function SuperMap.LevelRenderer.Render.prototype.addGroup
  55184. * @description 添加组到根节点。
  55185. *
  55186. * (code)
  55187. * //添加组到根节点例子
  55188. * var render = new SuperMap.LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  55189. * render.clear();
  55190. * var g = new SuperMap.LevelRenderer.Group();
  55191. * g.addChild(new SuperMap.LevelRenderer.Shape.Circle({
  55192. * style: {
  55193. * x: 100,
  55194. * y: 100,
  55195. * r: 20,
  55196. * brushType: 'fill'
  55197. * }
  55198. * }));
  55199. * render.addGroup(g);
  55200. * render.render();
  55201. * (end)
  55202. *
  55203. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  55204. * @return {SuperMap.LevelRenderer.Render} this。
  55205. */
  55206. addGroup(group) {
  55207. this.storage.addRoot(group);
  55208. return this;
  55209. }
  55210. /**
  55211. * @function SuperMap.LevelRenderer.Render.prototype.delShape
  55212. * @description 从根节点删除图形形状。
  55213. *
  55214. * @param {string} shapeId - 图形对象唯一标识。
  55215. * @return {SuperMap.LevelRenderer.Render} this。
  55216. */
  55217. delShape(shapeId) {
  55218. this.storage.delRoot(shapeId);
  55219. return this;
  55220. }
  55221. /**
  55222. * @function SuperMap.LevelRenderer.Render.prototype.delGroup
  55223. * @description 从根节点删除组。
  55224. *
  55225. * @param {string} groupId - 组对象唯一标识。
  55226. * @return {SuperMap.LevelRenderer.Render} this。
  55227. */
  55228. delGroup(groupId) {
  55229. this.storage.delRoot(groupId);
  55230. return this;
  55231. }
  55232. /**
  55233. * @function SuperMap.LevelRenderer.Render.prototype.modShape
  55234. * @description 修改图形形状。
  55235. *
  55236. * @param {string} shapeId - 图形对象唯一标识。
  55237. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  55238. * @return {SuperMap.LevelRenderer.Render} this。
  55239. */
  55240. modShape(shapeId, shape) {
  55241. this.storage.mod(shapeId, shape);
  55242. return this;
  55243. }
  55244. /**
  55245. * @function SuperMap.LevelRenderer.Render.prototype.modGroup
  55246. * @description 修改组。
  55247. *
  55248. * @param {string} groupId - 组对象唯一标识。
  55249. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  55250. * @return {SuperMap.LevelRenderer.Render} this。
  55251. */
  55252. modGroup(groupId, group) {
  55253. this.storage.mod(groupId, group);
  55254. return this;
  55255. }
  55256. /**
  55257. * @function SuperMap.LevelRenderer.Render.prototype.modLayer
  55258. * @description 修改指定 zlevel 的绘制配置项。
  55259. *
  55260. * @param {string} zLevel - 组对象唯一标识。
  55261. * @param {Object} config - 配置对象。
  55262. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  55263. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  55264. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  55265. * @param {Array.<number>} position - 层的平移。
  55266. * @param {Array.<number>} rotation - 层的旋转。
  55267. * @param {Array.<number>} scale - 层的缩放。
  55268. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  55269. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  55270. * @return {SuperMap.LevelRenderer.Render} this。
  55271. */
  55272. modLayer(zLevel, config) {
  55273. this.painter.modLayer(zLevel, config);
  55274. return this;
  55275. }
  55276. /**
  55277. * @function SuperMap.LevelRenderer.Render.prototype.addHoverShape
  55278. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  55279. *
  55280. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  55281. * @return {SuperMap.LevelRenderer.Render} this。
  55282. */
  55283. addHoverShape(shape) {
  55284. this.storage.addHover(shape);
  55285. return this;
  55286. }
  55287. /**
  55288. * @function SuperMap.LevelRenderer.Render.prototype.render
  55289. * @description 渲染。
  55290. *
  55291. * @callback {Function} callback - 渲染结束后回调函数。
  55292. * @return {SuperMap.LevelRenderer.Render} this。
  55293. */
  55294. render(callback) {
  55295. this.painter.render(callback);
  55296. this._needsRefreshNextFrame = false;
  55297. return this;
  55298. }
  55299. /**
  55300. * @function SuperMap.LevelRenderer.Render.prototype.refresh
  55301. * @description 视图更新。
  55302. *
  55303. * @callback {Function} callback - 视图更新后回调函数。
  55304. * @return {SuperMap.LevelRenderer.Render} this。
  55305. */
  55306. refresh(callback) {
  55307. this.painter.refresh(callback);
  55308. this._needsRefreshNextFrame = false;
  55309. return this;
  55310. }
  55311. /**
  55312. * @function SuperMap.LevelRenderer.Render.prototype.refreshNextFrame
  55313. * @description 标记视图在浏览器下一帧需要绘制。
  55314. * @return {SuperMap.LevelRenderer.Render} this。
  55315. */
  55316. refreshNextFrame() {
  55317. this._needsRefreshNextFrame = true;
  55318. return this;
  55319. }
  55320. /**
  55321. * @function SuperMap.LevelRenderer.Render.prototype.refreshHover
  55322. * @description 绘制(视图更新)高亮层。
  55323. * @callback {Function} callback - 视图更新后回调函数。
  55324. * @return {SuperMap.LevelRenderer.Render} this。
  55325. */
  55326. refreshHover(callback) {
  55327. this.painter.refreshHover(callback);
  55328. return this;
  55329. }
  55330. /**
  55331. * @function SuperMap.LevelRenderer.Render.prototype.refreshShapes
  55332. * @description 视图更新。
  55333. *
  55334. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  55335. * @callback {Function} callback - 视图更新后回调函数。
  55336. * @return {SuperMap.LevelRenderer.Render} this。
  55337. */
  55338. refreshShapes(shapeList, callback) {
  55339. this.painter.refreshShapes(shapeList, callback);
  55340. return this;
  55341. }
  55342. /**
  55343. * @function SuperMap.LevelRenderer.Render.prototype.resize
  55344. * @description 调整视图大小。
  55345. * @return {SuperMap.LevelRenderer.Render} this。
  55346. */
  55347. resize() {
  55348. this.painter.resize();
  55349. return this;
  55350. }
  55351. /**
  55352. * @function SuperMap.LevelRenderer.Render.prototype.animate
  55353. * @description 动画。
  55354. *
  55355. * @example
  55356. * zr.animate(circle.id, 'style', false)
  55357. * .when(1000, {x: 10} )
  55358. * .done(function(){ // Animation done })
  55359. * .start()
  55360. *
  55361. *
  55362. * @param {Array.<(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)>} el - 动画对象。
  55363. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<SuperMap.LevelRenderer.Group>,path需为空字符串。
  55364. * @param {Function} loop - 动画是否循环。
  55365. * @return {SuperMap.LevelRenderer.animation.Animator} Animator。
  55366. */
  55367. animate(el, path, loop) {
  55368. if (typeof(el) === 'string') {
  55369. el = this.storage.get(el);
  55370. }
  55371. if (el) {
  55372. var target;
  55373. if (path) {
  55374. var pathSplitted = path.split('.');
  55375. var prop = el;
  55376. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  55377. if (!prop) {
  55378. continue;
  55379. }
  55380. prop = prop[pathSplitted[i]];
  55381. }
  55382. if (prop) {
  55383. target = prop;
  55384. }
  55385. } else {
  55386. target = el;
  55387. }
  55388. if (!target) {
  55389. SUtil.Util_log(
  55390. 'Property "'
  55391. + path
  55392. + '" is not existed in element '
  55393. + el.id
  55394. );
  55395. return;
  55396. }
  55397. var animatingElements = this.animatingElements;
  55398. if (typeof el.__aniCount === 'undefined') {
  55399. // 正在进行的动画记数
  55400. el.__aniCount = 0;
  55401. }
  55402. if (el.__aniCount === 0) {
  55403. animatingElements.push(el);
  55404. }
  55405. el.__aniCount++;
  55406. return this.animation.animate(target, {loop: loop})
  55407. .done(function () {
  55408. el.__aniCount--;
  55409. if (el.__aniCount === 0) {
  55410. // 从animatingElements里移除
  55411. var idx = new levelRenderer_Util_Util().indexOf(animatingElements, el);
  55412. animatingElements.splice(idx, 1);
  55413. }
  55414. });
  55415. } else {
  55416. SUtil.Util_log('Element not existed');
  55417. }
  55418. }
  55419. /**
  55420. * @function SuperMap.LevelRenderer.Render.prototype.clearAnimation
  55421. * @description 停止所有动画。
  55422. *
  55423. */
  55424. clearAnimation() {
  55425. this.animation.clear();
  55426. }
  55427. /**
  55428. * @function SuperMap.LevelRenderer.Render.prototype.getWidth
  55429. * @description 获取视图宽度。
  55430. * @return {number} 视图宽度。
  55431. */
  55432. getWidth() {
  55433. return this.painter.getWidth();
  55434. }
  55435. /**
  55436. * @function SuperMap.LevelRenderer.Render.prototype.getHeight
  55437. * @description 获取视图高度。
  55438. * @return {number} 视图高度。
  55439. */
  55440. getHeight() {
  55441. return this.painter.getHeight();
  55442. }
  55443. /**
  55444. * @function SuperMap.LevelRenderer.Render.prototype.toDataURL
  55445. * @description 图像导出。
  55446. *
  55447. * @param {string} type - 类型。
  55448. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  55449. * @param {string} args - 参数。
  55450. * @return {string} 图片的 Base64 url。
  55451. */
  55452. toDataURL(type, backgroundColor, args) {
  55453. return this.painter.toDataURL(type, backgroundColor, args);
  55454. }
  55455. /**
  55456. * @function SuperMap.LevelRenderer.Render.prototype.shapeToImage
  55457. * @description 将常规 shape 转成 image shape。
  55458. *
  55459. * @param {SuperMap.LevelRenderer.Shape} e - 图形。
  55460. * @param {number} width - 宽度。
  55461. * @param {number} height - 高度。
  55462. * @return {Object} image shape。
  55463. */
  55464. shapeToImage(e, width, height) {
  55465. var id = Util_Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  55466. return this.painter.shapeToImage(id, e, width, height);
  55467. }
  55468. /**
  55469. * @function SuperMap.LevelRenderer.Render.prototype.on
  55470. * @description 事件绑定。
  55471. *
  55472. * @param {string} eventName - 事件名称。
  55473. * @param {Function} eventHandler - 响应函数。
  55474. * @return {SuperMap.LevelRenderer.Render} this。
  55475. */
  55476. on(eventName, eventHandler) {
  55477. this.handler.on(eventName, eventHandler);
  55478. return this;
  55479. }
  55480. /**
  55481. * @function SuperMap.LevelRenderer.Render.prototype.un
  55482. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  55483. *
  55484. * @param {string} eventName - 事件名称。
  55485. * @param {Function} eventHandler - 响应函数。
  55486. * @return {SuperMap.LevelRenderer.Render} this。
  55487. */
  55488. un(eventName, eventHandler) {
  55489. this.handler.un(eventName, eventHandler);
  55490. return this;
  55491. }
  55492. /**
  55493. * @function SuperMap.LevelRenderer.Render.prototype.trigger
  55494. * @description 事件触发。
  55495. *
  55496. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  55497. * @param {event} event - event dom事件对象。
  55498. * @return {SuperMap.LevelRenderer.Render} this。
  55499. */
  55500. trigger(eventName, event) {
  55501. this.handler.trigger(eventName, event);
  55502. this.handler.dispatch(eventName, event);
  55503. return this;
  55504. }
  55505. /**
  55506. * @function SuperMap.LevelRenderer.Render.prototype.clear
  55507. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  55508. * @return {SuperMap.LevelRenderer.Render} this。
  55509. */
  55510. clear() {
  55511. this.storage.delRoot();
  55512. this.painter.clear();
  55513. return this;
  55514. }
  55515. /**
  55516. * @function SuperMap.LevelRenderer.Render.prototype.dispose
  55517. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  55518. */
  55519. dispose() {
  55520. this.animation.stop();
  55521. this.clear();
  55522. this.storage.dispose();
  55523. this.painter.dispose();
  55524. this.handler.dispose();
  55525. this.animation = null;
  55526. this.animatingElements = null;
  55527. this.storage = null;
  55528. this.painter = null;
  55529. this.handler = null;
  55530. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  55531. // zrender.delInstance(this.id);
  55532. }
  55533. // SMIC-方法扩展 - start
  55534. /**
  55535. * @function SuperMap.LevelRenderer.Render.prototype.updateHoverShapes
  55536. * @description 更新设置显示高亮图层。
  55537. *
  55538. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapes - 图形数组。
  55539. * @return {SuperMap.LevelRenderer.Render} this。
  55540. */
  55541. updateHoverShapes(shapes) {
  55542. this.painter.updateHoverLayer(shapes);
  55543. return this;
  55544. }
  55545. /**
  55546. * @function SuperMap.LevelRenderer.Render.prototype.getAllShapes
  55547. * @description 获取所有图形。
  55548. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  55549. */
  55550. getAllShapes() {
  55551. return this.storage._shapeList;
  55552. }
  55553. /**
  55554. * @function SuperMap.LevelRenderer.Render.prototype.clearAll
  55555. * @description 清除高亮和图形图层。
  55556. * @return {SuperMap.LevelRenderer.Render} this。
  55557. */
  55558. clearAll() {
  55559. this.clear();
  55560. this.painter.clearHover();
  55561. return this;
  55562. }
  55563. /**
  55564. * @function SuperMap.LevelRenderer.Render.prototype.getHoverOne
  55565. * @description 获取单个高亮图形,当前鼠标对应。
  55566. * @return {SuperMap.LevelRenderer.Shape} 高亮图形。
  55567. */
  55568. getHoverOne() {
  55569. return this.handler.getLastHoverOne();
  55570. }
  55571. static getFrameCallback(renderInstance) {
  55572. return function () {
  55573. var animatingElements = renderInstance.animatingElements;
  55574. //animatingElements instanceof Array 临时解决 destory 报错
  55575. if (animatingElements instanceof Array) {
  55576. for (var i = 0, l = animatingElements.length; i < l; i++) {
  55577. renderInstance.storage.mod(animatingElements[i].id);
  55578. }
  55579. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  55580. renderInstance.refresh();
  55581. }
  55582. }
  55583. };
  55584. }
  55585. // SMIC-方法扩展 - end
  55586. }
  55587. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  55588. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  55589. * This program are made available under the terms of the Apache License, Version 2.0
  55590. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55591. /**
  55592. * @class SuperMap.LevelRenderer
  55593. * @category Visualization Theme
  55594. * @classdesc LevelRenderer 渲染器
  55595. * @private
  55596. */
  55597. class LevelRenderer_LevelRenderer {
  55598. /**
  55599. * @function SuperMap.LevelRenderer.constructor
  55600. * @description 构造函数。
  55601. * @example
  55602. * //在渲染器上加上图形
  55603. * var levelRenderer = new SuperMap.LevelRenderer();
  55604. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  55605. * zr.clear();
  55606. * zr.addShape(new SuperMap.LevelRenderer.Shape.Circle({
  55607. * style:{
  55608. * x : 100,
  55609. * y : 100,
  55610. * r : 50,
  55611. * brushType: 'fill'
  55612. * }
  55613. * }));
  55614. * zr.render();
  55615. */
  55616. constructor() {
  55617. /**
  55618. * @member {Object} SuperMap.LevelRenderer.prototype._instances
  55619. * @description LevelRenderer 实例 map 索引
  55620. */
  55621. LevelRenderer_LevelRenderer._instances = {};
  55622. // 工具
  55623. LevelRenderer_LevelRenderer.Tool = {};
  55624. /**
  55625. * @member {string} SuperMap.LevelRenderer.prototype.version
  55626. * @description 版本。zRender(Baidu)的版本号
  55627. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  55628. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  55629. */
  55630. this.version = '2.0.4';
  55631. this.CLASS_NAME = "SuperMap.LevelRenderer";
  55632. }
  55633. /**
  55634. * @function SuperMap.LevelRenderer.prototype.destroy
  55635. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  55636. */
  55637. destroy() {
  55638. this.dispose();
  55639. this.version = null;
  55640. }
  55641. /**
  55642. * @function SuperMap.LevelRenderer.prototype.init
  55643. * @description 创建 LevelRenderer 实例。
  55644. * @param {HTMLElement} dom - 绘图容器。
  55645. * @returns {SuperMap.LevelRenderer} LevelRenderer 实例。
  55646. */
  55647. init(dom) {
  55648. var zr = new Render_Render(Util_Util.createUniqueID("LRenderer_"), dom);
  55649. LevelRenderer_LevelRenderer._instances[zr.id] = zr;
  55650. return zr;
  55651. }
  55652. /**
  55653. * @function SuperMap.LevelRenderer.prototype.dispose
  55654. * @description LevelRenderer 实例销毁。
  55655. * 可以通过 zrender.dispose(zr) 销毁指定 SuperMap.LevelRenderer.Render 实例。
  55656. * 也可以通过 zr.dispose() 直接销毁
  55657. * @param {SuperMap.LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  55658. * @returns {SuperMap.LevelRenderer} this。
  55659. */
  55660. dispose(zr) {
  55661. if (zr) {
  55662. zr.dispose();
  55663. this.delInstance(zr.id);
  55664. } else {
  55665. for (var key in LevelRenderer_LevelRenderer._instances) {
  55666. LevelRenderer_LevelRenderer._instances[key].dispose();
  55667. }
  55668. LevelRenderer_LevelRenderer._instances = {};
  55669. }
  55670. return this;
  55671. }
  55672. /**
  55673. * @function SuperMap.LevelRenderer.prototype.getInstance
  55674. * @description 获取 SuperMap.LevelRenderer.Render 实例。
  55675. * @param {string} id - ZRender对象索引。
  55676. * @returns {SuperMap.LevelRenderer.Render} SuperMap.LevelRenderer.Render 实例。
  55677. */
  55678. getInstance(id) {
  55679. return LevelRenderer_LevelRenderer._instances[id];
  55680. }
  55681. /**
  55682. * @function SuperMap.LevelRenderer.prototype.delInstance
  55683. * @description 删除 zrender 实例,SuperMap.LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  55684. * @param {string} id - ZRender对象索引。
  55685. * @param {string} id - SuperMap.LevelRenderer.Render 对象索引。
  55686. * @returns {SuperMap.LevelRenderer} this。
  55687. */
  55688. delInstance(id) {
  55689. delete LevelRenderer_LevelRenderer._instances[id];
  55690. return this;
  55691. }
  55692. }
  55693. SuperMap.LevelRenderer = LevelRenderer_LevelRenderer;
  55694. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  55695. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  55696. * This program are made available under the terms of the Apache License, Version 2.0
  55697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55698. /**
  55699. * @private
  55700. * @class SuperMap.LevelRenderer.Shape.SmicEllipse
  55701. * @category Visualization Theme
  55702. * @classdesc 椭圆。
  55703. * @extends SuperMap.LevelRenderer.Shape
  55704. * @example
  55705. * var shape = new SuperMap.LevelRenderer.Shape.SmicEllipse({
  55706. * style: {
  55707. * x: 100,
  55708. * y: 100,
  55709. * a: 40,
  55710. * b: 20,
  55711. * brushType: 'both',
  55712. * color: 'blue',
  55713. * strokeColor: 'red',
  55714. * lineWidth: 3,
  55715. * text: 'SmicEllipse'
  55716. * }
  55717. * });
  55718. * levelRenderer.addShape(shape);
  55719. *
  55720. *
  55721. */
  55722. class SmicEllipse_SmicEllipse extends Shape_Shape {
  55723. /**
  55724. * @member {Object} SuperMap.LevelRenderer.Shape.SmicEllipse.style
  55725. * @description 绘制样式。
  55726. *
  55727. * @param {number} style.x - 圆心 x 坐标,必设参数。
  55728. * @param {number} style.y - 圆心 y 坐标,必设参数。
  55729. * @param {number} style.a - 横轴半径,必设参数。
  55730. * @param {number} style.b - 纵轴半径,必设参数。
  55731. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  55732. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  55733. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  55734. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  55735. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  55736. * @param {number} style.opacity - 绘制透明度。默认值:1。
  55737. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  55738. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  55739. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  55740. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  55741. * @param {string} style.text - 图形中的附加文本。默认值:""。
  55742. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  55743. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  55744. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  55745. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  55746. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  55747. */
  55748. //打开接口 style
  55749. /**
  55750. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.constructor
  55751. * @description 构造函数。
  55752. *
  55753. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  55754. *
  55755. */
  55756. constructor(options) {
  55757. super(options);
  55758. /**
  55759. * @member {string} SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.type
  55760. * @description 图形类型。
  55761. */
  55762. this.type = 'smicellipse';
  55763. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55764. this.refOriginalPosition = [0, 0];
  55765. }
  55766. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  55767. }
  55768. /**
  55769. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.destroy
  55770. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55771. */
  55772. destroy() {
  55773. this.type = null;
  55774. super.destroy();
  55775. }
  55776. /**
  55777. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  55778. * @description 构建椭圆的 Path。
  55779. *
  55780. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  55781. * @param {Object} style - style。
  55782. *
  55783. */
  55784. buildPath(ctx, style) {
  55785. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55786. this.refOriginalPosition = [0, 0];
  55787. }
  55788. var __OP = this.refOriginalPosition;
  55789. var k = 0.5522848;
  55790. var x = style.x + __OP[0];
  55791. var y = style.y + __OP[1];
  55792. var a = style.a;
  55793. var b = style.b;
  55794. var ox = a * k; // 水平控制点偏移量
  55795. var oy = b * k; // 垂直控制点偏移量
  55796. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  55797. ctx.moveTo(x - a, y);
  55798. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  55799. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  55800. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  55801. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  55802. ctx.closePath();
  55803. }
  55804. /**
  55805. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.getRect
  55806. * @description 计算返回椭圆包围盒矩形
  55807. *
  55808. * @param {Object} style - style
  55809. * @return {Object} 边框对象。包含属性:x,y,width,height。
  55810. *
  55811. */
  55812. getRect(style) {
  55813. if (style.__rect) {
  55814. return style.__rect;
  55815. }
  55816. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55817. this.refOriginalPosition = [0, 0];
  55818. }
  55819. var __OP = this.refOriginalPosition;
  55820. var lineWidth;
  55821. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  55822. lineWidth = style.lineWidth || 1;
  55823. } else {
  55824. lineWidth = 0;
  55825. }
  55826. style.__rect = {
  55827. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  55828. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  55829. width: style.a * 2 + lineWidth,
  55830. height: style.b * 2 + lineWidth
  55831. };
  55832. return style.__rect;
  55833. }
  55834. }
  55835. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  55836. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  55837. * This program are made available under the terms of the Apache License, Version 2.0
  55838. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55839. /**
  55840. * @private
  55841. * @class SuperMap.LevelRenderer.Shape.SmicIsogon
  55842. * @category Visualization Theme
  55843. * @classdesc 正多边形。
  55844. * @extends SuperMap.LevelRenderer.Shape
  55845. */
  55846. class SmicIsogon_SmicIsogon extends Shape_Shape {
  55847. /**
  55848. * @member {Object} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.style
  55849. * @description 绘制样式。
  55850. *
  55851. * @param {number} x - 正 n 边形外接圆心 x 坐标,必设参数。
  55852. * @param {number} y - 正 n 边形外接圆心 y 坐标,必设参数。
  55853. * @param {number} r - 正n边形外接圆半径,必设参数。
  55854. * @param {number} n - 指明正几边形,必设参数(n>=3)。
  55855. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  55856. * @param {string} color - 填充颜色。默认值:"#000000'"。
  55857. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  55858. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  55859. * @param {number} lineWidth - 描边宽度。默认值:1。
  55860. * @param {number} opacity - 绘制透明度。默认值:1。
  55861. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  55862. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  55863. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  55864. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  55865. * @param {string} text - 图形中的附加文本。默认值:""。
  55866. * @param {string} textColor -文本颜色。默认值:"#000000'"。
  55867. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  55868. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  55869. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  55870. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  55871. */
  55872. //打开接口 style
  55873. /**
  55874. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.constructor
  55875. * @description 构造函数。
  55876. *
  55877. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  55878. *
  55879. */
  55880. constructor(options) {
  55881. super(options);
  55882. /**
  55883. * @member {string} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.type
  55884. * @description 图形类型。
  55885. */
  55886. this.type = 'smicisogon';
  55887. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55888. this.refOriginalPosition = [0, 0];
  55889. }
  55890. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  55891. }
  55892. /**
  55893. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.destroy
  55894. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55895. */
  55896. destroy() {
  55897. this.type = null;
  55898. super.destroy();
  55899. }
  55900. /**
  55901. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  55902. * @description 创建n角星(n>=3)路径。
  55903. *
  55904. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  55905. * @param {Object} style - style。
  55906. *
  55907. */
  55908. buildPath(ctx, style) {
  55909. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55910. this.refOriginalPosition = [0, 0];
  55911. }
  55912. var __OP = this.refOriginalPosition;
  55913. var sin = SUtil.Util_math.sin;
  55914. var cos = SUtil.Util_math.cos;
  55915. var PI = Math.PI;
  55916. var n = style.n;
  55917. if (!n || n < 2) {
  55918. return;
  55919. }
  55920. var x = style.x + __OP[0];
  55921. var y = style.y + __OP[1];
  55922. var r = style.r;
  55923. var dStep = 2 * PI / n;
  55924. var deg = -PI / 2;
  55925. var xStart = x + r * cos(deg);
  55926. var yStart = y + r * sin(deg);
  55927. deg += dStep;
  55928. // 记录边界点,用于判断insight
  55929. var pointList = style.pointList = [];
  55930. pointList.push([xStart, yStart]);
  55931. for (let i = 0, end = n - 1; i < end; i++) {
  55932. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  55933. deg += dStep;
  55934. }
  55935. pointList.push([xStart, yStart]);
  55936. // 绘制
  55937. ctx.moveTo(pointList[0][0], pointList[0][1]);
  55938. for (let i = 0; i < pointList.length; i++) {
  55939. ctx.lineTo(pointList[i][0], pointList[i][1]);
  55940. }
  55941. ctx.closePath();
  55942. return;
  55943. }
  55944. /**
  55945. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.getRect
  55946. * @description 计算返回正多边形的包围盒矩形。
  55947. *
  55948. * @param {Object} style - style
  55949. * @return {Object} 边框对象。包含属性:x,y,width,height。
  55950. */
  55951. getRect(style) {
  55952. if (style.__rect) {
  55953. return style.__rect;
  55954. }
  55955. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55956. this.refOriginalPosition = [0, 0];
  55957. }
  55958. var __OP = this.refOriginalPosition;
  55959. var lineWidth;
  55960. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  55961. lineWidth = style.lineWidth || 1;
  55962. } else {
  55963. lineWidth = 0;
  55964. }
  55965. style.__rect = {
  55966. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  55967. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  55968. width: style.r * 2 + lineWidth,
  55969. height: style.r * 2 + lineWidth
  55970. };
  55971. return style.__rect;
  55972. }
  55973. }
  55974. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  55975. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  55976. * This program are made available under the terms of the Apache License, Version 2.0
  55977. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55978. /**
  55979. * @private
  55980. * @class SuperMap.LevelRenderer.Shape.SmicRing
  55981. * @category Visualization Theme
  55982. * @classdesc 圆环。
  55983. * @extends SuperMap.LevelRenderer.Shape
  55984. * @example
  55985. * var shape = new SuperMap.LevelRenderer.Shape.SmicRing({
  55986. * style: {
  55987. * x: 100,
  55988. * y: 100,
  55989. * r0: 30,
  55990. * r: 50
  55991. * }
  55992. * });
  55993. * levelRenderer.addShape(shape);
  55994. *
  55995. */
  55996. class SmicRing_SmicRing extends Shape_Shape {
  55997. /**
  55998. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRing.prototype.style
  55999. * @description 绘制样式。
  56000. *
  56001. * @param {number} x - 圆心 x 坐标,必设参数。
  56002. * @param {number} y - 圆心 y 坐标,必设参数。
  56003. * @param {number} r - 外圆半径,必设参数。
  56004. * @param {number} r0 - 内圆半径,必设参数。
  56005. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  56006. * @param {string} color - 填充颜色。默认值:"#000000'"。
  56007. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  56008. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  56009. * @param {number} lineWidth -描边宽度。默认值:1。
  56010. * @param {number} opacity - 绘制透明度。默认值:1。
  56011. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  56012. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  56013. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  56014. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  56015. * @param {string} text -图形中的附加文本。默认值:""。
  56016. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  56017. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  56018. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  56019. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  56020. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  56021. */
  56022. //打开接口 style
  56023. /**
  56024. * @function SuperMap.LevelRenderer.Shape.SmicRing.constructor
  56025. * @description 构造函数。
  56026. *
  56027. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  56028. */
  56029. constructor(options) {
  56030. super(options);
  56031. /**
  56032. * @member {string} SuperMap.LevelRenderer.Shape.SmicRing.prototype.type
  56033. * @description 图形类型。
  56034. */
  56035. this.type = 'smicring';
  56036. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56037. this.refOriginalPosition = [0, 0];
  56038. }
  56039. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  56040. }
  56041. /**
  56042. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.destroy
  56043. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56044. */
  56045. destroy() {
  56046. this.type = null;
  56047. super.destroy();
  56048. }
  56049. /**
  56050. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.buildPath
  56051. * @description 创建圆环路径。
  56052. *
  56053. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  56054. * @param {Object} style - style。
  56055. *
  56056. */
  56057. buildPath(ctx, style) {
  56058. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56059. this.refOriginalPosition = [0, 0];
  56060. }
  56061. var __OP = this.refOriginalPosition;
  56062. // 非零环绕填充优化
  56063. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  56064. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  56065. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  56066. return;
  56067. }
  56068. /**
  56069. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.getRect
  56070. * @description 计算返回圆环包围盒矩阵
  56071. *
  56072. * @param {Object} style - style
  56073. * @return {Object} 边框对象。包含属性:x,y,width,height。
  56074. */
  56075. getRect(style) {
  56076. if (style.__rect) {
  56077. return style.__rect;
  56078. }
  56079. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56080. this.refOriginalPosition = [0, 0];
  56081. }
  56082. var __OP = this.refOriginalPosition;
  56083. var lineWidth;
  56084. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  56085. lineWidth = style.lineWidth || 1;
  56086. } else {
  56087. lineWidth = 0;
  56088. }
  56089. style.__rect = {
  56090. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  56091. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  56092. width: style.r * 2 + lineWidth,
  56093. height: style.r * 2 + lineWidth
  56094. };
  56095. return style.__rect;
  56096. }
  56097. }
  56098. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  56099. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56100. * This program are made available under the terms of the Apache License, Version 2.0
  56101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56102. /**
  56103. * @private
  56104. * @class SuperMap.LevelRenderer.Shape.SmicStar
  56105. * @category Visualization Theme
  56106. * @classdesc n 角星(n>3)。
  56107. * @extends SuperMap.LevelRenderer.Shape
  56108. * @example
  56109. * var shape = new SuperMap.LevelRenderer.Shape.SmicStar({
  56110. * style: {
  56111. * x: 200,
  56112. * y: 100,
  56113. * r: 150,
  56114. * n: 5,
  56115. * text: '五角星'
  56116. * }
  56117. * });
  56118. * levelRenderer.addShape(shape);
  56119. *
  56120. *
  56121. */
  56122. class SmicStar_SmicStar extends Shape_Shape {
  56123. /**
  56124. * @member {Object} SuperMap.LevelRenderer.Shape.SmicStar.prototype.style
  56125. * @description 绘制样式。
  56126. *
  56127. * @param {number} style.x - n 角星外接圆心 x 坐标,必设参数。
  56128. * @param {number} style.y - n 角星外接圆心 y 坐标,必设参数。
  56129. * @param {number} style.r - n 角星外接圆半径,必设参数。
  56130. * @param {number} style.r0 - n 角星内部顶点(凹点)的外接圆半径。如果不指定此参数,则自动计算:取相隔外部顶点连线的交点作内部顶点。
  56131. * @param {number} style.n -指明几角星,必设参数。
  56132. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  56133. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  56134. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  56135. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  56136. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  56137. * @param {number} style.opacity - 绘制透明度。默认值:1。
  56138. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  56139. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  56140. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  56141. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  56142. * @param {string} style.text - 图形中的附加文本。默认值:""。
  56143. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  56144. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  56145. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  56146. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  56147. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  56148. */
  56149. //打开接口 style
  56150. /**
  56151. * @function SuperMap.LevelRenderer.Shape.SmicStar.constructor
  56152. * @description 构造函数。
  56153. *
  56154. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  56155. *
  56156. */
  56157. constructor(options) {
  56158. super(options);
  56159. /**
  56160. * @member {string} SuperMap.LevelRenderer.Shape.SmicStar.prototype.type
  56161. * @description 图形类型。
  56162. */
  56163. this.type = 'smicstar';
  56164. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56165. this.refOriginalPosition = [0, 0];
  56166. }
  56167. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  56168. }
  56169. /**
  56170. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.destroy
  56171. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56172. */
  56173. destroy() {
  56174. this.type = null;
  56175. super.destroy();
  56176. }
  56177. /**
  56178. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.buildPath
  56179. * @description 创建n 角星(n>3)路径。
  56180. *
  56181. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  56182. * @param {Object} style - style。
  56183. *
  56184. */
  56185. buildPath(ctx, style) {
  56186. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56187. this.refOriginalPosition = [0, 0];
  56188. }
  56189. var __OP = this.refOriginalPosition;
  56190. var n = style.n;
  56191. if (!n || n < 2) {
  56192. return;
  56193. }
  56194. var sin = SUtil.Util_math.sin;
  56195. var cos = SUtil.Util_math.cos;
  56196. var PI = Math.PI;
  56197. var x = style.x + __OP[0];
  56198. var y = style.y + __OP[1];
  56199. var r = style.r;
  56200. var r0 = style.r0;
  56201. // 如果未指定内部顶点外接圆半径,则自动计算
  56202. if (r0 == null) {
  56203. r0 = n > 4
  56204. // 相隔的外部顶点的连线的交点,
  56205. // 被取为内部交点,以此计算r0
  56206. ? r * cos(2 * PI / n) / cos(PI / n)
  56207. // 二三四角星的特殊处理
  56208. : r / 3;
  56209. }
  56210. var dStep = PI / n;
  56211. var deg = -PI / 2;
  56212. var xStart = x + r * cos(deg);
  56213. var yStart = y + r * sin(deg);
  56214. deg += dStep;
  56215. // 记录边界点,用于判断inside
  56216. var pointList = style.pointList = [];
  56217. pointList.push([xStart, yStart]);
  56218. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  56219. ri = i % 2 === 0 ? r0 : r;
  56220. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  56221. deg += dStep;
  56222. }
  56223. pointList.push([xStart, yStart]);
  56224. // 绘制
  56225. ctx.moveTo(pointList[0][0], pointList[0][1]);
  56226. for (let i = 0; i < pointList.length; i++) {
  56227. ctx.lineTo(pointList[i][0], pointList[i][1]);
  56228. }
  56229. ctx.closePath();
  56230. return;
  56231. }
  56232. /**
  56233. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.getRect
  56234. * @description 返回 n 角星包围盒矩形。
  56235. *
  56236. * @param {Object} style - style
  56237. * @return {Object} 边框对象。包含属性:x,y,width,height。
  56238. */
  56239. getRect(style) {
  56240. if (style.__rect) {
  56241. return style.__rect;
  56242. }
  56243. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56244. this.refOriginalPosition = [0, 0];
  56245. }
  56246. var __OP = this.refOriginalPosition;
  56247. var lineWidth;
  56248. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  56249. lineWidth = style.lineWidth || 1;
  56250. } else {
  56251. lineWidth = 0;
  56252. }
  56253. style.__rect = {
  56254. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  56255. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  56256. width: style.r * 2 + lineWidth,
  56257. height: style.r * 2 + lineWidth
  56258. };
  56259. return style.__rect;
  56260. }
  56261. }
  56262. // CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  56263. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56264. * This program are made available under the terms of the Apache License, Version 2.0
  56265. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56266. // CONCATENATED MODULE: ./src/common/overlay/index.js
  56267. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56268. * This program are made available under the terms of the Apache License, Version 2.0
  56269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56270. // CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  56271. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56272. * This program are made available under the terms of the Apache License, Version 2.0
  56273. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56274. /**
  56275. * 该文件用于存储一些公用常量
  56276. *
  56277. */
  56278. const FileTypes = {
  56279. EXCEL: "EXCEL",
  56280. CSV: "CSV",
  56281. ISERVER: "ISERVER",
  56282. GEOJSON: "GEOJSON",
  56283. JSON: 'JSON'
  56284. };
  56285. const FileConfig = {
  56286. fileMaxSize: 10 * 1024 * 1024
  56287. };
  56288. // CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  56289. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56290. * This program are made available under the terms of the Apache License, Version 2.0
  56291. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56292. /**
  56293. * @class SuperMap.FileModel
  56294. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  56295. * @category Components OpenFile
  56296. * @private
  56297. */
  56298. class FileModel_FileModel {
  56299. constructor(options) {
  56300. this.FileTypes = FileTypes;
  56301. this.FileConfig = FileConfig;
  56302. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  56303. }
  56304. /**
  56305. * @function SuperMap.FileModel.prototype.set
  56306. * @description 设置属性值
  56307. * @param {string} key - 属性名称
  56308. * @param {string|Object} value - 属性值
  56309. */
  56310. set(key, value) {
  56311. this[key] = value;
  56312. }
  56313. /**
  56314. * @function SuperMap.FileModel.prototype.get
  56315. * @description 获取数据值
  56316. * @param {string} key - 属性名称
  56317. * @returns {string|Object} value - 返回属性值
  56318. */
  56319. get(key) {
  56320. return this[key];
  56321. }
  56322. }
  56323. // CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  56324. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56325. * This program are made available under the terms of the Apache License, Version 2.0
  56326. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56327. /**
  56328. * @class SuperMap.Components.MessageBox
  56329. * @version 9.1.1
  56330. * @classdesc 组件信息提示框。
  56331. * @category Components Common
  56332. */
  56333. class MessageBox {
  56334. constructor() {
  56335. this._initView();
  56336. }
  56337. _initView() {
  56338. //原生js形式
  56339. const messageBoxContainer = document.createElement("div");
  56340. messageBoxContainer.hidden = true;
  56341. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  56342. //图标
  56343. const iconContainer = document.createElement("div");
  56344. iconContainer.setAttribute("class", "icon");
  56345. this.icon = document.createElement("span");
  56346. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  56347. iconContainer.appendChild(this.icon);
  56348. messageBoxContainer.appendChild(iconContainer);
  56349. //内容:
  56350. const messageBox = document.createElement("div");
  56351. messageBox.setAttribute("class", "component-messagebox");
  56352. messageBox.innerHTML = "";
  56353. messageBoxContainer.appendChild(messageBox);
  56354. this.messageBox = messageBox;
  56355. //关闭按钮
  56356. const cancelContainer = document.createElement("div");
  56357. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  56358. const cancelBtn = document.createElement("button");
  56359. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  56360. cancelBtn.innerHTML = "x";
  56361. cancelBtn.onclick = this.closeView.bind(this);
  56362. cancelContainer.appendChild(cancelBtn);
  56363. messageBoxContainer.appendChild(cancelContainer);
  56364. this.messageBoxContainer = messageBoxContainer;
  56365. document.body.appendChild(this.messageBoxContainer);
  56366. }
  56367. /**
  56368. * @function SuperMap.Components.MessageBox.prototype.closeView
  56369. * @description 关闭提示框。
  56370. */
  56371. closeView() {
  56372. this.messageBoxContainer.hidden = true;
  56373. }
  56374. /**
  56375. * @function SuperMap.Components.MessageBox.prototype.showView
  56376. * @description 显示提示框。
  56377. * @param {string} message - 提示框显示内容。
  56378. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  56379. */
  56380. showView(message, type = 'warring') {
  56381. //设置提示框的样式:
  56382. if (type === "success") {
  56383. this.icon.setAttribute("class", "supermapol-icons-message-success");
  56384. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  56385. } else if (type === "failure") {
  56386. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  56387. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  56388. } else if (type === "warring") {
  56389. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  56390. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  56391. }
  56392. this.messageBox.innerHTML = message;
  56393. this.messageBoxContainer.hidden = false;
  56394. }
  56395. }
  56396. SuperMap.Components.MessageBox = MessageBox;
  56397. // EXTERNAL MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  56398. var external_function_try_return_echarts_catch_e_return_ = __webpack_require__(9);
  56399. var external_function_try_return_echarts_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_echarts_catch_e_return_);
  56400. // CONCATENATED MODULE: ./src/common/lang/Lang.js
  56401. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56402. * This program are made available under the terms of the Apache License, Version 2.0
  56403. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56404. /**
  56405. * @name Lang
  56406. * @memberOf SuperMap
  56407. * @namespace
  56408. * @category BaseTypes
  56409. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  56410. */
  56411. let Lang = {
  56412. /**
  56413. * @member {string} SuperMap.Lang.code
  56414. * @description 当前所使用的语言类型。
  56415. */
  56416. code: null,
  56417. /**
  56418. * @member {string} [SuperMap.Lang.defaultCode='en-US']
  56419. * @description 默认使用的语言类型。
  56420. */
  56421. defaultCode: "en-US",
  56422. /**
  56423. * @function SuperMap.Lang.getCode
  56424. * @description 获取当前的语言代码。
  56425. * @returns {string} 当前的语言代码。
  56426. */
  56427. getCode: function () {
  56428. if (!SuperMap.Lang.code) {
  56429. SuperMap.Lang.setCode();
  56430. }
  56431. return SuperMap.Lang.code;
  56432. },
  56433. /**
  56434. * @function SuperMap.Lang.setCode
  56435. * @description 设置语言代码。
  56436. * @param {string} code - 此参数遵循IETF规范。
  56437. */
  56438. setCode: function () {
  56439. var lang = this.getLanguageFromCookie();
  56440. if (lang) {
  56441. SuperMap.Lang.code = lang;
  56442. return;
  56443. }
  56444. lang = SuperMap.Lang.defaultCode;
  56445. if (navigator.appName === 'Netscape') {
  56446. lang = navigator.language;
  56447. } else {
  56448. lang = navigator.browserLanguage;
  56449. }
  56450. if (lang.indexOf('zh') === 0) {
  56451. lang = 'zh-CN';
  56452. }
  56453. if (lang.indexOf('en') === 0) {
  56454. lang = 'en-US';
  56455. }
  56456. SuperMap.Lang.code = lang;
  56457. },
  56458. /**
  56459. * @function SuperMap.Lang.getLanguageFromCookie
  56460. * @description 从 cookie 中获取语言类型。
  56461. */
  56462. getLanguageFromCookie() {
  56463. var name = 'language=';
  56464. var ca = document.cookie.split(';');
  56465. for (var i = 0; i < ca.length; i++) {
  56466. var c = ca[i];
  56467. while (c.charAt(0) === ' ') {
  56468. c = c.substring(1)
  56469. }
  56470. if (c.indexOf(name) !== -1) {
  56471. return c.substring(name.length, c.length)
  56472. }
  56473. }
  56474. return "";
  56475. },
  56476. /**
  56477. * @function SuperMap.Lang.i18n
  56478. * @description 从当前语言字符串的字典查找 key。
  56479. * @param {string} key - 字典中 i18n 字符串值的关键字。
  56480. * @returns {string} 国际化的字符串。
  56481. */
  56482. i18n: function (key) {
  56483. var dictionary = SuperMap.Lang[SuperMap.Lang.getCode()];
  56484. var message = dictionary && dictionary[key];
  56485. if (!message) {
  56486. // Message not found, fall back to message key
  56487. message = key;
  56488. }
  56489. return message;
  56490. }
  56491. };
  56492. SuperMap.Lang = Lang;
  56493. SuperMap.i18n = SuperMap.Lang.i18n;
  56494. // EXTERNAL MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  56495. var external_function_try_return_XLSX_catch_e_return_ = __webpack_require__(5);
  56496. var external_function_try_return_XLSX_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_XLSX_catch_e_return_);
  56497. // CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  56498. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56499. * This program are made available under the terms of the Apache License, Version 2.0
  56500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56501. /**
  56502. * @class SuperMap.Components.FileReaderUtil
  56503. * @classdesc 组件读取文件工具类。
  56504. * @version 9.1.1
  56505. * @type {{rABS: (boolean|*), rABF: (boolean|*), rAT: (boolean|*), readFile: (function(*, *=, *=, *=, *=)), readTextFile: (function(*, *=, *=, *=)), readXLSXFile: (function(*, *=, *=, *=)), processDataToGeoJson: (function(string, Object): GeoJSONObject), processExcelDataToGeoJson: (function(Object): GeoJSONObject), isXField: (function(*)), isYField: (function(*)), string2Csv: (function(*, *=))}}
  56506. */
  56507. let FileReaderUtil = {
  56508. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  56509. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  56510. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  56511. /**
  56512. * @function SuperMap.Components.FileReaderUtil.prototype.readFile
  56513. * @description 读取文件
  56514. * @param {string} fileType - 当前读取的文件类型
  56515. *
  56516. * @param {Object} file - 读取回来的文件内容对象
  56517. * @param {function} success - 读取文件成功回调函数
  56518. * @param {function} failed - 读取文件失败回调函数
  56519. * @param {Object} context - 回调重定向对象
  56520. */
  56521. readFile(fileType, file, success, failed, context) {
  56522. if (FileTypes.JSON === fileType || FileTypes.GEOJSON === fileType) {
  56523. this.readTextFile(file, success, failed, context)
  56524. } else if (FileTypes.EXCEL === fileType || FileTypes.CSV === fileType) {
  56525. this.readXLSXFile(file, success, failed, context)
  56526. }
  56527. },
  56528. /**
  56529. * 读取文本文件
  56530. * @param file
  56531. * @param success
  56532. * @param failed
  56533. * @param {Object} context - 回调重定向对象
  56534. */
  56535. readTextFile(file, success, failed, context) {
  56536. let reader = new FileReader();
  56537. reader.onloadend = function (evt) {
  56538. success && success.call(context, evt.target.result);
  56539. };
  56540. reader.onerror = function (error) {
  56541. failed && failed.call(context, error)
  56542. };
  56543. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  56544. },
  56545. /**
  56546. * 读取excel或csv文件
  56547. * @param file
  56548. * @param success
  56549. * @param failed
  56550. * @param {Object} context - 回调重定向对象
  56551. */
  56552. readXLSXFile(file, success, failed, context) {
  56553. let reader = new FileReader();
  56554. reader.onloadend = function (evt) {
  56555. let xLSXData = new Uint8Array(evt.target.result);
  56556. let workbook = external_function_try_return_XLSX_catch_e_return_default.a.read(xLSXData, {type: "array"});
  56557. try {
  56558. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  56559. //暂时只读取第一个sheets的内容
  56560. let sheetName = workbook.SheetNames[0];
  56561. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_default.a.utils.sheet_to_csv(workbook.Sheets[sheetName]);
  56562. success && success.call(context, xLSXCSVString);
  56563. }
  56564. } catch (error) {
  56565. failed && failed.call(context, error);
  56566. }
  56567. };
  56568. reader.onerror = function (error) {
  56569. failed && failed.call(context, error)
  56570. };
  56571. this.rABF && reader.readAsArrayBuffer(file.file);
  56572. },
  56573. /**
  56574. * @function SuperMap.Components.FileReaderUtil.prototype.processDataToGeoJson
  56575. * @description 将读取回来得数据统一处理为 GeoJSON 格式
  56576. * @param {string} type - 文件类型
  56577. * @param {Object} data - 读取返回的数据对象
  56578. * @param {function} success - 数据处理成功的回调
  56579. * @param {function} failed - 数据处理失败的回调
  56580. * @param {Object} context - 回调重定向对象
  56581. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  56582. * @private
  56583. */
  56584. processDataToGeoJson(type, data, success, failed, context) {
  56585. let geojson = null;
  56586. if (type === "EXCEL" || type === "CSV") {
  56587. geojson = this.processExcelDataToGeoJson(data);
  56588. success && success.call(context, geojson);
  56589. } else if (type === 'JSON' || type === 'GEOJSON') {
  56590. let result = data;
  56591. //geojson、json未知,通过类容来判断
  56592. if ((typeof result) === "string") {
  56593. result = JSON.parse(result);
  56594. }
  56595. if (result.type === 'ISERVER') {
  56596. geojson = result.data.recordsets[0].features;
  56597. } else if (result.type === 'FeatureCollection') {
  56598. //geojson
  56599. geojson = result;
  56600. } else {
  56601. //不支持数据
  56602. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  56603. }
  56604. success && success.call(context, geojson);
  56605. } else {
  56606. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  56607. }
  56608. },
  56609. /**
  56610. * @function SuperMap.Components.FileReaderUtil.prototype.processExcelDataToGeoJson
  56611. * @description 表格文件数据处理
  56612. * @param {Object} data - 读取的表格文件数据
  56613. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  56614. * @private
  56615. */
  56616. processExcelDataToGeoJson(data) {
  56617. //处理为对象格式转化
  56618. let dataContent = this.string2Csv(data);
  56619. let fieldCaptions = dataContent.colTitles;
  56620. //位置属性处理
  56621. let xfieldIndex = -1,
  56622. yfieldIndex = -1;
  56623. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  56624. if (this.isXField(fieldCaptions[i])) {
  56625. xfieldIndex = i;
  56626. }
  56627. if (this.isYField(fieldCaptions[i])) {
  56628. yfieldIndex = i;
  56629. }
  56630. }
  56631. // feature 构建后期支持坐标系 4326/3857
  56632. let features = [];
  56633. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  56634. let row = dataContent.rows[i];
  56635. //if (featureFrom === "LonLat") {
  56636. let x = Number(row[xfieldIndex]),
  56637. y = Number(row[yfieldIndex]);
  56638. //属性信息
  56639. let attributes = {};
  56640. for (let index in dataContent.colTitles) {
  56641. let key = dataContent.colTitles[index];
  56642. attributes[key] = dataContent.rows[i][index];
  56643. }
  56644. //目前csv 只支持处理点,所以先生成点类型的 geojson
  56645. let feature = {
  56646. "type": "Feature",
  56647. "geometry": {
  56648. "type": "Point",
  56649. "coordinates": [x, y]
  56650. },
  56651. "properties": attributes
  56652. };
  56653. features.push(feature);
  56654. }
  56655. return features;
  56656. },
  56657. /**
  56658. * 判断是否地理X坐标
  56659. * @param data
  56660. */
  56661. isXField(data) {
  56662. var lowerdata = data.toLowerCase();
  56663. return (lowerdata === "x" || lowerdata === "smx" ||
  56664. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  56665. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  56666. },
  56667. /**
  56668. * 判断是否地理Y坐标
  56669. * @param data
  56670. */
  56671. isYField(data) {
  56672. var lowerdata = data.toLowerCase();
  56673. return (lowerdata === "y" || lowerdata === "smy" ||
  56674. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  56675. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  56676. },
  56677. /**
  56678. * 字符串转为dataEditor 支持的csv格式数据
  56679. * @param string
  56680. * @param withoutTitle
  56681. */
  56682. string2Csv(string, withoutTitle) {
  56683. // let rows = string.split('\r\n');
  56684. let rows = string.split('\n');
  56685. let result = {};
  56686. if (!withoutTitle) {
  56687. result["colTitles"] = rows[0].split(',');
  56688. } else {
  56689. result["colTitles"] = [];
  56690. }
  56691. result['rows'] = [];
  56692. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  56693. rows[i] && result['rows'].push(rows[i].split(','));
  56694. }
  56695. return result;
  56696. }
  56697. };
  56698. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  56699. // CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  56700. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  56701. * This program are made available under the terms of the Apache License, Version 2.0
  56702. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56703. /**
  56704. * @class SuperMap.Components.ChartModel
  56705. * @classdesc 图表组件数据模型
  56706. * @private
  56707. * @param {Object} datasets - 数据来源。
  56708. * @category Components Chart
  56709. * @fires SuperMap.Components.ChartModel#getdatafailed
  56710. */
  56711. class ChartModel_ChartModel {
  56712. constructor(datasets) {
  56713. this.datasets = datasets;
  56714. this.EVENT_TYPES = ['getdatafailed'];
  56715. this.events = new Events_Events(this, null, this.EVENT_TYPES);
  56716. }
  56717. /**
  56718. * @private
  56719. * @function SuperMap.Components.ChartModel.prototype.getDatasetInfo
  56720. * @description 获得数据集数据。
  56721. * @param {string} datasetUrl - 数据集资源地址。
  56722. */
  56723. getDatasetInfo(success) {
  56724. let datasetUrl = this.datasets.url;
  56725. let me = this;
  56726. FetchRequest.get(datasetUrl)
  56727. .then(function (response) {
  56728. return response.json();
  56729. })
  56730. .then(function (results) {
  56731. if (results.datasetInfo) {
  56732. let datasetInfo = results.datasetInfo;
  56733. me.datasetsInfo = {
  56734. dataSourceName: datasetInfo.dataSourceName,
  56735. datasetName: datasetInfo.name,
  56736. mapName: results.name
  56737. };
  56738. success({
  56739. result: me.datasetsInfo
  56740. });
  56741. }
  56742. })
  56743. .catch(function (error) {
  56744. console.log(error);
  56745. me._fireFailedEvent(error);
  56746. });
  56747. }
  56748. /**
  56749. * @private
  56750. * @function SuperMap.Components.ChartModel.prototype.getDataFeatures
  56751. * @description 请求数据集的数据信息
  56752. * @param {Object} results - 数据集信息。
  56753. * @param {function} success - 成功回调函数。
  56754. */
  56755. getDataFeatures(results, success) {
  56756. let datasetsInfo = results.result;
  56757. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  56758. let params = {
  56759. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  56760. };
  56761. Object.assign(params, this.datasets.queryInfo);
  56762. getFeatureParam = new SuperMap.FilterParameter(params);
  56763. getFeatureBySQLParams = new SuperMap.GetFeaturesBySQLParameters({
  56764. queryParameter: getFeatureParam,
  56765. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  56766. fromIndex: 0,
  56767. toIndex: 100000
  56768. });
  56769. getFeatureBySQLService = new SuperMap.GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  56770. eventListeners: {
  56771. processCompleted: success,
  56772. processFailed: function () {}
  56773. }
  56774. });
  56775. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  56776. }
  56777. /**
  56778. * @private
  56779. * @function SuperMap.Components.ChartModel.prototype.getLayerFeatures
  56780. * @description 请求图层要素的数据信息
  56781. * @param {Object} results - 数据集信息。
  56782. * @param {Callbacks} success - 成功回调函数。
  56783. */
  56784. getLayerFeatures(results, success) {
  56785. let datasetsInfo = results.result;
  56786. let queryParam, queryBySQLParams, queryBySQLService;
  56787. let params = {
  56788. name: datasetsInfo.mapName
  56789. };
  56790. Object.assign(params, this.datasets.queryInfo);
  56791. queryParam = new SuperMap.FilterParameter(params);
  56792. queryBySQLParams = new SuperMap.QueryBySQLParameters({
  56793. queryParams: [queryParam],
  56794. expectCount: 100000
  56795. });
  56796. queryBySQLService = new SuperMap.QueryBySQLService(datasetsInfo.dataUrl, {
  56797. eventListeners: {
  56798. processCompleted: success,
  56799. processFailed: function () {}
  56800. }
  56801. });
  56802. queryBySQLService.processAsync(queryBySQLParams);
  56803. }
  56804. /**
  56805. * @private
  56806. * @function SuperMap.Components.ChartModel.prototype.getDataInfoByIptl
  56807. * @description 用dataId获取iportal的数据。
  56808. * @param {Callbacks} success - getdatachart。
  56809. *
  56810. */
  56811. getDataInfoByIptl(success) {
  56812. // success是chart的回调
  56813. this.getServiceInfo(this.datasets.url, success);
  56814. }
  56815. /**
  56816. * @private
  56817. * @function SuperMap.Components.ChartModel.prototype.getServiceInfo
  56818. * @description 用iportal获取dataItemServices。
  56819. * @param {String} url
  56820. * @param {Callbacks} success - getdatachart。
  56821. * */
  56822. getServiceInfo(url, success) {
  56823. let me = this;
  56824. FetchRequest.get(url, null, {
  56825. withCredentials: this.datasets.withCredentials
  56826. })
  56827. .then((response) => {
  56828. return response.json();
  56829. })
  56830. .then((data) => {
  56831. if (data.succeed === false) {
  56832. //请求失败
  56833. me._fireFailedEvent(data);
  56834. return;
  56835. }
  56836. // 是否有rest服务
  56837. if (data.dataItemServices && data.dataItemServices.length > 0) {
  56838. let dataItemServices = data.dataItemServices,
  56839. resultData;
  56840. dataItemServices.forEach((item) => {
  56841. // 如果有restdata并且发布成功,就请求restdata服务
  56842. // 如果有restmap并且发布成功,就请求restmap服务
  56843. // 其他情况就请求iportal/content.json
  56844. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  56845. resultData = item;
  56846. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  56847. resultData = item;
  56848. } else {
  56849. me.getDatafromContent(url, success);
  56850. return;
  56851. }
  56852. });
  56853. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  56854. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  56855. } else {
  56856. me.getDatafromContent(url, success);
  56857. return;
  56858. }
  56859. })
  56860. .catch((error) => {
  56861. console.log(error);
  56862. me._fireFailedEvent(error);
  56863. });
  56864. }
  56865. /**
  56866. * @private
  56867. * @function SuperMap.Components.ChartModel.prototype.getDatafromURL
  56868. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  56869. * @param {String} url
  56870. * @param {Callbacks} success - getdatachart。
  56871. */
  56872. getDatafromContent(url, success) {
  56873. // 成功回调传入的results
  56874. let results = {
  56875. result: {}
  56876. },
  56877. me = this;
  56878. url += '/content.json?pageSize=9999999&currentPage=1';
  56879. // 获取图层数据
  56880. FetchRequest.get(url, null, {
  56881. withCredentials: this.datasets.withCredentials
  56882. })
  56883. .then((response) => {
  56884. return response.json();
  56885. })
  56886. .then((data) => {
  56887. if (data.succeed === false) {
  56888. //请求失败
  56889. me._fireFailedEvent(data);
  56890. return;
  56891. }
  56892. if (data.type) {
  56893. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  56894. // 将字符串转换成json
  56895. data.content = JSON.parse(data.content.trim());
  56896. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  56897. if (!data.content.features) {
  56898. //json格式解析失败
  56899. console.log(Lang.i18n('msg_jsonResolveFiled'));
  56900. return;
  56901. }
  56902. let features = this._formatGeoJSON(data.content);
  56903. results.result.features = {
  56904. type: data.content.type,
  56905. features
  56906. };
  56907. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  56908. let features = this._excelData2Feature(data.content);
  56909. results.result.features = {
  56910. type: 'FeatureCollection',
  56911. features
  56912. };
  56913. }
  56914. success(results, 'content');
  56915. }
  56916. }, this)
  56917. .catch((error) => {
  56918. console.log(error);
  56919. me._fireFailedEvent(error);
  56920. });
  56921. }
  56922. /**
  56923. * @private
  56924. * @function SuperMap.Components.ChartModel.prototype._getDataSource
  56925. * @description 获取数据源名和数据集名。
  56926. * @param {string} serviceType 服务类型
  56927. * @param {string} address 地址
  56928. * @param {Callbacks} success - getdatachart。
  56929. * @return{array} [数据源名:数据集名]
  56930. * @return{string} 图层名
  56931. */
  56932. getDatafromRest(serviceType, address, success) {
  56933. let me = this,
  56934. withCredentials = this.datasets.withCredentials;
  56935. if (serviceType === 'RESTDATA') {
  56936. let url = `${address}/data/datasources`,
  56937. sourceName,
  56938. datasetName;
  56939. // 请求获取数据源名
  56940. FetchRequest.get(url, null, {
  56941. withCredentials
  56942. })
  56943. .then((response) => {
  56944. return response.json();
  56945. })
  56946. .then((data) => {
  56947. sourceName = data.datasourceNames[0];
  56948. url = `${address}/data/datasources/${sourceName}/datasets`;
  56949. // 请求获取数据集名
  56950. FetchRequest.get(url, null, {
  56951. withCredentials
  56952. })
  56953. .then((response) => {
  56954. return response.json();
  56955. })
  56956. .then((data) => {
  56957. datasetName = data.datasetNames[0];
  56958. // 请求restdata服务
  56959. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  56960. return [sourceName + ':' + datasetName];
  56961. })
  56962. .catch(function (error) {
  56963. me._fireFailedEvent(error);
  56964. });
  56965. })
  56966. .catch(function (error) {
  56967. me._fireFailedEvent(error);
  56968. });
  56969. } else {
  56970. // 如果是地图服务
  56971. let url = `${address}/maps`,
  56972. mapName,
  56973. layerName,
  56974. path;
  56975. // 请求获取地图名
  56976. FetchRequest.get(url, null, {
  56977. withCredentials
  56978. })
  56979. .then((response) => {
  56980. return response.json();
  56981. })
  56982. .then((data) => {
  56983. mapName = data[0].name;
  56984. path = data[0].path;
  56985. url = url = `${address}/maps/${mapName}/layers`;
  56986. // 请求获取图层名
  56987. FetchRequest.get(url, null, {
  56988. withCredentials
  56989. })
  56990. .then((response) => {
  56991. return response.json();
  56992. })
  56993. .then((data) => {
  56994. layerName = data[0].subLayers.layers[0].caption;
  56995. // 请求restmap服务
  56996. me.getDatafromRestMap(layerName, path, success);
  56997. return layerName;
  56998. })
  56999. .catch(function (error) {
  57000. me._fireFailedEvent(error);
  57001. });
  57002. })
  57003. .catch(function (error) {
  57004. me._fireFailedEvent(error);
  57005. });
  57006. }
  57007. }
  57008. /**
  57009. * @private
  57010. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestData
  57011. * @description 请求restdata服务
  57012. * @param {String} url
  57013. * @param {Array<string>} dataSource [数据源名:数据集名]
  57014. * @param {Callbacks} success - getdatachart。
  57015. */
  57016. getDatafromRestData(url, dataSource, success) {
  57017. let me = this;
  57018. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  57019. this._getFeatureBySQL(
  57020. url,
  57021. dataSource,
  57022. this.datasets.queryInfo,
  57023. (results) => {
  57024. // 此时的features已经处理成geojson了
  57025. success(results, 'RESTDATA');
  57026. },
  57027. (error) => {
  57028. console.log(error);
  57029. me._fireFailedEvent(error);
  57030. }
  57031. );
  57032. }
  57033. /**
  57034. * @private
  57035. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestMap
  57036. * @description 请求restmap服务
  57037. * @param {String} dataSource layerName
  57038. * @param {String} path - map服务地址。
  57039. * @param {Callbacks} success - getdatachart。
  57040. */
  57041. getDatafromRestMap(dataSource, path, success) {
  57042. let me = this;
  57043. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  57044. this._queryFeatureBySQL(
  57045. path,
  57046. dataSource,
  57047. this.datasets.queryInfo,
  57048. null,
  57049. null,
  57050. (results) => {
  57051. // let features = result.result.recordsets[0].features;
  57052. success(results, 'RESTMAP');
  57053. },
  57054. (error) => {
  57055. console.log(error);
  57056. me._fireFailedEvent(error);
  57057. }
  57058. );
  57059. }
  57060. /**
  57061. * @private
  57062. * @function SuperMap.Components.ChartModel.prototype._getFeatureBySQL
  57063. * @description 通过 sql 方式查询数据。
  57064. */
  57065. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  57066. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  57067. let params = {
  57068. name: datasetNames.join().replace(':', '@')
  57069. };
  57070. Object.assign(params, queryInfo);
  57071. getFeatureParam = new FilterParameter_FilterParameter(params);
  57072. getFeatureBySQLParams = new GetFeaturesBySQLParameters_GetFeaturesBySQLParameters({
  57073. queryParameter: getFeatureParam,
  57074. datasetNames: datasetNames,
  57075. fromIndex: 0,
  57076. toIndex: 100000,
  57077. returnContent: true
  57078. });
  57079. let options = {
  57080. eventListeners: {
  57081. processCompleted: (getFeaturesEventArgs) => {
  57082. processCompleted && processCompleted(getFeaturesEventArgs);
  57083. },
  57084. processFailed: (e) => {
  57085. processFaild && processFaild(e);
  57086. }
  57087. }
  57088. };
  57089. getFeatureBySQLService = new GetFeaturesBySQLService_GetFeaturesBySQLService(url, options);
  57090. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  57091. }
  57092. /**
  57093. * @private
  57094. * @function SuperMap.Components.ChartModel.prototype._queryFeatureBySQL
  57095. * @description 通过 sql 方式查询数据。
  57096. */
  57097. _queryFeatureBySQL(
  57098. url,
  57099. layerName,
  57100. queryInfo,
  57101. fields,
  57102. epsgCode,
  57103. processCompleted,
  57104. processFaild,
  57105. startRecord,
  57106. recordLength,
  57107. onlyAttribute
  57108. ) {
  57109. var queryParam, queryBySQLParams;
  57110. var filterParams = {
  57111. name: layerName
  57112. };
  57113. Object.assign(filterParams, queryInfo);
  57114. queryParam = new FilterParameter_FilterParameter(filterParams);
  57115. if (fields) {
  57116. queryParam.fields = fields;
  57117. }
  57118. var params = {
  57119. queryParams: [queryParam]
  57120. };
  57121. if (onlyAttribute) {
  57122. params.queryOption = QueryOption.ATTRIBUTE;
  57123. }
  57124. startRecord && (params.startRecord = startRecord);
  57125. recordLength && (params.expectCount = recordLength);
  57126. if (epsgCode) {
  57127. params.prjCoordSys = {
  57128. epsgCode: epsgCode
  57129. };
  57130. }
  57131. queryBySQLParams = new QueryBySQLParameters_QueryBySQLParameters(params);
  57132. this._queryBySQL(url, queryBySQLParams, (data) => {
  57133. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  57134. });
  57135. }
  57136. /**
  57137. * @function SuperMap.Components.ChartModel.prototype._queryBySQL
  57138. * @description SQL 查询服务。
  57139. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  57140. * @param {RequestCallback} callback - 回调函数。
  57141. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  57142. */
  57143. _queryBySQL(url, params, callback, resultFormat) {
  57144. var me = this;
  57145. var queryBySQLService = new QueryBySQLService_QueryBySQLService(url, {
  57146. eventListeners: {
  57147. scope: me,
  57148. processCompleted: callback,
  57149. processFailed: callback
  57150. },
  57151. format: me._processFormat(resultFormat)
  57152. });
  57153. queryBySQLService.processAsync(params);
  57154. }
  57155. /**
  57156. * @function SuperMap.Components.ChartModel.prototype._processFormat
  57157. * @description 将数据转换成geojson。
  57158. * @param {object} resultFormat - 返回结果集。
  57159. * @return {object} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  57160. */
  57161. _processFormat(resultFormat) {
  57162. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  57163. }
  57164. /**
  57165. * @private
  57166. * @function SuperMap.Components.ChartModel.prototype._formatGeoJSON
  57167. * @description 格式 GeoJSON。
  57168. * @param {GeoJSON} data - GeoJSON 数据。
  57169. */
  57170. _formatGeoJSON(data) {
  57171. let features = data.features;
  57172. features.forEach((row, index) => {
  57173. row.properties['index'] = index;
  57174. });
  57175. return features;
  57176. }
  57177. /**
  57178. * @private
  57179. * @description 将 csv 和 xls 文件内容转换成 geojson
  57180. * @function SuperMap.Components.ChartModel.prototype._excelData2Feature
  57181. * @param content 文件内容
  57182. * @param layerInfo 图层信息
  57183. * @returns {Array} feature的数组集合
  57184. */
  57185. _excelData2Feature(dataContent) {
  57186. let fieldCaptions = dataContent.colTitles;
  57187. //位置属性处理
  57188. let xfieldIndex = -1,
  57189. yfieldIndex = -1;
  57190. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  57191. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  57192. xfieldIndex = i;
  57193. }
  57194. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  57195. yfieldIndex = i;
  57196. }
  57197. }
  57198. // feature 构建后期支持坐标系 4326/3857
  57199. let features = [];
  57200. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  57201. let row = dataContent.rows[i];
  57202. let x = Number(row[xfieldIndex]),
  57203. y = Number(row[yfieldIndex]);
  57204. //属性信息
  57205. let attributes = {};
  57206. for (let index in dataContent.colTitles) {
  57207. let key = dataContent.colTitles[index];
  57208. attributes[key] = dataContent.rows[i][index];
  57209. }
  57210. attributes['index'] = i + '';
  57211. //目前csv 只支持处理点,所以先生成点类型的 geojson
  57212. let feature = {
  57213. type: 'Feature',
  57214. geometry: {
  57215. type: 'Point',
  57216. coordinates: [x, y]
  57217. },
  57218. properties: attributes
  57219. };
  57220. features.push(feature);
  57221. }
  57222. return features;
  57223. }
  57224. /**
  57225. * @private
  57226. * @description 请求数据失败的事件
  57227. * @function SuperMap.Components.ChartModel.prototype._fireFailedEvent
  57228. * @param {object} error 错误信息
  57229. */
  57230. _fireFailedEvent(error) {
  57231. let errorData = error
  57232. ? {
  57233. error,
  57234. message: Lang.i18n('msg_getdatafailed')
  57235. }
  57236. : {
  57237. message: Lang.i18n('msg_getdatafailed')
  57238. };
  57239. /**
  57240. * @event SuperMap.Components.Chart#getdatafailed
  57241. * @description 监听到获取数据失败事件后触发
  57242. * @property {Object} error - 事件对象。
  57243. */
  57244. this.events.triggerEvent('getdatafailed', errorData);
  57245. }
  57246. }
  57247. // CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  57248. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  57249. * This program are made available under the terms of the Apache License, Version 2.0
  57250. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57251. /**
  57252. * @class SuperMap.Components.ChartViewModel
  57253. * @classdesc 图表组件功能类
  57254. * @category Components Chart
  57255. * @version 10.0.0
  57256. * @param {Object} options - 可选参数。
  57257. * @param {string} options.type - 图表类型。
  57258. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源。
  57259. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  57260. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  57261. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  57262. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  57263. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  57264. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  57265. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  57266. * @fires SuperMap.Components.ChartViewModel#getdatafailed
  57267. */
  57268. class ChartViewModel_ChartViewModel {
  57269. constructor(options) {
  57270. this.datasets = options.datasets;
  57271. this.xField = [];
  57272. this.yField = [];
  57273. this.grid = {
  57274. top: "50px",
  57275. bottom: "50px",
  57276. left: "50px",
  57277. right: "60px"
  57278. };
  57279. this.chartType = options.type || "bar";
  57280. this._initXYField(options.chartOptions);
  57281. this.EVENT_TYPES = ["getdatafailed"];
  57282. this.events = new Events_Events(this, null, this.EVENT_TYPES);
  57283. }
  57284. /**
  57285. * @function SuperMap.Components.ChartViewModel.prototype._initXYField
  57286. * @description 初始化XY字段。
  57287. * @private
  57288. * @param {Object} chartOptions - options里的图表参数
  57289. */
  57290. _initXYField(chartOptions) {
  57291. let me = this;
  57292. if (chartOptions && chartOptions.length > 0) {
  57293. chartOptions.forEach(function (option) {
  57294. if (option.xAxis) {
  57295. me.xField.push({
  57296. field: option.xAxis.field,
  57297. name: option.xAxis.name
  57298. });
  57299. }
  57300. if (option.yAxis) {
  57301. me.yField.push({
  57302. field: option.yAxis.field,
  57303. name: option.yAxis.name
  57304. });
  57305. }
  57306. });
  57307. }
  57308. }
  57309. /**
  57310. * @function SuperMap.Components.ChartViewModel.prototype.getDatasetInfo
  57311. * @description 获得数据集数据。
  57312. * @param {function} success - 成功回调函数
  57313. */
  57314. getDatasetInfo(success) {
  57315. this.createChart = success;
  57316. if (this.datasets && this._checkUrl(this.datasets.url)) {
  57317. this.chartModel = new ChartModel_ChartModel(this.datasets);
  57318. if(this.datasets.type === 'iServer'){
  57319. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  57320. }else if(this.datasets.type === 'iPortal'){
  57321. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  57322. }
  57323. /**
  57324. * @event SuperMap.Components.ChartViewModel#getdatafailed
  57325. * @description 监听到获取数据失败事件后触发
  57326. * @property {Object} error - 事件对象。
  57327. */
  57328. this.chartModel.events.on({"getdatafailed": (error) => {
  57329. this.events.triggerEvent("getdatafailed", error)
  57330. }});
  57331. }
  57332. }
  57333. /**
  57334. * @function SuperMap.Components.ChartViewModel.prototype._getDatasetInfoSuccess
  57335. * @description 成功回调函数。
  57336. * @private
  57337. * @param {Object} results - 数据集信息
  57338. */
  57339. _getDatasetInfoSuccess(results) {
  57340. let datasetUrl = this.datasets.url;
  57341. //判断服务为地图服务 或者 数据服务
  57342. let restIndex = datasetUrl.indexOf("rest");
  57343. if (restIndex > 0) {
  57344. let index = datasetUrl.indexOf("/", restIndex + 5);
  57345. let type = datasetUrl.substring(restIndex + 5, index);
  57346. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  57347. if (type === "maps") {
  57348. let mapIndex = datasetUrl.indexOf("/", index + 1);
  57349. let mapName = datasetUrl.substring(index + 1, mapIndex);
  57350. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  57351. results.result.dataUrl = dataUrl;
  57352. this._getLayerFeatures(results);
  57353. } else if (type === "data") {
  57354. results.result.dataUrl = dataUrl;
  57355. this._getDataFeatures(results);
  57356. }
  57357. }
  57358. }
  57359. /**
  57360. * @function SuperMap.Components.ChartViewModel.prototype._getDataInfoSuccess
  57361. * @description 请求iportal数据成功之后的回调
  57362. * @private
  57363. */
  57364. _getDataInfoSuccess(results, type) {
  57365. let me = this;
  57366. if(type === 'RESTMAP'){
  57367. me._getChartDatasFromLayer(results);
  57368. }else{
  57369. me._getChartDatas(results);
  57370. }
  57371. }
  57372. /**
  57373. * @function SuperMap.Components.ChartViewModel.prototype._getDataFeatures
  57374. * @description 请求数据集的数据信息
  57375. * @private
  57376. * @param {Object} results - 数据集信息
  57377. */
  57378. _getDataFeatures(results) {
  57379. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  57380. }
  57381. /**
  57382. * @function SuperMap.Components.ChartViewModel.prototype._getLayerFeatures
  57383. * @description 请求图层的数据信息
  57384. * @private
  57385. * @param {Object} results - 数据集信息
  57386. */
  57387. _getLayerFeatures(results) {
  57388. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  57389. }
  57390. /**
  57391. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatas
  57392. * @description 将请求回来的数据转换为图表所需的数据格式
  57393. * @private
  57394. * @param {Object} results - 数据要素信息
  57395. */
  57396. _getChartDatas(results) {
  57397. if (results) {
  57398. // 数据来自restdata---results.result.features
  57399. this.features = results.result.features;
  57400. let features = this.features.features;
  57401. let data = {};
  57402. if (features.length) {
  57403. let feature = features[0];
  57404. let attrFields = [],
  57405. itemTypes = [];
  57406. for (let attr in feature.properties) {
  57407. attrFields.push(attr);
  57408. itemTypes.push(this._getDataType(feature.properties[attr]));
  57409. }
  57410. data = {
  57411. features,
  57412. fieldCaptions: attrFields,
  57413. fieldTypes: itemTypes,
  57414. fieldValues: []
  57415. }
  57416. for (let m in itemTypes) {
  57417. let fieldValue = [];
  57418. for (let j in features) {
  57419. let feature = features[j];
  57420. let caption = data.fieldCaptions[m];
  57421. let value = feature.properties[caption];
  57422. fieldValue.push(value);
  57423. }
  57424. data.fieldValues.push(fieldValue);
  57425. }
  57426. this.createChart(data);
  57427. }
  57428. }
  57429. }
  57430. /**
  57431. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatasFromLayer
  57432. * @description 将请求回来的数据转换为图表所需的数据格式
  57433. * @private
  57434. * @param {Object} results - 图层数据要素信息
  57435. */
  57436. _getChartDatasFromLayer(results) {
  57437. if (results.result.recordsets) {
  57438. let recordsets = results.result.recordsets[0];
  57439. let features = recordsets.features.features;
  57440. this.features = recordsets.features;
  57441. let data = {};
  57442. if (features.length) {
  57443. data = {
  57444. features: recordsets.features,
  57445. fieldCaptions: recordsets.fieldCaptions,
  57446. fieldTypes: recordsets.fieldTypes,
  57447. fieldValues: []
  57448. }
  57449. for (let m in data.fieldCaptions) {
  57450. let fieldValue = [];
  57451. for (let j in features) {
  57452. let feature = features[j];
  57453. let caption = data.fieldCaptions[m];
  57454. let value = feature.properties[caption];
  57455. fieldValue.push(value);
  57456. }
  57457. data.fieldValues.push(fieldValue);
  57458. }
  57459. this.createChart(data);
  57460. }
  57461. }
  57462. }
  57463. /**
  57464. * @function SuperMap.Components.ChartViewModel.prototype._createChartOptions
  57465. * @description 创建图表所需参数
  57466. * @private
  57467. * @param {Object} data - 图表数据
  57468. */
  57469. _createChartOptions(data) {
  57470. this.calculatedData = this._createChartDatas(data);
  57471. return this.updateChartOptions(this.chartType);
  57472. }
  57473. /**
  57474. * @function SuperMap.Components.ChartViewModel.prototype.changeType
  57475. * @description 改变图表类型
  57476. * @param {string} type - 图表类型
  57477. */
  57478. changeType(type) {
  57479. if (type !== this.chartType) {
  57480. this.chartType = type;
  57481. return this.updateChartOptions(this.chartType);
  57482. }
  57483. }
  57484. /**
  57485. * @function SuperMap.Components.ChartViewModel.prototype.updateData
  57486. * @description 改变图表类型
  57487. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  57488. * @param {function} success 成功回调函数
  57489. */
  57490. updateData(datasets, chartOption, success) {
  57491. this.updateChart = success;
  57492. this.xField = [];
  57493. this.yField = [];
  57494. this._initXYField(chartOption);
  57495. // type的设置默认值
  57496. datasets.type = datasets.type || 'iServer';
  57497. // withCredentials的设置默认值
  57498. datasets.withCredentials = datasets.withCredentials || false;
  57499. this.datasets = datasets;
  57500. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  57501. }
  57502. /**
  57503. * @function SuperMap.Components.ChartViewModel.prototype._updateDataSuccess
  57504. * @description 改变图表类型
  57505. * @private
  57506. * @param {Object} data - 图表数据
  57507. */
  57508. _updateDataSuccess(data) {
  57509. let options = this._createChartOptions(data);
  57510. this.updateChart(options);
  57511. }
  57512. /**
  57513. * @function SuperMap.Components.ChartViewModel.prototype.updateChartOptions
  57514. * @description 更新图表所需参数
  57515. * @param {string} type - 图表类型
  57516. * @param {Object} style - 图表样式
  57517. */
  57518. updateChartOptions(type, style) {
  57519. if (this.calculatedData) {
  57520. let grid = this.grid;
  57521. let series = this._createChartSeries(this.calculatedData, type);
  57522. let datas = [];
  57523. for (let i in this.calculatedData.XData) {
  57524. datas.push({
  57525. value: this.calculatedData.XData[i].fieldsData
  57526. });
  57527. }
  57528. let xAxis = {
  57529. type: "category",
  57530. name: this.xField[0].name || "X",
  57531. data: datas,
  57532. nameTextStyle: {
  57533. color: '#fff',
  57534. fontSize: 14
  57535. },
  57536. splitLine: {
  57537. show: false
  57538. },
  57539. axisLine: {
  57540. lineStyle: {
  57541. color: '#eee'
  57542. }
  57543. }
  57544. }
  57545. let yAxis = {
  57546. type: "value",
  57547. name: this.yFieldName || "Y",
  57548. data: {},
  57549. nameTextStyle: {
  57550. color: '#fff',
  57551. fontSize: 14
  57552. },
  57553. splitLine: {
  57554. show: false
  57555. },
  57556. axisLine: {
  57557. lineStyle: {
  57558. color: '#eee'
  57559. }
  57560. }
  57561. }
  57562. let tooltip = {
  57563. formatter: '{b0}: {c0}'
  57564. };
  57565. let backgroundColor = '#404a59';
  57566. if (style) {
  57567. if (style.grid) {
  57568. grid = style.grid;
  57569. }
  57570. if (style.tooltip) {
  57571. tooltip = style.tooltip;
  57572. }
  57573. if (style.backgroundColor) {
  57574. backgroundColor = style.backgroundColor;
  57575. }
  57576. }
  57577. return {
  57578. backgroundColor: backgroundColor,
  57579. grid: grid,
  57580. series: series,
  57581. xAxis: xAxis,
  57582. yAxis: yAxis,
  57583. tooltip: tooltip
  57584. }
  57585. }
  57586. }
  57587. /**
  57588. * @function SuperMap.Components.ChartViewModel.prototype._createChartDatas
  57589. * @description 构建图表数据
  57590. * @private
  57591. * @param {Object} data - 源数据
  57592. */
  57593. _createChartDatas(data) {
  57594. let fieldIndex = 0, yfieldIndexs = [];
  57595. let fieldCaptions = data.fieldCaptions;
  57596. let me = this;
  57597. //X
  57598. fieldCaptions.forEach(function (field, index) {
  57599. if (me.xField[0] && field === me.xField[0].field) {
  57600. fieldIndex = index;
  57601. }
  57602. });
  57603. //Y
  57604. this.yFieldName = "";
  57605. this.yField.forEach(function (value, index) {
  57606. if (index !== 0) {
  57607. me.yFieldName = me.yFieldName + ",";
  57608. }
  57609. me.yFieldName = me.yFieldName + value.name;
  57610. fieldCaptions.forEach(function (field, index) {
  57611. if (field === value.field) {
  57612. yfieldIndexs.push(index);
  57613. }
  57614. });
  57615. })
  57616. let datas = this._getAttrData(data, fieldIndex);
  57617. let yDatas = [];
  57618. if (yfieldIndexs.length > 0) {
  57619. yfieldIndexs.forEach(function (yfieldIndex) {
  57620. let yData = [];
  57621. for (let i in data.fieldValues[yfieldIndex]) {
  57622. yData.push({
  57623. value: data.fieldValues[yfieldIndex][i]
  57624. });
  57625. }
  57626. yDatas.push(yData);
  57627. });
  57628. } else { //未指定Y字段时,y轴计数
  57629. let YData = [],
  57630. XData = [],
  57631. len = datas.length;
  57632. //计算X轴,Y轴数据,并去重
  57633. for (let i = 0; i < len; i++) {
  57634. let isSame = false;
  57635. for (let j = 0, leng = XData.length; j < leng; j++) {
  57636. if (datas[i].fieldsData === XData[j].fieldsData) {
  57637. YData[j].value++;
  57638. XData[j].recordIndexs.push(i);
  57639. isSame = true;
  57640. break;
  57641. }
  57642. }
  57643. if (!isSame) {
  57644. if (datas[i].fieldsData) {
  57645. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  57646. YData.push({ value: 1 });
  57647. }
  57648. }
  57649. }
  57650. datas = XData;
  57651. yDatas = [YData];
  57652. }
  57653. return {
  57654. XData: datas,
  57655. YData: yDatas
  57656. }
  57657. }
  57658. /**
  57659. * @function SuperMap.Components.ChartViewModel.prototype._getAttrData
  57660. * @description 选中字段数据
  57661. * @private
  57662. * @param {Object} datacontent - 图表数据
  57663. * @param {number} index - 字段索引
  57664. */
  57665. _getAttrData(datacontent, index) {
  57666. if (index === 0) {
  57667. this.xField = [{
  57668. field: datacontent.fieldCaptions[index],
  57669. name: datacontent.fieldCaptions[index]
  57670. }];
  57671. }
  57672. let fieldsDatas = [];
  57673. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  57674. let value = datacontent.fieldValues[index][i];
  57675. fieldsDatas.push({
  57676. recordIndexs: i,
  57677. fieldsData: value
  57678. });
  57679. }
  57680. return fieldsDatas;
  57681. }
  57682. /**
  57683. * @function SuperMap.Components.ChartViewModel.prototype._createChartSeries
  57684. * @description 图表数据
  57685. * @private
  57686. * @param {Object} calculatedData - 图表数据
  57687. * @param {string} chartType - 图表类型
  57688. */
  57689. _createChartSeries(calculatedData, chartType) {
  57690. let series = [];
  57691. let yDatas = calculatedData.YData;
  57692. yDatas.forEach(function (yData) {
  57693. let value = 0;
  57694. let serieData = [];
  57695. for (let data of yData) {
  57696. value = data.value;
  57697. serieData.push({
  57698. value: value
  57699. });
  57700. }
  57701. let serie = {
  57702. type: chartType,
  57703. data: serieData,
  57704. name: "y"
  57705. };
  57706. series.push(serie);
  57707. });
  57708. return series;
  57709. }
  57710. /**
  57711. * @function SuperMap.Components.ChartViewModel.prototype._isDate
  57712. * @description 判断是否为日期
  57713. * @private
  57714. * @param {string} data - 字符串
  57715. */
  57716. _isDate(data) {
  57717. let reg = /((^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(10|12|0?[13578])([-\/\._])(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(11|0?[469])([-\/\._])(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(0?2)([-\/\._])(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([3579][26]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][13579][26])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][13579][26])([-\/\._])(0?2)([-\/\._])(29)$))/ig;
  57718. return reg.test(data);
  57719. }
  57720. /**
  57721. * @function SuperMap.Components.ChartViewModel.prototype._isNumber
  57722. * @description 判断是否为数值
  57723. * @private
  57724. * @param {string} data - 字符串
  57725. */
  57726. _isNumber(data) {
  57727. let mdata = Number(data);
  57728. if (mdata === 0) {
  57729. return true;
  57730. }
  57731. return !isNaN(mdata);
  57732. }
  57733. /**
  57734. * @function SuperMap.Components.ChartViewModel.prototype._getDataType
  57735. * @description 判断数据的类型
  57736. * @private
  57737. * @param {string} data - 字符串
  57738. */
  57739. _getDataType(data) {
  57740. if (data !== null && data !== undefined && data !== '') {
  57741. if (this._isDate(data)) {
  57742. return "DATE";
  57743. }
  57744. if (this._isNumber(data)) {
  57745. return "NUMBER";
  57746. }
  57747. }
  57748. return "STRING";
  57749. }
  57750. /**
  57751. * @function SuperMap.Components.ChartViewModel.prototype._checkUrl
  57752. * @description 检查url是否符合要求
  57753. * @private
  57754. * @param {string} url
  57755. */
  57756. _checkUrl(url) {
  57757. let match;
  57758. if (url === '' || !this._isMatchUrl(url)) {
  57759. match = false;
  57760. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  57761. //不是实际域名
  57762. match = false;
  57763. } else {
  57764. match = true;
  57765. }
  57766. return match;
  57767. }
  57768. /**
  57769. * @function SuperMap.Components.ChartViewModel.prototype._isMatchUrl
  57770. * @description 判断输入的地址是否符合地址格式
  57771. * @private
  57772. * @param {string} str - url
  57773. */
  57774. _isMatchUrl(str) {
  57775. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  57776. return reg.test(str);
  57777. }
  57778. /**
  57779. * @function SuperMap.Components.ChartViewModel.prototype.getStyle
  57780. * @description 获取图表样式。
  57781. */
  57782. getStyle() {
  57783. let style = {
  57784. grid: this.grid,
  57785. tooltip: this.tooltip,
  57786. backgroundColor: this.backgroundColor
  57787. }
  57788. return style;
  57789. }
  57790. /**
  57791. * @function SuperMap.Components.ChartViewModel.prototype.getFeatures
  57792. * @description 获取地图服务,数据服务请求返回的数据。
  57793. */
  57794. getFeatures() {
  57795. return this.features;
  57796. }
  57797. /**
  57798. * @function SuperMap.Components.ChartViewModel.prototype.setStyle
  57799. * @description 设置图表样式。
  57800. * @param {Object} style - 图表样式
  57801. */
  57802. setStyle(style) {
  57803. return this.updateChartOptions(this.chartType, style);
  57804. }
  57805. }
  57806. SuperMap.Components.ChartViewModel = ChartViewModel_ChartViewModel;
  57807. // CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  57808. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  57809. * This program are made available under the terms of the Apache License, Version 2.0
  57810. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57811. /**
  57812. * @class SuperMap.Components.Chart
  57813. * @classdesc 图表组件
  57814. * @version 9.1.2
  57815. * @param {string} domID - 图表dom元素ID。
  57816. * @param {Object} options - 可选参数。
  57817. * @param {string} options.type - 图表类型。
  57818. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源
  57819. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  57820. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  57821. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  57822. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  57823. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  57824. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  57825. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  57826. * @category Components Chart
  57827. */
  57828. /**
  57829. * @typedef {Object} SuperMap.Components.Chart.Datasets - 数据来源
  57830. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  57831. * @property {string} url - 服务url地址。
  57832. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie
  57833. * @property {SuperMap.FilterParameter} queryInfo - 查询条件
  57834. */
  57835. class ChartView_ChartView {
  57836. constructor(domID, options) {
  57837. this.domID = domID;
  57838. this.chartType = options.type || "bar";
  57839. // 设置options.datasets.type的默认值是iServer
  57840. options.datasets.type = options.datasets.type || 'iServer';
  57841. // 设置withCredentials的默认值为false
  57842. options.datasets.withCredentials = options.datasets.withCredentials || false;
  57843. this.viewModel = new ChartViewModel_ChartViewModel(options);
  57844. //添加控件。
  57845. this._fillDataToView();
  57846. }
  57847. /**
  57848. * @function SuperMap.Components.Chart.prototype.onAdd
  57849. * @description 创建图表之后成功回调
  57850. * @param {function} addChart - 回调函数
  57851. */
  57852. onAdd(addChart) {
  57853. this.addChart = addChart;
  57854. }
  57855. /**
  57856. * @function SuperMap.Components.Chart.prototype._fillDataToView
  57857. * @description 填充数据到 view。
  57858. * @private
  57859. */
  57860. _fillDataToView() {
  57861. let messageboxs = new MessageBox();
  57862. //iclient 绑定createChart事件成功回调
  57863. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  57864. this.viewModel.events.on({
  57865. "getdatafailed": (error) => {
  57866. messageboxs.showView(error.message);
  57867. }
  57868. });
  57869. }
  57870. /**
  57871. * @function SuperMap.Components.Chart.prototype.getStyle
  57872. * @description 获取图表样式。
  57873. */
  57874. getStyle() {
  57875. return this.viewModel.getStyle()
  57876. }
  57877. /**
  57878. * @function SuperMap.Components.Chart.prototype.getFeatures
  57879. * @description 获取地图服务,数据服务请求返回的数据。
  57880. */
  57881. getFeatures() {
  57882. return this.viewModel.getFeatures();
  57883. }
  57884. /**
  57885. * @function SuperMap.Components.Chart.prototype.setStyle
  57886. * @description 设置图表样式。
  57887. * @param {Object} style - 图表样式 参考Echarts-options样式设置
  57888. */
  57889. setStyle(style) {
  57890. let newOptions = this.viewModel.setStyle(style);
  57891. this._updateChart(newOptions);
  57892. }
  57893. /**
  57894. * @function SuperMap.Components.Chart.prototype.changeType
  57895. * @description 改变图表类型
  57896. * @param {string} type - 图表类型
  57897. */
  57898. changeType(type) {
  57899. if (this.chartType !== type) {
  57900. this.chartType = type;
  57901. let newOptions = this.viewModel.changeType(type);
  57902. this._updateChart(newOptions);
  57903. }
  57904. }
  57905. /**
  57906. * @function SuperMap.Components.Chart.prototype.updateData
  57907. * @description 更新图表数据
  57908. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  57909. * @param {Object} chartOption - X,Y轴信息
  57910. */
  57911. updateData(datasets, chartOption) {
  57912. let me = this;
  57913. this.viewModel.updateData(datasets, chartOption, function (options) {
  57914. me._updateChart(options);
  57915. if (me.addChart) {
  57916. me.addChart();
  57917. }
  57918. });
  57919. }
  57920. /**
  57921. * @function SuperMap.Components.Chart.prototype._createChart
  57922. * @description 创建图表
  57923. * @private
  57924. * @param {Object} data - 图表数据
  57925. */
  57926. _createChart(data) {
  57927. this.echart = external_function_try_return_echarts_catch_e_return_default.a.init(
  57928. document.getElementById(this.domID),
  57929. null, {
  57930. renderer: "canvas"
  57931. }
  57932. )
  57933. let options = this.viewModel._createChartOptions(data);
  57934. this.echart.setOption(options);
  57935. if (this.addChart) {
  57936. this.addChart();
  57937. }
  57938. }
  57939. /**
  57940. * @function SuperMap.Components.Chart.prototype._updateChart
  57941. * @description 更新图表
  57942. * @private
  57943. * @param {Object} options - 图表参数
  57944. */
  57945. _updateChart(options) {
  57946. if (this.echart) {
  57947. this.echart.clear();
  57948. this.echart.setOption(options);
  57949. }
  57950. }
  57951. }
  57952. SuperMap.Components.Chart = ChartView_ChartView;
  57953. // CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  57954. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  57955. * This program are made available under the terms of the Apache License, Version 2.0
  57956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57957. /**
  57958. * @class SuperMap.Components.TemplateBase
  57959. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  57960. * @version 9.1.1
  57961. * @param {Object} options - 组件配置参数。
  57962. * @param {string} options.id - 组件 dom 元素 id。
  57963. * @category Components Common
  57964. */
  57965. class TemplateBase {
  57966. constructor(options) {
  57967. options = options ? options : {};
  57968. /**
  57969. * @member {string} [SuperMap.Components.TemplateBase.prototype.id=null]
  57970. * @description 组件 dom 元素 id。
  57971. */
  57972. this.id = options.id ? options.id : null;
  57973. /**
  57974. * @member {Element} [SuperMap.Components.TemplateBase.prototype.rootContainer=null]
  57975. * @description 组件 dom 元素对象。
  57976. */
  57977. this.rootContainer = null;
  57978. }
  57979. /**
  57980. * @function SuperMap.Components.TemplateBase.prototype.getElement
  57981. * @description 获取当前组件元素对象。
  57982. * @return {Element}
  57983. */
  57984. getElement() {
  57985. //todo 其实感觉再这里给组件设置不太合理
  57986. if (this.id) {
  57987. this.rootContainer.id = this.id;
  57988. }
  57989. return this.rootContainer;
  57990. }
  57991. /**
  57992. * @function SuperMap.Components.TemplateBase.prototype._initView
  57993. * @private
  57994. * @description 初始化模板。
  57995. */
  57996. _initView() {
  57997. //子类实现此方法
  57998. }
  57999. /**
  58000. * @function SuperMap.Components.TemplateBase.prototype.showView
  58001. * @description 显示组件。
  58002. */
  58003. showView() {
  58004. this.rootContainer.hidden = false;
  58005. }
  58006. /**
  58007. * @function SuperMap.Components.TemplateBase.prototype.closeView
  58008. * @description 隐藏组件。
  58009. */
  58010. closeView() {
  58011. this.rootContainer.hidden = true;
  58012. }
  58013. }
  58014. SuperMap.Components.TemplateBase = TemplateBase;
  58015. // CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  58016. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58017. * This program are made available under the terms of the Apache License, Version 2.0
  58018. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58019. /**
  58020. * @class SuperMap.Components.CommonContainer
  58021. * @classdesc 组件统一外框。
  58022. * @version 9.1.1
  58023. * @param {Object} options - 组件可选参数。
  58024. * @param {string} options.id - 组件 dom 元素 id。
  58025. * @param {string} options.title - 标题。
  58026. * @category Components Common
  58027. * @extends {SuperMap.Components.TemplateBase}
  58028. */
  58029. class CommonContainer_CommonContainer extends TemplateBase {
  58030. constructor(options) {
  58031. super(options);
  58032. let title = options.title ? options.title : "";
  58033. this._initView(title);
  58034. }
  58035. /**
  58036. * @private
  58037. * @override
  58038. */
  58039. _initView(title) {
  58040. const container = document.createElement("div");
  58041. container.setAttribute("class", "component-container");
  58042. //title
  58043. const titleContainer = document.createElement("div");
  58044. titleContainer.setAttribute("class", "component-title");
  58045. const titleContent = document.createElement("div");
  58046. titleContent.innerHTML = title;
  58047. titleContainer.appendChild(titleContent);
  58048. container.appendChild(titleContainer);
  58049. //container
  58050. const componentContent = document.createElement("div");
  58051. componentContent.setAttribute("class", "component-content");
  58052. container.appendChild(componentContent);
  58053. this.content = componentContent;
  58054. this.rootContainer = container;
  58055. return container;
  58056. }
  58057. /**
  58058. * @function SuperMap.Components.CommonContainer.prototype.getContentElement
  58059. * @description 获取内容元素容器
  58060. */
  58061. getContentElement() {
  58062. return this.content;
  58063. }
  58064. /**
  58065. * @function SuperMap.Components.CommonContainer.prototype.appendContent
  58066. * @description 填充内容元素
  58067. */
  58068. appendContent(element) {
  58069. this.content.appendChild(element);
  58070. }
  58071. }
  58072. SuperMap.Components.CommonContainer = CommonContainer_CommonContainer;
  58073. // CONCATENATED MODULE: ./src/common/components/templates/Select.js
  58074. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58075. * This program are made available under the terms of the Apache License, Version 2.0
  58076. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58077. /**
  58078. * @class SuperMap.Components.Select
  58079. * @classdesc 组件统一的文字下拉框。
  58080. * @version 9.1.1
  58081. * @param {Array.<string|Array>} options - 需要创建的 Select 数据数组。
  58082. * @param {string} options.id - 组件 dom 元素 id。
  58083. * @param {string} [options.labelName] - label 名称。
  58084. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  58085. * @param {Function} [options.optionsClickCb] - option 点击事件回调函数。
  58086. * @extends {SuperMap.Components.TemplateBase}
  58087. * @category Components Common
  58088. */
  58089. class Select_Select extends TemplateBase {
  58090. constructor(options) {
  58091. super(options);
  58092. this._initView(options);
  58093. }
  58094. _initView(options) {
  58095. let selectTool = this._createElement('div', "component-selecttool");
  58096. if (options.labelName) {
  58097. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  58098. label.innerHTML = options.labelName;
  58099. }
  58100. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  58101. chartSelect.setAttribute('tabindex', '1');
  58102. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  58103. selectName.title = options.optionsArr[0];
  58104. selectName.innerHTML = options.optionsArr[0];
  58105. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  58106. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  58107. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  58108. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  58109. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  58110. scrollareaContent.setAttribute('tabindex', '1');
  58111. this.createOptions(scrollareaContent, options.optionsArr);
  58112. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  58113. // 下拉框显示 & 隐藏事件
  58114. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  58115. this.rootContainer = selectTool;
  58116. }
  58117. /**
  58118. * @function SuperMap.Components.Select.prototype.createOptions
  58119. * @description 创建所属下拉框选项。
  58120. */
  58121. createOptions(container, optionsArr) {
  58122. for (let i in optionsArr) {
  58123. let option = this._createElement('div', 'component-selecttool__option', container);
  58124. option.title = optionsArr[i];
  58125. option.innerHTML = optionsArr[i];
  58126. }
  58127. }
  58128. /**
  58129. * @function SuperMap.Components.Select.prototype._selectClickEvent
  58130. * @description select 点击显示&隐藏事件。
  58131. * @private
  58132. */
  58133. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  58134. eventElement.onclick = function (e) {
  58135. if (contentElement.style.display === "block") {
  58136. contentElement.style.display = "none";
  58137. triangleBtn.className = "component-triangle-down-img";
  58138. } else {
  58139. contentElement.style.display = "block";
  58140. triangleBtn.className = "triangle-up-img";
  58141. }
  58142. e.preventDefault();
  58143. e.stopPropagation();
  58144. };
  58145. eventElement.onmousedown = function (evt) {
  58146. //console.log('dropdownbox onmousedown '+evt.target.className);
  58147. if (evt.target !== this) {
  58148. this.focus();
  58149. evt.preventDefault();
  58150. evt.stopPropagation()
  58151. }
  58152. };
  58153. eventElement.onblur = function () {
  58154. contentElement.style.display = "none";
  58155. triangleBtn.className = "component-triangle-down-img";
  58156. }
  58157. }
  58158. /**
  58159. * @function Select.prototype._createElement
  58160. * @description 通用创建元素。
  58161. * @private
  58162. */
  58163. _createElement(tagName, className, parentEle) {
  58164. let ele = document.createElement(tagName || 'div');
  58165. className && (ele.className = className);
  58166. parentEle && parentEle.appendChild(ele);
  58167. return ele;
  58168. }
  58169. /**
  58170. * @function SuperMap.Components.Select.prototype.optionClickEvent
  58171. * @description 下拉框的 option 的点击事件。
  58172. */
  58173. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  58174. for (let i = 0; i < optionEleArr.children.length; i++) {
  58175. let childEle = optionEleArr.children[i];
  58176. childEle.onclick = function () {
  58177. selectNameEle.innerHTML = childEle.innerHTML;
  58178. selectNameEle.title = childEle.title;
  58179. if (childEle.getAttribute('data-value')) {
  58180. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  58181. }
  58182. optionsClickCb && optionsClickCb(childEle);
  58183. }
  58184. }
  58185. }
  58186. }
  58187. SuperMap.Components.Select = Select_Select;
  58188. // CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  58189. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58190. * This program are made available under the terms of the Apache License, Version 2.0
  58191. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58192. /**
  58193. * @class SuperMap.Components.DropDownBox
  58194. * @classdesc 组件统一的图片下拉框。
  58195. * @version 9.1.1
  58196. * @param {Array.<Object>} optionsArr - 需要创建的 option 数据数组。
  58197. * @param {string} optionsArr.id - 组件 dom 元素 id。
  58198. * @param {string} optionsArr.title - 下拉框 title。
  58199. * @param {string} optionsArr.remark - 下拉框解释标记文本。
  58200. * @param {string} optionsArr.icon - 下拉框图标。
  58201. * @param {string} [optionsArr.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  58202. * @param {string} [optionsArr.icon.className] - 下拉框图标类名。
  58203. * @param {string} [optionsArr.icon.background] - 下拉框图标背景 url。
  58204. * @category Components Common
  58205. * @extends {SuperMap.Components.TemplateBase}
  58206. */
  58207. class DropDownBox_DropDownBox extends TemplateBase {
  58208. constructor(optionsArr) {
  58209. super(optionsArr);
  58210. this._initView(optionsArr);
  58211. }
  58212. /**
  58213. * @function SuperMap.Components.DropDownBox.prototype._initView
  58214. * @description 初始化下拉框。
  58215. * @private
  58216. * @override
  58217. */
  58218. _initView(optionsArr) {
  58219. let dropDownContainer = document.createElement('div');
  58220. dropDownContainer.className = 'component-dropdownbox--container';
  58221. let dropDownBox = document.createElement('div');
  58222. dropDownBox.setAttribute('tabindex', '1');
  58223. dropDownBox.className = "component-dropdownbox";
  58224. dropDownContainer.appendChild(dropDownBox);
  58225. let dropDownTopContainer = document.createElement('div');
  58226. dropDownBox.appendChild(dropDownTopContainer);
  58227. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  58228. let triangleBtnContainer = document.createElement('div');
  58229. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  58230. dropDownBox.appendChild(triangleBtnContainer);
  58231. let triangleBtn = document.createElement('div');
  58232. triangleBtn.className = 'component-triangle-down-img';
  58233. triangleBtnContainer.appendChild(triangleBtn);
  58234. let createDropDownBoxParam = {
  58235. "parentEle": dropDownBox,
  58236. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  58237. "scrollareaContent": 'component-selecttool__scrollarea__content',
  58238. "optionsArr": optionsArr,
  58239. "triangleBtn": triangleBtn,
  58240. "dropDownTopContainer": dropDownTopContainer
  58241. };
  58242. this._createDropDownBox(createDropDownBoxParam);
  58243. this.rootContainer = dropDownContainer;
  58244. }
  58245. /**
  58246. * @function SuperMap.Components.DropDownBox.prototype._createDropDownBox
  58247. * @description 创建下拉框。
  58248. * @private
  58249. */
  58250. _createDropDownBox(createDropDownBoxParam) {
  58251. let dropDownBox = createDropDownBoxParam.parentEle;
  58252. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  58253. let dropDownContent = document.createElement('div');
  58254. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  58255. dropDownBox.appendChild(dropDownContent);
  58256. let scrollareaContent = document.createElement('div');
  58257. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  58258. dropDownContent.appendChild(scrollareaContent);
  58259. let optionsArr = createDropDownBoxParam.optionsArr;
  58260. for (let i = 0; i < optionsArr.length; i++) {
  58261. this._createDropDownOption(optionsArr[i], scrollareaContent)
  58262. }
  58263. // 下拉框显示 & 隐藏事件
  58264. let triangleBtn = createDropDownBoxParam.triangleBtn;
  58265. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  58266. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  58267. // 下拉框 options 点击事件
  58268. let scrollareaOptions = scrollareaContent.children;
  58269. for (let i = 0; i < scrollareaOptions.length; i++) {
  58270. scrollareaOptions[i].onclick = function () {
  58271. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  58272. //evt.stopPropagation();
  58273. }
  58274. }
  58275. }
  58276. /**
  58277. * @function SuperMap.Components.DropDownBox.prototype._createDropDownOption
  58278. * @description 创建下拉框子元素。
  58279. * @private
  58280. */
  58281. _createDropDownOption(data, parentElement) {
  58282. let ele = document.createElement('div');
  58283. ele.className = 'component-dropdownbox__item';
  58284. let dataItem = data;
  58285. if (dataItem['dataValue']) {
  58286. ele.setAttribute('data-value', dataItem['dataValue']);
  58287. }
  58288. parentElement.appendChild(ele);
  58289. let imgContainer = document.createElement('div');
  58290. imgContainer.className = 'component-dropdownbox__item__img';
  58291. ele.appendChild(imgContainer);
  58292. let img = document.createElement('div');
  58293. if (dataItem.icon.className) {
  58294. img.className = dataItem.icon.className;
  58295. }
  58296. if (dataItem.icon.background) {
  58297. img.style.background = dataItem.icon.background;
  58298. }
  58299. imgContainer.appendChild(img);
  58300. let title = document.createElement('div');
  58301. title.className = 'component-dropdownbox__item__title';
  58302. title.title = dataItem.title;
  58303. title.innerHTML = dataItem.title;
  58304. ele.appendChild(title);
  58305. let remark = document.createElement('div');
  58306. remark.className = 'component-dropdownbox__item__remark';
  58307. remark.title = dataItem.remark;
  58308. remark.innerHTML = dataItem.remark;
  58309. ele.appendChild(remark);
  58310. }
  58311. /**
  58312. * @function SuperMap.Components.DropDownBox.prototype._dropDownClickEvent
  58313. * @description 下拉框点击事件。
  58314. * @private
  58315. */
  58316. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  58317. eventElement.onclick = function (e) {
  58318. if (contentElement.style.display === "block") {
  58319. contentElement.style.display = "none";
  58320. triangleBtn.className = "component-triangle-down-img";
  58321. } else {
  58322. contentElement.style.display = "block";
  58323. triangleBtn.className = "triangle-up-img";
  58324. }
  58325. e.preventDefault();
  58326. e.stopPropagation()
  58327. };
  58328. eventElement.onmousedown = function (evt) {
  58329. //console.log('dropdownbox onmousedown '+evt.target.className);
  58330. if (evt.target !== this) {
  58331. this.focus();
  58332. evt.preventDefault();
  58333. evt.stopPropagation()
  58334. }
  58335. }
  58336. }
  58337. /**
  58338. * @function SuperMap.Components.DropDownBox.prototype._eleOnblur
  58339. * @description 下拉框失焦事件。
  58340. * @private
  58341. */
  58342. _eleOnblur(eventElement, contentElement, triangleBtn) {
  58343. eventElement.onblur = function () {
  58344. contentElement.style.display = "none";
  58345. triangleBtn.className = "component-triangle-down-img";
  58346. }
  58347. }
  58348. /**
  58349. * @function SuperMap.Components.DropDownBox.prototype._createElement
  58350. * @description 通用创建元素。
  58351. * @private
  58352. */
  58353. _createElement(tagName, className, parentEle) {
  58354. let ele = document.createElement(tagName || 'div');
  58355. className && (ele.className = className);
  58356. parentEle && parentEle.appendChild(ele);
  58357. return ele;
  58358. }
  58359. }
  58360. SuperMap.Components.DropDownBox = DropDownBox_DropDownBox;
  58361. // CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  58362. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58363. * This program are made available under the terms of the Apache License, Version 2.0
  58364. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58365. /**
  58366. * @class SuperMap.Components.PopContainer
  58367. * @classdesc 弹框组件。
  58368. * @version 9.1.1
  58369. * @param {Object} options - 组件配置参数。
  58370. * @param {string} options.id - 组件 dom 元素 id。
  58371. * @param {string} options.title - 弹框组件名称。
  58372. * @extends {SuperMap.Components.TemplateBase}
  58373. * @category Components Common
  58374. */
  58375. class PopContainer_PopContainer extends TemplateBase {
  58376. constructor(options) {
  58377. options = options ? options : {};
  58378. super(options);
  58379. options.title = options.title ? options.title : "";
  58380. this._initView(options.title);
  58381. }
  58382. /**
  58383. * @private
  58384. * @override
  58385. */
  58386. _initView(titile) {
  58387. const container = document.createElement("div");
  58388. container.setAttribute("class", "component-popcontainer");
  58389. //header
  58390. const header = document.createElement("div");
  58391. header.setAttribute("class", "component-popcontainer__header");
  58392. const title = document.createElement("label");
  58393. title.setAttribute("class", "component-popcontainer__header__title");
  58394. title.innerHTML = titile;
  58395. header.appendChild(title);
  58396. const closeBtn = document.createElement("span");
  58397. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  58398. closeBtn.onclick = this.closeView.bind(this);
  58399. container.appendChild(closeBtn);
  58400. container.appendChild(header);
  58401. //content
  58402. const content = document.createElement("div");
  58403. content.setAttribute("class", "component-popcontainer__content");
  58404. this.content = content;
  58405. container.appendChild(content);
  58406. this.rootContainer = container;
  58407. }
  58408. /**
  58409. * @function SuperMap.Components.PopContainer.prototype.appendContent
  58410. * @description 追加内容。
  58411. * @param {Element} dom - 内容元素。
  58412. */
  58413. appendContent(dom) {
  58414. this.content.appendChild(dom);
  58415. }
  58416. }
  58417. SuperMap.Components.PopContainer = PopContainer_PopContainer;
  58418. // CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  58419. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58420. * This program are made available under the terms of the Apache License, Version 2.0
  58421. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58422. /**
  58423. * @class SuperMap.Components.AttributesPopContainer
  58424. * @classdesc 属性弹框组件
  58425. * @version 9.1.1
  58426. * @param {Object} options - 组件配置参数。
  58427. * @param {string} options.id - 组件 dom 元素 id。
  58428. * @param {Object} options.title - 属性弹框组件名称。
  58429. * @param {Object} options.attributes - 组件需要显示的属性内容。
  58430. * @extends {SuperMap.Components.PopContainer}
  58431. * @category Components Common
  58432. */
  58433. class AttributesPopContainer_AttributesPopContainer extends PopContainer_PopContainer {
  58434. constructor(options) {
  58435. //默认为属性:
  58436. options.title = options.title ? options.title : "属性";
  58437. super(options);
  58438. this.rootContainer.firstChild.hidden = true;
  58439. options.attributes = options.attributes ? options.attributes : [];
  58440. this._createAttributesTable(options.attributes);
  58441. }
  58442. _createAttributesTable(attributes) {
  58443. const table = document.createElement("table");
  58444. table.setAttribute("class", "component-popcontainer__content__table");
  58445. const tbody = document.createElement("tbody");
  58446. let single = true;
  58447. for (let name in attributes) {
  58448. const tr = document.createElement("tr");
  58449. if (single) {
  58450. tr.setAttribute("class", "component-popcontainer__content__td--color");
  58451. }
  58452. const title = document.createElement("td");
  58453. const titleSpan = document.createElement("Span");
  58454. titleSpan.innerHTML = name;
  58455. title.appendChild(titleSpan);
  58456. const value = document.createElement("td");
  58457. value.innerHTML = attributes[name];
  58458. tr.appendChild(title);
  58459. tr.appendChild(value);
  58460. tbody.appendChild(tr);
  58461. single = !single;
  58462. }
  58463. table.appendChild(tbody);
  58464. this.appendContent(table);
  58465. }
  58466. }
  58467. SuperMap.Components.AttributesPopContainer = AttributesPopContainer_AttributesPopContainer;
  58468. // CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  58469. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58470. * This program are made available under the terms of the Apache License, Version 2.0
  58471. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58472. /**
  58473. * @class SuperMap.Components.IndexTabsPageContainer
  58474. * @description 标签索引组件。
  58475. * @version 9.1.1
  58476. * @param {Object} options - 可选参数。
  58477. * @param {string} options.id - 组件 dom 元素 id。
  58478. * @category Components Common
  58479. * @extends {SuperMap.Components.TemplateBase}
  58480. */
  58481. class IndexTabsPageContainer_IndexTabsPageContainer extends TemplateBase {
  58482. constructor(options) {
  58483. super(options);
  58484. this._initView();
  58485. }
  58486. /**
  58487. * @private
  58488. * @override
  58489. */
  58490. _initView() {
  58491. const container = document.createElement("div");
  58492. container.setAttribute("class", "component-tabpage");
  58493. const header = document.createElement("ul");
  58494. this.header = header;
  58495. const content = document.createElement("div");
  58496. content.setAttribute("class", "component-tabpage__content");
  58497. this.content = content;
  58498. container.appendChild(header);
  58499. container.appendChild(content);
  58500. this.rootContainer = container;
  58501. }
  58502. /**
  58503. * @function SuperMap.Components.IndexTabsPageContainer.prototype.setTabs
  58504. * @description 设置标签元素。
  58505. * @param {Array.<Element>} tabs
  58506. */
  58507. setTabs(tabs) {
  58508. this.removeAllTabs();
  58509. this.appendTabs(tabs);
  58510. }
  58511. /**
  58512. * @function SuperMap.Components.IndexTabsPageContainer.prototype.appendTabs
  58513. * @description 追加标签元素。
  58514. * @param {Array.<Element>} tabs
  58515. */
  58516. appendTabs(tabs) {
  58517. for (let i = 0; i < tabs.length; i++) {
  58518. let title = document.createElement("span");
  58519. title.index = i;
  58520. title.appendChild(document.createTextNode(tabs[i].title));
  58521. //绑定标签切换对应页面:
  58522. title.onclick = this._changeTabsPage.bind(this);
  58523. let content = tabs[i].content;
  58524. content.index = i;
  58525. content.hidden = true;
  58526. this.header.appendChild(title);
  58527. this.content.appendChild(content);
  58528. }
  58529. //todo 确认是否两个子元素的 index 相互对应
  58530. //默认显示第一个标签对象
  58531. this.header.firstChild.setAttribute("class", "on");
  58532. this.content.firstChild.hidden = false;
  58533. }
  58534. /**
  58535. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeTab
  58536. * @description 删除某个标签页面。
  58537. * @param {number} index - 标签索引号。
  58538. */
  58539. removeTab(index) {
  58540. this.header.removeChild(this.header.children[index]);
  58541. this.content.removeChild(this.content.children[index]);
  58542. }
  58543. /**
  58544. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeAllTabs
  58545. * @description 删除所有标签。
  58546. */
  58547. removeAllTabs() {
  58548. for (let i = this.header.children.length; i > 0; i--) {
  58549. this.header.removeChild(this.header.children[i]);
  58550. this.content.removeChild(this.content.children[i]);
  58551. }
  58552. }
  58553. _changeTabsPage(e) {
  58554. const index = e.target.index;
  58555. for (let i = 0; i < this.header.children.length; i++) {
  58556. this.header.children[i].setAttribute("class", "");
  58557. this.content.children[i].hidden = true;
  58558. if (i === index) {
  58559. this.header.children[i].setAttribute("class", "on");
  58560. this.content.children[i].hidden = false;
  58561. }
  58562. }
  58563. }
  58564. }
  58565. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer_IndexTabsPageContainer;
  58566. // CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  58567. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58568. * This program are made available under the terms of the Apache License, Version 2.0
  58569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58570. /**
  58571. * @class SuperMap.Components.CityTabsPage
  58572. * @classdesc 城市地址匹配组件模板
  58573. * @version 9.1.1
  58574. * @param {Object} options - 组件配置参数。
  58575. * @param {string} options.id - 组件 dom 元素 id。
  58576. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  58577. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  58578. * @extends {SuperMap.Components.IndexTabsPageContainer}
  58579. * @category Components Common
  58580. */
  58581. class CityTabsPage_CityTabsPage extends IndexTabsPageContainer_IndexTabsPageContainer {
  58582. constructor(options) {
  58583. super(options);
  58584. //去掉默认的边框阴影样式:
  58585. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  58586. this.config = options.config;
  58587. //header,若 config为城市名称数组,则直接加载内容
  58588. if (Util_Util.isArray(this.config)) {
  58589. this.header.hidden = true;
  58590. this._createCityItem("城市", this.config);
  58591. this.content.style.border = "none";
  58592. } else {
  58593. this._createTabs();
  58594. this.header.onclick = (e) => {
  58595. //关闭所有元素 是否有更简化的写法?
  58596. for (let i = 0; i < this.header.children.length; i++) {
  58597. this.header.children[i].setAttribute("class", "");
  58598. }
  58599. //打开点击内容元素
  58600. e.target.setAttribute("class", "on");
  58601. this._createCityContent(e.target.innerHTML);
  58602. };
  58603. }
  58604. }
  58605. /**
  58606. * @function SuperMap.Components.CityTabsPage.prototype._createTabs
  58607. * @description 创建 Tabs
  58608. * @private
  58609. */
  58610. _createTabs() {
  58611. //header
  58612. if (Util_Util.isArray(this.config)) {
  58613. for (let i = 0; i < this.config.length; i++) {
  58614. let innerHTML = "";
  58615. for (const key in this.config[i]) {
  58616. innerHTML += key;
  58617. }
  58618. let li = document.createElement("li");
  58619. li.innerHTML = innerHTML;
  58620. this.header.appendChild(li);
  58621. }
  58622. } else {
  58623. for (const key in this.config) {
  58624. let li = document.createElement("li");
  58625. li.innerHTML = key;
  58626. this.header.appendChild(li);
  58627. }
  58628. }
  58629. this.header.firstChild.setAttribute("class", "on");
  58630. this._createCityContent(this.header.firstChild.innerHTML);
  58631. }
  58632. /**
  58633. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  58634. * @description 创建列表容器
  58635. * @private
  58636. */
  58637. _createCityContent(keyName) {
  58638. //清除元素:
  58639. for (let i = this.content.children.length; i > 0; i--) {
  58640. this.content.removeChild(this.content.children[i - 1]);
  58641. }
  58642. //创建对应元素
  58643. const cities = this.config[keyName];
  58644. for (let key in cities) {
  58645. this._createCityItem(key, cities[key]);
  58646. }
  58647. }
  58648. /**
  58649. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  58650. * @description 创建列表容器
  58651. * @private
  58652. */
  58653. _createCityItem(key, cities) {
  58654. const city = document.createElement("div");
  58655. const cityClass = document.createElement("div");
  58656. cityClass.setAttribute("class", "component-citytabpag__py-key");
  58657. cityClass.innerHTML = key;
  58658. city.appendChild(cityClass);
  58659. const cityContent = document.createElement("div");
  58660. cityContent.setAttribute("class", "component-citytabpag__content");
  58661. for (let i = 0; i < cities.length; i++) {
  58662. let span = document.createElement("span");
  58663. span.innerHTML = cities[i];
  58664. cityContent.appendChild(span);
  58665. }
  58666. //HOT 元素长度单独微调:
  58667. if (key === "HOT") {
  58668. cityContent.style.width = "428px";
  58669. }
  58670. city.appendChild(cityContent);
  58671. this.content.appendChild(city);
  58672. }
  58673. }
  58674. SuperMap.Components.CityTabsPage = CityTabsPage_CityTabsPage;
  58675. // CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  58676. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58677. * This program are made available under the terms of the Apache License, Version 2.0
  58678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58679. /**
  58680. * @class SuperMap.Components.NavTabsPage
  58681. * @classdesc 标签页面组件。
  58682. * @version 9.1.1
  58683. * @param {Object} options - 组件配置参数。
  58684. * @param {string} optionsArr.id - 组件 dom 元素 id。
  58685. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  58686. * @extends {SuperMap.Components.TemplateBase}
  58687. * @category Components Common
  58688. */
  58689. // todo 思考拆分的控件应该以哪种方式使用
  58690. class NavTabsPage_NavTabsPage extends TemplateBase {
  58691. constructor(options) {
  58692. super(options);
  58693. this.navTabsTitle = null;
  58694. this.navTabsContent = null;
  58695. options.tabs = options.tabs ? options.tabs : [];
  58696. this._initView(options.tabs);
  58697. }
  58698. /**
  58699. * @override
  58700. * @private
  58701. */
  58702. _initView(tabs) {
  58703. const navTabsPage = document.createElement("div");
  58704. navTabsPage.setAttribute("class", "component-navtabspage");
  58705. //关闭按钮
  58706. const closeBtn = document.createElement("span");
  58707. closeBtn.setAttribute("class", "supermapol-icons-close");
  58708. closeBtn.onclick = this.closeView.bind(this);
  58709. navTabsPage.appendChild(closeBtn);
  58710. //标签
  58711. const navTabsTitle = document.createElement("div");
  58712. this.navTabsTitle = navTabsTitle;
  58713. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  58714. navTabsPage.appendChild(navTabsTitle);
  58715. //内容
  58716. const navTabsContent = document.createElement("div");
  58717. this.navTabsContent = navTabsContent;
  58718. navTabsContent.setAttribute("class", "component-navtabspage__content");
  58719. navTabsPage.appendChild(navTabsContent);
  58720. //若 tabs 初始传入值,则
  58721. if (tabs.length > 0) {
  58722. this.appendTabs(tabs);
  58723. }
  58724. this.rootContainer = navTabsPage;
  58725. }
  58726. /**
  58727. * @function SuperMap.Components.NavTabsPage.prototype.setTabs
  58728. * @description 设置标签。
  58729. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  58730. */
  58731. setTabs(tabs) {
  58732. this.removeAllTabs();
  58733. this.appendTabs(tabs);
  58734. }
  58735. /**
  58736. * @function SuperMap.Components.NavTabsPage.prototype.appendTabs
  58737. * @description 添加标签页面。
  58738. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  58739. */
  58740. appendTabs(tabs) {
  58741. for (let i = 0; i < tabs.length; i++) {
  58742. let title = document.createElement("span");
  58743. title.index = i;
  58744. title.appendChild(document.createTextNode(tabs[i].title));
  58745. //绑定标签切换对应页面:
  58746. title.onclick = this._changeTabsPage.bind(this);
  58747. let content = tabs[i].content;
  58748. content.index = i;
  58749. content.hidden = true;
  58750. this.navTabsTitle.appendChild(title);
  58751. this.navTabsContent.appendChild(content);
  58752. }
  58753. //todo 确认是否两个子元素的 index 相互对应
  58754. //默认显示第一个标签对象
  58755. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  58756. this.navTabsContent.firstChild.hidden = false;
  58757. }
  58758. /**
  58759. * @function SuperMap.Components.NavTabsPage.prototype.removeTab
  58760. * @description 删除某个标签页面。
  58761. * @param {number} index - 标签索引号。
  58762. */
  58763. removeTab(index) {
  58764. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  58765. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  58766. }
  58767. /**
  58768. * @function SuperMap.Components.NavTabsPage.prototype.removeAllTabs
  58769. * @description 删除所有标签。
  58770. */
  58771. removeAllTabs() {
  58772. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  58773. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  58774. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  58775. }
  58776. }
  58777. _changeTabsPage(e) {
  58778. const index = e.target.index;
  58779. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  58780. this.navTabsTitle.children[i].setAttribute("class", "");
  58781. this.navTabsContent.children[i].hidden = true;
  58782. if (i === index) {
  58783. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  58784. this.navTabsContent.children[i].hidden = false;
  58785. }
  58786. }
  58787. }
  58788. }
  58789. SuperMap.Components.NavTabsPage = NavTabsPage_NavTabsPage;
  58790. // CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  58791. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  58792. * This program are made available under the terms of the Apache License, Version 2.0
  58793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58794. /**
  58795. * @class SuperMap.Components.PaginationContainer
  58796. * @classdesc 分页组件模板。
  58797. * @version 9.1.1
  58798. * @param {Object} options - 组件配置参数。
  58799. * @param {string} optionsArr.id - 组件 dom 元素 id。
  58800. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  58801. * @param {number} options.pageCounts - 页数。
  58802. * @extends {SuperMap.Components.TemplateBase}
  58803. * @category Components Common
  58804. */
  58805. class PaginationContainer_PaginationContainer extends TemplateBase {
  58806. constructor(options) {
  58807. options = options ? options : {};
  58808. super(options);
  58809. this.currentPage = 0;
  58810. this.pageNumberLis = [];
  58811. this.currentPageNumberLis = [];
  58812. this.linkageEvent = null;
  58813. options.contents = options.contents ? options.contents : null;
  58814. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  58815. this._initView(options.contents, options.pageCounts);
  58816. }
  58817. /**
  58818. * @function SuperMap.Components.PaginationContainer.prototype.setLinkageEvent
  58819. * @description 设置页面联动方法。
  58820. * @param {function} linkageEvent - 联动方法,实现指定功能。
  58821. */
  58822. setLinkageEvent(linkageEvent) {
  58823. this.linkageEvent = linkageEvent;
  58824. }
  58825. /**
  58826. * @private
  58827. * @override
  58828. */
  58829. _initView(contents, pageCounts) {
  58830. const container = document.createElement("div");
  58831. container.setAttribute("class", "component-pagination");
  58832. //content
  58833. const content = document.createElement("div");
  58834. content.setAttribute("class", "component-pagination__content");
  58835. container.appendChild(content);
  58836. this.content = content;
  58837. //link
  58838. const link = document.createElement("ul");
  58839. link.setAttribute("class", "component-pagination__link");
  58840. link.onclick = this._changePageEvent.bind(this);
  58841. container.appendChild(link);
  58842. this._createLink(link);
  58843. this.link = link;
  58844. //填充内容:
  58845. if (contents) {
  58846. this.setContent(contents);
  58847. }
  58848. if (pageCounts !== 0) {
  58849. this.setPageLink(pageCounts);
  58850. }
  58851. this.rootContainer = container;
  58852. }
  58853. /**---------以下是页面相关操作 **/
  58854. /**
  58855. * @function SuperMap.Components.PaginationContainer.prototype.setContent
  58856. * @description 设置页面内容。
  58857. * @param {Element} element - 页面内容元素。
  58858. */
  58859. setContent(element) {
  58860. this.clearContent();
  58861. this.appendContent(element);
  58862. }
  58863. /**
  58864. * @function SuperMap.Components.PaginationContainer.prototype.appendContent
  58865. * @description 追加内容。
  58866. * @param {Element} element - 页面内容元素。
  58867. */
  58868. appendContent(element) {
  58869. this.content.appendChild(element);
  58870. }
  58871. /**
  58872. * @function SuperMap.Components.PaginationContainer.prototype.clearContent
  58873. * @description 清空内容元素。
  58874. */
  58875. clearContent() {
  58876. for (let i = this.content.children.length - 1; i >= 0; i--) {
  58877. this.content.removeChild(this.content.children[i]);
  58878. }
  58879. }
  58880. /** -----以下是页码相关的操作:**/
  58881. /**
  58882. * @function SuperMap.Components.PaginationContainer.prototype.setPageLink
  58883. * @description 设置页码数。
  58884. * @param {number} pageNumber - 页码数。
  58885. */
  58886. setPageLink(pageNumber) {
  58887. //清空当前页码
  58888. this.pageNumberLis = [];
  58889. this.currentPageNumberLis = [];
  58890. this.clearPageLink();
  58891. //创建页码
  58892. this._createPageLi(pageNumber);
  58893. //添加页码到页码列表
  58894. this._appendPageLink();
  58895. }
  58896. /**
  58897. * @description 创建页码。
  58898. * @param pageNumber
  58899. * @private
  58900. */
  58901. _createPageLi(pageNumber) {
  58902. for (let i = 0; i < pageNumber; i++) {
  58903. const pageLi = document.createElement("li");
  58904. pageLi.innerHTML = i + 1;
  58905. /*const liContent = document.createElement("span");
  58906. liContent.innerHTML = i + 1;*/
  58907. // pageLi.appendChild(liContent);
  58908. this.pageNumberLis.push(pageLi);
  58909. }
  58910. this.pageNumberLis[0].setAttribute("class", "active");
  58911. this.currentPage = 1;
  58912. if (pageNumber < 5) {
  58913. this.currentPageNumberLis = this.pageNumberLis;
  58914. } else {
  58915. for (let i = 0; i < 5; i++) {
  58916. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  58917. }
  58918. }
  58919. }
  58920. /**
  58921. * @description 添加页码到页码列表。
  58922. * @private
  58923. */
  58924. _appendPageLink() {
  58925. //todo 如何插入中间
  58926. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  58927. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  58928. }
  58929. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  58930. //清空 active 状态
  58931. this.currentPageNumberLis[i].setAttribute("class", "");
  58932. //给当前选中的 li 赋值 active 状态
  58933. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  58934. this.currentPageNumberLis[i].setAttribute("class", "active");
  58935. }
  58936. }
  58937. //根据 currentPage 改变按钮状态
  58938. this._changeDisableState();
  58939. if (this.linkageEvent) {
  58940. this.linkageEvent(this.currentPage);
  58941. }
  58942. }
  58943. /**
  58944. * @function SuperMap.Components.PaginationContainer.prototype.clearPageLink
  58945. * @description 清除页码列表。
  58946. */
  58947. clearPageLink() {
  58948. for (let i = this.link.children.length - 3; i > 1; i--) {
  58949. this.link.removeChild(this.link.children[i]);
  58950. }
  58951. }
  58952. /**
  58953. * @description 创建页码按钮。
  58954. * @param ul
  58955. * @private
  58956. */
  58957. _createLink(ul) {
  58958. for (let i = 0; i < 4; i++) {
  58959. const li = document.createElement("li");
  58960. li.setAttribute("class", "disable");
  58961. const liContent = document.createElement("span");
  58962. li.appendChild(liContent);
  58963. if (i === 0) {
  58964. liContent.id = "first";
  58965. liContent.setAttribute("class", "supermapol-icons-first");
  58966. } else if (i === 1) {
  58967. liContent.id = "prev";
  58968. liContent.setAttribute("class", "supermapol-icons-prev");
  58969. } else if (i === 2) {
  58970. liContent.id = "next";
  58971. liContent.setAttribute("class", "supermapol-icons-next");
  58972. } else if (i === 3) {
  58973. liContent.id = "last";
  58974. liContent.setAttribute("class", "supermapol-icons-last");
  58975. }
  58976. ul.appendChild(li);
  58977. }
  58978. }
  58979. /**
  58980. * @description 点击页码事件。
  58981. * @param e
  58982. * @private
  58983. */
  58984. _changePageEvent(e) {
  58985. //todo
  58986. const trigger = e.target;
  58987. //若列表禁用,点击无效
  58988. if (trigger.parentElement.classList[0] === "disable") {
  58989. return;
  58990. }
  58991. let targetLi;
  58992. if (trigger.id) {
  58993. targetLi = trigger.id;
  58994. } else if (Number(trigger.innerHTML)) {
  58995. targetLi = Number(trigger.innerHTML);
  58996. } else {
  58997. return;
  58998. }
  58999. //页码预处理:
  59000. this._prePageNum(targetLi);
  59001. //根据 currentPageNumberLis 创建页码列表
  59002. this.clearPageLink();
  59003. this._appendPageLink();
  59004. }
  59005. /**
  59006. * @description 根据 currentPage 改变按钮状态。
  59007. * @private
  59008. */
  59009. _changeDisableState() {
  59010. this.link.children[0].setAttribute("class", "");
  59011. this.link.children[1].setAttribute("class", "");
  59012. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  59013. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  59014. if (this.currentPage === 1) {
  59015. this.link.children[0].setAttribute("class", "disable");
  59016. this.link.children[1].setAttribute("class", "disable");
  59017. }
  59018. if (this.currentPage === this.pageNumberLis.length) {
  59019. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  59020. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  59021. }
  59022. }
  59023. /**
  59024. * @description 根据点击页码列表事件准备需展现的页码列表。
  59025. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  59026. * @private
  59027. */
  59028. _prePageNum(targetLi) {
  59029. const currentPageNumberLis = [];
  59030. if (targetLi === "first") {
  59031. this.currentPage = 1;
  59032. } else if (targetLi === "last") {
  59033. this.currentPage = this.pageNumberLis.length;
  59034. } else if (targetLi === "prev") {
  59035. this.currentPage = this.currentPage - 1;
  59036. } else if (targetLi === "next") {
  59037. this.currentPage = this.currentPage + 1;
  59038. } else {
  59039. this.currentPage = targetLi;
  59040. }
  59041. if (this.pageNumberLis.length <= 5) {
  59042. for (let i = 0; i < this.pageNumberLis.length; i++) {
  59043. currentPageNumberLis.push(this.pageNumberLis[i]);
  59044. }
  59045. } else {
  59046. //当前点击前三,都取前五
  59047. if (this.currentPage <= 3) {
  59048. for (let i = 0; i < 5; i++) {
  59049. currentPageNumberLis.push(this.pageNumberLis[i]);
  59050. }
  59051. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  59052. //点击后三,都取后5
  59053. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  59054. currentPageNumberLis.push(this.pageNumberLis[i]);
  59055. }
  59056. } else {
  59057. //其他,取中间:
  59058. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  59059. currentPageNumberLis.push(this.pageNumberLis[i]);
  59060. }
  59061. }
  59062. }
  59063. if (currentPageNumberLis.length > 0) {
  59064. this.currentPageNumberLis = currentPageNumberLis;
  59065. }
  59066. }
  59067. }
  59068. SuperMap.Components.PaginationContainer = PaginationContainer_PaginationContainer;
  59069. // CONCATENATED MODULE: ./src/common/components/util/Util.js
  59070. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59071. * This program are made available under the terms of the Apache License, Version 2.0
  59072. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59073. let ComponentsUtil = {
  59074. /**
  59075. * 获取上传文件类型
  59076. * @param fileName
  59077. */
  59078. getFileType(fileName) {
  59079. let regCSV = /^.*\.(?:csv)$/i;
  59080. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  59081. let regGeojson = /^.*\.(?:geojson|json)$/i;
  59082. if (regExcel.test(fileName)) { //校验不通过
  59083. return FileTypes.EXCEL;
  59084. } else if (regCSV.test(fileName)) {
  59085. return FileTypes.CSV;
  59086. } else if (regGeojson.test(fileName)) {
  59087. return FileTypes.GEOJSON;
  59088. }
  59089. return null;
  59090. }
  59091. };
  59092. // CONCATENATED MODULE: ./src/common/components/util/index.js
  59093. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59094. * This program are made available under the terms of the Apache License, Version 2.0
  59095. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59096. // CONCATENATED MODULE: ./src/common/components/index.js
  59097. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59098. * This program are made available under the terms of the Apache License, Version 2.0
  59099. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59100. //数据
  59101. //组件
  59102. //提示框组件
  59103. //图表组件
  59104. //公用模板:
  59105. //工具类
  59106. // CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  59107. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59108. * This program are made available under the terms of the Apache License, Version 2.0
  59109. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59110. /**
  59111. * Namespace: SuperMap.Lang["en"]
  59112. * Dictionary for English. Keys for entries are used in calls to
  59113. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  59114. * strings formatted for use with <SuperMap.String.format> calls.
  59115. */
  59116. let en = {
  59117. 'title_dataFlowService': 'Data Flow Service',
  59118. 'title_distributedAnalysis': 'Distributed Analysis',
  59119. 'title_clientComputing': 'Client Computing',
  59120. 'title_dataServiceQuery': 'Data Service Query',
  59121. 'title_searchCity':'Search city',
  59122. 'title_searchLayer':' Search layer',
  59123. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  59124. 'text_displayFeaturesInfo': 'Display feature information',
  59125. 'text_subscribe': 'subscribe',
  59126. 'text_cancelSubscribe': 'unsubscribe',
  59127. 'text_densityAnalysis': 'Density Analysis',
  59128. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  59129. 'text_option_selectDataset':'Please select a dataset',
  59130. 'text_label_dataset': 'Dataset',
  59131. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  59132. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  59133. 'text_label_analyticalMethod': 'Analytical method',
  59134. 'text_option_quadrilateral': 'Quadrilateral',
  59135. 'text_option_hexagon': 'hexagon',
  59136. 'text_label_meshType': 'Mesh type',
  59137. 'text_option_notSet': 'Not set',
  59138. 'text_label_weightField': 'Weight field',
  59139. 'text_label_gridSizeInMeters': 'Grid size',
  59140. 'text_label_searchRadius': 'Search radius',
  59141. 'text_label_queryRange': 'Scope of analysis',
  59142. 'text_label_areaUnit': 'Area unit',
  59143. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  59144. 'text_option_logarithm': 'Logarithm',
  59145. 'text_option_equalCountingSegment': 'Equal counting segment',
  59146. 'text_option_squareRootSegmentation': 'Square root segmentation',
  59147. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  59148. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  59149. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  59150. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  59151. 'text_option_rainbowGradient': 'Rainbow gradient',
  59152. 'text_option_spectralGradient': 'Spectral gradient',
  59153. 'text_option_terrainGradient': 'Terrain gradient',
  59154. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  59155. 'text_label_resultLayerName': 'Result layer name',
  59156. 'text_chooseFile': 'Open File',
  59157. 'text_isoline': 'Isoline',
  59158. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  59159. 'text_buffer': 'Buffer',
  59160. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  59161. 'text_label_analysisLayer': 'Analysis layer',
  59162. 'text_label_extractField': 'Extract field',
  59163. 'text_label_extractedValue': 'Extracted value',
  59164. 'text_label_distanceAttenuation': 'Distance attenuation',
  59165. 'text_label_gridSize': 'gridSize',
  59166. 'text_label_bufferRadius': 'Buffer radius',
  59167. 'text_label_defaultkilometers': 'Default 10 kilometers',
  59168. 'text_label_kilometer': 'kilometer',
  59169. 'text_label_unit': 'unit',
  59170. 'text_retainOriginal': 'Retain original object field',
  59171. 'text_mergeBuffer': 'Merge buffer',
  59172. 'text_label_color': 'Color',
  59173. 'text_label_buffer': '[Buffer]',
  59174. 'text_label_isolines': '[Isolines]',
  59175. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  59176. 'text_label_queryModel': 'Query mode',
  59177. 'text_label_IDArrayOfFeatures': 'ID array of features',
  59178. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  59179. 'text_label_bufferDistance': 'Buffer distance',
  59180. 'text_label_queryRange1': 'Query range',
  59181. 'text_label_spatialQueryMode': 'Spatial query mode',
  59182. 'text_label_featureFilter': 'Feature filter',
  59183. 'text_label_geometricObject': 'Geometric object',
  59184. 'text_label_queryMode': 'Query mode',
  59185. 'text_label_searchTips': 'Search for city locations or layer features',
  59186. 'text_label_chooseSearchLayers': 'Select a query layer',
  59187. 'text_loadSearchCriteria': 'Load search criteria',
  59188. 'text_saveSearchCriteria': 'Save search criteria',
  59189. "btn_analyze": "Analyze",
  59190. "btn_analyzing": "Analyzing",
  59191. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  59192. "btn_cancelAnalysis": "Cancel",
  59193. "btn_query": "Query",
  59194. "btn_querying": "Querying",
  59195. "btn_emptyTheRresultLayer": "Clear all result layers",
  59196. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  59197. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  59198. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  59199. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  59200. 'msg_selectDataset': 'Please select a data set!',
  59201. 'msg_setTheWeightField': 'Please set the weight field!',
  59202. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  59203. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  59204. 'msg_openFileFail': 'Failed to open file!',
  59205. 'msg_fileTypeUnsupported': 'File format is not supported!',
  59206. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  59207. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  59208. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  59209. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  59210. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  59211. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  59212. 'msg_getFeatureField':"No related vector features found!",
  59213. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  59214. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  59215. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  59216. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  59217. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  59218. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  59219. 'msg_getdatafailed': 'Failed to get data!'
  59220. };
  59221. SuperMap.Lang['en-US'] = en;
  59222. // CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  59223. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59224. * This program are made available under the terms of the Apache License, Version 2.0
  59225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59226. /**
  59227. * Namespace: SuperMap.Lang["zh-CN"]
  59228. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  59229. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  59230. * strings formatted for use with <SuperMap.String.format> calls.
  59231. */
  59232. let zh = {
  59233. 'title_dataFlowService': '数据流服务',
  59234. 'title_distributedAnalysis': '分布式分析',
  59235. 'title_clientComputing': '客户端计算',
  59236. 'title_dataServiceQuery': '数据服务查询',
  59237. 'title_searchCity':'搜索城市',
  59238. 'title_searchLayer':'搜索图层',
  59239. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  59240. 'text_displayFeaturesInfo': '显示要素信息',
  59241. 'text_subscribe': '订阅',
  59242. 'text_cancelSubscribe': '取消订阅',
  59243. 'text_densityAnalysis': '密度分析',
  59244. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  59245. 'text_option_selectDataset':'请选择数据集',
  59246. 'text_label_dataset': '数据集',
  59247. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  59248. 'text_option_nuclearDensityAnalysis': '核密度分析',
  59249. 'text_label_analyticalMethod': '分析方法',
  59250. 'text_option_quadrilateral': '四边形',
  59251. 'text_option_hexagon': '六边形',
  59252. 'text_label_meshType': '网格面类型',
  59253. 'text_option_notSet': '未设置',
  59254. 'text_label_weightField': '权重字段',
  59255. 'text_label_gridSizeInMeters': '网格大小',
  59256. 'text_label_searchRadius': '搜索半径',
  59257. 'text_label_queryRange': '分析范围',
  59258. 'text_label_areaUnit': '面积单位',
  59259. 'text_option_equidistantSegmentation': '等距离分段',
  59260. 'text_option_logarithm': '对数',
  59261. 'text_option_equalCountingSegment': '等计数分段',
  59262. 'text_option_squareRootSegmentation': '平方根分段',
  59263. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  59264. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  59265. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  59266. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  59267. 'text_option_rainbowGradient': '彩虹渐变',
  59268. 'text_option_spectralGradient': '光谱渐变',
  59269. 'text_option_terrainGradient': '地形渐变',
  59270. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  59271. 'text_label_resultLayerName': '结果图层名称',
  59272. 'text_chooseFile': '选择文件',
  59273. 'text_isoline': '等值线',
  59274. 'text_extractDiscreteValue': '提取离散值生成曲线',
  59275. 'text_buffer': '缓冲区',
  59276. 'text_specifyTheDistance': '指定距离创建周边区域',
  59277. 'text_label_analysisLayer': '分析图层',
  59278. 'text_label_extractField': '提取字段',
  59279. 'text_label_extractedValue': '提取值',
  59280. 'text_label_distanceAttenuation': '距离衰减',
  59281. 'text_label_gridSize': '栅格大小',
  59282. 'text_label_bufferRadius': '缓冲半径',
  59283. 'text_label_defaultkilometers': '默认10千米',
  59284. 'text_option_kilometer': '千米',
  59285. 'text_label_unit': '单位',
  59286. 'text_retainOriginal': '保留原对象字段属性',
  59287. 'text_mergeBuffer': '合并缓冲区',
  59288. 'text_label_color': '颜色',
  59289. 'text_label_buffer': '[缓冲区]',
  59290. 'text_label_isolines': '[等值线]',
  59291. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  59292. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  59293. 'text_label_maxFeatures': '最多可返回的要素数量',
  59294. 'text_label_bufferDistance': '缓冲区距离',
  59295. 'text_label_queryRange1': '查询范围',
  59296. 'text_label_spatialQueryMode': '空间查询模式',
  59297. 'text_label_featureFilter': '要素过滤器',
  59298. 'text_label_geometricObject': '几何对象',
  59299. 'text_label_queryMode': '查询模式',
  59300. 'text_label_searchTips': '搜索城市地点或图层要素',
  59301. 'text_label_chooseSearchLayers': '选择查询图层',
  59302. 'text_loadSearchCriteria': '加载搜索条件',
  59303. 'text_saveSearchCriteria': '保存搜索条件',
  59304. "btn_analyze": "分析",
  59305. "btn_analyzing": "分析中",
  59306. "btn_emptyTheAnalysisLayer": "清空分析图层",
  59307. "btn_cancelAnalysis": "取消",
  59308. "btn_query": "查询",
  59309. "btn_querying": "查询中",
  59310. "btn_emptyTheRresultLayer": "清除所有结果图层",
  59311. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  59312. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  59313. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  59314. 'msg_selectDataset': '请选择数据集!',
  59315. 'msg_setTheWeightField': '请设置权重字段!',
  59316. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  59317. 'msg_resultIsEmpty': '分析的结果为空!',
  59318. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  59319. 'msg_openFileFail': '打开文件失败!',
  59320. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  59321. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  59322. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  59323. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  59324. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  59325. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  59326. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  59327. 'msg_getFeatureField':"未查找到相关矢量要素!",
  59328. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  59329. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  59330. 'msg_crsunsupport':'不支持当前地图的坐标系',
  59331. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  59332. 'msg_jsonResolveFiled': 'json格式解析失败!',
  59333. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  59334. 'msg_getdatafailed': '获取数据失败!'
  59335. };
  59336. SuperMap.Lang["zh-CN"] = zh;
  59337. // CONCATENATED MODULE: ./src/common/lang/index.js
  59338. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59339. * This program are made available under the terms of the Apache License, Version 2.0
  59340. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59341. // CONCATENATED MODULE: ./src/common/index.js
  59342. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59343. * This program are made available under the terms of the Apache License, Version 2.0
  59344. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59345. // EXTERNAL MODULE: external "mapboxgl"
  59346. var external_mapboxgl_ = __webpack_require__(0);
  59347. var external_mapboxgl_default = /*#__PURE__*/__webpack_require__.n(external_mapboxgl_);
  59348. // CONCATENATED MODULE: ./src/mapboxgl/core/MapExtend.js
  59349. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59350. * This program are made available under the terms of the Apache License, Version 2.0
  59351. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59352. /**
  59353. * @function mapboxgl.supermap.MapExtend
  59354. * @description 扩展了 mapboxgl.Map 对图层相关的操作。
  59355. * @private
  59356. */
  59357. var MapExtend = function () {
  59358. external_mapboxgl_default.a.Map.prototype.overlayLayersManager = {};
  59359. external_mapboxgl_default.a.Map.prototype.addLayerBak = external_mapboxgl_default.a.Map.prototype.addLayer;
  59360. external_mapboxgl_default.a.Map.prototype.addLayer = function (layer, before) {
  59361. if (layer.source || layer.type === 'custom' || layer.type === "background") {
  59362. this.addLayerBak(layer, before);
  59363. return this;
  59364. }
  59365. if (this.overlayLayersManager[layer.id] || this.style._layers[layer.id]) {
  59366. this.fire('error', {
  59367. error: new Error('A layer with this id already exists.')
  59368. });
  59369. return;
  59370. }
  59371. addLayer(layer, this);
  59372. this.overlayLayersManager[layer.id] = layer;
  59373. return this;
  59374. };
  59375. external_mapboxgl_default.a.Map.prototype.getLayer = function (id) {
  59376. if (this.overlayLayersManager[id]) {
  59377. return this.overlayLayersManager[id];
  59378. }
  59379. return this.style.getLayer(id);
  59380. };
  59381. external_mapboxgl_default.a.Map.prototype.moveLayer = function (id, beforeId) {
  59382. if (this.overlayLayersManager[id]) {
  59383. moveLayer(id, beforeId);
  59384. return this;
  59385. }
  59386. if (this.style._layers[id]) {
  59387. this.style.moveLayer(id, beforeId);
  59388. this._update(true);
  59389. return this;
  59390. }
  59391. };
  59392. external_mapboxgl_default.a.Map.prototype.removeLayer = function (id) {
  59393. if (this.overlayLayersManager[id]) {
  59394. removeLayer(this.overlayLayersManager[id]);
  59395. delete this.overlayLayersManager[id];
  59396. return this;
  59397. }
  59398. this.style.removeLayer(id);
  59399. this._update(true);
  59400. return this;
  59401. };
  59402. //目前扩展的overlayer,只支持显示或隐藏图层操作
  59403. external_mapboxgl_default.a.Map.prototype.setLayoutProperty = function (layerID, name, value) {
  59404. if (this.overlayLayersManager[layerID]) {
  59405. if (name === "visibility") {
  59406. if (value === "visible") {
  59407. value = true;
  59408. } else {
  59409. value = false;
  59410. }
  59411. setVisibility(this.overlayLayersManager[layerID], value);
  59412. this.style.fire('data', {dataType: 'style'});
  59413. }
  59414. return this;
  59415. }
  59416. this.style.setLayoutProperty(layerID, name, value);
  59417. this._update(true);
  59418. return this;
  59419. };
  59420. external_mapboxgl_default.a.Map.prototype.updateTransform = function (units, originX, originY, centerX, centerY, width, height) {
  59421. this.transform.units = units;
  59422. this.transform.latRange = [this._tileExtent[1], this._tileExtent[3]];
  59423. this.transform.lngRange = [this._tileExtent[0], this._tileExtent[2]];
  59424. var mercatorZfromAltitude = this.mercatorZfromAltitude;
  59425. external_mapboxgl_default.a.MercatorCoordinate.fromLngLat = function (lngLatLike, altitude) {
  59426. altitude = altitude || 0;
  59427. const lngLat = external_mapboxgl_default.a.LngLat.convert(lngLatLike);
  59428. return new external_mapboxgl_default.a.MercatorCoordinate(
  59429. (lngLat.lng - originX) / width,
  59430. (originY - lngLat.lat) / height,
  59431. mercatorZfromAltitude(altitude, lngLat.lat));
  59432. };
  59433. external_mapboxgl_default.a.MercatorCoordinate.prototype.toLngLat = function () {
  59434. return new external_mapboxgl_default.a.LngLat(
  59435. this.x * width + originX,
  59436. originY - this.y * height);
  59437. };
  59438. this.customConvertPoint = window.URL.createObjectURL(new Blob(['customConvertPoint = {projectX:function(x){return (x - ' + centerX + ') / ' + width + ' + 0.5},projectY:function(y){y = 0.5 - ((y - ' + centerY + ') / ' + height + ');return y < 0 ? 0 : y > 1 ? 1 : y;},toY:function(y){return (0.5-y)*' + height + '+' + centerY + ';}}'],{type:"text/javascript"}));
  59439. }
  59440. function addLayer(layer, map) {
  59441. layer.onAdd && layer.onAdd(map);
  59442. }
  59443. /**
  59444. * @function mapboxgl.supermap.MapExtend.prototype.removeFromMap
  59445. * @description 移除事件。
  59446. */
  59447. function removeLayer(layer) {
  59448. layer.removeFromMap && layer.removeFromMap();
  59449. }
  59450. /**
  59451. * @function mapboxgl.supermap.MapExtend.prototype.setVisibility
  59452. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  59453. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  59454. */
  59455. function setVisibility(layer, visibility) {
  59456. layer.setVisibility && layer.setVisibility(visibility);
  59457. }
  59458. /**
  59459. * @function mapboxgl.supermap.MapExtend.prototype.moveTo
  59460. * @description 将图层移动到某个图层之前。
  59461. * @param {string} layerID -待插入的图层 ID。
  59462. * @param {boolean} [beforeLayerID] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  59463. */
  59464. function moveLayer(layerID, beforeLayerID) {
  59465. var layer = document.getElementById(layerID);
  59466. // var beforeLayer;
  59467. if (beforeLayerID) {
  59468. var beforeLayer = document.getElementById(beforeLayerID);
  59469. if (!beforeLayer) {
  59470. external_mapboxgl_default.a.Evented.prototype.fire("error", {
  59471. error: new Error(`Layer with id "${beforeLayerID}" does not exist on this document.`)
  59472. });
  59473. }
  59474. }
  59475. if (layer && beforeLayer) {
  59476. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  59477. } else {
  59478. //当没有传入beforeLayerID ,则默认将图层移动到最上面
  59479. layer.parentNode.appendChild(layer);
  59480. }
  59481. }
  59482. }();
  59483. // CONCATENATED MODULE: ./src/mapboxgl/core/Base.js
  59484. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59485. * This program are made available under the terms of the Apache License, Version 2.0
  59486. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59487. /**
  59488. * SuperMap mapboxgl基类
  59489. * 定义命名空间
  59490. */
  59491. /**
  59492. * @namespace mapboxgl
  59493. * @category BaseTypes Namespace
  59494. */
  59495. /**
  59496. * @namespace mapboxgl.supermap
  59497. * @category BaseTypes Namespace
  59498. */
  59499. external_mapboxgl_default.a.supermap = external_mapboxgl_default.a.supermap || {};
  59500. // CONCATENATED MODULE: ./src/mapboxgl/control/Logo.js
  59501. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59502. * This program are made available under the terms of the Apache License, Version 2.0
  59503. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59504. /**
  59505. * @class mapboxgl.supermap.LogoControl
  59506. * @category Control
  59507. * @classdesc Logo 控件。默认不显示。
  59508. *
  59509. * @example
  59510. * (start code)
  59511. * map.addControl(new mapboxgl.supermap.LogoControl(),'bottom-right');
  59512. * (end)
  59513. * @param {Object} options - logo 控件配置项。
  59514. * @param {string} [options.imageUrl] - logo 图片地址。
  59515. * @param {string} [options.width] - logo 图片宽。
  59516. * @param {string} [options.height] - logo 图片高。
  59517. * @param {string} [options.link] - logo 图片跳转链接。
  59518. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  59519. */
  59520. class Logo_Logo {
  59521. constructor(options) {
  59522. //logo图片地址
  59523. this.imageUrl = null;
  59524. //跳转链接
  59525. this.link = null;
  59526. //logo图片宽
  59527. this.width = null;
  59528. //logo图片高
  59529. this.height = null;
  59530. //logo图片失效时显示文本
  59531. this.alt = "SuperMap iClient";
  59532. this._extend(this, options)
  59533. }
  59534. /**
  59535. * @function mapboxgl.supermap.LogoControl.prototype.onAdd
  59536. * @description 添加一个 logo。
  59537. * @returns {HTMLElement} 返回创建的 logo 元素。
  59538. */
  59539. onAdd(map) {
  59540. this._map = map;
  59541. this._container = document.createElement('div');
  59542. this._container.className = 'mapboxgl-ctrl iclient-logo';
  59543. this._container.style.marginTop = 0;
  59544. this._container.style.marginBottom = 0;
  59545. this._container.style.marginLeft = 0;
  59546. this._container.style.marginRight = 0;
  59547. var imgSrc = LogoBase64;
  59548. if (this.imageUrl) {
  59549. imgSrc = this.imageUrl;
  59550. }
  59551. var alt = this.alt;
  59552. var imageWidth = "94px";
  59553. var imageHeight = "29px";
  59554. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  59555. if (this.imageUrl) {
  59556. imageWidth = this.width;
  59557. imageHeight = this.height;
  59558. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  59559. if (!imageWidth || !imageHeight) {
  59560. styleSize = "";
  59561. }
  59562. }
  59563. var link = this.link || "https://iclient.supermap.io";
  59564. this._container.innerHTML = "<a href='" + link + "' target='_blank'>" +
  59565. "<img src=" + imgSrc + " alt='" + alt + "' style='" + styleSize + "margin-bottom: 2px'></a>";
  59566. this._createStyleSheet();
  59567. return this._container;
  59568. }
  59569. _createStyleSheet() {
  59570. var style = document.createElement('style');
  59571. style.type = 'text/css';
  59572. style.innerHTML = ".iclient-logo{" +
  59573. "margin:0 !important;" +
  59574. "}" +
  59575. ".iclient-logo a{" +
  59576. "border: none;" +
  59577. "display: block;" +
  59578. "height:31px;" +
  59579. "}" +
  59580. ".iclient-logo img{" +
  59581. "border: none;" +
  59582. "white-space: nowrap" +
  59583. "}";
  59584. document.getElementsByTagName('head')[0].appendChild(style);
  59585. }
  59586. _extend(dest) {
  59587. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  59588. var arg = Object.getOwnPropertyNames(arguments)[index];
  59589. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  59590. continue;
  59591. }
  59592. var obj = arguments[arg];
  59593. if (obj) {
  59594. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  59595. var key = Object.getOwnPropertyNames(obj)[j];
  59596. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  59597. continue;
  59598. }
  59599. dest[key] = obj[key];
  59600. }
  59601. }
  59602. }
  59603. return dest;
  59604. }
  59605. }
  59606. external_mapboxgl_default.a.supermap.LogoControl = Logo_Logo;
  59607. // CONCATENATED MODULE: ./src/mapboxgl/control/index.js
  59608. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59609. * This program are made available under the terms of the Apache License, Version 2.0
  59610. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59611. // CONCATENATED MODULE: ./src/mapboxgl/core/Util.js
  59612. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59613. * This program are made available under the terms of the Apache License, Version 2.0
  59614. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59615. /**
  59616. * @class mapboxgl.supermap.Util
  59617. * @category BaseTypes Util
  59618. * @classdesc 工具类。
  59619. */
  59620. class core_Util_Util {
  59621. /**
  59622. * @function mapboxgl.supermap.Util.toSuperMapGeometry
  59623. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  59624. * @param {GeoJSONObject} geoJSON - GeoJSON 对象。
  59625. * @returns {SuperMap.Geometry}
  59626. */
  59627. static toSuperMapGeometry(geoJSON) {
  59628. if (geoJSON && geoJSON.type) {
  59629. var format = new GeoJSON_GeoJSON();
  59630. var result = format.read(geoJSON, "FeatureCollection");
  59631. return result[0].geometry;
  59632. }
  59633. }
  59634. static toSuperMapBounds(bounds) {
  59635. if (this.isArray(bounds)) {
  59636. //左下右上
  59637. return new Bounds_Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  59638. }
  59639. return new Bounds_Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
  59640. }
  59641. static toSuperMapPoint(lnglat) {
  59642. //客户端可传入 geojson 对象 或者 mapboxgl lnglat 点对象,或者是点数组
  59643. if (this.isArray(lnglat)) {
  59644. return new Point_Point(lnglat[0], lnglat[1]);
  59645. } else if (lnglat.lng && lnglat.lat) {
  59646. return new Point_Point(lnglat.lng, lnglat.lat);
  59647. }
  59648. return new Point_Point(lnglat.geometry.coordinates[0], lnglat.geometry.coordinates[1]);
  59649. }
  59650. /**
  59651. * @function mapboxgl.supermap.Util.toSuperMapPolygon
  59652. * @description 将 Mapbox GL LngLatbounds 对象转为 SuperMap 几何图形。
  59653. * @param {Mapboxgl.LngLatbounds} lnglatBounds - Mapbox GL LngLatbounds对象。
  59654. * @returns {SuperMap.Geometry.Polygon}
  59655. */
  59656. static toSuperMapPolygon(lnglatBounds) {
  59657. const west = lnglatBounds.getWest();
  59658. const east = lnglatBounds.getEast();
  59659. const sourth = lnglatBounds.getSouth();
  59660. const north = lnglatBounds.getNorth();
  59661. return new Polygon_Polygon([
  59662. new LinearRing_LinearRing([
  59663. new Point_Point(west, sourth),
  59664. new Point_Point(east, sourth),
  59665. new Point_Point(east, north),
  59666. new Point_Point(west, north)
  59667. ])
  59668. ]);
  59669. }
  59670. /**
  59671. * @function mapboxgl.supermap.Util.isArray
  59672. * @description 判断是否为数组格式。
  59673. * @param {Object} obj - 待判断对象。
  59674. * @returns {boolean} 是否是数组。
  59675. */
  59676. static isArray(obj) {
  59677. return Object.prototype.toString.call(obj) == "[object Array]";
  59678. }
  59679. /**
  59680. * @function mapboxgl.supermap.Util.toGeoJSON
  59681. * @description 将传入对象转为 GeoJSON 格式。
  59682. * @param {Object} smObj - 待转参数。
  59683. */
  59684. static toGeoJSON(smObj) {
  59685. if (smObj) {
  59686. var format = new GeoJSON_GeoJSON();
  59687. return format.toGeoJSON(smObj);
  59688. }
  59689. }
  59690. /**
  59691. * @function mapboxgl.supermap.Util.toProcessingParam
  59692. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  59693. * @param {Array} points - Region 各个节点数组。
  59694. * @returns {Object} processing 服务裁剪、查询分析的分析参数。
  59695. */
  59696. static toProcessingParam(points) {
  59697. var geometryParam = {};
  59698. if (points.length < 1) {
  59699. geometryParam = "";
  59700. } else {
  59701. var results = [];
  59702. for (var i = 0; i < points.length; i++) {
  59703. var point = {};
  59704. point.x = points[i][0];
  59705. point.y = points[i][1];
  59706. results.push(point);
  59707. }
  59708. geometryParam.type = "REGION";
  59709. geometryParam.points = results;
  59710. }
  59711. return geometryParam;
  59712. }
  59713. /**
  59714. * @function mapboxgl.supermap.Util.extend
  59715. * @description 对象拷贝赋值。
  59716. * @param {Object} dest - 目标对象。
  59717. * @param {Object} arguments - 待拷贝的对象。
  59718. * @returns {Object} 赋值后的目标对象。
  59719. */
  59720. static extend(dest) {
  59721. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  59722. var arg = Object.getOwnPropertyNames(arguments)[index];
  59723. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  59724. continue;
  59725. }
  59726. var obj = arguments[arg];
  59727. if (obj) {
  59728. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  59729. var key = Object.getOwnPropertyNames(obj)[j];
  59730. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  59731. continue;
  59732. }
  59733. dest[key] = obj[key];
  59734. }
  59735. }
  59736. }
  59737. return dest;
  59738. }
  59739. /**
  59740. * 检测数据是否为number
  59741. * @param value 值,未知数据类型
  59742. * @returns {boolean}
  59743. */
  59744. static isNumber(value) {
  59745. if (value === "") {
  59746. return false;
  59747. }
  59748. let mdata = Number(value);
  59749. if (mdata === 0) {
  59750. return true;
  59751. }
  59752. return !isNaN(mdata);
  59753. }
  59754. static isString(str) {
  59755. return (typeof str === 'string') && str.constructor === String;
  59756. }
  59757. /**
  59758. * 随机生成id
  59759. * @param attr
  59760. * @returns {string}
  59761. */
  59762. static newGuid(attr) {
  59763. let len = attr || 32;
  59764. let guid = "";
  59765. for (let i = 1; i < len; i++) {
  59766. let n = Math.floor(Math.random() * 16.0).toString(16);
  59767. guid += n;
  59768. }
  59769. return guid;
  59770. }
  59771. /**
  59772. * @description 十六进制转 RGBA 格式。
  59773. * @param {Object} hex - 十六进制格式参数。
  59774. * @param {number} opacity -Alpha 参数。
  59775. * @returns {string} 生成的 RGBA 格式。
  59776. */
  59777. static hexToRgba(hex, opacity) {
  59778. var color = [],
  59779. rgba = [];
  59780. hex = hex.replace(/#/, "");
  59781. if (hex.length == 3) {
  59782. var tmp = [];
  59783. for (let i = 0; i < 3; i++) {
  59784. tmp.push(hex.charAt(i) + hex.charAt(i));
  59785. }
  59786. hex = tmp.join("");
  59787. }
  59788. for (let i = 0; i < 6; i += 2) {
  59789. color[i] = "0x" + hex.substr(i, 2);
  59790. rgba.push(parseInt(Number(color[i])));
  59791. }
  59792. rgba.push(opacity);
  59793. return "rgba(" + rgba.join(",") + ")";
  59794. }
  59795. /**
  59796. * @param {string} featureName 原始数据中的地名
  59797. * @param {string} fieldName 需要匹配的地名
  59798. * @returns {boolean} 是否匹配
  59799. */
  59800. static isMatchAdministrativeName(featureName, fieldName) {
  59801. if (this.isString(fieldName)) {
  59802. let shortName = featureName.substr(0, 2);
  59803. // 张家口市和张家界市 特殊处理
  59804. if (shortName === '张家') {
  59805. shortName = featureName.substr(0, 3);
  59806. }
  59807. return !!fieldName.match(new RegExp(shortName));
  59808. }
  59809. return false;
  59810. }
  59811. }
  59812. external_mapboxgl_default.a.supermap.Util = core_Util_Util;
  59813. // CONCATENATED MODULE: ./src/mapboxgl/core/index.js
  59814. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59815. * This program are made available under the terms of the Apache License, Version 2.0
  59816. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59817. // CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/ThemeFeature.js
  59818. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59819. * This program are made available under the terms of the Apache License, Version 2.0
  59820. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59821. /**
  59822. * @class mapboxgl.supermap.ThemeFeature
  59823. * @category Visualization Theme
  59824. * @classdesc 专题图要素类。
  59825. * @param {GeoJSONObject} geometry - 专题图要素几何对象。
  59826. * @param {Object} [attributes] - 几何对象属性。
  59827. */
  59828. class ThemeFeature_ThemeFeature {
  59829. constructor(geometry, attributes) {
  59830. this.geometry = geometry;
  59831. this.attributes = attributes;
  59832. }
  59833. /**
  59834. * @function mapboxgl.supermap.ThemeFeature.prototype.toFeature
  59835. * @description 转为矢量要素。
  59836. */
  59837. toFeature() {
  59838. var geometry = core_Util_Util.toSuperMapGeometry(this.geometry);
  59839. var points = [];
  59840. if (this.geometry instanceof external_mapboxgl_default.a.LngLat) {
  59841. points = [this.geometry.lng, this.geometry.lat];
  59842. } else if (this.geometry instanceof external_mapboxgl_default.a.Point) {
  59843. points = [this.geometry.x, this.geometry.y];
  59844. } else if (this.geometry.length === 3) {
  59845. geometry = new GeoText_GeoText(this.geometry[0], this.geometry[1], this.geometry[2]);
  59846. }
  59847. if (points.length > 1) {
  59848. geometry = new Point_Point(points[0], points[1]);
  59849. }
  59850. return new Vector_Vector(geometry, this.attributes);
  59851. }
  59852. }
  59853. external_mapboxgl_default.a.supermap.ThemeFeature = ThemeFeature_ThemeFeature;
  59854. // CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/ThemeLayer.js
  59855. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  59856. * This program are made available under the terms of the Apache License, Version 2.0
  59857. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59858. /**
  59859. * @class mapboxgl.supermap.ThemeLayer
  59860. * @category Visualization Theme
  59861. * @classdesc 专题图基类。
  59862. * @param {string} name - 专题图图层名。
  59863. * @param {Object} options -可选参数。
  59864. * @param {mapboxgl.Map} options.map - 当前 mapboxgl map 对象,将在下个版本弃用,请用 map.addLayer()方法添加图层。
  59865. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  59866. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  59867. * @param {boolean} [options.visibility=true] - 图层是否可见。
  59868. * @param {number} [options.opacity=1] - 图层透明度。
  59869. * @fires mapboxgl.supermap.ThemeLayer#changelayer
  59870. * @fires mapboxgl.supermap.ThemeLayer#featuresremoved
  59871. */
  59872. class ThemeLayer_Theme {
  59873. constructor(name, opt_options) {
  59874. var options = opt_options ? opt_options : {};
  59875. /**
  59876. * @member {string} mapboxgl.supermap.ThemeLayer.prototype.name
  59877. * @description 专题图图层名称。
  59878. */
  59879. this.name = name;
  59880. /**
  59881. * @member {string} [mapboxgl.supermap.ThemeLayer.prototype.id]
  59882. * @description 专题图图层 id。
  59883. */
  59884. this.id = options.id ? options.id : Util_Util.createUniqueID("themeLayer_");
  59885. /**
  59886. * @member {float} [mapboxgl.supermap.ThemeLayer.prototype.opacity=1]
  59887. * @description 图层透明度。
  59888. */
  59889. this.opacity = options.opacity ? options.opacity : 1;
  59890. /**
  59891. * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.visibility=true]
  59892. * @description 图层是否可见。
  59893. */
  59894. this.visibility = true;
  59895. /**
  59896. * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.loadWhileAnimating=true]
  59897. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为 false)。
  59898. */
  59899. this.loadWhileAnimating = options.loadWhileAnimating === undefined ? true : options.loadWhileAnimating;
  59900. /**
  59901. * @member {mapboxgl.Map} mapboxgl.supermap.ThemeLayer.prototype.map
  59902. * @description map 对象。
  59903. */
  59904. this.map = options.map ? options.map : null;
  59905. this.features = [];
  59906. this.TFEvents = [];
  59907. //todo 保留之前创建图层同时添加到图层的用法,在下个版本遗弃
  59908. if (this.map) {
  59909. this.map.addLayer(this);
  59910. }
  59911. }
  59912. /**
  59913. * @function mapboxgl.supermap.ThemeLayer.prototype.onAdd
  59914. * @description 向底图添加该图层。
  59915. */
  59916. onAdd(map) {
  59917. this.map = map;
  59918. this._createCanvasContainer();
  59919. //处理用户预先(在图层添加到 map 前)监听的事件
  59920. this.addTFEvents();
  59921. this.map.on('resize', this.resizeEvent.bind(this));
  59922. this.map.on('zoomstart', this.zoomStartEvent.bind(this));
  59923. this.map.on('zoomend', this.zoomEndEvent.bind(this));
  59924. this.map.on('rotatestart', this.rotateStartEvent.bind(this));
  59925. this.map.on('rotate', this.rotateEvent.bind(this));
  59926. this.map.on('rotateend', this.rotateEndEvent.bind(this));
  59927. this.map.on('dragend', this.dragEndEvent.bind(this));
  59928. this.map.on('movestart', this.moveStartEvent.bind(this));
  59929. this.map.on('move', this.moveEvent.bind(this));
  59930. this.map.on('moveend', this.moveEndEvent.bind(this));
  59931. this.map.on('remove', this.removeFromMap.bind(this));
  59932. this.refresh();
  59933. }
  59934. /**
  59935. * @function mapboxgl.supermap.HeatMapLayer.prototype.refresh
  59936. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  59937. */
  59938. refresh() {
  59939. if (this.features.length === 0) {
  59940. return;
  59941. }
  59942. if (this.map) {
  59943. this.redrawThematicFeatures(this.map.getBounds());
  59944. }
  59945. }
  59946. _createCanvasContainer() {
  59947. this.movingOffset = [0, 0];
  59948. this.mapContainer = this.map.getCanvasContainer();
  59949. this.div = document.createElement('div');
  59950. this.div.id = this.id;
  59951. this.div.style.position = 'absolute';
  59952. var container = this.map.getCanvasContainer();
  59953. var canvas = this.map.getCanvas();
  59954. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  59955. this.div.style.width = canvas.style.width;
  59956. this.div.style.height = canvas.style.height;
  59957. this.div.className = "themeLayer";
  59958. this.div.width = parseInt(canvas.width);
  59959. this.div.height = parseInt(canvas.height);
  59960. container.appendChild(this.div);
  59961. this.setOpacity(this.opacity);
  59962. this.levelRenderer = new LevelRenderer_LevelRenderer();
  59963. this.renderer = this.levelRenderer.init(this.div);
  59964. this.renderer.clear();
  59965. }
  59966. /**
  59967. * @function mapboxgl.supermap.ThemeLayer.prototype.destroyFeatures
  59968. * @description 销毁某个要素。
  59969. * @param {SuperMap.Feature.Vector} features - 将被销毁的要素。
  59970. */
  59971. destroyFeatures(features) {
  59972. var all = (features == undefined);
  59973. if (all) {
  59974. features = this.features;
  59975. }
  59976. if (features) {
  59977. this.removeFeatures(features);
  59978. for (var i = features.length - 1; i >= 0; i--) {
  59979. features[i].destroy();
  59980. }
  59981. }
  59982. }
  59983. /**
  59984. * @function mapboxgl.supermap.ThemeLayer.prototype.setVisibility
  59985. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  59986. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  59987. */
  59988. setVisibility(visibility) {
  59989. if (visibility !== this.visibility) {
  59990. this.visibility = visibility;
  59991. this.display(visibility);
  59992. this.redrawThematicFeatures(this.map.getBounds());
  59993. }
  59994. }
  59995. /**
  59996. * @function mapboxgl.supermap.ThemeLayer.prototype.display
  59997. * @description 临时隐藏或者显示图层。通过对 CSS 控制产生即时效果,重新渲染失效。一般用 setVisibility 方法来动态控制图层的显示和隐藏。
  59998. * @param {boolean} [display] - 是否显示图层。
  59999. */
  60000. display(display) {
  60001. this.div.style.display = display ? "block" : "none";
  60002. }
  60003. /**
  60004. * @function mapboxgl.supermap.ThemeLayer.prototype.setOpacity
  60005. * @description 设置图层的不透明度,取值[0-1]之间。
  60006. * @param {number} [opacity] - 不透明度。
  60007. */
  60008. setOpacity(opacity) {
  60009. if (opacity !== this.opacity) {
  60010. this.opacity = opacity;
  60011. var element = this.div;
  60012. Util_Util.modifyDOMElement(element, null, null, null,
  60013. null, null, null, opacity);
  60014. if (this.map !== null) {
  60015. /**
  60016. * @event mapboxgl.supermap.ThemeLayer#changelayer
  60017. * @description 图层属性改变之后触发。
  60018. * @property {Object} layer - 图层。
  60019. * @property {string} property - 被改变的属性。
  60020. */
  60021. external_mapboxgl_default.a.Evented.prototype.fire('changelayer', {layer: this, property: "opacity"});
  60022. }
  60023. }
  60024. }
  60025. /**
  60026. * @function mapboxgl.supermap.ThemeLayer.prototype.addFeatures
  60027. * @param {mapboxgl.supermap.ThemeFeature|SuperMap.ServerFeature|GeoJSONObject} features - 待添加要素。
  60028. * @description 抽象方法,可实例化子类必须实现此方法。向专题图图层中添加数据 ,
  60029. */
  60030. addFeatures(features) { // eslint-disable-line no-unused-vars
  60031. }
  60032. /**
  60033. * @function mapboxgl.supermap.ThemeLayer.prototype.removeFeatures
  60034. * @param {Array.<SuperMap.Feature.Vector>} features - 要删除 feature 的数组。
  60035. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  60036. * 参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature,
  60037. * 如果无法确定 feature 数组,则可以调用 removeAllFeatures 来删除所有 feature。
  60038. * 如果要删除的 feature 数组中的元素特别多,推荐使用 removeAllFeatures,
  60039. * 删除所有 feature 后再重新添加。这样效率会更高。
  60040. */
  60041. removeFeatures(features) {
  60042. if (!features || features.length === 0) {
  60043. return;
  60044. }
  60045. if (features === this.features) {
  60046. return this.removeAllFeatures();
  60047. }
  60048. if (!(Util_Util.isArray(features))) {
  60049. features = [features];
  60050. }
  60051. var featuresFailRemoved = [];
  60052. for (var i = features.length - 1; i >= 0; i--) {
  60053. var feature = features[i];
  60054. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  60055. //并将其放入未删除的数组中。
  60056. var findex = Util_Util.indexOf(this.features, feature);
  60057. if (findex === -1) {
  60058. featuresFailRemoved.push(feature);
  60059. continue;
  60060. }
  60061. this.features.splice(findex, 1);
  60062. }
  60063. var drawFeatures = [];
  60064. for (var hex = 0, len = this.features.length; hex < len; hex++) {
  60065. feature = this.features[hex];
  60066. drawFeatures.push(feature);
  60067. }
  60068. this.features = [];
  60069. this.addFeatures(drawFeatures);
  60070. //绘制专题要素
  60071. if (this.renderer) {
  60072. this.redrawThematicFeatures(this.map.getBounds());
  60073. }
  60074. var succeed = featuresFailRemoved.length == 0 ? true : false;
  60075. /**
  60076. * @event mapboxgl.supermap.ThemeLayer#featuresremoved
  60077. * @description 要素删除之后触发。
  60078. * @property {Array.<SuperMap.Feature.Vector>} features - 未被成功删除的要素。
  60079. * @property {boolean} succeed - 删除成功与否。
  60080. */
  60081. external_mapboxgl_default.a.Evented.prototype.fire("featuresremoved", {features: featuresFailRemoved, succeed: succeed});
  60082. }
  60083. /**
  60084. * @function mapboxgl.supermap.ThemeLayer.prototype.removeAllFeatures
  60085. * @description 清除当前图层所有的矢量要素。
  60086. */
  60087. removeAllFeatures() {
  60088. if (this.renderer) {
  60089. this.renderer.clear();
  60090. }
  60091. this.features = [];
  60092. external_mapboxgl_default.a.Evented.prototype.fire('featuresremoved', {features: [], succeed: true});
  60093. }
  60094. /**
  60095. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeatures
  60096. * @description 查看当前图层中的有效数据。
  60097. * @returns {SuperMap.Feature.Vector} 用户加入图层的有效数据。
  60098. */
  60099. getFeatures() {
  60100. var len = this.features.length;
  60101. var clonedFeatures = new Array(len);
  60102. for (var i = 0; i < len; ++i) {
  60103. clonedFeatures[i] = this.features[i];
  60104. }
  60105. return clonedFeatures;
  60106. }
  60107. /**
  60108. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeatureBy
  60109. * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,
  60110. * 返回此 feature(并且只返回第一个)。
  60111. * @param {string} property - feature 的某个属性名称。
  60112. * @param {string} value - property 所对应的值。
  60113. * @returns {SuperMap.Feature.Vector} 第一个匹配属性和值的矢量要素。
  60114. */
  60115. getFeatureBy(property, value) {
  60116. var feature = null;
  60117. for (var id in this.features) {
  60118. if (this.features[id][property] === value) {
  60119. feature = this.features[id];
  60120. break;
  60121. }
  60122. }
  60123. return feature;
  60124. }
  60125. /**
  60126. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeatureById
  60127. * @description 通过给定一个 id,返回对应的矢量要素。
  60128. * @param {string} featureId - 矢量要素的属性 id。
  60129. * @returns {SuperMap.Feature.Vector} 对应 id 的 feature,如果不存在则返回 null。
  60130. */
  60131. getFeatureById(featureId) {
  60132. return this.getFeatureBy('id', featureId);
  60133. }
  60134. /**
  60135. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeaturesByAttribute
  60136. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  60137. * @param {string} attrName - 属性的 key。
  60138. * @param {string} attrValue - 矢量要素的属性 id。
  60139. * @returns {Array.<SuperMap.Feature.Vector>} 一个匹配的 feature 数组。
  60140. */
  60141. getFeaturesByAttribute(attrName, attrValue) {
  60142. var feature,
  60143. foundFeatures = [];
  60144. for (var id in this.features) {
  60145. feature = this.features[id];
  60146. if (feature && feature.attributes) {
  60147. if (feature.attributes[attrName] === attrValue) {
  60148. foundFeatures.push(feature);
  60149. }
  60150. }
  60151. }
  60152. return foundFeatures;
  60153. }
  60154. /**
  60155. * @function mapboxgl.supermap.ThemeLayer.prototype.redrawThematicFeatures
  60156. * @description 抽象方法,可实例化子类必须实现此方法。重绘专题要素。
  60157. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  60158. */
  60159. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  60160. }
  60161. /**
  60162. * @function mapboxgl.supermap.ThemeLayer.prototype.on
  60163. * @description 添加专题要素事件监听。添加专题要素事件监听。
  60164. * @param {Event} event - 监听事件。
  60165. * @param {function} callback - 回调函数。
  60166. * @param {string} context - 信息。
  60167. */
  60168. on(event, callback, context) { // eslint-disable-line no-unused-vars
  60169. if (this.renderer) {
  60170. this.renderer.on(event, callback);
  60171. } else {
  60172. this.map.on(event, callback);
  60173. }
  60174. return this;
  60175. }
  60176. /**
  60177. * @function mapboxgl.supermap.ThemeLayer.prototype.off
  60178. * @description 移除专题要素事件监听。
  60179. * @param {Event} event - 监听事件。
  60180. * @param {function} callback - 回调函数。
  60181. * @param {string} context - 信息。
  60182. */
  60183. off(event, callback, context) { // eslint-disable-line no-unused-vars
  60184. var me = this;
  60185. if (me.renderer) {
  60186. me.renderer.off(event, callback);
  60187. } else {
  60188. this.map.off(event, callback);
  60189. }
  60190. return this;
  60191. }
  60192. /**
  60193. * @function mapboxgl.supermap.ThemeLayer.prototype.addTFEvents
  60194. * @description 将图层添加到地图上之前用户要求添加的事件监听添加到图层。
  60195. * @private
  60196. */
  60197. addTFEvents() {
  60198. var tfEs = this.TFEvents;
  60199. var len = tfEs.length;
  60200. for (var i = 0; i < len; i++) {
  60201. this.renderer.on(tfEs[i][0], tfEs[i][1]);
  60202. }
  60203. }
  60204. /**
  60205. * @function mapboxgl.supermap.ThemeLayer.prototype.getLocalXY
  60206. * @description 地理坐标转为像素坐标。
  60207. * @param {Object} [coordinate] - 坐标位置。
  60208. */
  60209. getLocalXY(coordinate) {
  60210. var pixelP, map = this.map;
  60211. if (coordinate instanceof Point_Point || coordinate instanceof GeoText_GeoText) {
  60212. let tempPoint = map.project(new external_mapboxgl_default.a.LngLat(coordinate.x, coordinate.y));
  60213. pixelP = [tempPoint.x, tempPoint.y];
  60214. }
  60215. if (coordinate instanceof LonLat_LonLat) {
  60216. let tempPoint = map.project(new external_mapboxgl_default.a.LngLat(coordinate.lon, coordinate.lat));
  60217. pixelP = [tempPoint.x, tempPoint.y];
  60218. }
  60219. return pixelP;
  60220. }
  60221. /**
  60222. * @function mapboxgl.supermap.ThemeLayer.prototype.toFeature
  60223. * @description 转为 iClient 要素。
  60224. * @param {mapboxgl.supermap.ThemeFeature|GeoJSONObject} features - 待转要素。
  60225. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素。
  60226. */
  60227. toiClientFeature(features) {
  60228. if (!Util_Util.isArray(features)) {
  60229. features = [features];
  60230. }
  60231. let featuresTemp = [];
  60232. for (let i = 0; i < features.length; i++) {
  60233. //mapboxgl.supermap.ThemeFeature 类型
  60234. if (features[i] instanceof ThemeFeature_ThemeFeature) {
  60235. featuresTemp.push(features[i].toFeature());
  60236. } else if (features[i] instanceof Vector_Vector) {
  60237. // 若是 GeometryVector 直接返回
  60238. featuresTemp.push(features[i]);
  60239. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  60240. //GeoJSON 规范数据类型
  60241. let format = new GeoJSON_GeoJSON();
  60242. featuresTemp = featuresTemp.concat(format.read(features[i]));
  60243. } else if (features[i].geometry && features[i].geometry.parts) {
  60244. //iServer服务器返回数据格式
  60245. featuresTemp.push(ServerFeature_ServerFeature.fromJson(features[i]).toFeature());
  60246. } else {
  60247. throw new Error(`features's type is not be supported.`);
  60248. }
  60249. }
  60250. return featuresTemp;
  60251. }
  60252. /**
  60253. * @function mapboxgl.supermap.ThemeLayer.prototype.toFeature
  60254. * @deprecated
  60255. * @description 转为 iClient 要素,该方法将被弃用,由 {@link mapboxgl.supermap.ThemeLayer#toiClientFeature} 代替。
  60256. * @param {mapboxgl.supermap.ThemeFeature|GeoJSONObject} features - 待转要素。
  60257. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素。
  60258. */
  60259. toFeature(features) {
  60260. return this.toiClientFeature(features);
  60261. }
  60262. moveEndEvent() {
  60263. if (this.loadWhileAnimating || !this.visibility) {
  60264. return;
  60265. }
  60266. this.div.style.transform = '';
  60267. this.redrawThematicFeatures(this.map.getBounds());
  60268. this._show();
  60269. }
  60270. moveStartEvent() {
  60271. if (this.loadWhileAnimating || !this.visibility) {
  60272. return;
  60273. }
  60274. this.startPitch = this.map.getPitch();
  60275. this.startBearing = this.map.getBearing();
  60276. var startMovePoint = this.map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  60277. this.startMoveX = startMovePoint.x;
  60278. this.startMoveY = startMovePoint.y;
  60279. }
  60280. moveEvent() {
  60281. if (this.loadWhileAnimating || !this.visibility) {
  60282. this.redrawThematicFeatures(this.map.getBounds());
  60283. return;
  60284. }
  60285. if (this.rotating || this.zooming) {
  60286. return;
  60287. }
  60288. if (this.map.getPitch() !== 0) {
  60289. this._hide();
  60290. }
  60291. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  60292. var tPitch = this.map.getPitch() - this.startPitch;
  60293. var tBearing = -this.map.getBearing() + this.startBearing;
  60294. var endMovePoint = this.map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  60295. var tMoveX = endMovePoint.x - this.startMoveX;
  60296. var tMoveY = endMovePoint.y - this.startMoveY;
  60297. this.div.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)' + ' translate3d(' + tMoveX + 'px, ' + tMoveY + 'px, 0px)';
  60298. }
  60299. zoomStartEvent() {
  60300. if (this.loadWhileAnimating || !this.visibility) {
  60301. return;
  60302. }
  60303. this.zooming = true;
  60304. this._hide();
  60305. }
  60306. zoomEndEvent() {
  60307. if (this.loadWhileAnimating || !this.visibility) {
  60308. return;
  60309. }
  60310. this.zooming = false;
  60311. this._show();
  60312. }
  60313. rotateStartEvent() {
  60314. if (this.loadWhileAnimating || !this.visibility) {
  60315. return;
  60316. }
  60317. this.rotating = true;
  60318. }
  60319. rotateEvent() {
  60320. if (this.loadWhileAnimating || !this.visibility) {
  60321. return;
  60322. }
  60323. if (this.map.getPitch() !== 0) {
  60324. this._hide();
  60325. }
  60326. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  60327. var tPitch = this.map.getPitch() - this.startPitch;
  60328. var tBearing = -this.map.getBearing() + this.startBearing;
  60329. this.div.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)'
  60330. }
  60331. rotateEndEvent() {
  60332. if (this.loadWhileAnimating || !this.visibility) {
  60333. return;
  60334. }
  60335. this.rotating = false;
  60336. this._show();
  60337. }
  60338. dragEndEvent() {
  60339. if (this.loadWhileAnimating || !this.visibility) {
  60340. return;
  60341. }
  60342. this._hide();
  60343. }
  60344. resizeEvent() {
  60345. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  60346. var canvas = this.map.getCanvas();
  60347. this.div.style.width = canvas.style.width;
  60348. this.div.style.height = canvas.style.height;
  60349. this.div.width = parseInt(canvas.width);
  60350. this.div.height = parseInt(canvas.height);
  60351. this.renderer.resize();
  60352. }
  60353. /**
  60354. * @function mapboxgl.supermap.ThemeLayer.prototype.removeFromMap
  60355. * @description 移除图层。
  60356. */
  60357. removeFromMap() {
  60358. this.mapContainer.removeChild(this.div);
  60359. this.removeAllFeatures();
  60360. }
  60361. /**
  60362. * @function mapboxgl.supermap.ThemeLayer.prototype.moveTo
  60363. * @description 将图层移动到某个图层之前。
  60364. * @param {string} layerID - 待插入的图层 ID。
  60365. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  60366. */
  60367. moveTo(layerID, before) {
  60368. const layer = document.getElementById(this.div.id);
  60369. before = before !== undefined ? before : true;
  60370. if (before) {
  60371. const beforeLayer = document.getElementById(layerID);
  60372. if (layer && beforeLayer) {
  60373. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  60374. }
  60375. return;
  60376. }
  60377. const nextLayer = document.getElementById(layerID);
  60378. if (layer) {
  60379. if (nextLayer.nextSibling) {
  60380. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  60381. return;
  60382. }
  60383. nextLayer.parentNode.appendChild(layer);
  60384. }
  60385. }
  60386. _hide() {
  60387. this.renderer.painter.root.style.display = 'none';
  60388. }
  60389. _show() {
  60390. this.renderer.painter.root.style.display = 'block';
  60391. }
  60392. }
  60393. external_mapboxgl_default.a.supermap.ThemeLayer = ThemeLayer_Theme;
  60394. // CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphThemeLayer.js
  60395. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  60396. * This program are made available under the terms of the Apache License, Version 2.0
  60397. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60398. /**
  60399. * @class mapboxgl.supermap.GraphThemeLayer
  60400. * @category Visualization Theme
  60401. * @classdesc 统计专题图层。
  60402. * @param {string} name - 图层名。
  60403. * @param {string} chartsType - 图表类别。
  60404. * @param {Object} opt_options - 参数。
  60405. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  60406. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  60407. * @param {mapboxgl.Map} opt_options.map - 当前mapboxgl map对象。
  60408. * @param {number} [opt_options.opacity=1] - 图层透明度。
  60409. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  60410. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  60411. * @param {string} [opt_options.chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  60412. * @param {Object} opt_options.chartsSetting - 符号 Circle 配置对象。
  60413. * @param {Array.<number>} opt_options.chartsSetting.codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  60414. * @param {number} [opt_options.chartsSetting.maxR] - 圆形的最大半径。
  60415. * @param {number} [opt_options.chartsSetting.minR] - 圆形的最小半径。
  60416. * @param {string} opt_options.chartsSetting.fillColor - 圆形的填充色,如:fillColor: "#FFB980"。
  60417. * @param {Object} opt_options.chartsSetting.circleStyle - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  60418. * @param {number} opt_options.chartsSetting.decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  60419. * @param {Object} opt_options.chartsSetting.circleHoverStyle - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  60420. * @param {boolean} [opt_options.chartsSetting.circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  60421. * @param {boolean} [opt_options.chartsSetting.circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  60422. * @extends {mapboxgl.supermap.ThemeLayer}
  60423. * @fires mapboxgl.supermap.GraphThemeLayer#beforefeaturesadded
  60424. */
  60425. class GraphThemeLayer_Graph extends ThemeLayer_Theme {
  60426. constructor(name, chartsType, opt_options) {
  60427. super(name, opt_options);
  60428. this.chartsSetting = opt_options.chartsSetting || {};
  60429. this.themeFields = opt_options.themeFields || null;
  60430. this.overlayWeightField = opt_options.overlayWeightField || null;
  60431. this.isOverLay = opt_options.isOverLay === undefined ? true : opt_options.isOverLay;
  60432. this.charts = opt_options.charts || [];
  60433. this.cache = opt_options.cache || {};
  60434. this.chartsType = chartsType;
  60435. }
  60436. /**
  60437. * @function mapboxgl.supermap.GraphThemeLayer.prototype.setChartsType
  60438. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。
  60439. * @param {string} [chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  60440. */
  60441. setChartsType(chartsType) {
  60442. this.chartsType = chartsType;
  60443. this.redraw();
  60444. }
  60445. /**
  60446. * @function mapboxgl.supermap.GraphThemeLayer.prototype.addFeatures
  60447. * @description 向专题图图层中添加数据,支持的 feature 类型为:iServer 返回的 feature JSON 对象。
  60448. * @param {SuperMap.ServerFeature} features - 待添加的要素。
  60449. */
  60450. addFeatures(features) {
  60451. /**
  60452. * @event mapboxgl.supermap.GraphThemeLayer#beforefeaturesadded
  60453. * @description 要素添加之前触发。
  60454. * @property {SuperMap.ServerFeature} features - 要被添加的要素。
  60455. */
  60456. var ret = external_mapboxgl_default.a.Evented.prototype.fire('beforefeaturesadded', {
  60457. features: features
  60458. });
  60459. if (ret === false) {
  60460. return;
  60461. }
  60462. //转换 features 形式
  60463. this.features = this.toiClientFeature(features);
  60464. //绘制专题要素
  60465. if (this.renderer) {
  60466. this.redrawThematicFeatures(this.map.getBounds());
  60467. }
  60468. }
  60469. /**
  60470. * @function mapboxgl.supermap.GraphThemeLayer.prototype.redrawThematicFeatures
  60471. * @description 重绘所有专题要素。
  60472. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  60473. * 地图漫游时调用此方法进行图层刷新。
  60474. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  60475. */
  60476. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  60477. this.clearCache();
  60478. //清除当前所有可视元素
  60479. this.renderer.clearAll();
  60480. var features = this.features;
  60481. for (var i = 0, len = features.length; i < len; i++) {
  60482. var feature = features[i];
  60483. // // 要素范围判断
  60484. // var feaBounds = feature.geometry.getBounds();
  60485. // //剔除当前视图(地理)范围以外的数据
  60486. // if (extent) {
  60487. // var bounds = new SuperMap.Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  60488. // // if (!bounds.intersectsBounds(feaBounds)) continue;
  60489. // }
  60490. var cache = this.cache;
  60491. // 用 feature id 做缓存标识
  60492. var cacheField = feature.id;
  60493. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  60494. if (cache[cacheField]) {
  60495. continue;
  60496. }
  60497. cache[cacheField] = cacheField;
  60498. var chart = this.createThematicFeature(feature);
  60499. // 压盖处理权重值
  60500. if (chart && this.overlayWeightField) {
  60501. if (feature.attributes[this.overlayWeightField] && !isNaN(feature.attributes[this.overlayWeightField])) {
  60502. chart["__overlayWeight"] = feature.attributes[this.overlayWeightField];
  60503. }
  60504. }
  60505. if (chart) {
  60506. this.charts.push(chart);
  60507. }
  60508. }
  60509. this.drawCharts();
  60510. }
  60511. /**
  60512. * @function mapboxgl.supermap.GraphThemeLayer.prototype.createThematicFeature
  60513. * @description 向专题图图层中添加数据, 支持的 feature 类型为:iServer 返回的 feature json 对象。
  60514. * @param {Object} feature - 待添加的要素。
  60515. *
  60516. */
  60517. createThematicFeature(feature) {
  60518. var thematicFeature;
  60519. // 检查图表创建条件并创建图形
  60520. if (feature_Theme_Theme[this.chartsType] && this.themeFields && this.chartsSetting) {
  60521. thematicFeature = new feature_Theme_Theme[this.chartsType](feature, this, this.themeFields, this.chartsSetting);
  60522. }
  60523. // thematicFeature 是否创建成功
  60524. if (!thematicFeature) {
  60525. return false;
  60526. }
  60527. // 对专题要素执行图形装载
  60528. thematicFeature.assembleShapes();
  60529. return thematicFeature;
  60530. }
  60531. /**
  60532. * @function mapboxgl.supermap.GraphThemeLayer.prototype.drawCharts
  60533. * @description 绘制图表。包含压盖处理。
  60534. *
  60535. */
  60536. drawCharts() {
  60537. // 判断 rendere r就绪
  60538. if (!this.renderer) {
  60539. return;
  60540. }
  60541. var charts = this.charts;
  60542. // 图表权重值处理des
  60543. if (this.overlayWeightField) {
  60544. charts.sort(function (cs, ce) {
  60545. if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  60546. return 0;
  60547. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  60548. return -1;
  60549. } else if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  60550. return 1;
  60551. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  60552. if (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) {
  60553. return 1;
  60554. } else {
  60555. return -1;
  60556. }
  60557. }
  60558. return 0;
  60559. });
  60560. }
  60561. // 不进行避让
  60562. if (!this.isOverLay) {
  60563. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  60564. var chart_m = charts[m];
  60565. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  60566. var shapeROP_m = chart_m.resetLocation();
  60567. // 添加图形
  60568. var shapes_m = chart_m.shapes;
  60569. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  60570. shapes_m[n].refOriginalPosition = shapeROP_m;
  60571. this.renderer.addShape(shapes_m[n]);
  60572. }
  60573. }
  60574. } else {
  60575. // 压盖判断所需 chartsBounds 集合
  60576. var chartsBounds = [];
  60577. //var extent = this.map.getBounds();
  60578. //var mapBounds = new Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  60579. // 获取地图像素 bounds
  60580. //var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  60581. //var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  60582. //var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  60583. // 压盖处理 & 添加图形
  60584. for (let i = 0, len = charts.length; i < len; i++) {
  60585. var chart = charts[i];
  60586. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  60587. var shapeROP = chart.resetLocation();
  60588. // 图表框
  60589. var cbs = chart.chartBounds;
  60590. var cBounds = [{
  60591. "x": cbs.left,
  60592. "y": cbs.top
  60593. }, {
  60594. "x": cbs.left,
  60595. "y": cbs.bottom
  60596. }, {
  60597. "x": cbs.right,
  60598. "y": cbs.bottom
  60599. }, {
  60600. "x": cbs.right,
  60601. "y": cbs.top
  60602. }, {
  60603. "x": cbs.left,
  60604. "y": cbs.top
  60605. }];
  60606. // // 地图范围外不绘制
  60607. // if (mBounds) {
  60608. // // if (!this.isChartInMap(mBounds, cBounds)) continue;
  60609. // }
  60610. // 是否压盖
  60611. var isOL = false;
  60612. if (i !== 0) {
  60613. for (let j = 0; j < chartsBounds.length; j++) {
  60614. //压盖判断
  60615. if (this.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  60616. isOL = true;
  60617. break;
  60618. }
  60619. }
  60620. }
  60621. if (isOL) {
  60622. continue;
  60623. } else {
  60624. chartsBounds.push(cBounds);
  60625. }
  60626. // 添加图形
  60627. var shapes = chart.shapes;
  60628. for (let j = 0, slen = shapes.length; j < slen; j++) {
  60629. shapes[j].refOriginalPosition = shapeROP;
  60630. this.renderer.addShape(shapes[j]);
  60631. }
  60632. }
  60633. }
  60634. // 绘制图形
  60635. this.renderer.render();
  60636. }
  60637. /**
  60638. * @function mapboxgl.supermap.GraphThemeLayer.prototype.getShapesByFeatureID
  60639. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  60640. * @param {number} featureID - 要素 ID。
  60641. */
  60642. getShapesByFeatureID(featureID) {
  60643. var list = [];
  60644. var shapeList = this.renderer.getAllShapes();
  60645. if (!featureID) {
  60646. return shapeList
  60647. }
  60648. for (var i = 0, len = shapeList.length; i < len; i++) {
  60649. var si = shapeList[i];
  60650. if (si.refDataID && featureID === si.refDataID) {
  60651. list.push(si);
  60652. }
  60653. }
  60654. return list;
  60655. }
  60656. /**
  60657. * @function mapboxgl.supermap.GraphThemeLayer.prototype.isQuadrilateralOverLap
  60658. * @description 判断两个四边形是否有压盖。
  60659. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  60660. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  60661. */
  60662. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  60663. var quadLen = quadrilateral.length,
  60664. quad2Len = quadrilateral2.length;
  60665. if (quadLen !== 5 || quad2Len !== 5) {
  60666. return null;
  60667. } //不是四边形
  60668. var OverLap = false;
  60669. //如果两四边形互不包含对方的节点,则两个四边形不相交
  60670. for (let i = 0; i < quadLen; i++) {
  60671. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  60672. OverLap = true;
  60673. break;
  60674. }
  60675. }
  60676. for (let i = 0; i < quad2Len; i++) {
  60677. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  60678. OverLap = true;
  60679. break;
  60680. }
  60681. }
  60682. //加上两矩形十字相交的情况
  60683. for (let i = 0; i < quadLen - 1; i++) {
  60684. if (OverLap) {
  60685. break;
  60686. }
  60687. for (let j = 0; j < quad2Len - 1; j++) {
  60688. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  60689. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  60690. OverLap = true;
  60691. break;
  60692. }
  60693. }
  60694. }
  60695. return OverLap;
  60696. }
  60697. /**
  60698. * @function mapboxgl.supermap.GraphThemeLayer.prototype.isPointInPoly
  60699. * @description 判断一个点是否在多边形里面。(射线法)
  60700. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x (横坐标),属性 y (纵坐标)。
  60701. * @param {Array.<Object>} poly - 多边形节点数组。
  60702. */
  60703. isPointInPoly(pt, poly) {
  60704. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  60705. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  60706. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  60707. (isIn = !isIn);
  60708. }
  60709. return isIn;
  60710. }
  60711. /**
  60712. * @function mapboxgl.supermap.GraphThemeLayer.prototype.isChartInMap
  60713. * @description 判断图表是否在地图里。
  60714. * @param {SuperMap.Bounds} mapPxBounds - 地图像素范围。
  60715. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  60716. */
  60717. isChartInMap(mapPxBounds, chartPxBounds) {
  60718. var mb = mapPxBounds;
  60719. var isIn = false;
  60720. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  60721. var cb = chartPxBounds[i];
  60722. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  60723. isIn = true;
  60724. break;
  60725. }
  60726. }
  60727. return isIn;
  60728. }
  60729. /**
  60730. * @function mapboxgl.supermap.GraphThemeLayer.prototype.clearCache
  60731. * @description 清除缓存
  60732. */
  60733. clearCache() {
  60734. this.cache = {};
  60735. this.charts = [];
  60736. }
  60737. /**
  60738. * @function mapboxgl.supermap.GraphThemeLayer.prototype.removeFeatures
  60739. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  60740. * @param {SuperMap.Feature.Vector} features - 要删除的要素。
  60741. */
  60742. removeFeatures(features) {
  60743. this.clearCache();
  60744. super.removeFeatures(features);
  60745. }
  60746. /**
  60747. * @function mapboxgl.supermap.GraphThemeLayer.prototype.removeAllFeatures
  60748. * @description 移除所有的要素。
  60749. */
  60750. removeAllFeatures() {
  60751. this.clearCache();
  60752. super.removeAllFeatures();
  60753. }
  60754. /**
  60755. * @function mapboxgl.supermap.GraphThemeLayer.prototype.redraw
  60756. * @description 重绘该图层。
  60757. */
  60758. redraw() {
  60759. this.clearCache();
  60760. if (this.renderer) {
  60761. this.redrawThematicFeatures(this.map.getBounds());
  60762. return true;
  60763. }
  60764. return false
  60765. }
  60766. /**
  60767. * @function mapboxgl.supermap.GraphThemeLayer.prototype.clear
  60768. * @description 清除的内容包括数据(features) 、专题要素、缓存。
  60769. */
  60770. clear() {
  60771. if (this.renderer) {
  60772. this.renderer.clearAll();
  60773. this.renderer.refresh();
  60774. }
  60775. this.removeAllFeatures();
  60776. this.clearCache();
  60777. }
  60778. }
  60779. external_mapboxgl_default.a.supermap.GraphThemeLayer = GraphThemeLayer_Graph;
  60780. // CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/GeoFeatureThemeLayer.js
  60781. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  60782. * This program are made available under the terms of the Apache License, Version 2.0
  60783. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60784. /**
  60785. * @class mapboxgl.supermap.GeoFeatureThemeLayer
  60786. * @category Visualization Theme
  60787. * @classdesc 地理几何专题要素型专题图层。
  60788. * @param {string} name - 图层名。
  60789. * @param {Object} opt_options - 参数。
  60790. * @param {mapboxgl.Map} opt_options.map - 当前 mapboxgl map 对象。
  60791. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  60792. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  60793. * @param {number} [opt_options.nodesClipPixel=2] - 节点抽稀像素距离。
  60794. * @param {boolean} [opt_options.isHoverAble=false] - 图形是否在 hover 时高亮。
  60795. * @param {boolean} [opt_options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  60796. * @param {boolean} [opt_options.isClickAble=true] - 图形是否可点击。
  60797. * @param {boolean} [opt_options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  60798. * 禁止对专题要素使用数据(feature)的 style。
  60799. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  60800. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  60801. * @param {number} [opt_options.opacity=1] - 图层透明度。
  60802. * @extends {mapboxgl.supermap.ThemeLayer}
  60803. * @fires mapboxgl.supermap.GeoFeatureThemeLayer#beforefeaturesadded
  60804. */
  60805. class GeoFeatureThemeLayer_GeoFeature extends ThemeLayer_Theme {
  60806. constructor(name, opt_options) {
  60807. super(name, opt_options);
  60808. /**
  60809. * @member {string} mapboxgl.supermap.GeoFeatureThemeLayer.prototype.name
  60810. * @description 专题图图层名称。
  60811. */
  60812. this.name = null;
  60813. /**
  60814. * @member {SuperMap.ThemeStyle} mapboxgl.supermap.GeoFeatureThemeLayer.prototype.style
  60815. * @description 专题图图层全局样式。
  60816. */
  60817. this.style = null;
  60818. /**
  60819. * @member {SuperMap.ThemeStyle} mapboxgl.supermap.GeoFeatureThemeLayer.prototype.highlightStyle
  60820. * @description 专题图图层高亮样式。
  60821. */
  60822. this.highlightStyle = null;
  60823. /**
  60824. * @member {number} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.nodesClipPixel=2]
  60825. * @description 节点抽稀像素距离。
  60826. */
  60827. this.nodesClipPixel = 2;
  60828. /**
  60829. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isHoverAble=false]
  60830. * @description 图形是否在 hover 时高亮。
  60831. */
  60832. this.isHoverAble = false;
  60833. /**
  60834. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isMultiHover=false]
  60835. * @description 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  60836. */
  60837. this.isMultiHover = false;
  60838. /**
  60839. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isClickAble=true]
  60840. * @description 图形是否可点击。
  60841. */
  60842. this.isClickAble = true;
  60843. /**
  60844. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isAllowFeatureStyle=false]
  60845. * @description 是否允许 feature 样式(style) 中的有效属性应用到专题图层。</br>
  60846. * 禁止对专题要素使用数据(feature)的 style。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  60847. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  60848. */
  60849. this.isAllowFeatureStyle = false;
  60850. Util_Util.extend(this, opt_options);
  60851. this.cache = opt_options.cache || {};
  60852. this.cacheFields = opt_options.cacheFields || [];
  60853. this.maxCacheCount = opt_options.maxCacheCount || 0;
  60854. this.isCustomSetMaxCacheCount = opt_options.isCustomSetMaxCacheCount === undefined ? false : opt_options.isCustomSetMaxCacheCount;
  60855. }
  60856. /**
  60857. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.addFeatures
  60858. * @description 添加要素。
  60859. * @param {mapboxgl.supermap.ThemeFeature|SuperMap.ServerFeature} features - 要素对象。
  60860. */
  60861. addFeatures(features) {
  60862. /**
  60863. * @event mapboxgl.supermap.GeoFeatureThemeLayer#beforefeaturesadded
  60864. * @description 要素添加之前触发。
  60865. * @property {mapboxgl.supermap.ThemeFeature|SuperMap.ServerFeature} features - 被添加的要素。
  60866. */
  60867. external_mapboxgl_default.a.Evented.prototype.fire('beforefeaturesadded', {features: features});
  60868. //转换 features 形式
  60869. this.features = this.toiClientFeature(features);
  60870. if (!this.isCustomSetMaxCacheCount) {
  60871. this.maxCacheCount = this.features.length * 5;
  60872. }
  60873. //绘制专题要素
  60874. if (this.renderer) {
  60875. this.redrawThematicFeatures(this.map.getBounds());
  60876. }
  60877. }
  60878. /**
  60879. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.removeFeatures
  60880. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  60881. * @param {SuperMap.Feature.Vector} features - 要删除的要素对象。
  60882. */
  60883. removeFeatures(features) { // eslint-disable-line no-unused-vars
  60884. this.clearCache();
  60885. ThemeLayer_Theme.prototype.removeFeatures.apply(this, arguments);
  60886. }
  60887. /**
  60888. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.removeAllFeatures
  60889. * @description 清除当前图层所有的矢量要素。
  60890. */
  60891. removeAllFeatures() {
  60892. this.clearCache();
  60893. ThemeLayer_Theme.prototype.removeAllFeatures.apply(this, arguments);
  60894. }
  60895. /**
  60896. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.redrawThematicFeatures
  60897. * @description 重绘所有专题要素。
  60898. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  60899. */
  60900. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  60901. this.clearCache();
  60902. //获取高亮专题要素对应的用户 id
  60903. var hoverone = this.renderer.getHoverOne();
  60904. var hoverFid = null;
  60905. if (hoverone && hoverone.refDataID) {
  60906. hoverFid = hoverone.refDataID;
  60907. }
  60908. //清除当前所有可视元素
  60909. this.renderer.clearAll();
  60910. var features = this.features;
  60911. var cache = this.cache;
  60912. var cacheFields = this.cacheFields;
  60913. var cmZoom = this.map.getZoom();
  60914. var maxCC = this.maxCacheCount;
  60915. for (var i = 0, len = features.length; i < len; i++) {
  60916. var feature = features[i];
  60917. // var feaBounds = feature.geometry.getBounds();
  60918. //
  60919. // //剔除当前视图(地理)范围以外的数据
  60920. // if (extent) {
  60921. // var bounds = new SuperMap.Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  60922. // // if (!bounds.intersectsBounds(feaBounds)) continue;
  60923. // }
  60924. //缓存字段
  60925. var fields = feature.id + "_zoom_" + cmZoom.toString();
  60926. var thematicFeature;
  60927. //判断专题要素缓存是否存在
  60928. if (cache[fields]) {
  60929. cache[fields].updateAndAddShapes();
  60930. } else {
  60931. //如果专题要素缓存不存在,创建专题要素
  60932. thematicFeature = this.createThematicFeature(features[i]);
  60933. //检查 thematicFeature 是否有可视化图形
  60934. if (thematicFeature.getShapesCount() < 1) {
  60935. continue;
  60936. }
  60937. //加入缓存
  60938. cache[fields] = thematicFeature;
  60939. cacheFields.push(fields);
  60940. //缓存数量限制
  60941. if (cacheFields.length > maxCC) {
  60942. var fieldsTemp = cacheFields[0];
  60943. cacheFields.splice(0, 1);
  60944. delete cache[fieldsTemp];
  60945. }
  60946. }
  60947. }
  60948. this.renderer.render();
  60949. //地图漫游后,重新高亮图形
  60950. if (hoverFid && this.isHoverAble && this.isMultiHover) {
  60951. var hShapes = this.getShapesByFeatureID(hoverFid);
  60952. this.renderer.updateHoverShapes(hShapes);
  60953. }
  60954. }
  60955. /**
  60956. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.createThematicFeature
  60957. * @description 创建专题要素。
  60958. * @param {SuperMap.Feature.Vector} feature - 要素对象。
  60959. */
  60960. createThematicFeature(feature) {
  60961. var style = Util_Util.copyAttributesWithClip(this.style);
  60962. if (feature.style && this.isAllowFeatureStyle === true) {
  60963. style = Util_Util.copyAttributesWithClip(feature.style);
  60964. }
  60965. //创建专题要素时的可选参数
  60966. var options = {};
  60967. options.nodesClipPixel = this.nodesClipPixel;
  60968. options.isHoverAble = this.isHoverAble;
  60969. options.isMultiHover = this.isMultiHover;
  60970. options.isClickAble = this.isClickAble;
  60971. options.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(this.highlightStyle);
  60972. //将数据转为专题要素(Vector)
  60973. var thematicFeature = new ThemeVector_ThemeVector(feature, this, ShapeFactory_ShapeFactory.transformStyle(style), options);
  60974. //直接添加图形到渲染器
  60975. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  60976. this.renderer.addShape(thematicFeature.shapes[m]);
  60977. }
  60978. return thematicFeature;
  60979. }
  60980. /**
  60981. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.clearCache
  60982. * @description 清除缓存。
  60983. */
  60984. clearCache() {
  60985. this.cache = {};
  60986. this.cacheFields = [];
  60987. }
  60988. /**
  60989. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.clear
  60990. * @description 清除的内容包括数据(features)、专题要素和缓存。
  60991. */
  60992. clear() {
  60993. this.renderer.clearAll();
  60994. this.renderer.refresh();
  60995. this.removeAllFeatures();
  60996. this.clearCache();
  60997. }
  60998. /**
  60999. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.getCacheCount
  61000. * @description 获取当前缓存数量。
  61001. * @returns {number} 当前缓存数量。
  61002. */
  61003. getCacheCount() {
  61004. return this.cacheFields.length;
  61005. }
  61006. /**
  61007. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.setMaxCacheCount
  61008. * @param {number} [cacheCount] - 缓存总数。
  61009. * @description 设置最大缓存条数。
  61010. */
  61011. setMaxCacheCount(cacheCount) {
  61012. if (!isNaN(cacheCount)) {
  61013. this.maxCacheCount = cacheCount;
  61014. this.isCustomSetMaxCacheCount = true;
  61015. }
  61016. }
  61017. /**
  61018. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.setMaxCacheCount
  61019. * @param {number} [featureID=si.refDataID] - 要素 ID。
  61020. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  61021. */
  61022. getShapesByFeatureID(featureID) {
  61023. var list = [];
  61024. var shapeList = this.renderer.getAllShapes();
  61025. if (!featureID) {
  61026. return shapeList
  61027. }
  61028. for (var i = 0, len = shapeList.length; i < len; i++) {
  61029. var si = shapeList[i];
  61030. if (si.refDataID && featureID === si.refDataID) {
  61031. list.push(si);
  61032. }
  61033. }
  61034. return list;
  61035. }
  61036. }
  61037. external_mapboxgl_default.a.supermap.GeoFeatureThemeLayer = GeoFeatureThemeLayer_GeoFeature;
  61038. // CONCATENATED MODULE: ./src/mapboxgl/overlay/LabelThemeLayer.js
  61039. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  61040. * This program are made available under the terms of the Apache License, Version 2.0
  61041. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61042. /**
  61043. * @class mapboxgl.supermap.LabelThemeLayer
  61044. * @category Visualization Theme
  61045. * @classdesc 标签专题图层。
  61046. * @param {string} name - 图层名。
  61047. * @param {Object} opt_options - 参数。
  61048. * @param {mapboxgl.Map} opt_options.map - 当前mapboxgl map 对象。
  61049. * @param {string} opt_options.themeField - 指定创建专题图字段。
  61050. * @param {Object} opt_options.style - 专题图样式。
  61051. * @param {Object} opt_options.styleGroups - 各专题类型样式组。
  61052. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  61053. * @param {string} [opt_options.id] - 专题图层 ID。专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  61054. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  61055. * @param {number} [opt_options.opacity=1] - 图层透明度。
  61056. * @param {boolean} [options.isAvoid=true] - 是否进行地图边缘的避让处理。
  61057. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  61058. * @param {boolean} [opt_options.isHoverAble] - 是否开启 hover 事件。
  61059. * @extends {mapboxgl.supermap.GeoFeatureThemeLayer}
  61060. */
  61061. class LabelThemeLayer_Label extends GeoFeatureThemeLayer_GeoFeature {
  61062. constructor(name, opt_options) {
  61063. super(name, opt_options);
  61064. /**
  61065. * @member {boolean} [mapboxgl.supermap.LabelThemeLayer.prototype.isOverLay=true]
  61066. * @description 是否进行压盖处理,如果设为 true,将隐藏被压盖的标签。
  61067. */
  61068. this.isOverLay = true;
  61069. /**
  61070. * @member {boolean} [mapboxgl.supermap.LabelThemeLayer.prototype.isAvoid=true]
  61071. * @description 是否进行地图边缘的避让处理,如果设为 true,将把与地图边缘相交的标签移到地图范围内,在地图边缘处做避让处理。
  61072. */
  61073. this.isAvoid = true;
  61074. /**
  61075. * @member {string} mapboxgl.supermap.LabelThemeLayer.prototype.themeField
  61076. * @description 用于指定专题要素样式的属性字段名称。</br>
  61077. * 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。</br>
  61078. * 使用标签分组显示还需要设置 styleGroups 属性。
  61079. */
  61080. this.themeField = null;
  61081. /**
  61082. * @member {Array.<Object>} mapboxgl.supermap.LabelThemeLayer.prototype.styleGroups
  61083. * @description 分组样式。使用此属性需要设置 themeField 属性。</br>
  61084. * 1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;</br>
  61085. * 2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;</br>
  61086. * &nbsp;&nbsp;a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。</br>
  61087. * &nbsp;&nbsp;b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。</br>
  61088. * 此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  61089. */
  61090. this.styleGroups = null;
  61091. Util_Util.extend(this, opt_options);
  61092. this.defaultStyle = {
  61093. //默认文本样式
  61094. fontColor: "#000000",
  61095. fontOpacity: 1,
  61096. fontSize: "12px",
  61097. fontStyle: "normal",
  61098. fontWeight: "normal",
  61099. labelAlign: "cm",
  61100. labelXOffset: 0,
  61101. labelYOffset: 0,
  61102. labelRotation: 0,
  61103. //默认样式
  61104. fill: false,
  61105. fillColor: "#ee9900",
  61106. fillOpacity: 0.4,
  61107. stroke: false,
  61108. strokeColor: "#ee9900",
  61109. strokeOpacity: 1,
  61110. strokeWidth: 1,
  61111. strokeLinecap: "round",
  61112. strokeDashstyle: "solid",
  61113. //默认显示背景框
  61114. labelRect: true,
  61115. //对用户隐藏但必须保持此值的属性
  61116. //cursor: "pointer",
  61117. labelSelect: true,
  61118. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  61119. _isGeoTextStrategyStyle: true
  61120. };
  61121. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  61122. this.getPxBoundsMode = 0;
  61123. this.labelFeatures = [];
  61124. }
  61125. /**
  61126. * @function mapboxgl.supermap.LabelThemeLayer.prototype.redrawThematicFeatures
  61127. * @description 重绘所有专题要素。</br>
  61128. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。</br>
  61129. * 地图漫游时调用此方法进行图层刷新。
  61130. * @param {mapboxgl.LngLatBounds} bounds - 重绘范围。
  61131. */
  61132. redrawThematicFeatures(bounds) {
  61133. if (this.features.length > 0 && this.labelFeatures.length == 0) {
  61134. var feats = this.setLabelsStyle(this.features);
  61135. for (var i = 0, len = feats.length; i < len; i++) {
  61136. this.labelFeatures.push(feats[i]);
  61137. }
  61138. }
  61139. this.features = this.getDrawnLabels(this.labelFeatures);
  61140. super.redrawThematicFeatures.call(this, bounds);
  61141. }
  61142. /**
  61143. * @function mapboxgl.supermap.LabelThemeLayer.prototype.removeFeatures
  61144. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  61145. * @param {SuperMap.Feature.Vector} features - 要删除的要素对象。
  61146. */
  61147. removeFeatures(features) { // eslint-disable-line no-unused-vars
  61148. this.labelFeatures = [];
  61149. super.removeFeatures.call(this, arguments);
  61150. }
  61151. /**
  61152. * @function mapboxgl.supermap.LabelThemeLayer.prototype.removeAllFeatures
  61153. * @description 清除当前图层所有的矢量要素。
  61154. */
  61155. removeAllFeatures() {
  61156. this.labelFeatures = [];
  61157. super.removeAllFeatures.call(this, arguments);
  61158. }
  61159. /**
  61160. * @function mapboxgl.supermap.LabelThemeLayer.prototype.createThematicFeature
  61161. * @description 创建专题图要素。
  61162. * @param {Object} feature - 要创建的专题图形要素。
  61163. */
  61164. createThematicFeature(feature) {
  61165. //赋 style
  61166. var style = this.getStyleByData(feature);
  61167. //创建专题要素时的可选参数
  61168. var options = {};
  61169. options.nodesClipPixel = this.nodesClipPixel;
  61170. options.isHoverAble = this.isHoverAble;
  61171. options.isMultiHover = this.isMultiHover;
  61172. options.isClickAble = this.isClickAble;
  61173. options.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(this.highlightStyle);
  61174. //将数据转为专题要素(Vector)
  61175. var thematicFeature = new ThemeVector_ThemeVector(feature, this, ShapeFactory_ShapeFactory.transformStyle(style), options);
  61176. //直接添加图形到渲染器
  61177. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  61178. this.renderer.addShape(thematicFeature.shapes[m]);
  61179. }
  61180. return thematicFeature;
  61181. }
  61182. /**
  61183. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getDrawnLabels
  61184. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  61185. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 所有标签要素的数组。
  61186. * @returns {Array.<SuperMap.Feature.Vector>} 最终要绘制的标签要素数组。
  61187. */
  61188. getDrawnLabels(labelFeatures) {
  61189. var feas = [], //最终要绘制的标签要素集
  61190. fea, //最终要绘制的标签要素
  61191. fi, //临时标签要素,用户的第i个标签
  61192. labelsB = [], //不产生压盖的标签要素范围集
  61193. styTmp, //用于临时存储要素style的变量
  61194. feaSty, //标签要素最终的style
  61195. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  61196. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  61197. styleTemp = {
  61198. labelAlign: "cm",
  61199. labelXOffset: 0,
  61200. labelYOffset: 0
  61201. };
  61202. var map = this.map;
  61203. var zoom = map.getZoom();
  61204. var canvas = map.getCanvas();
  61205. var mapSize = {
  61206. x: parseFloat(canvas.style.width),
  61207. y: parseFloat(canvas.style.height)
  61208. };
  61209. //对用户的每个标签要素进行处理与判断
  61210. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  61211. fi = labelFeatures[i];
  61212. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  61213. if (fi.isStyleChange || fi.isStyleChange === undefined) {
  61214. fi = this.setStyle(fi);
  61215. }
  61216. //标签最终的中心点像素位置 (偏移后)
  61217. var loc = this.getLabelPxLocation(fi);
  61218. //过滤掉地图范围外的标签 (偏移后)
  61219. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  61220. //根据当前地图缩放级别过滤标签
  61221. if (fi.style.minZoomLevel > -1) {
  61222. if (zoom <= fi.style.minZoomLevel) {
  61223. continue;
  61224. }
  61225. }
  61226. if (fi.style.maxZoomLevel > -1) {
  61227. if (zoom > fi.style.maxZoomLevel) {
  61228. continue;
  61229. }
  61230. }
  61231. //计算标签bounds
  61232. var boundsQuad = null;
  61233. if (fi.isStyleChange) {
  61234. fi.isStyleChange = null;
  61235. boundsQuad = this.calculateLabelBounds(fi, loc);
  61236. } else {
  61237. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  61238. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  61239. boundsQuad = this.calculateLabelBounds2(fi, loc);
  61240. } else {
  61241. boundsQuad = this.calculateLabelBounds(fi, loc);
  61242. }
  61243. }
  61244. //避让处理 -start
  61245. var mapViewBounds = new Bounds_Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  61246. quadlen = boundsQuad.length;
  61247. if (this.isAvoid) {
  61248. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  61249. if (avoidInfo) {
  61250. //横向(x方向)上的避让
  61251. if (avoidInfo.aspectW === "left") {
  61252. fi.style.labelXOffset += avoidInfo.offsetX;
  61253. for (let j = 0; j < quadlen; j++) {
  61254. boundsQuad[j].x += avoidInfo.offsetX;
  61255. }
  61256. } else if (avoidInfo.aspectW === "right") {
  61257. fi.style.labelXOffset += (-avoidInfo.offsetX);
  61258. for (let j = 0; j < quadlen; j++) {
  61259. boundsQuad[j].x += (-avoidInfo.offsetX);
  61260. }
  61261. }
  61262. //纵向(y方向)上的避让
  61263. if (avoidInfo.aspectH === "top") {
  61264. fi.style.labelYOffset += avoidInfo.offsetY;
  61265. for (let j = 0; j < quadlen; j++) {
  61266. boundsQuad[j].y += avoidInfo.offsetY;
  61267. }
  61268. } else if (avoidInfo.aspectH === "bottom") {
  61269. fi.style.labelYOffset += (-avoidInfo.offsetY);
  61270. for (let j = 0; j < quadlen; j++) {
  61271. boundsQuad[j].y += (-avoidInfo.offsetY);
  61272. }
  61273. }
  61274. //如果style发生变化,记录下来
  61275. fi.isStyleChange = true;
  61276. }
  61277. }
  61278. //避让处理 -end
  61279. //压盖处理 -start
  61280. if (this.isOverLay) {
  61281. //是否压盖
  61282. var isOL = false;
  61283. if (i != 0) {
  61284. for (let j = 0; j < labelsB.length; j++) {
  61285. //压盖判断
  61286. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  61287. isOL = true;
  61288. break;
  61289. }
  61290. }
  61291. }
  61292. if (isOL) {
  61293. continue;
  61294. } else {
  61295. labelsB.push(boundsQuad);
  61296. }
  61297. }
  61298. //压盖处理 -end
  61299. //背景(事件)-start
  61300. //将标签像素范围转为地理范围
  61301. var geoBs = [];
  61302. for (let j = 0; j < quadlen - 1; j++) {
  61303. geoBs.push(map.unproject(boundsQuad[j]));
  61304. }
  61305. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  61306. var leftBottom = geoBs[3];
  61307. var rightTop = geoBs[1];
  61308. var bounds = new Bounds_Bounds(leftBottom.lng, leftBottom.lat, rightTop.lng, rightTop.lat);
  61309. var center = bounds.getCenterLonLat();
  61310. var label = new GeoText_GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  61311. label.calculateBounds();
  61312. styTmp = Util_Util.cloneObject(fi.style);
  61313. feaSty = Util_Util.cloneObject(Util_Util.copyAttributes(styTmp, styleTemp));
  61314. fea = new Vector_Vector(label, fi.attributes, feaSty);
  61315. //赋予id
  61316. fea.id = fi.id;
  61317. fea.fid = fi.fid;
  61318. feas.push(fea);
  61319. }
  61320. }
  61321. //返回最终要绘制的标签要素
  61322. return feas;
  61323. }
  61324. /**
  61325. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getStyleByData
  61326. * @description 根据用户数据(feature)设置专题要素的 Style。
  61327. * @param {SuperMap.Feature.Vector} feat - 矢量要素对象。
  61328. * @returns {Array.<SuperMap.ThemeStyle>} 专题要素的 Style。
  61329. */
  61330. getStyleByData(feat) {
  61331. var feature = feat;
  61332. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  61333. //将style赋给标签
  61334. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  61335. this.style.fontSize = "12px";
  61336. }
  61337. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  61338. if (this.themeField && this.styleGroups && feature.attributes) {
  61339. var Sf = this.themeField;
  61340. var attributes = feature.attributes;
  61341. var groups = this.styleGroups;
  61342. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  61343. var attr = null; //属性值
  61344. for (var property in attributes) {
  61345. if (Sf === property) {
  61346. isSfInAttrs = true;
  61347. attr = attributes[property];
  61348. break;
  61349. }
  61350. }
  61351. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  61352. if (isSfInAttrs) {
  61353. for (var i = 0, len = groups.length; i < len; i++) {
  61354. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  61355. var sty1 = groups[i].style;
  61356. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  61357. sty1.fontSize = "12px";
  61358. }
  61359. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  61360. }
  61361. }
  61362. }
  61363. feature.style.label = feature.attributes[this.themeField]
  61364. }
  61365. return feature.style;
  61366. }
  61367. /**
  61368. * @function mapboxgl.supermap.LabelThemeLayer.prototype.setLabelsStyle
  61369. * @description 设置标签要素的 Style。
  61370. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 需要设置 Style 的标签要素数组。
  61371. * @returns {Array.<SuperMap.Feature.Vector>} 赋予 Style 后的标签要素数组。
  61372. */
  61373. setLabelsStyle(labelFeatures) {
  61374. var fea, labelFeas = [];
  61375. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  61376. var feature = labelFeatures[i];
  61377. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  61378. //设置标签的Style
  61379. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  61380. feature.geometry.bsInfo.w = null;
  61381. feature.geometry.bsInfo.h = null;
  61382. feature.geometry.labelWTmp = null;
  61383. }
  61384. fea = this.setStyle(feature);
  61385. //为标签要素指定图层
  61386. fea.layer = this.layer;
  61387. labelFeas.push(fea);
  61388. } else {
  61389. return labelFeatures;
  61390. }
  61391. }
  61392. return labelFeas;
  61393. }
  61394. /**
  61395. * @function mapboxgl.supermap.LabelThemeLayer.prototype.setStyle
  61396. * @description 设置标签要素的Style。
  61397. * @param {SuperMap.Feature.Vector} feat - 需要赋予 style 的要素。
  61398. */
  61399. setStyle(feat) {
  61400. var feature = feat;
  61401. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  61402. //将style赋给标签
  61403. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  61404. this.style.fontSize = "12px";
  61405. }
  61406. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  61407. if (this.groupField && this.styleGroups && feature.attributes) {
  61408. var Sf = this.groupField;
  61409. var Attrs = feature.attributes;
  61410. var Gro = this.styleGroups;
  61411. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  61412. var attr = null; //属性值
  61413. for (var property in Attrs) {
  61414. if (Sf === property) {
  61415. isSfInAttrs = true;
  61416. attr = Attrs[property];
  61417. break;
  61418. }
  61419. }
  61420. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  61421. if (isSfInAttrs) {
  61422. for (var i = 0, len = Gro.length; i < len; i++) {
  61423. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  61424. //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  61425. var sty1 = Gro[i].style;
  61426. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  61427. sty1.fontSize = "12px";
  61428. }
  61429. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  61430. }
  61431. }
  61432. }
  61433. }
  61434. //将文本内容赋到标签要素的style上
  61435. feature.style.label = feature.geometry.text;
  61436. return feature;
  61437. }
  61438. /**
  61439. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getLabelPxLocation
  61440. * @description 获取标签要素的像素坐标。
  61441. * @param {SuperMap.Feature.Vector} feature - 标签要素。
  61442. * @returns {mapboxgl.Point} 标签位置。
  61443. */
  61444. getLabelPxLocation(feature) {
  61445. var geoText = feature.geometry;
  61446. var styleTmp = feature.style;
  61447. //将标签的地理位置转为像素位置
  61448. var locationTmp = geoText.getCentroid();
  61449. var locTmp = this.map.project(new external_mapboxgl_default.a.LngLat(locationTmp.x, locationTmp.y));
  61450. var loc = new external_mapboxgl_default.a.Point(locTmp.x, locTmp.y);
  61451. //偏移处理
  61452. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  61453. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  61454. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  61455. var point = loc.add(new external_mapboxgl_default.a.Point(xOffset, -yOffset));
  61456. return new external_mapboxgl_default.a.Point(point.x, point.y);
  61457. } else {
  61458. return new external_mapboxgl_default.a.Point(loc.x, loc.y);
  61459. }
  61460. }
  61461. /**
  61462. * @function mapboxgl.supermap.LabelThemeLayer.prototype.calculateLabelBounds
  61463. * @description 获得标签要素的最终范围。
  61464. *
  61465. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  61466. * @param {mapboxgl.Point} loc - 标签位置。
  61467. *
  61468. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  61469. */
  61470. calculateLabelBounds(feature, loc) {
  61471. var geoText = feature.geometry;
  61472. //标签范围(未旋转前)
  61473. var labB = null;
  61474. var labelInfo = null;
  61475. //获取bounds的方式
  61476. if (this.getPxBoundsMode == 0) {
  61477. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  61478. } else if (this.getPxBoundsMode === 1) {
  61479. //canvas
  61480. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  61481. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  61482. } else {
  61483. return null;
  61484. }
  61485. //旋转Bounds
  61486. var boundsQuad = [];
  61487. if ((feature.style.labelRotation % 180) == 0) {
  61488. boundsQuad = [{
  61489. "x": labB.left,
  61490. "y": labB.top
  61491. },
  61492. {
  61493. "x": labB.right,
  61494. "y": labB.top
  61495. },
  61496. {
  61497. "x": labB.right,
  61498. "y": labB.bottom
  61499. },
  61500. {
  61501. "x": labB.left,
  61502. "y": labB.bottom
  61503. },
  61504. {
  61505. "x": labB.left,
  61506. "y": labB.top
  61507. }
  61508. ];
  61509. } else {
  61510. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  61511. }
  61512. //重置GeoText的bounds
  61513. geoText.bounds = new Bounds_Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  61514. return boundsQuad;
  61515. }
  61516. /**
  61517. * @function mapboxgl.supermap.LabelThemeLayer.prototype.calculateLabelBounds2
  61518. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  61519. *
  61520. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  61521. * @param {mapboxgl.Point} loc - 标签位置。
  61522. *
  61523. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  61524. */
  61525. calculateLabelBounds2(feature, loc) {
  61526. var labB, left, bottom, top, right;
  61527. var labelSize = feature.geometry.bsInfo;
  61528. var style = feature.style;
  61529. var locationPx = Util_Util.cloneObject(loc);
  61530. //处理文字对齐
  61531. if (style.labelAlign && style.labelAlign !== "cm") {
  61532. switch (style.labelAlign) {
  61533. case "lt":
  61534. locationPx.x += labelSize.w / 2;
  61535. locationPx.y += labelSize.h / 2;
  61536. break;
  61537. case "lm":
  61538. locationPx.x += labelSize.w / 2;
  61539. break;
  61540. case "lb":
  61541. locationPx.x += labelSize.w / 2;
  61542. locationPx.y -= labelSize.h / 2;
  61543. break;
  61544. case "ct":
  61545. locationPx.y += labelSize.h / 2;
  61546. break;
  61547. case "cb":
  61548. locationPx.y -= labelSize.h / 2;
  61549. break;
  61550. case "rt":
  61551. locationPx.x -= labelSize.w / 2;
  61552. locationPx.y += labelSize.h / 2;
  61553. break;
  61554. case "rm":
  61555. locationPx.x -= labelSize.w / 2;
  61556. break;
  61557. case "rb":
  61558. locationPx.x -= labelSize.w / 2;
  61559. locationPx.y -= labelSize.h / 2;
  61560. break;
  61561. default:
  61562. break;
  61563. }
  61564. }
  61565. left = locationPx.x - labelSize.w / 2;
  61566. bottom = locationPx.y + labelSize.h / 2;
  61567. //处理斜体字
  61568. if (style.fontStyle && style.fontStyle === "italic") {
  61569. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  61570. } else {
  61571. right = locationPx.x + labelSize.w / 2;
  61572. }
  61573. top = locationPx.y - labelSize.h / 2;
  61574. labB = new Bounds_Bounds(left, bottom, right, top);
  61575. //旋转Bounds
  61576. var boundsQuad = [];
  61577. if ((style.labelRotation % 180) == 0) {
  61578. boundsQuad = [{
  61579. "x": labB.left,
  61580. "y": labB.top
  61581. },
  61582. {
  61583. "x": labB.right,
  61584. "y": labB.top
  61585. },
  61586. {
  61587. "x": labB.right,
  61588. "y": labB.bottom
  61589. },
  61590. {
  61591. "x": labB.left,
  61592. "y": labB.bottom
  61593. },
  61594. {
  61595. "x": labB.left,
  61596. "y": labB.top
  61597. }
  61598. ];
  61599. } else {
  61600. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  61601. }
  61602. //重置GeoText的bounds
  61603. feature.geometry.bounds = new Bounds_Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  61604. return boundsQuad;
  61605. }
  61606. /**
  61607. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getLabelInfo
  61608. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  61609. * @returns {Object} 绘制后的标签信息。
  61610. */
  61611. getLabelInfo(location, style) {
  61612. var LABEL_ALIGN = {
  61613. "l": "left",
  61614. "r": "right",
  61615. "t": "top",
  61616. "b": "bottom"
  61617. },
  61618. LABEL_FACTOR = {
  61619. "l": 0,
  61620. "r": -1,
  61621. "t": 0,
  61622. "b": -1
  61623. };
  61624. style = Util_Util.extend({
  61625. fontColor: "#000000",
  61626. labelAlign: "cm"
  61627. }, style);
  61628. var pt = this.getLocalXY(location);
  61629. var labelWidth = 0;
  61630. if (style.labelXOffset || style.labelYOffset) {
  61631. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  61632. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  61633. pt[0] += xOffset;
  61634. pt[1] -= yOffset;
  61635. }
  61636. var canvas = document.createElement('canvas');
  61637. canvas.globalAlpha = 0;
  61638. canvas.lineWidth = 1;
  61639. var ctx = canvas.getContext("2d");
  61640. ctx.fillStyle = style.fontColor;
  61641. ctx.globalAlpha = style.fontOpacity || 1.0;
  61642. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  61643. "normal",
  61644. style.fontWeight ? style.fontWeight : "normal",
  61645. style.fontSize ? style.fontSize : "1em",
  61646. style.fontFamily ? style.fontFamily : "sans-serif"
  61647. ].join(" ");
  61648. var labelRows = style.label.split('\n');
  61649. var numRows = labelRows.length;
  61650. var vfactor, lineHeight, labelWidthTmp;
  61651. if (ctx.fillText) {
  61652. // HTML5
  61653. ctx.font = fontStyle;
  61654. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  61655. "center";
  61656. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  61657. "middle";
  61658. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  61659. if (vfactor == null) {
  61660. vfactor = -.5;
  61661. }
  61662. lineHeight = ctx.measureText('Mg').height ||
  61663. ctx.measureText('xx').width;
  61664. pt[1] += lineHeight * vfactor * (numRows - 1);
  61665. for (let i = 0; i < numRows; i++) {
  61666. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  61667. if (labelWidth < labelWidthTmp) {
  61668. labelWidth = labelWidthTmp;
  61669. }
  61670. }
  61671. } else if (ctx.mozDrawText) {
  61672. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  61673. ctx.mozTextStyle = fontStyle;
  61674. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  61675. if (vfactor == null) {
  61676. vfactor = -.5;
  61677. }
  61678. lineHeight = ctx.mozMeasureText('xx');
  61679. pt[1] += lineHeight * (1 + (vfactor * numRows));
  61680. for (let i = 0; i < numRows; i++) {
  61681. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  61682. if (labelWidth < labelWidthTmp) {
  61683. labelWidth = labelWidthTmp;
  61684. }
  61685. }
  61686. }
  61687. var labelInfo = {}; //标签信息
  61688. if (labelWidth) {
  61689. labelInfo.w = labelWidth; //标签的宽
  61690. } else {
  61691. return null;
  61692. }
  61693. labelInfo.h = style.fontSize; //一行标签的高
  61694. labelInfo.rows = labelRows.length; //标签的行数
  61695. return labelInfo;
  61696. }
  61697. /**
  61698. * @function mapboxgl.supermap.LabelThemeLayer.prototype.rotationBounds
  61699. * @description 旋转 bounds。
  61700. *
  61701. * @param {SuperMap.Bounds} bounds - 要旋转的 bounds。
  61702. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性X(横坐标),属性Y(纵坐标)。
  61703. * @param {number} angle - 旋转角度(顺时针)。
  61704. *
  61705. * @returns {Array.<Object>} bounds 旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]
  61706. */
  61707. rotationBounds(bounds, rotationCenterPoi, angle) {
  61708. var ltPoi = new external_mapboxgl_default.a.Point(bounds.left, bounds.top);
  61709. var rtPoi = new external_mapboxgl_default.a.Point(bounds.right, bounds.top);
  61710. var rbPoi = new external_mapboxgl_default.a.Point(bounds.right, bounds.bottom);
  61711. var lbPoi = new external_mapboxgl_default.a.Point(bounds.left, bounds.bottom);
  61712. var ver = [];
  61713. ver.push(this.getRotatedLocation(ltPoi.x, ltPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  61714. ver.push(this.getRotatedLocation(rtPoi.x, rtPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  61715. ver.push(this.getRotatedLocation(rbPoi.x, rbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  61716. ver.push(this.getRotatedLocation(lbPoi.x, lbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  61717. //bounds旋转后形成的多边形节点数组
  61718. var quad = [];
  61719. for (var i = 0; i < ver.length; i++) {
  61720. quad.push({
  61721. "x": ver[i].x,
  61722. "y": ver[i].y
  61723. });
  61724. }
  61725. quad.push({
  61726. "x": ver[0].x,
  61727. "y": ver[0].y
  61728. });
  61729. return quad;
  61730. }
  61731. /**
  61732. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getRotatedLocation
  61733. * @description 获取一个点绕旋转中心顺时针旋转后的位置(此方法用于屏幕坐标)。
  61734. *
  61735. * @param {number} x - 旋转点横坐标。
  61736. * @param {number} y - 旋转点纵坐标。
  61737. * @param {number} rx - 旋转中心点横坐标。
  61738. * @param {number} ry - 旋转中心点纵坐标。
  61739. * @param {number} angle - 旋转角度。
  61740. *
  61741. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性X(横坐标),属性Y(纵坐标)。
  61742. */
  61743. getRotatedLocation(x, y, rx, ry, angle) {
  61744. var loc = {},
  61745. x0, y0;
  61746. y = -y;
  61747. ry = -ry;
  61748. angle = -angle; //顺时针旋转
  61749. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  61750. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  61751. loc.x = x0;
  61752. loc.y = -y0;
  61753. return loc;
  61754. }
  61755. /**
  61756. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getAvoidInfo
  61757. * @description 获取避让的信息。
  61758. *
  61759. * @param {SuperMap.Bounds} bounds - 地图像素范围。
  61760. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  61761. *
  61762. * @returns {Object} 避让的信息。
  61763. */
  61764. getAvoidInfo(bounds, quadrilateral) {
  61765. if (quadrilateral.length !== 5) {
  61766. return null;
  61767. } //不是四边形
  61768. //将bound序列化为点数组形式
  61769. var bounddQuad = [{
  61770. "x": bounds.left,
  61771. "y": bounds.top
  61772. },
  61773. {
  61774. "x": bounds.right,
  61775. "y": bounds.top
  61776. },
  61777. {
  61778. "x": bounds.right,
  61779. "y": bounds.bottom
  61780. },
  61781. {
  61782. "x": bounds.left,
  61783. "y": bounds.bottom
  61784. },
  61785. {
  61786. "x": bounds.left,
  61787. "y": bounds.top
  61788. }
  61789. ];
  61790. var isIntersection = false,
  61791. bqLen = bounddQuad.length,
  61792. quadLen = quadrilateral.length;
  61793. var offsetX = 0,
  61794. offsetY = 0,
  61795. aspectH = "",
  61796. aspectW = "";
  61797. for (var i = 0; i < bqLen - 1; i++) {
  61798. for (var j = 0; j < quadLen - 1; j++) {
  61799. var isLineIn = Util_Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  61800. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  61801. //设置避让信息
  61802. setInfo(quadrilateral[j]);
  61803. setInfo(quadrilateral[j + 1]);
  61804. isIntersection = true;
  61805. }
  61806. }
  61807. }
  61808. if (isIntersection) {
  61809. //组织避让操作所需的信息
  61810. return {
  61811. "aspectW": aspectW,
  61812. "aspectH": aspectH,
  61813. "offsetX": offsetX,
  61814. "offsetY": offsetY
  61815. };
  61816. } else {
  61817. return null;
  61818. }
  61819. //内部函数:设置避让信息
  61820. //参数:{Object} vec- quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  61821. function setInfo(vec) {
  61822. //四边形不在bounds内的节点
  61823. if (!bounds.contains(vec.x, vec.y)) {
  61824. //bounds的Top边
  61825. if (vec.y < bounds.top) {
  61826. let oY = Math.abs(bounds.top - vec.y);
  61827. if (oY > offsetY) {
  61828. offsetY = oY;
  61829. aspectH = "top";
  61830. }
  61831. }
  61832. //bounds的Bottom边
  61833. if (vec.y > bounds.bottom) {
  61834. let oY = Math.abs(vec.y - bounds.bottom);
  61835. if (oY > offsetY) {
  61836. offsetY = oY;
  61837. aspectH = "bottom";
  61838. }
  61839. }
  61840. //bounds的left边
  61841. if (vec.x < bounds.left) {
  61842. let oX = Math.abs(bounds.left - vec.x);
  61843. if (oX > offsetX) {
  61844. offsetX = oX;
  61845. aspectW = "left";
  61846. }
  61847. }
  61848. //bounds的right边
  61849. if (vec.x > bounds.right) {
  61850. let oX = Math.abs(vec.x - bounds.right);
  61851. if (oX > offsetX) {
  61852. offsetX = oX;
  61853. aspectW = "right";
  61854. }
  61855. }
  61856. }
  61857. }
  61858. }
  61859. /**
  61860. * @function mapboxgl.supermap.LabelThemeLayer.prototype.isQuadrilateralOverLap
  61861. * @description 判断两个四边形是否有压盖。
  61862. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  61863. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  61864. * @returns {boolean} 是否压盖,true 表示压盖。
  61865. */
  61866. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  61867. var quadLen = quadrilateral.length,
  61868. quad2Len = quadrilateral2.length;
  61869. if (quadLen !== 5 || quad2Len !== 5) {
  61870. return null;
  61871. } //不是四边形
  61872. var OverLap = false;
  61873. //如果两四边形互不包含对方的节点,则两个四边形不相交
  61874. for (let i = 0; i < quadLen; i++) {
  61875. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  61876. OverLap = true;
  61877. break;
  61878. }
  61879. }
  61880. for (let i = 0; i < quad2Len; i++) {
  61881. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  61882. OverLap = true;
  61883. break;
  61884. }
  61885. }
  61886. //加上两矩形十字相交的情况
  61887. for (let i = 0; i < quadLen - 1; i++) {
  61888. if (OverLap) {
  61889. break;
  61890. }
  61891. for (var j = 0; j < quad2Len - 1; j++) {
  61892. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  61893. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  61894. OverLap = true;
  61895. break;
  61896. }
  61897. }
  61898. }
  61899. return OverLap;
  61900. }
  61901. /**
  61902. * @function mapboxgl.supermap.LabelThemeLayer.prototype.isPointInPoly
  61903. * @description 判断一个点是否在多边形里面。(射线法)
  61904. *
  61905. * @param {Object} pt - 需要判定的点对象,该对象含有属性x(横坐标),属性y(纵坐标)。
  61906. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]
  61907. * @returns {boolean} 点是否在多边形内。
  61908. */
  61909. isPointInPoly(pt, poly) {
  61910. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  61911. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  61912. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  61913. (isIn = !isIn);
  61914. }
  61915. return isIn;
  61916. }
  61917. }
  61918. external_mapboxgl_default.a.supermap.LabelThemeLayer = LabelThemeLayer_Label;
  61919. // EXTERNAL MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  61920. var external_function_try_return_mapv_catch_e_return_ = __webpack_require__(1);
  61921. // CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapvRenderer.js
  61922. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  61923. * This program are made available under the terms of the Apache License, Version 2.0
  61924. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61925. var BaseLayer = external_function_try_return_mapv_catch_e_return_["baiduMapLayer"] ? external_function_try_return_mapv_catch_e_return_["baiduMapLayer"].__proto__ : Function;
  61926. /**
  61927. * @private
  61928. * @class MapvRenderer
  61929. * @classdesc MapV图层渲染。
  61930. * @param {Object} map - 地图。
  61931. * @param {Object} layer - 图层。
  61932. * @param {MapV.DataSet} dataSet - 数据集。
  61933. * @param {Object} options - 交互时所需可选参数。
  61934. * @extends {MapV.BaseLayer}
  61935. *
  61936. */
  61937. class MapvRenderer_MapvRenderer extends BaseLayer {
  61938. constructor(map, layer, dataSet, options) {
  61939. super(map, dataSet, options);
  61940. if (!BaseLayer) {
  61941. return;
  61942. }
  61943. this.map = map;
  61944. var self = this;
  61945. options = options || {};
  61946. self.init(options);
  61947. self.argCheck(options);
  61948. this.canvasLayer = layer;
  61949. this.stopAniamation = false;
  61950. this.animation = options.animation;
  61951. this.clickEvent = this.clickEvent.bind(this);
  61952. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  61953. this.bindMapEvent();
  61954. this.bindEvent();
  61955. this._expectShow = true;
  61956. }
  61957. /**
  61958. * @function MapvRenderer.prototype.clickEvent
  61959. * @description 点击绑定事件。
  61960. * @param {Object} e - 事件。
  61961. */
  61962. clickEvent(e) {
  61963. var pixel = e.point;
  61964. super.clickEvent(pixel, e);
  61965. }
  61966. /**
  61967. * @function MapvRenderer.prototype.mousemoveEvent
  61968. * @description 鼠标移动事件。
  61969. * @param {Object} e - 事件。
  61970. */
  61971. mousemoveEvent(e) {
  61972. var pixel = e.point;
  61973. super.mousemoveEvent(pixel, e);
  61974. }
  61975. /**
  61976. * @function MapvRenderer.prototype.bindEvent
  61977. * @description 绑定事件。
  61978. */
  61979. bindEvent() {
  61980. var map = this.map;
  61981. if (this.options.methods) {
  61982. if (this.options.methods.click) {
  61983. map.on('click', this.clickEvent);
  61984. }
  61985. if (this.options.methods.mousemove) {
  61986. map.on('mousemove', this.mousemoveEvent);
  61987. }
  61988. }
  61989. }
  61990. /**
  61991. * @function MapvRenderer.prototype.unbindEvent
  61992. * @description 解绑事件。
  61993. */
  61994. unbindEvent() {
  61995. var map = this.map;
  61996. if (this.options.methods) {
  61997. if (this.options.methods.click) {
  61998. map.off('click', this.clickEvent);
  61999. }
  62000. if (this.options.methods.mousemove) {
  62001. map.off('mousemove', this.mousemoveEvent);
  62002. }
  62003. }
  62004. }
  62005. /**
  62006. * @function MapvRenderer.prototype.getContext
  62007. * @description 获取信息。
  62008. */
  62009. getContext() {
  62010. return this.canvasLayer.canvas.getContext(this.context);
  62011. }
  62012. /**
  62013. * @function MapvRenderer.prototype.addData
  62014. * @description 添加数据。
  62015. * @param {oject} data - 待添加的数据。
  62016. * @param {oject} options - 待添加的数据信息。
  62017. */
  62018. addData(data, options) {
  62019. var _data = data;
  62020. if (data && data.get) {
  62021. _data = data.get();
  62022. }
  62023. this.dataSet.add(_data);
  62024. this.update({
  62025. options: options
  62026. });
  62027. }
  62028. /**
  62029. * @function MapvRenderer.prototype.update
  62030. * @description 更新图层。
  62031. * @param {Object} opt - 待更新的数据。
  62032. * @param {Object} opt.data - mapv 数据集。
  62033. * @param {Object} opt.options - mapv 绘制参数。
  62034. */
  62035. update(opt) {
  62036. var update = opt || {};
  62037. var _data = update.data;
  62038. if (_data && _data.get) {
  62039. _data = _data.get();
  62040. }
  62041. if (_data != undefined) {
  62042. this.dataSet.set(_data);
  62043. }
  62044. super.update({
  62045. options: update.options
  62046. });
  62047. }
  62048. /**
  62049. * @function MapvRenderer.prototype.getData
  62050. * @description 获取数据。
  62051. */
  62052. getData() {
  62053. return this.dataSet;
  62054. }
  62055. /**
  62056. * @function MapvRenderer.prototype.removeData
  62057. * @description 删除符合过滤条件的数据。
  62058. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为true,表示删除该元素;否则表示不删除。
  62059. */
  62060. removeData(filter) {
  62061. if (!this.dataSet) {
  62062. return;
  62063. }
  62064. var newData = this.dataSet.get({
  62065. filter: function (data) {
  62066. return filter != null && typeof filter === 'function' ? !filter(data) : true;
  62067. }
  62068. });
  62069. this.dataSet.set(newData);
  62070. this.update({
  62071. options: null
  62072. });
  62073. }
  62074. /**
  62075. * @function MapVRenderer.prototype.clearData
  62076. * @description 清除数据。
  62077. */
  62078. clearData() {
  62079. this.dataSet && this.dataSet.clear();
  62080. this.update({
  62081. options: null
  62082. });
  62083. }
  62084. /**
  62085. * @function MapVRenderer.prototype.updateData
  62086. * @param {Object} dataSet - 数据集。
  62087. * @param {Object} options - 数据项配置。
  62088. * @description 更新数据。
  62089. */
  62090. updateData(dataSet, options) {
  62091. if (dataSet && dataSet.get) {
  62092. this.dataSet.set(dataSet.get());
  62093. }
  62094. this.update({
  62095. options: options
  62096. });
  62097. }
  62098. _canvasUpdate(time) {
  62099. var map = this.map;
  62100. if (!this.canvasLayer || this.stopAniamation) {
  62101. return;
  62102. }
  62103. var self = this;
  62104. var animationOptions = self.options.animation;
  62105. var context = this.getContext();
  62106. if (self.isEnabledTime()) {
  62107. if (time === undefined) {
  62108. this.clear(context);
  62109. return;
  62110. }
  62111. if (this.context === '2d') {
  62112. context.save();
  62113. context.globalCompositeOperation = 'destination-out';
  62114. context.fillStyle = 'rgba(0, 0, 0, .1)';
  62115. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  62116. context.restore();
  62117. }
  62118. } else {
  62119. this.clear(context);
  62120. }
  62121. if (this.context === '2d') {
  62122. for (var key in self.options) {
  62123. context[key] = self.options[key];
  62124. }
  62125. } else {
  62126. context.clear(context.COLOR_BUFFER_BIT);
  62127. }
  62128. if (
  62129. (self.options.minZoom && map.getZoom() < self.options.minZoom) ||
  62130. (self.options.maxZoom && map.getZoom() > self.options.maxZoom)
  62131. ) {
  62132. return;
  62133. }
  62134. var bounds = map.getBounds(),
  62135. dw = bounds.getEast() - bounds.getWest(),
  62136. dh = bounds.getNorth() - bounds.getSouth();
  62137. var resolutionX = dw / this.canvasLayer.canvas.width,
  62138. resolutionY = dh / this.canvasLayer.canvas.height;
  62139. // 一个像素是多少米
  62140. var zoomUnit = getMeterPerMapUnit('DEGREE') * resolutionX;
  62141. var center = map.getCenter();
  62142. var centerPx = map.project(center);
  62143. var dataGetOptions = {
  62144. transferCoordinate: function (coordinate) {
  62145. if (map.transform.rotationMatrix || self.context === '2d') {
  62146. var worldPoint = map.project(new external_mapboxgl_default.a.LngLat(coordinate[0], coordinate[1]));
  62147. return [worldPoint.x, worldPoint.y];
  62148. }
  62149. var pixel = [(coordinate[0] - center.lng) / resolutionX, (center.lat - coordinate[1]) / resolutionY];
  62150. return [pixel[0] + centerPx.x, pixel[1] + centerPx.y];
  62151. }
  62152. };
  62153. if (time !== undefined) {
  62154. dataGetOptions.filter = function (item) {
  62155. var trails = animationOptions.trails || 10;
  62156. return time && item.time > time - trails && item.time < time;
  62157. };
  62158. }
  62159. var data = self.dataSet.get(dataGetOptions);
  62160. this.processData(data);
  62161. // 兼容unit为'm'的情况
  62162. if (self.options.unit === 'm') {
  62163. if (self.options.size) {
  62164. self.options._size = self.options.size / zoomUnit;
  62165. }
  62166. if (self.options.width) {
  62167. self.options._width = self.options.width / zoomUnit;
  62168. }
  62169. if (self.options.height) {
  62170. self.options._height = self.options.height / zoomUnit;
  62171. }
  62172. } else {
  62173. self.options._size = self.options.size;
  62174. self.options._height = self.options.height;
  62175. self.options._width = self.options.width;
  62176. }
  62177. var worldPoint = map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  62178. this.drawContext(context, data, self.options, worldPoint);
  62179. self.options.updateCallback && self.options.updateCallback(time);
  62180. }
  62181. init(options) {
  62182. var self = this;
  62183. self.options = options;
  62184. this.initDataRange(options);
  62185. this.context = self.options.context || '2d';
  62186. if (self.options.zIndex) {
  62187. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  62188. }
  62189. this.initAnimator();
  62190. }
  62191. /**
  62192. * @function L.supermap.MapVRenderer.prototype.bindMapEvent
  62193. * @description 绑定鼠标移动事件。
  62194. */
  62195. bindMapEvent() {
  62196. this.mapEvent = {
  62197. resizeEvent: this.resizeEvent.bind(this),
  62198. zoomStartEvent: this.zoomStartEvent.bind(this),
  62199. zoomEndEvent: this.zoomEndEvent.bind(this),
  62200. rotateStartEvent: this.rotateStartEvent.bind(this),
  62201. rotateEvent: this.rotateEvent.bind(this),
  62202. moveStartEvent: this.moveStartEvent.bind(this),
  62203. rotateEndEvent: this.rotateEndEvent.bind(this),
  62204. moveEvent: this.moveEvent.bind(this),
  62205. moveEndEvent: this.moveEndEvent.bind(this),
  62206. removeEvent: this.removeEvent.bind(this)
  62207. }
  62208. this.map.on('resize', this.mapEvent.resizeEvent);
  62209. this.map.on('zoomstart', this.mapEvent.zoomStartEvent);
  62210. this.map.on('zoomend', this.mapEvent.zoomEndEvent);
  62211. this.map.on('rotatestart', this.mapEvent.rotateStartEvent);
  62212. this.map.on('rotate', this.mapEvent.rotateEvent);
  62213. this.map.on('rotateend', this.mapEvent.rotateEndEvent);
  62214. // this.map.on('dragend', this.dragEndEvent.bind(this));
  62215. this.map.on('movestart', this.mapEvent.moveStartEvent);
  62216. this.map.on('move', this.mapEvent.moveEvent);
  62217. this.map.on('moveend', this.mapEvent.moveEndEvent);
  62218. this.map.on('remove', this.mapEvent.removeEvent);
  62219. }
  62220. /**
  62221. * @function L.supermap.MapVRenderer.prototype.unbindMapEvent
  62222. * @description 解绑鼠标移动事件。
  62223. */
  62224. unbindMapEvent() {
  62225. this.map.off('resize', this.mapEvent.resizeEvent);
  62226. this.map.off('zoomstart', this.mapEvent.zoomStartEvent);
  62227. this.map.off('zoomend', this.mapEvent.zoomEndEvent);
  62228. this.map.off('rotatestart', this.mapEvent.rotateStartEvent);
  62229. this.map.off('rotate', this.mapEvent.rotateEvent);
  62230. this.map.off('rotateend', this.mapEvent.rotateEndEvent);
  62231. this.map.off('movestart', this.mapEvent.moveStartEvent);
  62232. this.map.off('move', this.mapEvent.moveEvent);
  62233. this.map.off('moveend', this.mapEvent.moveEndEvent);
  62234. this.map.off('remove', this.mapEvent.removeEvent);
  62235. }
  62236. /**
  62237. * @function L.supermap.MapVRenderer.prototype.destroy
  62238. * @description 释放资源。
  62239. */
  62240. destroy() {
  62241. this.unbindMapEvent();
  62242. this.unbindEvent();
  62243. this.clearData();
  62244. this.animator && this.animator.stop();
  62245. this.animator = null;
  62246. this.canvasLayer = null;
  62247. }
  62248. /**
  62249. * @function MapvRenderer.prototype.addAnimatorEvent
  62250. * @description 添加动画事件。
  62251. */
  62252. addAnimatorEvent() {}
  62253. /**
  62254. * @function MapvRenderer.prototype.removeEvent
  62255. * @description 移除事件。
  62256. */
  62257. removeEvent() {
  62258. this.canvasLayer.mapContainer.removeChild(this.canvasLayer.canvas);
  62259. }
  62260. /**
  62261. * @function MapvRenderer.prototype.resizeEvent
  62262. * @description 调整事件。
  62263. */
  62264. resizeEvent() {
  62265. this.canvasLayer.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  62266. var canvas = this.canvasLayer.canvas;
  62267. canvas.style.position = 'absolute';
  62268. canvas.style.top = 0 + 'px';
  62269. canvas.style.left = 0 + 'px';
  62270. var global$2 = typeof window === 'undefined' ? {} : window;
  62271. var devicePixelRatio = this.canvasLayer.devicePixelRatio = global$2.devicePixelRatio || 1;
  62272. canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio;
  62273. canvas.height = parseInt(this.map.getCanvas().style.height) * devicePixelRatio;
  62274. if (!this.canvasLayer.mapVOptions.context || this.canvasLayer.mapVOptions.context == '2d') {
  62275. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  62276. }
  62277. canvas.style.width = this.map.getCanvas().style.width;
  62278. canvas.style.height = this.map.getCanvas().style.height;
  62279. }
  62280. moveEndEvent() {
  62281. this.stopAniamation = false;
  62282. var canvas = this.getContext().canvas;
  62283. canvas.style.transform = '';
  62284. this._canvasUpdate();
  62285. if (this._expectShow === true) {
  62286. this._show();
  62287. }
  62288. }
  62289. moveStartEvent() {
  62290. this.startPitch = this.map.getPitch();
  62291. this.startBearing = this.map.getBearing();
  62292. var startMovePoint = this.map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  62293. this.startMoveX = startMovePoint.x;
  62294. this.startMoveY = startMovePoint.y;
  62295. if (this.animation) {
  62296. this.stopAniamation = true;
  62297. }
  62298. if (this.rotating || this.zooming) {
  62299. return;
  62300. }
  62301. this._expectShow = this.canvasLayer.canvas.style.display !== 'none';
  62302. if (this.map.getPitch() !== 0) {
  62303. this._hide();
  62304. }
  62305. }
  62306. moveEvent() {
  62307. this.canvasLayer.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  62308. var tPitch = this.map.getPitch() - this.startPitch;
  62309. var tBearing = -this.map.getBearing() + this.startBearing;
  62310. var endMovePoint = this.map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  62311. var tMoveX = endMovePoint.x - this.startMoveX;
  62312. var tMoveY = endMovePoint.y - this.startMoveY;
  62313. var canvas = this.getContext().canvas;
  62314. canvas.style.transform =
  62315. 'rotateX(' +
  62316. tPitch +
  62317. 'deg)' +
  62318. ' rotateZ(' +
  62319. tBearing +
  62320. 'deg)' +
  62321. ' translate3d(' +
  62322. tMoveX +
  62323. 'px, ' +
  62324. tMoveY +
  62325. 'px, 0px)';
  62326. }
  62327. zoomStartEvent() {
  62328. this.zooming = true;
  62329. this._hide();
  62330. }
  62331. zoomEndEvent() {
  62332. this.zooming = false;
  62333. }
  62334. rotateStartEvent() {
  62335. this.rotating = true;
  62336. if (this.map.getPitch() !== 0) {
  62337. this._hide();
  62338. }
  62339. }
  62340. rotateEvent() {
  62341. this.canvasLayer.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  62342. var tPitch = this.map.getPitch() - this.startPitch;
  62343. var tBearing = -this.map.getBearing() + this.startBearing;
  62344. var canvas = this.getContext().canvas;
  62345. canvas.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)';
  62346. }
  62347. rotateEndEvent() {
  62348. this.rotating = false;
  62349. }
  62350. /**
  62351. * @function MapvRenderer.prototype.clear
  62352. * @param {Object} context - 当前环境。
  62353. * @description 清除环境。
  62354. */
  62355. clear(context) {
  62356. context &&
  62357. context.clearRect &&
  62358. context.clearRect(
  62359. 0,
  62360. 0,
  62361. parseInt(this.map.getCanvas().style.width),
  62362. parseInt(this.map.getCanvas().style.height)
  62363. );
  62364. }
  62365. /**
  62366. * @function MapvRenderer.prototype.draw
  62367. * @description 渲染绘制。
  62368. */
  62369. draw() {
  62370. this._canvasUpdate();
  62371. }
  62372. _hide() {
  62373. this.canvasLayer.canvas.style.display = 'none';
  62374. }
  62375. _show() {
  62376. this.canvasLayer.canvas.style.display = 'block';
  62377. }
  62378. }
  62379. // CONCATENATED MODULE: ./src/mapboxgl/overlay/MapvLayer.js
  62380. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  62381. * This program are made available under the terms of the Apache License, Version 2.0
  62382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62383. /**
  62384. * @class mapboxgl.supermap.MapvLayer
  62385. * @category Visualization MapV
  62386. * @classdesc Mapv 图层。
  62387. * @param {mapboxgl.Map} map - mapboxgl 地图对象,将在下个版本弃用,请用 map.addLayer() 方法添加图层。
  62388. * @param {Mapv.DataSet} dataSet - MapV 图层数据集。
  62389. * @param {Object} mapVOptions - Mapv 参数。
  62390. * @param {string} [mapVOptions.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("mapvLayer_") 创建专题图层 ID。
  62391. */
  62392. class MapvLayer_MapvLayer {
  62393. constructor(map, dataSet, mapVOptions) {
  62394. this.map = map;
  62395. this.id = mapVOptions.layerID ? mapVOptions.layerID : Util_Util.createUniqueID('mapvLayer_');
  62396. delete mapVOptions['layerID'];
  62397. this.mapVOptions = mapVOptions;
  62398. this.dataSet = dataSet;
  62399. this.visibility = true;
  62400. //保留之前的用法
  62401. if (this.map) {
  62402. this.map.addLayer(this);
  62403. }
  62404. }
  62405. onAdd(map) {
  62406. this.map = map;
  62407. this.renderer = new MapvRenderer_MapvRenderer(this.map, this, this.dataSet, this.mapVOptions);
  62408. this.canvas = this._createCanvas();
  62409. this.renderer._canvasUpdate();
  62410. this.mapContainer = map.getCanvasContainer();
  62411. this.mapContainer.appendChild(this.canvas);
  62412. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  62413. }
  62414. /**
  62415. * @function mapboxgl.supermap.MapvLayer.prototype.removeFromMap
  62416. * @description 移除图层。
  62417. */
  62418. removeFromMap() {
  62419. this.mapContainer.removeChild(this.canvas);
  62420. this.renderer.destroy();
  62421. }
  62422. /**
  62423. * @function mapboxgl.supermap.MapvLayer.prototype.setVisibility
  62424. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  62425. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  62426. */
  62427. setVisibility(visibility) {
  62428. if (visibility !== this.visibility) {
  62429. this.visibility = visibility;
  62430. if (visibility) {
  62431. this.show();
  62432. } else {
  62433. this.hide();
  62434. }
  62435. }
  62436. }
  62437. /**
  62438. * @function mapboxgl.supermap.MapvLayer.prototype.moveTo
  62439. * @description 将图层移动到某个图层之前。
  62440. * @param {string} layerID - 待插入的图层 ID。
  62441. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  62442. */
  62443. moveTo(layerID, before) {
  62444. const layer = document.getElementById(this.canvas.id);
  62445. before = before !== undefined ? before : true;
  62446. if (before) {
  62447. const beforeLayer = document.getElementById(layerID);
  62448. if (layer && beforeLayer) {
  62449. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  62450. }
  62451. return;
  62452. }
  62453. const nextLayer = document.getElementById(layerID);
  62454. if (layer) {
  62455. if (nextLayer.nextSibling) {
  62456. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  62457. return;
  62458. }
  62459. nextLayer.parentNode.appendChild(layer);
  62460. }
  62461. }
  62462. /**
  62463. * @function mapboxgl.supermap.MapvLayer.prototype.getTopLeft
  62464. * @description 获取左上的距离。
  62465. */
  62466. getTopLeft() {
  62467. var map = this.map;
  62468. var topLeft;
  62469. if (map) {
  62470. var bounds = map.getBounds();
  62471. topLeft = bounds.getNorthWest();
  62472. }
  62473. return topLeft;
  62474. }
  62475. /**
  62476. * @function mapboxgl.supermap.MapvLayer.prototype.addData
  62477. * @description 追加数据。
  62478. * @param {Object} data - 要追加的数据。
  62479. * @param {Object} options - 要追加的值。
  62480. */
  62481. addData(data, options) {
  62482. this.renderer.addData(data, options);
  62483. }
  62484. /**
  62485. * @function mapboxgl.supermap.MapvLayer.prototype.update
  62486. * @description 更新图层。
  62487. * @param {Object} opt - 待更新的数据。
  62488. * @param {Object} opt.data - mapv 数据集。
  62489. * @param {Object} opt.options - mapv 绘制参数。
  62490. */
  62491. update(opt) {
  62492. this.renderer.update(opt);
  62493. }
  62494. /**
  62495. * @function mapboxgl.supermap.MapvLayer.prototype.getData
  62496. * @description 获取数据。
  62497. * @returns {mapv.DataSet} mapv 数据集。
  62498. */
  62499. getData() {
  62500. if (this.renderer) {
  62501. this.dataSet = this.renderer.getData();
  62502. }
  62503. return this.dataSet;
  62504. }
  62505. /**
  62506. * @function mapboxgl.supermap.MapvLayer.prototype.removeData
  62507. * @description 删除符合过滤条件的数据。
  62508. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  62509. * @example
  62510. * filter=function(data){
  62511. * if(data.id=="1"){
  62512. * return true
  62513. * }
  62514. * return false;
  62515. * }
  62516. */
  62517. removeData(filter) {
  62518. this.renderer && this.renderer.removeData(filter);
  62519. }
  62520. /**
  62521. * @function mapboxgl.supermap.MapvLayer.prototype.clearData
  62522. * @description 清除数据。
  62523. */
  62524. clearData() {
  62525. this.renderer.clearData();
  62526. }
  62527. show() {
  62528. if (this.renderer) {
  62529. this.renderer._show();
  62530. }
  62531. return this;
  62532. }
  62533. hide() {
  62534. if (this.renderer) {
  62535. this.renderer._hide();
  62536. }
  62537. return this;
  62538. }
  62539. _createCanvas() {
  62540. var canvas = document.createElement('canvas');
  62541. canvas.id = this.id;
  62542. canvas.style.position = 'absolute';
  62543. canvas.style.top = 0 + 'px';
  62544. canvas.style.left = 0 + 'px';
  62545. var global$2 = typeof window === 'undefined' ? {} : window;
  62546. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  62547. canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio;
  62548. canvas.height = parseInt(this.map.getCanvas().style.height) * devicePixelRatio;
  62549. if (!this.mapVOptions.context || this.mapVOptions.context == '2d') {
  62550. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  62551. }
  62552. canvas.style.width = this.map.getCanvas().style.width;
  62553. canvas.style.height = this.map.getCanvas().style.height;
  62554. return canvas;
  62555. }
  62556. /**
  62557. * @function mapboxgl.supermap.MapvLayer.prototype.setZIndex
  62558. * @description 设置 canvas 层级。
  62559. * @param {number} zIndex - canvas 层级。
  62560. */
  62561. setZIndex(z) {
  62562. this.canvas.style.zIndex = z;
  62563. }
  62564. }
  62565. external_mapboxgl_default.a.supermap.MapvLayer = MapvLayer_MapvLayer;
  62566. // CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/Theme3DLayer.js
  62567. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  62568. * This program are made available under the terms of the Apache License, Version 2.0
  62569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62570. /**
  62571. * @class mapboxgl.supermap.Theme3DLayer
  62572. * @category Visualization Theme
  62573. * @classdesc 三维专题图基类,不能直接实例化。
  62574. * @param {string} [id] - 专题图图层 id。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  62575. * @param {Object} layerOptions -专题图图层配置项。
  62576. * @param {number} [layerOptions.opacity=1] - 图层透明度。
  62577. * @param {boolean} [layerOptions.parseNumber=fasle] - 是否预处理数据,将数据转换为 number。
  62578. * @param {boolean} [layerOptions.enableHighlight=false] - 是否开启高亮。
  62579. * @param {string} [layerOptions.highlight="#ADA91E"] - 高亮颜色。
  62580. * @param {string} [layerOptions.baseHeightField] - 数据中表示基础高度的字段。
  62581. * @param {number} [layerOptions.height] - 高度。如果数据指定的 heightField (为height)没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  62582. * @param {string} [layerOptions.heightField] - 数据中表示高度的字段。
  62583. * @param {string} [layerOptions.themeField] - 专题展示的字段。
  62584. * @param {boolean} [playerOptions.showLegend=true] - 是否显示图例。
  62585. * @param {string} [layerOptions.legendTitle] - 图例标题。
  62586. * @param {string} [layerOptions.legendTheme='light'] - 图例主题,取值:'light','dark'。
  62587. * @param {string} [layerOptions.legendOrientation='horizontal'] - 图例方向,取值:'horizontal','vertical'。
  62588. * @param {string} [layerOptions.legendPosition] - 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  62589. */
  62590. class Theme3DLayer {
  62591. constructor(id, layerOptions) {
  62592. /**
  62593. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.id
  62594. * @description Mapbox GL 图层 id。
  62595. */
  62596. this.id = id;
  62597. /**
  62598. * @member {Object} mapboxgl.supermap.Theme3DLayer.prototype.map
  62599. * @description Mapbox GL 地图对象。
  62600. */
  62601. this.map = null;
  62602. /**
  62603. * @member {number} [mapboxgl.supermap.Theme3DLayer.prototype.opacity=1]
  62604. * @description 图层透明度。
  62605. */
  62606. this.opacity = 1;
  62607. /**
  62608. * @member {boolean} [mapboxgl.supermap.Theme3DLayer.prototype.parseNumber=false]
  62609. * @description 是否进行数据预处理,有些字段是 string 类型,需要转换为 number。
  62610. */
  62611. this.parseNumber = false;
  62612. /**
  62613. * @member {boolean} [mapboxgl.supermap.Theme3DLayer.prototype.enableHighlight=false]
  62614. * @description 是否开启高亮。
  62615. */
  62616. this.enableHighlight = false;
  62617. /**
  62618. * @member {Object} [mapboxgl.supermap.Theme3DLayer.prototype.highlight={color: "#ADA91E"}]
  62619. * @description 高亮相关配置。
  62620. */
  62621. this.highlight = {color: "#ADA91E"};
  62622. /**
  62623. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.baseHeightField
  62624. * @description 数据中表示基础高度的字段。
  62625. */
  62626. this.baseHeightField = null;
  62627. /**
  62628. * @member {number} mapboxgl.supermap.Theme3DLayer.prototype.height
  62629. * @description 高度。如果数据指定的 heightField (默认 height) 没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  62630. */
  62631. this.height = null;
  62632. /**
  62633. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.heightField
  62634. * @description 数据中表示高度的字段。
  62635. */
  62636. this.heightField = 'height';
  62637. /**
  62638. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.themeField]
  62639. * @description 专题展示的字段。
  62640. */
  62641. this.themeField = this.heightField;
  62642. /**
  62643. * @member {boolean} [mapboxgl.supermap.Theme3DLayer.prototype.showLegend=true]
  62644. * @description 是否显示图例。
  62645. */
  62646. this.showLegend = true;
  62647. /**
  62648. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.legendTitle]
  62649. * @description 图例标题。
  62650. */
  62651. this.legendTitle = null;
  62652. /**
  62653. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.legendTheme='light']
  62654. * @description 图例主题,取值:'light','dark'。
  62655. * @default 'light'
  62656. */
  62657. this.legendTheme = 'light';
  62658. /**
  62659. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.legendOrientation='horizontal']
  62660. * @description 图例方向,取值:'horizontal','vertical'。
  62661. * @default 'horizontal'
  62662. */
  62663. this.legendOrientation = 'horizontal';
  62664. /**
  62665. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.legendPosition
  62666. * @description 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  62667. * @default 'bottom-right'
  62668. */
  62669. this.legendPosition = 'bottom-right';
  62670. this._highlightLayerId = `${this.id}-highlightLayer`;
  62671. this._extend(this, layerOptions);
  62672. }
  62673. /**
  62674. * @function mapboxgl.supermap.Theme3DLayer.prototype.setLayerOptions
  62675. * @description 设置图层相关参数。
  62676. * @param {Object} layerOptions - 该专题图图层相关参数。
  62677. * @param {number} [layerOptions.opacity=1] - 图层透明度。
  62678. * @param {boolean} [layerOptions.parseNumber=false] - 是否预处理数据,将数据转换为 number。
  62679. * @param {string} [layerOptions.baseHeightField] - 数据中表示基础高度的字段
  62680. * @param {number} [layerOptions.height] - 高度。如果数据指定的heightField(默认height)没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  62681. * @param {string} [layerOptions.heightField] - 数据中表示高度的字段。
  62682. * @param {string} [layerOptions.themeField] - 专题展示的字段。
  62683. * @param {boolean} [layerOptions.showLegend=true] - 是否显示图例。
  62684. * @param {string} layerOptions.legendTitle - 图例标题。
  62685. * @param {string} [layerOptions.legendTheme='light'] - 图例主题,取值:'light','dark'。
  62686. * @param {string} [layerOptions.legendOrientation='horizontal'] - 图例方向,取值:'horizontal','vertical'。
  62687. * @param {string} [layerOptions.legendPosition] - 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  62688. * @returns {this}
  62689. */
  62690. setLayerOptions(layerOptions) {
  62691. this._extend(this, layerOptions);
  62692. return this;
  62693. }
  62694. /**
  62695. * @function mapboxgl.supermap.Theme3DLayer.prototype.setHighlightStyleOptions
  62696. * @description 设置图层高亮相关参数。
  62697. * @param {Object} highlightOptions - 该专题图图层高亮相关参数。
  62698. * @param {string} [highlightOptions.color] - 颜色。
  62699. * @param {function} highlightOptions.callback - 回调,返回数据参数(data,event)。
  62700. * @returns {this}
  62701. */
  62702. setHighlightStyleOptions(highlightOptions) {
  62703. this._extend(this.highlight, highlightOptions);
  62704. return this;
  62705. }
  62706. /**
  62707. * @function mapboxgl.supermap.Theme3DLayer.prototype.setData
  62708. * @description 设置数据,数据格式必须为 GeoJSON 格式。
  62709. * @param {GeoJSONObject} data - GeoJSON 格式数据。
  62710. * @param {boolean} [parseNumber=false] - 是否进行数据预处理,有些字段是 string 类型,需要转换为 number。
  62711. */
  62712. setData(data, parseNumber) {
  62713. var me = this;
  62714. me.data = data;
  62715. if (parseNumber != null) {
  62716. me.parseNumber = parseNumber;
  62717. }
  62718. me.parseNumber && me.data && me.data.features && me.data.features.map(function (val) {
  62719. if (me.baseHeightField && val.properties[me.baseHeightField]) {
  62720. val.properties[me.baseHeightField] = parseFloat(val.properties[me.baseHeightField]);
  62721. }
  62722. if (me.heightField && val.properties[me.heightField]) {
  62723. val.properties[me.heightField] = parseFloat(val.properties[me.heightField]);
  62724. }
  62725. return val;
  62726. });
  62727. return this;
  62728. }
  62729. /**
  62730. * @function mapboxgl.supermap.Theme3DLayer.prototype.getData
  62731. * @description 获取数据。
  62732. * @returns {GeoJSONObject} 获取的数据。
  62733. */
  62734. getData() {
  62735. return this.data;
  62736. }
  62737. /**
  62738. * @function mapboxgl.supermap.Theme3DLayer.prototype.addTo
  62739. * @description 添加图层到地图上。
  62740. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  62741. * @returns {this} this 对象。
  62742. */
  62743. addTo(map) {
  62744. this.map = map;
  62745. if (!this.map) {
  62746. return this;
  62747. }
  62748. this.show();
  62749. return this;
  62750. }
  62751. /**
  62752. * @function mapboxgl.supermap.Theme3DLayer.prototype.show
  62753. * @description 显示图层。
  62754. * @param {Object} options - 图层配置项。
  62755. * @returns {this} this 对象。
  62756. */
  62757. show(options) {
  62758. this._extend(this, options);
  62759. this._addLayer();
  62760. if (this.enableHighlight) {
  62761. this._addHighLightLayer();
  62762. }
  62763. if (this.showLegend) {
  62764. if (!this.legend) {
  62765. this.legend = this._createLegendControl();
  62766. }
  62767. this.map.addControl(this.legend, this.legendPosition);
  62768. }
  62769. return this;
  62770. }
  62771. /**
  62772. * @function mapboxgl.supermap.Theme3DLayer.prototype.remove
  62773. * @description 从地图上移除图层。
  62774. * @returns {this} this 对象。
  62775. */
  62776. remove() {
  62777. if (!this.map) {
  62778. return this;
  62779. }
  62780. //移除图层
  62781. var layerId = this.id ? this.id : "theme3DLayer";
  62782. if (this.map.getLayer(layerId)) {
  62783. this.map.off('mousemove', layerId, this._onMouseMove.bind(this));
  62784. this.map.on('mouseout', layerId, this._onMouseMove.bind(this));
  62785. this.map.removeLayer(layerId);
  62786. }
  62787. //移除高亮图层
  62788. if (this.map.getLayer(this._highlightLayerId)) {
  62789. this._selectFeatureId = null;
  62790. this.map.removeLayer(this._highlightLayerId );
  62791. }
  62792. //移除图例
  62793. if (this.legend) {
  62794. this.map.removeControl(this.legend);
  62795. }
  62796. return this;
  62797. }
  62798. /**
  62799. * @function mapboxgl.supermap.Theme3DLayer.prototype.getLayerStyleOptions
  62800. * @description 获取图层样式。
  62801. * @returns {Object} Mapbox GL 样式对象。
  62802. */
  62803. getLayerStyleOptions() {
  62804. //子类重写实现
  62805. }
  62806. /**
  62807. * @function mapboxgl.supermap.Theme3DLayer.prototype.getHighlightStyleOptions
  62808. * @description 获取高亮样式,子类重写实现。
  62809. * @returns {Object} Mapbox GL 样式对象。
  62810. */
  62811. getHighlightStyleOptions() {
  62812. //子类重写实现
  62813. }
  62814. _createLegendControl(html) {
  62815. var me = this;
  62816. function LegendControl() {
  62817. }
  62818. LegendControl.prototype.onAdd = function (map) {
  62819. this._map = map;
  62820. this._container = document.createElement('div');
  62821. var className = 'mapboxgl-ctrl legend ';
  62822. var theme = 'legend-light';
  62823. if (me.legendTheme === 'dark') {
  62824. theme = 'legend-dark';
  62825. }
  62826. var orientation = ' legend-horizontal';
  62827. if (me.legendOrientation === 'vertical') {
  62828. orientation = ' legend-vertical';
  62829. }
  62830. this._container.className = className + theme + orientation;
  62831. if (html) {
  62832. this._container.innerHTML = html;
  62833. } else {
  62834. var legendTitle = me.legendTitle || "";
  62835. var titleElement = " <div class='legend-title'>" + legendTitle + "</div>";
  62836. var content = me._createLegendElement.call(me) || "";
  62837. var contentElement = "<div class='legend-content'>" + content + "</div>";
  62838. this._container.innerHTML = titleElement + contentElement;
  62839. }
  62840. me._appendLegendCSSStyle();
  62841. return this._container;
  62842. };
  62843. LegendControl.prototype.onRemove = function () {
  62844. this._container.parentNode.removeChild(this._container);
  62845. this._map = undefined;
  62846. };
  62847. return new LegendControl();
  62848. }
  62849. _createLegendElement() {
  62850. //子类实现
  62851. }
  62852. _addLayer() {
  62853. var paintOptions = this.getLayerStyleOptions();
  62854. var id = this.id ? this.id : "theme3DLayer";
  62855. var sourceId = this.sourceId = id + 'Source';
  62856. if (!this.map.getSource(sourceId)) {
  62857. this.map.addSource(sourceId, {
  62858. 'type': 'geojson',
  62859. 'data': this.data
  62860. });
  62861. } else {
  62862. this.map.removeSource(sourceId);
  62863. this.map.addSource(sourceId, {
  62864. 'type': 'geojson',
  62865. 'data': this.data
  62866. });
  62867. }
  62868. this.map.addLayer({
  62869. 'id': id,
  62870. 'type': 'fill-extrusion',
  62871. 'source': sourceId,
  62872. 'paint': paintOptions
  62873. });
  62874. this.map.moveLayer(id);
  62875. }
  62876. //添加高亮图层
  62877. _addHighLightLayer() {
  62878. if (!this.map) {
  62879. return;
  62880. }
  62881. var map = this.map;
  62882. map.addLayer({
  62883. 'id': this._highlightLayerId,
  62884. 'type': 'fill-extrusion',
  62885. 'source': this.sourceId,
  62886. 'paint': this.getHighlightStyleOptions(),
  62887. "filter": ["in", "$id", ""]
  62888. });
  62889. this._selectFeatureId = null;
  62890. map.on('mousemove', this.id, this._onMouseMove.bind(this));
  62891. map.on('mouseout', this.id, this._onMouseMove.bind(this));
  62892. }
  62893. _onMouseMove(e) {
  62894. var me = this, map = this.map;
  62895. var features = map.queryRenderedFeatures(e.point, {layers: [me.id]});
  62896. if (me.highlight && me.highlight.callback) {
  62897. me.highlight.callback(features, e);
  62898. }
  62899. if (!features || features.length < 1) {
  62900. me._clearHighlight.call(me);
  62901. me._selectFeatureId = null;
  62902. return;
  62903. }
  62904. var id = features[0].id;
  62905. if (me._selectFeatureId === id) {
  62906. return;
  62907. }
  62908. me._selectFeatureId = id;
  62909. map.setFilter(me._highlightLayerId, ['==', '$id', me._selectFeatureId]);
  62910. }
  62911. _clearHighlight() {
  62912. if (this.map) {
  62913. this.map.setFilter(this._highlightLayerId, ["in", "$id", ""]);
  62914. }
  62915. }
  62916. _appendLegendCSSStyle() {
  62917. var legendStyle = document.createElement('style');
  62918. legendStyle.type = 'text/css';
  62919. var baseStyle = `
  62920. .legend {
  62921. display: inline-block;
  62922. border-radius: 2px;
  62923. -moz-border-radius: 2px;
  62924. -webkit-border-radius: 2px;
  62925. font-size: 12px;
  62926. color: rgba(0, 0, 0, 0.8);
  62927. background-color: rgb(255, 255, 255);
  62928. }
  62929. .legend-light {
  62930. color: rgba(0, 0, 0, 0.8);
  62931. background-color: rgb(255, 255, 255);
  62932. box-shadow: 0px 0px 6px #bbbbbb;
  62933. -moz-box-shadow: 0px 6px 10px #bbbbbb;
  62934. -webkit-box-shadow: 0px 0px 6px #bbbbbb;
  62935. }
  62936. .legend-dark {
  62937. color: rgba(255, 255, 255, 0.8);
  62938. background-color: rgb(64, 64, 64);
  62939. }
  62940. .legend .legend-title {
  62941. min-height: 14px;
  62942. max-width: 500px;
  62943. padding:6px 10px;
  62944. }
  62945. .legend-light .legend-title {
  62946. color: rgba(0, 0, 0, 0.8);
  62947. }
  62948. .legend-dark .legend-title {
  62949. color: rgba(255, 255, 255, 0.8);
  62950. }
  62951. .legend-content{
  62952. padding:6px 10px;
  62953. }
  62954. `;
  62955. legendStyle.innerHTML = baseStyle + this._legendCSSStyle();
  62956. document.getElementsByTagName('head')[0].appendChild(legendStyle);
  62957. }
  62958. //各种图层对应的自己的图例的样式
  62959. _legendCSSStyle() {
  62960. //子类可重写实现
  62961. return `
  62962. .legend ul {
  62963. padding: 0;
  62964. margin: 0 16px;
  62965. height: 100%;
  62966. display: block;
  62967. list-style: none;
  62968. }
  62969. .legend li {
  62970. vertical-align: middle;
  62971. }
  62972. .legend li span:first-child {
  62973. vertical-align: middle;
  62974. }
  62975. .legend li span:last-child {
  62976. line-height: 28px;
  62977. max-width: 200px;
  62978. vertical-align: middle;
  62979. white-space: nowrap;
  62980. overflow: hidden;
  62981. text-overflow: ellipsis;
  62982. -ms-text-overflow: ellipsis;
  62983. }
  62984. .legend-vertical li {
  62985. height: 28px;
  62986. }
  62987. .legend-vertical li span:first-child {
  62988. display: inline-block;
  62989. width: 60px;
  62990. height: 100%;
  62991. }
  62992. .legend-vertical li span:last-child {
  62993. display: inline-block;
  62994. margin-left: 16px;
  62995. height: 100%;
  62996. }
  62997. .legend-horizontal li {
  62998. height: 56px;
  62999. float: left;
  63000. }
  63001. .legend-horizontal li span:first-child {
  63002. display: block;
  63003. width: 100%;
  63004. height: 50%;
  63005. }
  63006. .legend-horizontal li span:last-child {
  63007. display: block;
  63008. vertical-align: middle;
  63009. width: 60px;
  63010. height: 50%;
  63011. text-align: center;
  63012. }
  63013. `;
  63014. }
  63015. _extend(dest) {
  63016. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  63017. var arg = Object.getOwnPropertyNames(arguments)[index];
  63018. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  63019. continue;
  63020. }
  63021. var obj = arguments[arg];
  63022. if (obj) {
  63023. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  63024. var key = Object.getOwnPropertyNames(obj)[j];
  63025. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  63026. continue;
  63027. }
  63028. dest[key] = obj[key];
  63029. }
  63030. }
  63031. }
  63032. return dest;
  63033. }
  63034. }
  63035. external_mapboxgl_default.a.supermap.Theme3DLayer = Theme3DLayer;
  63036. // CONCATENATED MODULE: ./src/mapboxgl/overlay/RangeTheme3DLayer.js
  63037. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63038. * This program are made available under the terms of the Apache License, Version 2.0
  63039. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63040. /**
  63041. * @class mapboxgl.supermap.RangeTheme3DLayer
  63042. * @category Visualization Theme
  63043. * @classdesc 三维分段专题图。
  63044. * @param {string} [id] - 专题图图层 id。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  63045. * @param {Object} layerOptions - 专题图图层配置项,参数继承自 Theme3DLayer。
  63046. * @param {Array} [layerOptions.heightStops] - 新增参数,数据高度分段数组。
  63047. * @param {Array} layerOptions.colorStops - 新增参数,数据颜色分段数组。
  63048. * @param {number} [layerOptions.base] - 新增参数,数据分段线性增量。
  63049. * @param {number} [layerOptions.legendRatio=1] - 新增参数,图例数值扩大系数。
  63050. * @example
  63051. * new mapboxgl.supermap.RangeTheme3DLayer(layerId, map, {
  63052. * enableHighlight:true,
  63053. * // 设置分段
  63054. * heightField: "floor",
  63055. * heightStops: [[1, 10], [10, 100]],
  63056. * colorStops: [[0, 'rgba(33, 41, 52, 0.8)'], [20, 'rgba(69,117,180, 0.7)'], [50, 'rgba(116,173,209, 0.7)'], [100, 'rgba(171,217,233, 0.7)']],
  63057. * // 显示图例
  63058. * showLegend: true,
  63059. * legendTheme: 'dark',
  63060. * legendTitle: "图例"
  63061. * });
  63062. */
  63063. class RangeTheme3DLayer_RangeTheme3DLayer extends Theme3DLayer {
  63064. constructor(id, layerOptions) {
  63065. super(id, layerOptions);
  63066. /**
  63067. * @member {Array} mapboxgl.supermap.RangeTheme3DLayer.prototype.heightStops
  63068. * @description 数据高度分段数组。
  63069. */
  63070. this.heightStops = null;
  63071. /**
  63072. * @member {Array} mapboxgl.supermap.RangeTheme3DLayer.prototype.colorStops
  63073. * @description 数据颜色分段数组。
  63074. */
  63075. this.colorStops = null;
  63076. /**
  63077. * @member {number} mapboxgl.supermap.RangeTheme3DLayer.prototype.base
  63078. * @description 数据分段线性增量。
  63079. */
  63080. this.base = null;
  63081. /**
  63082. * @member {number} [mapboxgl.supermap.RangeTheme3DLayer.prototype.legendRatio=1]
  63083. * @description 图例数值扩大系数。
  63084. */
  63085. this.legendRatio = 1;
  63086. this._extend(this, layerOptions);
  63087. }
  63088. /**
  63089. * @function mapboxgl.supermap.RangeTheme3DLayer.prototype.getLayerStyleOptions
  63090. * @description 获取图层样式。
  63091. * @returns {Object} Mapbox GL 样式对象。
  63092. */
  63093. getLayerStyleOptions() {
  63094. var opacity = this.opacity == null ? 1 : this.opacity;
  63095. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  63096. var reg = /^[0-9]+.?[0-9]*$/;
  63097. var options = {
  63098. 'fill-extrusion-color': {
  63099. 'stops': this.colorStops,
  63100. 'property': this.themeField || this.heightField,
  63101. 'type': 'interval',
  63102. 'base': reg.test(this.base) ? this.base : 1
  63103. },
  63104. 'fill-extrusion-opacity': opacity
  63105. };
  63106. if (this.heightStops) {
  63107. options['fill-extrusion-height'] = {
  63108. 'stops': this.heightStops,
  63109. 'property': this.heightField || 'height',
  63110. 'base': reg.test(this.base) ? this.base : 1
  63111. }
  63112. } else if (this.height) {
  63113. options['fill-extrusion-height'] = this.height;
  63114. } else {
  63115. options['fill-extrusion-height'] = {
  63116. 'property': this.heightField || 'height',
  63117. 'type': 'identity'
  63118. }
  63119. }
  63120. if (this.baseHeightField) {
  63121. options['fill-extrusion-base'] = {
  63122. 'property': this.baseHeightField,
  63123. 'type': 'identity'
  63124. }
  63125. }
  63126. return options;
  63127. }
  63128. /**
  63129. * @function mapboxgl.supermap.RangeTheme3DLayer.prototype.getHighlightStyleOptions
  63130. * @description 获取高亮样式。
  63131. * @returns {Object} mapboxgl 样式对象。
  63132. */
  63133. getHighlightStyleOptions() {
  63134. var color = (this.highlight && this.highlight.color != null) ? this.highlight.color : '#ADA91E';
  63135. return {
  63136. 'fill-extrusion-color': color,
  63137. 'fill-extrusion-height': {
  63138. "stops": this.heightStops,
  63139. "property": this.heightField
  63140. },
  63141. 'fill-extrusion-opacity': this.highlight && this.highlight.opacity || 0.6
  63142. }
  63143. }
  63144. _createLegendElement() {
  63145. var len = this.colorStops && this.colorStops.length || 0;
  63146. //颜色分段对应标识
  63147. var legendListElement = "<ul>";
  63148. var i;
  63149. for (i = 0; i < len; i++) {
  63150. var value = this.colorStops[i][0];
  63151. var text = this._getWrapperText(value);
  63152. if (i === len - 1) {
  63153. text = "> " + text;
  63154. } else {
  63155. var next = this._getWrapperText(this.colorStops[i + 1][0]);
  63156. text = text + "-" + next;
  63157. }
  63158. var color = this.colorStops[i][1];
  63159. legendListElement += "<li><span style='background-color:" + color + ";'></span><span>" + text + "</span></li>";
  63160. }
  63161. legendListElement += "</ul>";
  63162. return legendListElement;
  63163. }
  63164. _getWrapperText(number) {
  63165. var value = number * ((this.legendRatio == null) ? 1 : parseFloat(this.legendRatio));
  63166. //单个颜色值宽度为60px,最大只能完全显示1000000,否则就超出宽度,则显示以为k计数单位的值
  63167. var num = parseFloat(value);
  63168. if (num % 1000000 <= 1000000) {
  63169. return num.toString();
  63170. }
  63171. return parseInt(num / 1000) + 'k'
  63172. }
  63173. }
  63174. external_mapboxgl_default.a.supermap.RangeTheme3DLayer = RangeTheme3DLayer_RangeTheme3DLayer;
  63175. // CONCATENATED MODULE: ./src/mapboxgl/overlay/RangeThemeLayer.js
  63176. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63177. * This program are made available under the terms of the Apache License, Version 2.0
  63178. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63179. /**
  63180. * @class mapboxgl.supermap.RangeThemeLayer
  63181. * @category Visualization Theme
  63182. * @classdesc 分段专题图层。
  63183. * @param {string} name - 图层名。
  63184. * @param {Object} options - 参数。
  63185. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  63186. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  63187. * @param {mapboxgl.Map} options.map - 当前 Mapbox GL map 对象。
  63188. * @param {number} [options.opacity=1] - 图层透明度。
  63189. * @param {string} options.themeField - 指定创建专题图字段。
  63190. * @param {Object} options.style - 专题图样式。
  63191. * @param {Object} options.styleGroups - 各专题类型样式组。
  63192. * @param {boolean} [options.isHoverAble=false] - 是否开启 hover 事件。
  63193. * @param {Object} [options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  63194. * @extends {mapboxgl.supermap.GeoFeatureThemeLayer}
  63195. */
  63196. class RangeThemeLayer_Range extends GeoFeatureThemeLayer_GeoFeature {
  63197. constructor(name, opt_options) {
  63198. super(name, opt_options);
  63199. this.style = opt_options.style;
  63200. this.isHoverAble = opt_options.isHoverAble;
  63201. this.highlightStyle = opt_options.highlightStyle;
  63202. this.themeField = opt_options.themeField;
  63203. this.styleGroups = opt_options.styleGroups;
  63204. }
  63205. /**
  63206. * @function mapboxgl.supermap.RangeThemeLayer.prototype.createThematicFeature
  63207. * @description 创建专题图要素。
  63208. * @param {Object} feature - 要创建的专题图形要素。
  63209. */
  63210. createThematicFeature(feature) {
  63211. //赋 style
  63212. var style = this.getStyleByData(feature);
  63213. //创建专题要素时的可选参数
  63214. var options = {};
  63215. options.nodesClipPixel = this.nodesClipPixel;
  63216. options.isHoverAble = this.isHoverAble;
  63217. options.isMultiHover = this.isMultiHover;
  63218. options.isClickAble = this.isClickAble;
  63219. options.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(this.highlightStyle);
  63220. //将数据转为专题要素(Vector)
  63221. var thematicFeature = new ThemeVector_ThemeVector(feature, this, ShapeFactory_ShapeFactory.transformStyle(style), options);
  63222. //直接添加图形到渲染器
  63223. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  63224. this.renderer.addShape(thematicFeature.shapes[m]);
  63225. }
  63226. return thematicFeature;
  63227. }
  63228. /**
  63229. * @private
  63230. * @function mapboxgl.supermap.RangeThemeLayer.prototype.getStyleByData
  63231. * @description 通过数据获取 style。
  63232. * @param {Object} fea - 要素数据。
  63233. */
  63234. getStyleByData(fea) {
  63235. var style = {};
  63236. var feature = fea;
  63237. style = Util_Util.copyAttributesWithClip(style, this.style);
  63238. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  63239. var Sf = this.themeField;
  63240. var Attrs = feature.attributes;
  63241. var Gro = this.styleGroups;
  63242. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  63243. var attr = null; //属性值
  63244. for (var property in Attrs) {
  63245. if (Sf === property) {
  63246. isSfInAttrs = true;
  63247. attr = Attrs[property];
  63248. break;
  63249. }
  63250. }
  63251. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  63252. if (isSfInAttrs) {
  63253. for (var i = 0, len = Gro.length; i < len; i++) {
  63254. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  63255. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  63256. var sty1 = Gro[i].style;
  63257. style = Util_Util.copyAttributesWithClip(style, sty1);
  63258. }
  63259. }
  63260. }
  63261. }
  63262. if (feature.style && this.isAllowFeatureStyle === true) {
  63263. style = Util_Util.copyAttributesWithClip(feature.style);
  63264. }
  63265. return style;
  63266. }
  63267. }
  63268. external_mapboxgl_default.a.supermap.RangeThemeLayer = RangeThemeLayer_Range;
  63269. // CONCATENATED MODULE: ./src/mapboxgl/overlay/RankSymbolThemeLayer.js
  63270. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63271. * This program are made available under the terms of the Apache License, Version 2.0
  63272. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63273. /**
  63274. * @class mapboxgl.supermap.RankSymbolThemeLayer
  63275. * @category Visualization Theme
  63276. * @classdesc 等级符号专题图层。
  63277. * @param {string} name - 图层名。
  63278. * @param {string} symbolType - 符号类型。
  63279. * @param {Object} opt_options - 参数。
  63280. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  63281. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  63282. * @param {mapboxgl.Map} opt_options.map - 当前 mapboxgl map 对象。
  63283. * @param {number} [opt_options.opacity=1] - 图层透明度。
  63284. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  63285. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  63286. * @param {string} [opt_options.chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  63287. * @param {Object} [opt_options.symbolSetting] - 各类型图表的 symbolSetting 对象可设属性请参考具体图表模型类的注释中对 symbolSetting 对象可设属性的描述。symbolSetting 对象通常都具有以下 5 个基础可设属性:
  63288. * @param {number} [opt_options.symbolSetting.width] - 专题要素(图表)宽度。
  63289. * @param {number} [opt_options.symbolSetting.height] - 专题要素(图表)高度。
  63290. * @param {Array.<number>} opt_options.symbolSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  63291. * @param {number} [opt_options.symbolSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  63292. * @param {number} [opt_options.symbolSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  63293. * @param {Array.<number>} opt_options.symbolSetting.dataViewBoxParameter - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  63294. * @param {number} opt_options.symbolSetting.decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  63295. * @extends {mapboxgl.supermap.GraphThemeLayer}
  63296. */
  63297. class RankSymbolThemeLayer_RankSymbol extends GraphThemeLayer_Graph {
  63298. constructor(name, symbolType, opt_options) {
  63299. super(name, symbolType, opt_options);
  63300. this.symbolType = symbolType;
  63301. this.symbolSetting = opt_options.symbolSetting;
  63302. this.themeField = opt_options.themeField;
  63303. }
  63304. /**
  63305. * @function mapboxgl.supermap.RankSymbolThemeLayer.prototype.setSymbolType
  63306. * @description 设置标志符号。
  63307. * @param {string} [symbolType] - 符号类型。
  63308. */
  63309. setSymbolType(symbolType) {
  63310. this.symbolType = symbolType;
  63311. this.redraw();
  63312. }
  63313. /**
  63314. * @function mapboxgl.supermap.RankSymbolThemeLayer.prototype.createThematicFeature
  63315. * @description 创建专题图形要素。
  63316. * @param {Object} feature - 要创建的专题图形要素。
  63317. */
  63318. createThematicFeature(feature) {
  63319. var thematicFeature;
  63320. // 检查图形创建条件并创建图形
  63321. if (feature_Theme_Theme[this.symbolType] && this.themeField && this.symbolSetting) {
  63322. thematicFeature = new feature_Theme_Theme[this.symbolType](feature, this, [this.themeField], this.symbolSetting);
  63323. }
  63324. // thematicFeature 是否创建成功
  63325. if (!thematicFeature) {
  63326. return false;
  63327. }
  63328. // 对专题要素执行图形装载
  63329. thematicFeature.assembleShapes();
  63330. return thematicFeature;
  63331. }
  63332. }
  63333. external_mapboxgl_default.a.supermap.RankSymbolThemeLayer = RankSymbolThemeLayer_RankSymbol;
  63334. // CONCATENATED MODULE: ./src/mapboxgl/overlay/UniqueTheme3DLayer.js
  63335. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63336. * This program are made available under the terms of the Apache License, Version 2.0
  63337. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63338. /**
  63339. * @class mapboxgl.supermap.UniqueTheme3DLayer
  63340. * @category Visualization Theme
  63341. * @classdesc 三维单值专题图。
  63342. * @param {string} [id] - 专题图图层 id。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  63343. * @param {Object} layerOptions - 专题图图层配置项,参数继承自 Theme3DLayer。
  63344. * @param {number} [layerOptions.height] - 新增参数,如果数据指定的 heightField (默认为 height )没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  63345. * @param {Array} layerOptions.colorStops - 新增参数,数据颜色分段数组。
  63346. */
  63347. class UniqueTheme3DLayer_UniqueTheme3DLayer extends Theme3DLayer {
  63348. constructor(id, layerOptions) {
  63349. super(id, layerOptions);
  63350. /**
  63351. * @member mapboxgl.supermap.UniqueTheme3DLayer.prototype.colorStops -{Array}
  63352. * @description 数据颜色数组,如[["绿地","#CD7054"],["道路","#AD1283"]]。
  63353. */
  63354. this.colorStops = null;
  63355. this._extend(this, layerOptions);
  63356. }
  63357. /**
  63358. * @function mapboxgl.supermap.UniqueTheme3DLayer.prototype.getLayerStyleOptions
  63359. * @description 获取图层样式。
  63360. * @returns {Object} Mapbox GL 样式对象。
  63361. */
  63362. getLayerStyleOptions() {
  63363. var opacity = this.opacity == null ? 1 : this.opacity;
  63364. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  63365. var options = {
  63366. 'fill-extrusion-color': {
  63367. 'stops': this.colorStops,
  63368. 'property': this.themeField,
  63369. 'type': 'categorical'
  63370. },
  63371. 'fill-extrusion-opacity': opacity
  63372. };
  63373. if (this.height != null) {
  63374. options['fill-extrusion-height'] = this.height;
  63375. } else {
  63376. options['fill-extrusion-height'] = {
  63377. 'property': this.heightField || 'height',
  63378. 'type': 'categorical'
  63379. };
  63380. }
  63381. if (this.baseHeightField) {
  63382. options['fill-extrusion-base'] = {
  63383. 'property': this.baseHeightField,
  63384. 'type': 'identity'
  63385. }
  63386. }
  63387. return options;
  63388. }
  63389. /**
  63390. * @function mapboxgl.supermap.UniqueTheme3DLayer.prototype.getHighlightStyleOptions
  63391. * @description 获取高亮样式。
  63392. * @returns {Object} Mapbox GL 样式对象。
  63393. */
  63394. getHighlightStyleOptions() {
  63395. var color = (this.highlight && this.highlight.color != null) ? this.highlight.color : '#ADA91E';
  63396. var paint = {
  63397. 'fill-extrusion-color': color,
  63398. 'fill-extrusion-height': {
  63399. "stops": this.heightStops,
  63400. "property": this.heightField,
  63401. 'type': 'categorical'
  63402. },
  63403. 'fill-extrusion-opacity': this.highlight && this.highlight.opacity || 0.6
  63404. };
  63405. if (this.height != null) {
  63406. paint['fill-extrusion-height'] = this.height || 0;
  63407. }
  63408. return paint;
  63409. }
  63410. _createLegendElement() {
  63411. var legendListElement = "<ul>";
  63412. var len = this.colorStops && this.colorStops.length || 0;
  63413. for (var i = 0; i < len; i++) {
  63414. var text = this.colorStops[i][0];
  63415. var color = this.colorStops[i][1];
  63416. legendListElement += "<li><span style='background-color:" + color + ";'></span><span>" + text + "</span></li>";
  63417. }
  63418. legendListElement += "</ul>";
  63419. return legendListElement;
  63420. }
  63421. }
  63422. external_mapboxgl_default.a.supermap.UniqueTheme3DLayer = UniqueTheme3DLayer_UniqueTheme3DLayer;
  63423. // CONCATENATED MODULE: ./src/mapboxgl/overlay/UniqueThemeLayer.js
  63424. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63425. * This program are made available under the terms of the Apache License, Version 2.0
  63426. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63427. /**
  63428. * @class mapboxgl.supermap.UniqueThemeLayer
  63429. * @category Visualization Theme
  63430. * @classdesc 单值专题图层。
  63431. * @param {string} name - 图层名。
  63432. * @param {Object} opt_options - 参数。
  63433. * @param {string} opt_options.themeField - 指定创建专题图字段。
  63434. * @param {Object} opt_options.style - 专题图样式。
  63435. * @param {Object} opt_options.styleGroups - 各专题类型样式组。
  63436. * @param {mapboxgl.Map} opt_options.map - 当前 mapboxgl map 对象。
  63437. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  63438. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  63439. * @param {number} [opt_options.opacity=1] - 图层透明度。
  63440. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  63441. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  63442. * @extends {mapboxgl.supermap.GeoFeatureThemeLayer}
  63443. */
  63444. class UniqueThemeLayer_Unique extends GeoFeatureThemeLayer_GeoFeature {
  63445. constructor(name, opt_options) {
  63446. super(name, opt_options);
  63447. this.themeField = opt_options.themeField;
  63448. this.style = opt_options.style;
  63449. this.styleGroups = opt_options.styleGroups;
  63450. this.isHoverAble = opt_options.isHoverAble;
  63451. this.highlightStyle = opt_options.highlightStyle;
  63452. }
  63453. /**
  63454. * @private
  63455. * @function mapboxgl.supermap.UniqueThemeLayer.prototype.createThematicFeature
  63456. * @description 创建专题图要素。
  63457. * @param {Object} feature - 要创建的专题图形要素。
  63458. */
  63459. createThematicFeature(feature) {
  63460. //赋 style
  63461. var style = this.getStyleByData(feature);
  63462. //创建专题要素时的可选参数
  63463. var options = {};
  63464. options.nodesClipPixel = this.nodesClipPixel;
  63465. options.isHoverAble = this.isHoverAble;
  63466. options.isMultiHover = this.isMultiHover;
  63467. options.isClickAble = this.isClickAble;
  63468. options.highlightStyle = ShapeFactory_ShapeFactory.transformStyle(this.highlightStyle);
  63469. //将数据转为专题要素(Vector)
  63470. var thematicFeature = new ThemeVector_ThemeVector(feature, this, ShapeFactory_ShapeFactory.transformStyle(style), options);
  63471. //直接添加图形到渲染器
  63472. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  63473. this.renderer.addShape(thematicFeature.shapes[m]);
  63474. }
  63475. return thematicFeature;
  63476. }
  63477. /**
  63478. * @private
  63479. * @function mapboxgl.supermap.UniqueThemeLayer.prototype.getStyleByData
  63480. * @description 通过数据获取 style。
  63481. * @param {Object} fea - 要素数据。
  63482. */
  63483. getStyleByData(fea) {
  63484. var style = {};
  63485. var feature = fea;
  63486. style = Util_Util.copyAttributesWithClip(style, this.style);
  63487. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  63488. var tf = this.themeField;
  63489. var Attrs = feature.attributes;
  63490. var Gro = this.styleGroups;
  63491. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  63492. var attr = null; //属性值
  63493. for (var property in Attrs) {
  63494. if (tf === property) {
  63495. isSfInAttrs = true;
  63496. attr = Attrs[property];
  63497. break;
  63498. }
  63499. }
  63500. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  63501. if (isSfInAttrs) {
  63502. for (var i = 0, len = Gro.length; i < len; i++) {
  63503. if ((attr).toString() === ( Gro[i].value).toString()) {
  63504. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  63505. var sty1 = Gro[i].style;
  63506. style = Util_Util.copyAttributesWithClip(style, sty1);
  63507. }
  63508. }
  63509. }
  63510. }
  63511. if (feature.style && this.isAllowFeatureStyle === true) {
  63512. style = Util_Util.copyAttributesWithClip(feature.style);
  63513. }
  63514. return style;
  63515. }
  63516. }
  63517. external_mapboxgl_default.a.supermap.UniqueThemeLayer = UniqueThemeLayer_Unique;
  63518. // CONCATENATED MODULE: ./src/mapboxgl/overlay/graphic/Graphic.js
  63519. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63520. * This program are made available under the terms of the Apache License, Version 2.0
  63521. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63522. /**
  63523. * @class mapboxgl.supermap.Graphic
  63524. * @classdesc 高效率点图层点要素类。
  63525. * @category Visualization Graphic
  63526. * @param {(Object|Array.<number>)} lngLat - 坐标。格式:经纬度数组或包含{lng,lat}格式对象。
  63527. * @param {Object} style - 图形参数。
  63528. * @param {Array.<number>} [style.color] - 点颜色。目前只支持 rgba 数组。
  63529. * @param {Object} [style.radius] - 点半径。
  63530. * @param {Object} [attributes] - 属性信息。
  63531. * @example
  63532. * var graphic = new mapboxgl.supermap.Graphic(
  63533. * {
  63534. * lng:116,
  63535. * lat:39
  63536. * },{
  63537. * color:[255,0,0],
  63538. * radius:30
  63539. * }
  63540. * });
  63541. */
  63542. class Graphic_Graphic {
  63543. constructor(lngLat, style, attributes) {
  63544. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  63545. this.style = core_Util_Util.extend({}, style);
  63546. this.attributes = attributes;
  63547. }
  63548. /**
  63549. * @function mapboxgl.supermap.Graphic.prototype.getId
  63550. * @description 获取当前 ID。
  63551. * @returns {string} id
  63552. */
  63553. getId() {
  63554. return this.id;
  63555. }
  63556. /**
  63557. * @function mapboxgl.supermap.Graphic.prototype.setId
  63558. * @description 设置当前要素 ID。
  63559. * @param {string} id - 要素 ID。
  63560. */
  63561. setId(id) {
  63562. this.id = id;
  63563. }
  63564. /**
  63565. * @function mapboxgl.supermap.Graphic.prototype.getLngLat
  63566. * @description 获取经纬度坐标。
  63567. * @returns {Object} 经纬度坐标,数据格式{lng,lat}。
  63568. */
  63569. getLngLat() {
  63570. return this.lngLat;
  63571. }
  63572. /**
  63573. * @function mapboxgl.supermap.Graphic.prototype.setLngLat
  63574. * @description 设置经纬度坐标。
  63575. * @param {Object} lngLat - 经纬度坐标,数据格式{lng,lat}。
  63576. */
  63577. setLngLat(lngLat) {
  63578. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  63579. }
  63580. /**
  63581. * @function mapboxgl.supermap.Graphic.prototype.setStyle
  63582. * @description 设置点样式。
  63583. * @param {Object} style -样式选项。
  63584. * @param {Array} [style.color] - 颜色。
  63585. * @param {number} [style.radius] - 半径。
  63586. */
  63587. setStyle(style) {
  63588. this.style = core_Util_Util.extend(this.style, style);
  63589. }
  63590. /**
  63591. * @function mapboxgl.supermap.Graphic.prototype.getStyle
  63592. * @description 获取样式。
  63593. * @returns {Object} 点样式。
  63594. */
  63595. getStyle() {
  63596. return this.style;
  63597. }
  63598. /**
  63599. * @function mapboxgl.supermap.Graphic.prototype.setAttributes
  63600. * @description 设置属性信息。
  63601. * @param {Object} [attributes] - 属性信息。
  63602. */
  63603. setAttributes(attributes) {
  63604. this.attributes = core_Util_Util.extend({}, this.attributes, attributes);
  63605. }
  63606. /**
  63607. * @function mapboxgl.supermap.Graphic.prototype.getAttributes
  63608. * @description 获取属性信息。
  63609. * @returns {Object} 属性信息。
  63610. */
  63611. getAttributes() {
  63612. return this.attributes;
  63613. }
  63614. }
  63615. external_mapboxgl_default.a.supermap.Graphic = Graphic_Graphic;
  63616. // CONCATENATED MODULE: ./src/mapboxgl/overlay/graphic/index.js
  63617. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63618. * This program are made available under the terms of the Apache License, Version 2.0
  63619. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63620. // CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphicLayer.js
  63621. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  63622. * This program are made available under the terms of the Apache License, Version 2.0
  63623. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63624. const defaultProps = {
  63625. color: [0, 0, 0, 255],
  63626. opacity: 0.8,
  63627. radius: 10,
  63628. radiusScale: 1,
  63629. radiusMinPixels: 0,
  63630. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  63631. strokeWidth: 1,
  63632. outline: false
  63633. };
  63634. /**
  63635. * @class mapboxgl.supermap.GraphicLayer
  63636. * @category Visualization Graphic
  63637. * @classdesc 高效率点图层。
  63638. * @param {string} [id] - 图层id。默认使用 CommonUtil.createUniqueID("graphicLayer_") 创建专题图层 ID。
  63639. * @param {Object} options - 图层配置项。
  63640. * @param {Array.<mapboxgl.supermap.Graphic>} options.graphics - 点要素对象数组 。
  63641. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  63642. * @param {number} [options.radius=10] - 半径。
  63643. * @param {number} [options.opacity=0.8] - 不透明度。
  63644. * @param {Array.<number>} [options.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  63645. * @param {number} [options.radiusScale=1] - 点放大倍数。
  63646. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  63647. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  63648. * @param {number} [options.strokeWidth=1] - 边框大小。
  63649. * @param {boolean} [options.outline=false] - 是否显示边框。
  63650. */
  63651. class GraphicLayer_GraphicLayer {
  63652. constructor(id, options) {
  63653. let opt = core_Util_Util.extend(this, defaultProps, options);
  63654. /**
  63655. * @member {string} mapboxgl.supermap.GraphicLayer.prototype.id
  63656. * @description 高效率点图层 id。
  63657. */
  63658. this.id = id || Util_Util.createUniqueID("graphicLayer_");
  63659. /**
  63660. * @member {Array.<mapboxgl.supermap.Graphic>} mapboxgl.supermap.GraphicLayer.prototype.graphics
  63661. * @description 点要素对象数组。
  63662. */
  63663. this.graphics = [].concat(opt.graphics);
  63664. /**
  63665. * @member {boolean} [mapboxgl.supermap.GraphicLayer.prototype.visibility=true]
  63666. * @description 图层显示状态属性。
  63667. */
  63668. this.visibility = true;
  63669. }
  63670. /**
  63671. * @function mapboxgl.supermap.GraphicLayer.prototype.addTo
  63672. * @description 图层添加到地图,将在下个版本废弃,请使用 onAdd() 代替。
  63673. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  63674. * @returns this
  63675. */
  63676. addTo(map) {
  63677. this.onAdd(map);
  63678. }
  63679. /**
  63680. * @function mapboxgl.supermap.GraphicLayer.prototype.onAdd
  63681. * @description 图层添加到地图。
  63682. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  63683. * @returns {mapboxgl.supermap.GraphicLayer}
  63684. */
  63685. onAdd(map) {
  63686. this.map = map;
  63687. if (this.canvas) {
  63688. this.mapContainer = this.map.getCanvasContainer();
  63689. this.mapContainer.appendChild(this.canvas);
  63690. return this;
  63691. }
  63692. this._initContainer();
  63693. //当使用扩展的mapboxgl代码时有效
  63694. if (map.getCRS && map.getCRS() !== external_mapboxgl_default.a.CRS.EPSG3857) {
  63695. this.coordinateSystem = 3;
  63696. this.isGeographicCoordinateSystem = true;
  63697. }
  63698. let mapState = this.getState();
  63699. let {
  63700. data,
  63701. color,
  63702. radius,
  63703. opacity,
  63704. highlightColor,
  63705. radiusScale,
  63706. radiusMinPixels,
  63707. radiusMaxPixels,
  63708. strokeWidth,
  63709. outline
  63710. } = mapState;
  63711. let me = this;
  63712. let layerOptions = {
  63713. id: 'scatter-plot',
  63714. data,
  63715. pickable: Boolean(this.onClick) || Boolean(this.onHover),
  63716. autoHighlight: true,
  63717. color: color,
  63718. opacity: opacity,
  63719. radius: radius,
  63720. radiusScale: radiusScale,
  63721. highlightColor: highlightColor,
  63722. radiusMinPixels: radiusMinPixels,
  63723. radiusMaxPixels: radiusMaxPixels,
  63724. strokeWidth: strokeWidth,
  63725. outline: outline,
  63726. isGeographicCoordinateSystem: this.isGeographicCoordinateSystem,
  63727. coordinateSystem: this.coordinateSystem,
  63728. getPosition: function (point) {
  63729. if (!point) {
  63730. return [0, 0, 0];
  63731. }
  63732. let lngLat = point.getLngLat();
  63733. return lngLat && [lngLat.lng, lngLat.lat, 0];
  63734. },
  63735. getColor: function (point) {
  63736. let style = point && point.getStyle();
  63737. return style && style.color || me.color
  63738. },
  63739. getRadius: function (point) {
  63740. let style = point && point.getStyle();
  63741. return style && style.radius || me.radius
  63742. },
  63743. updateTriggers: {
  63744. getColor: [color],
  63745. getRadius: [radius]
  63746. }
  63747. };
  63748. if (this.onClick) {
  63749. layerOptions.onClick = this.onClick;
  63750. }
  63751. if (this.onHover) {
  63752. layerOptions.onHover = this.onHover;
  63753. }
  63754. this.layer = new window.DeckGL.ScatterplotLayer(layerOptions);
  63755. let deckOptions = {};
  63756. for (let key in mapState) {
  63757. deckOptions[key] = mapState[key];
  63758. }
  63759. deckOptions.layers = [this.layer];
  63760. deckOptions.canvas = this.canvas;
  63761. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  63762. this.map.on('render', this._moveEvent.bind(this));
  63763. this.map.on('resize', this._resizeEvent.bind(this));
  63764. this.draw();
  63765. return this;
  63766. }
  63767. /**
  63768. * @function mapboxgl.supermap.GraphicLayer.prototype.setStyle
  63769. * @description 设置图层整体样式。
  63770. * @param {Object} styleOptions - 样式对象。
  63771. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  63772. * @param {number} [styleOptions.radius=10] - 点半径。
  63773. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  63774. * @param {Array} [styleOptions.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  63775. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  63776. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  63777. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  63778. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  63779. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  63780. */
  63781. setStyle(styleOptions) {
  63782. let styleOpt = {
  63783. color: this.color,
  63784. radius: this.radius,
  63785. opacity: this.opacity,
  63786. highlightColor: this.highlightColor,
  63787. radiusScale: this.radiusScale,
  63788. radiusMinPixels: this.radiusMinPixels,
  63789. radiusMaxPixels: this.radiusMaxPixels,
  63790. strokeWidth: this.strokeWidth,
  63791. outline: this.outline
  63792. };
  63793. core_Util_Util.extend(this, styleOpt, styleOptions);
  63794. this.update();
  63795. }
  63796. /**
  63797. * @function mapboxgl.supermap.GraphicLayer.prototype.setGraphics
  63798. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  63799. * @param {Array.<mapboxgl.supermap.Graphic>} graphics - 点要素对象数组。
  63800. */
  63801. setGraphics(graphics) {
  63802. this.graphics = this.graphics || [];
  63803. this.graphics.length = 0;
  63804. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  63805. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  63806. if (!this.layer.props.data) {
  63807. this.layer.props.data = [];
  63808. }
  63809. this.layer.props.data.length = 0;
  63810. for (let i = 0; i < sGraphics.length; i++) {
  63811. this.layer.props.data.push(sGraphics[i]);
  63812. }
  63813. this.update();
  63814. }
  63815. /**
  63816. * @function mapboxgl.supermap.GraphicLayer.prototype.addGraphics
  63817. * @description 添加点要素,不会覆盖之前的要素。
  63818. * @param {Array.<mapboxgl.supermap.Graphic>} graphics - 点要素对象数组。
  63819. */
  63820. addGraphics(graphics) {
  63821. this.graphics = this.graphics || [];
  63822. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  63823. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  63824. if (!this.layer.props.data) {
  63825. this.layer.props.data = [];
  63826. }
  63827. for (let i = 0; i < sGraphics.length; i++) {
  63828. this.layer.props.data.push(sGraphics[i]);
  63829. }
  63830. this.update();
  63831. }
  63832. /**
  63833. * @function mapboxgl.supermap.GraphicLayer.prototype.getGraphicBy
  63834. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  63835. * @param {string} property - graphic 的某个属性名称。
  63836. * @param {string} value - property 所对应的值。
  63837. * @returns {ol.Graphic} 一个匹配的 graphic。
  63838. */
  63839. getGraphicBy(property, value) {
  63840. let graphic = null;
  63841. for (let index in this.graphics) {
  63842. if (this.graphics[index][property] === value) {
  63843. graphic = this.graphics[index];
  63844. break;
  63845. }
  63846. }
  63847. return graphic;
  63848. }
  63849. /**
  63850. * @function mapboxgl.supermap.GraphicLayer.prototype.getGraphicById
  63851. * @description 通过给定一个 id,返回对应的矢量要素。
  63852. * @param {string} graphicId - 矢量要素的属性 id
  63853. * @returns {ol.Graphic} 一个匹配的 graphic。
  63854. */
  63855. getGraphicById(graphicId) {
  63856. return this.getGraphicBy("id", graphicId);
  63857. }
  63858. /**
  63859. * @function mapboxgl.supermap.GraphicLayer.prototype.getGraphicsByAttribute
  63860. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  63861. * @param {string} attrName - graphic 的某个属性名称。
  63862. * @param {string} attrValue - property 所对应的值。
  63863. * @returns {Array.<ol.Graphic>} 一个匹配的 graphic 数组。
  63864. */
  63865. getGraphicsByAttribute(attrName, attrValue) {
  63866. var graphic,
  63867. foundgraphics = [];
  63868. for (let index in this.graphics) {
  63869. graphic = this.graphics[index];
  63870. if (graphic && graphic.attributes) {
  63871. if (graphic.attributes[attrName] === attrValue) {
  63872. foundgraphics.push(graphic);
  63873. }
  63874. }
  63875. }
  63876. return foundgraphics;
  63877. }
  63878. /**
  63879. * @function mapboxgl.supermap.GraphicLayer.prototype.removeGraphics
  63880. * @description 删除要素数组,默认将删除所有要素
  63881. * @param {Array.<ol.Graphic>} [graphics=null] - 删除的 graphics 数组
  63882. */
  63883. removeGraphics(graphics = null) {
  63884. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  63885. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  63886. this.graphics.length = 0;
  63887. if (this.layer.props.data) {
  63888. this.layer.props.data.length = 0;
  63889. }
  63890. this.update();
  63891. return;
  63892. }
  63893. if (!(Util_Util.isArray(graphics))) {
  63894. graphics = [graphics];
  63895. }
  63896. for (let i = graphics.length - 1; i >= 0; i--) {
  63897. let graphic = graphics[i];
  63898. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  63899. //并将其放入未删除的数组中。
  63900. let findex = Util_Util.indexOf(this.graphics, graphic);
  63901. if (findex === -1) {
  63902. continue;
  63903. }
  63904. this.graphics.splice(findex, 1);
  63905. }
  63906. //删除完成后重新设置 setGraphics,以更新
  63907. this.update();
  63908. }
  63909. /**
  63910. * @function mapboxgl.supermap.GraphicLayer.prototype.update
  63911. * @description 更新图层。
  63912. */
  63913. update() {
  63914. if (this.layer.lifecycle !== 'Awaiting state') {
  63915. this.layer.setChangeFlags({
  63916. dataChanged: true,
  63917. propsChanged: true,
  63918. viewportChanged: true,
  63919. updateTriggersChanged: true
  63920. });
  63921. let state = this.getState();
  63922. this.layer.setState(state);
  63923. }
  63924. }
  63925. /**
  63926. * @function mapboxgl.supermap.GraphicLayer.prototype.clear
  63927. * @description 释放图层资源。
  63928. */
  63929. clear() {
  63930. this.removeGraphics();
  63931. this.deckGL.finalize();
  63932. }
  63933. /**
  63934. * @function mapboxgl.supermap.GraphicLayer.prototype.remove
  63935. * @description 删除该图层。
  63936. */
  63937. remove() {
  63938. this.map.off('render', this._moveEvent.bind(this));
  63939. this.map.off('resize', this._resizeEvent.bind(this));
  63940. this.map.getCanvasContainer().removeChild(this.canvas);
  63941. }
  63942. /**
  63943. * @function mapboxgl.supermap.GraphicLayer.prototype.removeFromMap
  63944. * @deprecated
  63945. * @description 删除该图层。
  63946. */
  63947. removeFromMap() {
  63948. this.remove();
  63949. this.clear();
  63950. }
  63951. /**
  63952. * @function mapboxgl.supermap.GraphicLayer.prototype.moveTo
  63953. * @description 将图层移动到某个图层之前。
  63954. * @param {string} layerID - 待插入的图层 ID。
  63955. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  63956. */
  63957. moveTo(layerID, before) {
  63958. var layer = document.getElementById(this.id);
  63959. before = before !== undefined ? before : true;
  63960. if (before) {
  63961. var beforeLayer = document.getElementById(layerID);
  63962. if (layer && beforeLayer) {
  63963. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  63964. }
  63965. return;
  63966. }
  63967. var nextLayer = document.getElementById(layerID);
  63968. if (layer) {
  63969. if (nextLayer.nextSibling) {
  63970. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  63971. return;
  63972. }
  63973. nextLayer.parentNode.appendChild(layer);
  63974. }
  63975. }
  63976. /**
  63977. * @function mapboxgl.supermap.GraphicLayer.prototype.setVisibility
  63978. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  63979. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  63980. */
  63981. setVisibility(visibility) {
  63982. if (this.canvas && visibility !== this.visibility) {
  63983. this.visibility = visibility;
  63984. this.canvas.style.display = visibility ? "block" : "none";
  63985. }
  63986. }
  63987. /**
  63988. * @function mapboxgl.supermap.GraphicLayer.prototype.getState
  63989. * @description 获取当前地图及图层状态。
  63990. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  63991. */
  63992. getState() {
  63993. let map = this.map;
  63994. let width = parseInt(this.canvas.style.width);
  63995. let height = parseInt(this.canvas.style.height);
  63996. let center = map.getCenter();
  63997. let longitude = center.lng;
  63998. let latitude = center.lat;
  63999. let zoom = map.getZoom();
  64000. let maxZoom = map.getMaxZoom();
  64001. let pitch = map.getPitch();
  64002. let bearing = map.getBearing();
  64003. let mapViewport = {
  64004. longitude: longitude,
  64005. latitude: latitude,
  64006. zoom: zoom,
  64007. maxZoom: maxZoom,
  64008. pitch: pitch,
  64009. bearing: bearing
  64010. };
  64011. let state = {};
  64012. for (let key in mapViewport) {
  64013. state[key] = mapViewport[key];
  64014. }
  64015. state.width = width;
  64016. state.height = height;
  64017. state.data = this.graphics;
  64018. state.color = this.color;
  64019. state.radius = this.radius;
  64020. state.opacity = this.opacity;
  64021. state.highlightColor = this.highlightColor;
  64022. state.radiusScale = this.radiusScale;
  64023. state.radiusMinPixels = this.radiusMinPixels;
  64024. state.radiusMaxPixels = this.radiusMaxPixels;
  64025. state.strokeWidth = this.strokeWidth;
  64026. state.outline = this.outline;
  64027. //当使用扩展的mapboxgl代码时有效
  64028. if (map.getCRS && map.getCRS() !== external_mapboxgl_default.a.CRS.EPSG3857) {
  64029. state.coordinateSystem = this.coordinateSystem;
  64030. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  64031. }
  64032. return state;
  64033. }
  64034. /**
  64035. * @function mapboxgl.supermap.GraphicLayer.prototype.draw
  64036. * @description 绘制图层。
  64037. */
  64038. draw() {
  64039. let mapState = this.getState();
  64040. let deckOptions = {};
  64041. for (let key in mapState) {
  64042. deckOptions[key] = mapState[key];
  64043. }
  64044. deckOptions.layers = [this.layer];
  64045. deckOptions.canvas = this.canvas;
  64046. this.deckGL.setProps(deckOptions);
  64047. }
  64048. _moveEvent() {
  64049. this.draw();
  64050. }
  64051. _resizeEvent() {
  64052. let canvas = this.canvas;
  64053. let map = this.map;
  64054. canvas.width = parseInt(map.getCanvas().style.width);
  64055. canvas.height = parseInt(map.getCanvas().style.height);
  64056. canvas.style.width = map.getCanvas().style.width;
  64057. canvas.style.height = map.getCanvas().style.height;
  64058. this.draw();
  64059. }
  64060. _initContainer() {
  64061. this.canvas = this._createCanvas();
  64062. this.mapContainer = this.map.getCanvasContainer();
  64063. this.mapContainer.appendChild(this.canvas);
  64064. }
  64065. _createCanvas() {
  64066. let canvas = document.createElement('canvas');
  64067. if (this.id) {
  64068. canvas.id = this.id;
  64069. }
  64070. canvas.style.position = 'absolute';
  64071. canvas.style.top = 0 + "px";
  64072. canvas.style.left = 0 + "px";
  64073. canvas.style.cursor = "";
  64074. let map = this.map;
  64075. canvas.width = parseInt(map.getCanvas().style.width);
  64076. canvas.height = parseInt(map.getCanvas().style.height);
  64077. canvas.style.width = map.getCanvas().style.width;
  64078. canvas.style.height = map.getCanvas().style.height;
  64079. return canvas;
  64080. }
  64081. }
  64082. external_mapboxgl_default.a.supermap.GraphicLayer = GraphicLayer_GraphicLayer;
  64083. // EXTERNAL MODULE: external "function(){try{return THREE}catch(e){return {}}}()"
  64084. var external_function_try_return_THREE_catch_e_return_ = __webpack_require__(2);
  64085. // CONCATENATED MODULE: ./src/mapboxgl/overlay/threejs/Transform.js
  64086. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  64087. * This program are made available under the terms of the Apache License, Version 2.0
  64088. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64089. function wrap(source, min, max) {
  64090. if (source === max || source === min) {
  64091. return source;
  64092. }
  64093. let len = max - min;
  64094. return ((source - min) % len + len) % len + min
  64095. }
  64096. function rad(angle) {
  64097. return angle * Math.PI / 180;
  64098. }
  64099. var Projection = {
  64100. R: 6378137,
  64101. minZoom: 0,
  64102. maxZoom: 22,
  64103. nativeMaxZoom: 19,
  64104. RAD: Math.PI / 180,
  64105. METERS_PER_DEGREE: 6378137 * Math.PI / 180,
  64106. MAX_LATITUDE: 85.0511287798,
  64107. project: function (lngLat) {
  64108. const rad = this.RAD,
  64109. metersPerDegree = this.METERS_PER_DEGREE,
  64110. max = this.MAX_LATITUDE;
  64111. let ll = (lngLat instanceof Array)
  64112. ? {lng: lngLat[0], lat: lngLat[1]}
  64113. : {lng: lngLat.lng, lat: lngLat.lat};
  64114. let lng = ll.lng, lat = Math.max(Math.min(max, ll.lat), -max);
  64115. let c;
  64116. if (lat === 0) {
  64117. c = 0;
  64118. } else {
  64119. c = Math.log(Math.tan((90 + lat) * rad / 2)) / rad;
  64120. }
  64121. return {x: lng * metersPerDegree, y: c * metersPerDegree};
  64122. },
  64123. unproject: function (point) {
  64124. const x = point.x,
  64125. y = point.y;
  64126. const rad = this.RAD,
  64127. metersPerDegree = this.METERS_PER_DEGREE;
  64128. let c;
  64129. if (y === 0) {
  64130. c = 0;
  64131. } else {
  64132. c = y / metersPerDegree;
  64133. c = (2 * Math.atan(Math.exp(c * rad)) - Math.PI / 2) / rad;
  64134. }
  64135. return {lng: wrap(x / metersPerDegree, -180, 180), lat: wrap(c, -this.MAX_LATITUDE, this.MAX_LATITUDE)};
  64136. },
  64137. locate: function (lngLat, dx, dy) {
  64138. if (!lngLat) {
  64139. return null;
  64140. }
  64141. dx = !dx ? 0 : dx;
  64142. dy = !dy ? 0 : dy;
  64143. if (!dx && !dy) {
  64144. return lngLat;
  64145. }
  64146. let lng = lngLat.lng;
  64147. if (dx !== 0) {
  64148. let ndx = Math.abs(dx), radLng = rad(lngLat.lng);
  64149. let sLng = 2 * Math.sqrt(Math.pow(Math.sin(ndx / (2 * this.R)), 2) / Math.pow(Math.cos(radLng), 2));
  64150. radLng = radLng + sLng * (ndx > 0 ? 1 : -1);
  64151. lng = wrap(radLng * 180 / Math.PI, -180, 180);
  64152. }
  64153. let lat = lngLat.lat;
  64154. if (dy !== 0) {
  64155. let ndy = Math.abs(dy), radLat = rad(lngLat.lat);
  64156. let sLat = Math.sin(ndy / (2 * this.R)) * 2;
  64157. radLat = radLat + sLat * (ndy > 0 ? 1 : -1);
  64158. lat = wrap(radLat * 180 / Math.PI, -90, 90);
  64159. }
  64160. return {lng, lat};
  64161. },
  64162. getResolution: function (zoom) {
  64163. if (!this.resolutions) {
  64164. var resolutions = [];
  64165. var d = 2 * 6378137 * Math.PI;
  64166. for (var i = 0; i <= this.maxZoom; i++) {
  64167. resolutions[i] = d / (256 * Math.pow(2, i));
  64168. }
  64169. this.resolutions = resolutions;
  64170. }
  64171. let z = (zoom | 0), length = this.resolutions.length;
  64172. z = z < 0 ? 0 : z > length - 1 ? length - 1 : z;
  64173. const res = this.resolutions[z];
  64174. if ((zoom | 0) !== zoom && z !== length - 1) {
  64175. const next = this.resolutions[z + 1];
  64176. return res + (next - res) * (zoom - z);
  64177. }
  64178. return res;
  64179. }
  64180. };
  64181. var Transform = {
  64182. matrix: [1, -1, 0, 0],
  64183. projection: Projection,
  64184. project: function (lngLat) {
  64185. return this.projection.project(lngLat);
  64186. },
  64187. unproject: function (point) {
  64188. return this.projection.unproject(point);
  64189. },
  64190. lngLatToPoint: function (lngLat, zoom) {
  64191. var pt = this.project(lngLat);
  64192. return this.transform(pt, this.projection.getResolution(zoom));
  64193. },
  64194. locate: function (lngLat, dx, dy) {
  64195. return this.projection.locate(lngLat, dx, dy);
  64196. },
  64197. transform: function (point, scale) {
  64198. return {
  64199. x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
  64200. y: this.matrix[1] * (point.y - this.matrix[3]) / scale
  64201. };
  64202. }
  64203. };
  64204. external_mapboxgl_default.a.supermap.Transform = Transform;
  64205. // CONCATENATED MODULE: ./src/mapboxgl/overlay/threejs/ThreeLayerRenderer.js
  64206. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  64207. * This program are made available under the terms of the Apache License, Version 2.0
  64208. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64209. /**
  64210. * reference and modification
  64211. * maptalks.three
  64212. * (https://github.com/maptalks/maptalks.three)
  64213. * Apache Licene 2.0
  64214. * thanks maptalks
  64215. */
  64216. const projection = Transform.projection;
  64217. const {
  64218. Color: ThreeLayerRenderer_Color,
  64219. Scene,
  64220. WebGLRenderer,
  64221. CanvasRenderer,
  64222. PerspectiveCamera
  64223. } = external_function_try_return_THREE_catch_e_return_;
  64224. const RADIAN = Math.PI / 180;
  64225. const ThreeLayerRenderer_frame = window.requestAnimationFrame ||
  64226. window.mozRequestAnimationFrame ||
  64227. window.webkitRequestAnimationFrame ||
  64228. window.msRequestAnimationFrame;
  64229. const cancel = window.cancelAnimationFrame ||
  64230. window.mozCancelAnimationFrame ||
  64231. window.webkitCancelAnimationFrame ||
  64232. window.msCancelAnimationFrame;
  64233. /**
  64234. * @private
  64235. * @class ThreeLayerRenderer
  64236. * @category Visualization Three
  64237. * @classdesc Three图层渲染器
  64238. * @param {mapboxgl.supermap.ThreeLayer} layer - ThreeJs图层。</br>
  64239. * @param {string} [renderer="gl"] - 图层渲染方式(canvas或WebGL)。取值:"gl","canvas"。</br>
  64240. * @param {Object} options - threejs渲染器初始化参数对象。参数内容详见:
  64241. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}/
  64242. * [CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  64243. *
  64244. * @extends {mapboxgl.Evented}
  64245. * @fires mapboxgl.supermap.ThreeLayer#initialized
  64246. * @fires mapboxgl.supermap.ThreeLayer#draw
  64247. * @fires mapboxgl.supermap.ThreeLayer#rendererinitialized
  64248. */
  64249. class ThreeLayerRenderer_ThreeLayerRenderer {
  64250. constructor(layer, renderer, options) {
  64251. this._layer = layer;
  64252. this.renderer = renderer || "gl";
  64253. this.options = options;
  64254. }
  64255. setMap(map) {
  64256. this.map = map;
  64257. }
  64258. //开始渲染
  64259. render() {
  64260. if (!this._layer) {
  64261. return;
  64262. }
  64263. this.prepare();
  64264. /**
  64265. * @event mapboxgl.supermap.ThreeLayer#initialized
  64266. * @description three 初始化之后后触发。
  64267. */
  64268. this._layer.fire("initialized");
  64269. this._layer && this._layer.draw(this.context, this.scene, this.camera);
  64270. /**
  64271. * @event mapboxgl.supermap.ThreeLayer#draw
  64272. * @description draw 绘制事件, 调用提供给外部绘制的接口后触发
  64273. */
  64274. this._layer.fire("draw");
  64275. this.renderScene();
  64276. }
  64277. update() {
  64278. this.remove();
  64279. this.render();
  64280. }
  64281. //渲染场景(模型已经添加到图层)
  64282. renderScene() {
  64283. this.locationCamera();
  64284. this.animationFrame = this.renderFrame((function () {
  64285. this.animationFrame = null;
  64286. this.context && this.context.render(this.scene, this.camera);
  64287. }).bind(this));
  64288. }
  64289. renderFrame(fn) {
  64290. var render = function () {
  64291. fn && typeof fn === "function" && fn();
  64292. };
  64293. return ThreeLayerRenderer_frame(render);
  64294. }
  64295. resize() {
  64296. this._resetElementSize(this.container);
  64297. this._resetElementSize(this.canvas);
  64298. let width = this.canvas.width,
  64299. height = this.canvas.height;
  64300. let size = this.getMapSize();
  64301. this.camera.aspect = width / height;
  64302. this.camera.updateProjectionMatrix();
  64303. this.context.setSize(size.width, size.height);
  64304. this.renderScene();
  64305. }
  64306. //创建画布、初始化渲染器、初始化相机等
  64307. prepare() {
  64308. if (!this.map) {
  64309. return new Error("map object is necessary");
  64310. }
  64311. if (!this.canvas) {
  64312. this._initContainer();
  64313. this._initThreeRenderer();
  64314. /**
  64315. * @event mapboxgl.supermap.ThreeLayer#rendererinitialized
  64316. * @description rendererinitialized 事件,初始化 three 渲染器后触发
  64317. */
  64318. this._layer.fire("rendererinitialized");
  64319. } else {
  64320. this.clear(this.context);
  64321. }
  64322. }
  64323. getMapSize() {
  64324. let container = this.map.getContainer();
  64325. return {width: container.clientWidth, height: container.clientHeight};
  64326. }
  64327. cancelFrame() {
  64328. if (this.animationFrame != null) {
  64329. cancel(this.animationFrame);
  64330. }
  64331. }
  64332. remove() {
  64333. if (this.animationFrame != null) {
  64334. cancel(this.animationFrame);
  64335. }
  64336. this.container.removeChild(this.canvas);
  64337. this.container.parentNode.removeChild(this.container);
  64338. this.context = null;
  64339. this.canvas = null;
  64340. this.container = null;
  64341. }
  64342. //清理画布内容
  64343. clear(context) {
  64344. context && context.clear && context.clear();
  64345. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  64346. }
  64347. //计算缩放比例
  64348. getScale(zoom) {
  64349. let map = this.map;
  64350. let z = zoom == null ? map.getZoom() : zoom;
  64351. let max = projection.getResolution(projection.nativeMaxZoom),
  64352. res = projection.getResolution(z);
  64353. return res / max;
  64354. }
  64355. getCanvasContainer() {
  64356. return this.container;
  64357. }
  64358. getCanvas() {
  64359. return this.canvas;
  64360. }
  64361. //重新设置相机位置
  64362. locationCamera() {
  64363. let map = this.map;
  64364. let size = this.getMapSize();
  64365. let scale = map.transform.zoomScale(projection.nativeMaxZoom - map.getZoom() - 1);
  64366. let fovRatio = Math.tan(map.transform.fov / 2 * RADIAN);
  64367. let camera = this.camera;
  64368. //倾斜时,相机位置低于Z轴
  64369. let pitch = map.getPitch() * RADIAN;
  64370. let pZ = -scale * size.height / 2 / fovRatio;
  64371. camera.position.z = pZ * Math.cos(pitch);
  64372. let centerPoint = Transform.lngLatToPoint(map.getCenter(), projection.nativeMaxZoom);
  64373. let distance = Math.sin(pitch) * pZ;
  64374. let bearing = map.getBearing() * RADIAN;
  64375. camera.position.x = centerPoint.x + distance * Math.sin(bearing);
  64376. camera.position.y = centerPoint.y - distance * Math.cos(bearing);
  64377. camera.up.set(Math.sin(bearing), -Math.cos(bearing), 0);
  64378. camera.lookAt(new external_function_try_return_THREE_catch_e_return_["Vector3"](centerPoint.x, centerPoint.y, 0));
  64379. camera.updateProjectionMatrix();
  64380. }
  64381. _initContainer() {
  64382. var canvas = this._createCanvas();
  64383. var container = this.container = document.createElement("div");
  64384. if (this._layer._layerId) {
  64385. container.id = this._layer._layerId;
  64386. }
  64387. container.className = "threejs-wrapper";
  64388. container.style.position = "absolute";
  64389. container.style.left = "0px";
  64390. container.style.top = "0px";
  64391. container.style.overflow = "hidden";
  64392. this._resetElementSize(container);
  64393. container.appendChild(canvas);
  64394. var mapContainer = this.map.getCanvasContainer();
  64395. mapContainer.appendChild(container)
  64396. }
  64397. _createCanvas() {
  64398. if (this.canvas) {
  64399. return;
  64400. }
  64401. const canvas = this.canvas = document.createElement('canvas');
  64402. canvas.className = "threejs-overlay";
  64403. canvas.style.outline = "none";
  64404. this._resetElementSize(canvas);
  64405. return canvas;
  64406. }
  64407. _resetElementSize(element) {
  64408. if (!element) {
  64409. return;
  64410. }
  64411. const size = this.getMapSize();
  64412. const dpr = window.devicePixelRatio ? window.devicePixelRatio : 1;
  64413. const width = dpr * size.width;
  64414. const height = dpr * size.height;
  64415. element.width = width;
  64416. element.height = height;
  64417. element.style.width = size.width + 'px';
  64418. element.style.height = size.height + 'px';
  64419. }
  64420. _initThreeRenderer() {
  64421. let map = this.map;
  64422. let size = this.getMapSize();
  64423. let renderer = this.renderer || 'gl';
  64424. let context;
  64425. if (renderer === 'gl') {
  64426. context = new WebGLRenderer({
  64427. 'canvas': this.canvas,
  64428. 'alpha': true,
  64429. 'antialias': true,
  64430. 'preserveDrawingBuffer': true
  64431. }, this.options);
  64432. context.autoClear = true;
  64433. context.clear();
  64434. } else {
  64435. context = new CanvasRenderer(Util_Util.extend({
  64436. 'canvas': this.canvas,
  64437. 'alpha': true
  64438. }, this.options));
  64439. }
  64440. context.setClearColor(new ThreeLayerRenderer_Color(1, 1, 1), 0);
  64441. context.canvas = this.canvas;
  64442. this.context = context;
  64443. let fov = map.transform.fov;
  64444. let fovRatio = Math.tan(fov / 2 * RADIAN);
  64445. let maxScale = this.getScale(projection.minZoom) / this.getScale(projection.nativeMaxZoom);
  64446. let far = maxScale * size.height / 2 / fovRatio;
  64447. this.camera = new PerspectiveCamera(fov, size.width / size.height, 1, far);
  64448. this.scene = new Scene();
  64449. this.scene.add(this.camera);
  64450. }
  64451. }
  64452. // CONCATENATED MODULE: ./src/mapboxgl/overlay/threejs/index.js
  64453. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  64454. * This program are made available under the terms of the Apache License, Version 2.0
  64455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64456. // CONCATENATED MODULE: ./src/mapboxgl/overlay/ThreeLayer.js
  64457. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  64458. * This program are made available under the terms of the Apache License, Version 2.0
  64459. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64460. /**
  64461. * reference and modification
  64462. * maptalks.three
  64463. * (https://github.com/maptalks/maptalks.three)
  64464. * Apache Licene 2.0
  64465. * thanks maptalks
  64466. */
  64467. const {
  64468. Vector3,
  64469. Shape: ThreeLayer_Shape,
  64470. Mesh,
  64471. BufferGeometry,
  64472. ExtrudeGeometry
  64473. } = external_function_try_return_THREE_catch_e_return_;
  64474. /**
  64475. * @class mapboxgl.supermap.ThreeLayer
  64476. * @category Visualization Three
  64477. * @classdesc Three 图层。
  64478. * @param {string} id - 图层 ID。
  64479. * @param {string} [renderer="gl"] - 图层渲染方式( canvas 或 WebGL )。取值:"gl","canvas"。
  64480. * @param {Object} options - 初始化参数。
  64481. * @param {Object} options.threeOptions - threejs 渲染器初始化参数对象。参数内容详见:
  64482. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}
  64483. * [CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  64484. *
  64485. * @extends {mapboxgl.Evented}
  64486. * @fires mapboxgl.supermap.ThreeLayer#render
  64487. * @fires mapboxgl.supermap.ThreeLayer#renderscene
  64488. * @example
  64489. * var threeLayer = new mapboxgl.supermap.ThreeLayer('three');
  64490. * //模型绘制
  64491. * threeLayer.on("initialized", draw);
  64492. * threeLayer.addTo(map);
  64493. *
  64494. * function draw() {
  64495. * var scene=threeLayer.getScene();
  64496. * camera=threeLayer.getCamera();
  64497. * var light = new THREE.PointLight(0xffffff);
  64498. * camera.add(light);
  64499. * var material = new THREE.MeshPhongMaterial({color: 0xff0000});
  64500. * //根据坐标点转换成模型
  64501. * var mesh = this.toThreeMesh(feature.geometry.coordinates, 10, material, true);
  64502. * //模型添加到3D场景
  64503. * scene.add(mesh);
  64504. * }
  64505. *
  64506. * 叠加模型可以通过两种方式:</br>
  64507. * 1.调用 threeLayer.toThreeMesh 直接将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑),然后添加到 3D 场景
  64508. * 2.使用 ThreeJS 的接口创建好 Mesh,然后调用 threeLayer.setPosition 设置地理位置,然后添加到 3D 场景
  64509. *
  64510. */
  64511. class ThreeLayer_ThreeLayer extends external_mapboxgl_default.a.Evented {
  64512. //options.threeOptions是初始化threejs renderer的参数对象
  64513. constructor(id, renderer, options) {
  64514. super();
  64515. this._layerId = id;
  64516. this.options = options;
  64517. let threeOptions = options && options.threeOptions;
  64518. this.renderer = new ThreeLayerRenderer_ThreeLayerRenderer(this, renderer, threeOptions);
  64519. }
  64520. /**
  64521. * @function mapboxgl.supermap.ThreeLayer.prototype.toThreeShape
  64522. * @description 创建 threejs shape 对象。
  64523. * @param {Array} coordinates - 坐标点数组。
  64524. * @returns THREE.Shape{@link https://threejs.org/docs/index.html#api/extras/core/Shape} threejs shape 对象。
  64525. */
  64526. toThreeShape(coordinates) {
  64527. if (!coordinates) {
  64528. return null;
  64529. }
  64530. let center = this.getCoordinatesCenter(coordinates);
  64531. let centerPoint = this.lngLatToPosition(center);
  64532. let outer = coordinates.map(coords => this.lngLatToPosition({
  64533. lng: coords[0],
  64534. lat: coords[1]
  64535. }).sub(centerPoint));
  64536. return new ThreeLayer_Shape(outer);
  64537. }
  64538. /**
  64539. * @function mapboxgl.supermap.ThreeLayer.prototype.toThreeMesh
  64540. * @description 创建 threejs Mesh 对象。将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑)。
  64541. * @param {Array.<Object>} coordinates - 坐标点数组。
  64542. * @param {number} amount - 高度。
  64543. * @param {THREE.Material} material - Threejs 材质对象。参考:[THREE.Material]{@link https://threejs.org/docs/index.html#api/extras/core/Material}
  64544. * @param {boolean} [removeDuplicated] - 是否移除重复的坐标点。
  64545. * @returns {THREE.Mesh} threejs Mesh 对象。参考:[THREE.Mesh]{@link https://threejs.org/docs/index.html#api/objects/Mesh}
  64546. */
  64547. toThreeMesh(coordinates, amount, material, removeDuplicated) {
  64548. if (!coordinates) {
  64549. return null;
  64550. }
  64551. let coords = coordinates;
  64552. if (removeDuplicated) {
  64553. coords = this.removeDuplicatedCoordinates(coordinates)
  64554. }
  64555. let targetAmount = this.distanceToThreeVector3(amount, amount).x;
  64556. let shape = this.toThreeShape(coords);
  64557. let geometry = new ExtrudeGeometry(shape, {
  64558. 'amount': targetAmount,
  64559. 'bevelEnabled': true
  64560. });
  64561. let bufferGeometry = new BufferGeometry().fromGeometry(geometry);
  64562. let mesh = new Mesh(bufferGeometry, material);
  64563. let center = this.lngLatToPosition(this.getCoordinatesCenter(coords));
  64564. mesh.position.set(center.x, center.y, -targetAmount);
  64565. return mesh;
  64566. }
  64567. /**
  64568. * @function mapboxgl.supermap.ThreeLayer.prototype.addObject
  64569. * @description 设置threejs 3D 对象的坐标(经纬度)。
  64570. * @param {THREE.Object3D} object3D - threejs 3D 对象。参考:[THREE.Object3D]{@link https://threejs.org/docs/index.html#api/core/Object3D}及子类对象。
  64571. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  64572. * @returns {this} this
  64573. */
  64574. addObject(object3D, coordinate) {
  64575. if (coordinate && object3D) {
  64576. this.setPosition(object3D, coordinate);
  64577. }
  64578. this.renderer && this.renderer.scene.add(object3D);
  64579. }
  64580. /**
  64581. * @function mapboxgl.supermap.ThreeLayer.prototype.getScene
  64582. * @description 获取threejs 场景对象
  64583. * @returns {THREE.Scene} threejs 场景对象,参考:[THREE.Scene]{@link https://threejs.org/docs/index.html#api/scenes/Scene}
  64584. */
  64585. getScene() {
  64586. return this.renderer.scene;
  64587. }
  64588. /**
  64589. * @function mapboxgl.supermap.ThreeLayer.prototype.getCamera
  64590. * @description 获取threejs 相机。
  64591. * @returns {THREE.Camera} threejs 相机。参考:[THREE.Camera]{@link https://threejs.org/docs/index.html#api/cameras/Camera}
  64592. */
  64593. getCamera() {
  64594. return this.renderer.camera;
  64595. }
  64596. /**
  64597. * @function mapboxgl.supermap.ThreeLayer.prototype.getThreeRenderer
  64598. * @description 获取 threejs renderer。
  64599. * @returns {THREE.WebGLRenderer|THREE.CanvasRenderer} threejs renderer。参考:
  64600. * [THREE.WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}/
  64601. * [THREE.CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  64602. */
  64603. getThreeRenderer() {
  64604. return this.renderer.context;
  64605. }
  64606. // /**
  64607. // * @function mapboxgl.supermap.ThreeLayer.prototype.getObject
  64608. // * @description 根据条件获取添加到场景中的对象
  64609. // * @return {THREE.Object3D} threejs 3D对象。参考:[THREE.Object3D]{@link https://threejs.org/docs/index.html#api/core/Object3D}及子类对象
  64610. // */
  64611. // getObject(conditions) {
  64612. // if(!conditions){
  64613. // return;
  64614. // }
  64615. // var scene = this.getScene();
  64616. // var objects = scene.children;
  64617. // for(let obj of objects ){
  64618. // for(let condition of conditions ){
  64619. // obj[condition]
  64620. // }
  64621. // }
  64622. // }
  64623. /**
  64624. * @function mapboxgl.supermap.ThreeLayer.prototype.clearMesh
  64625. * @description 清除所有 threejs mesh 对象。
  64626. * @returns {this} this 对象。
  64627. */
  64628. clearMesh() {
  64629. let scene = this.renderer.scene;
  64630. if (!scene) {
  64631. return this;
  64632. }
  64633. for (let i = scene.children.length - 1; i >= 0; i--) {
  64634. if (scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_["Mesh"]) {
  64635. scene.remove(scene.children[i]);
  64636. }
  64637. }
  64638. return this;
  64639. }
  64640. /**
  64641. * @function mapboxgl.supermap.ThreeLayer.prototype.clearAll
  64642. * @description 清除所有 threejs 对象。
  64643. * @param {boolean} clearCamera - 是否同时清除相机。
  64644. * @returns {this} this 对象。
  64645. */
  64646. clearAll(clearCamera) {
  64647. let scene = this.renderer.scene;
  64648. if (!scene) {
  64649. return this;
  64650. }
  64651. for (let i = scene.children.length - 1; i >= 0; i--) {
  64652. if (!clearCamera && scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_["Camera"]) {
  64653. continue;
  64654. }
  64655. scene.remove(scene.children[i]);
  64656. }
  64657. return this;
  64658. }
  64659. /**
  64660. * @function mapboxgl.supermap.ThreeLayer.prototype.setPosition
  64661. * @description 设置 threejs 3D 对象的坐标(经纬度)。
  64662. * @param {THREE.Object3D} object3D - threejs 3D 对象,参考:[THREE.Object3D]{@link https://threejs.org/docs/index.html#api/core/Object3D}及子类对象。
  64663. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  64664. * @returns {this} this 对象。
  64665. */
  64666. setPosition(object3D, coordinate) {
  64667. if (!object3D || !coordinate) {
  64668. return this;
  64669. }
  64670. var pos = this.lngLatToPosition(coordinate);
  64671. object3D.position.set(pos.x, pos.y, pos.z);
  64672. return this;
  64673. }
  64674. /**
  64675. * @function mapboxgl.supermap.ThreeLayer.prototype.lngLatToPosition
  64676. * @description 经纬度转threejs 3D 失量对象。
  64677. * @param {(Array.<number>|Object)} lngLat - 经纬度坐标。
  64678. * @returns {THREE.Vector3} threejs 3D 失量对象。参考:[THREE.Vector3]{@link https://threejs.org/docs/index.html#api/math/Vector3}
  64679. */
  64680. lngLatToPosition(lngLat) {
  64681. let zoom = Transform.projection.nativeMaxZoom;
  64682. let point = Transform.lngLatToPoint(lngLat, zoom);
  64683. return new Vector3(point.x, point.y, -0);
  64684. }
  64685. /**
  64686. * @function mapboxgl.supermap.ThreeLayer.prototype.distanceToThreeVector3
  64687. * @description 计算距离指定坐标给定距离的新坐标的 threejs 3D 失量对象。
  64688. * @param {number} x - x 轴距离,单位米。
  64689. * @param {number} y - y 轴距离,单位米。
  64690. * @param {(Array.<number>|Object)} lngLat - 源坐标。
  64691. * @returns {THREE.Vector3} 目标点的 threejs 3D 失量对象。参考:[THREE.Vector3]{@link https://threejs.org/docs/index.html#api/math/Vector3}
  64692. */
  64693. distanceToThreeVector3(x, y, lngLat) {
  64694. let map = this._map;
  64695. let center = lngLat || map.getCenter(),
  64696. maxZoom = Transform.projection.nativeMaxZoom,
  64697. targetLngLat = Transform.locate(center, x, y);
  64698. let point1 = Transform.lngLatToPoint(center, maxZoom),
  64699. point2 = Transform.lngLatToPoint(targetLngLat, maxZoom);
  64700. let targetX = Math.abs(point2.x - point1.x) * Math.sign(x);
  64701. let targetY = Math.abs(point2.y - point1.y) * Math.sign(y);
  64702. return new Vector3(targetX, targetY, 0);
  64703. }
  64704. /**
  64705. * @function mapboxgl.supermap.ThreeLayer.prototype.removeDuplicatedCoordinates
  64706. * @description 移除数组中的重复坐标。
  64707. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  64708. * @returns {(Array.<Array.<number>>)} 新的坐标数组。
  64709. */
  64710. removeDuplicatedCoordinates(coordinates) {
  64711. function equals(point1, point2) {
  64712. return point1[0] === point2[0] && point1[1] === point2[1]
  64713. }
  64714. let coords = [].concat(coordinates);
  64715. let length = coords.length;
  64716. for (let i = length - 1; i >= 1; i--) {
  64717. if (equals(coords[i], coords[i - 1])) {
  64718. coords.splice(i, 1);
  64719. }
  64720. }
  64721. let isClose = equals(coords[0], coords[coords.length - 1]);
  64722. isClose && coords.splice(coords.length - 1, 1);
  64723. return coords;
  64724. }
  64725. /**
  64726. * @function mapboxgl.supermap.ThreeLayer.prototype.getCoordinatesCenter
  64727. * @description 获取给定坐标数组的中心坐标。
  64728. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  64729. * @returns {Object} 包含经纬度的坐标对象。
  64730. */
  64731. getCoordinatesCenter(coordinates) {
  64732. let sumX = 0, sumY = 0, count = 0;
  64733. let i = 0, len = coordinates.length;
  64734. for (; i < len; i++) {
  64735. if (coordinates[i]) {
  64736. sumX += coordinates[i][0];
  64737. sumY += coordinates[i][1];
  64738. count++;
  64739. }
  64740. }
  64741. return {
  64742. lng: sumX / count,
  64743. lat: sumY / count
  64744. };
  64745. }
  64746. /**
  64747. * @function mapboxgl.supermap.ThreeLayer.prototype.addTo
  64748. * @description 添加图层到地图。
  64749. * @param {Object} map - 地图对象。
  64750. * @returns {this} this 对象。
  64751. */
  64752. addTo(map) {
  64753. var me = this;
  64754. me._map = map;
  64755. me.renderer.setMap(map);
  64756. me.renderer.render();
  64757. //three mbgl 联动(仅联动相机,不执行重绘操作)
  64758. me._map.on('render', this._update.bind(me));
  64759. me._map.on('resize', this._resize.bind(me));
  64760. me.on('render', (function () {
  64761. this.context && this.context.render(this.scene, this.camera);
  64762. }).bind(me.renderer));
  64763. return this;
  64764. }
  64765. /**
  64766. * @function mapboxgl.supermap.ThreeLayer.prototype.getCanvasContainer
  64767. * @description 获取 three 图层容器。
  64768. * @returns {HTMLElement} three 图层的容器。
  64769. */
  64770. getCanvasContainer() {
  64771. return this.renderer.getCanvasContainer();
  64772. }
  64773. /**
  64774. * @function mapboxgl.supermap.ThreeLayer.prototype.getCanvas
  64775. * @description 获取 three 图层画布。
  64776. * @returns {HTMLCanvasElement} three 图层画布。
  64777. */
  64778. getCanvas() {
  64779. return this.renderer.getCanvas();
  64780. }
  64781. /**
  64782. * @function mapboxgl.supermap.ThreeLayer.prototype.remove
  64783. * @description 移除图层。
  64784. */
  64785. remove() {
  64786. let map = this._map, me = this;
  64787. map.off('render', me._update.bind(me));
  64788. map.off('resize', me._resize.bind(me));
  64789. me.renderer.remove();
  64790. me._map = null;
  64791. }
  64792. /**
  64793. * @function mapboxgl.supermap.ThreeLayer.prototype.draw
  64794. * @description 提供给外部的 threejs 模型绘制接口。
  64795. * @param {THREE.WebGLRenderer|THREE.CanvasRenderer} gl - threejs 渲染器上下文 。详情请参考:</br>
  64796. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}/
  64797. * [CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  64798. * @param {THREE.Scene} scene - threejs 场景对象。详情请参考:[THREE.Scene]{@link https://threejs.org/docs/index.html#api/scenes/Scene}
  64799. * @param {THREE.Camera} camera - threejs 相机对象。详情请参考:[THREE.Camera]{@link https://threejs.org/docs/index.html#api/cameras/Camera}
  64800. * @returns {this} this对象。
  64801. * @example
  64802. * var threeLayer = new mapboxgl.supermap.ThreeLayer('three');
  64803. * //可以通过重写 draw 实现模型绘制
  64804. * threeLayer.draw = function (gl, scene, camera) {
  64805. * //TODO 绘制操作
  64806. * }
  64807. * threeLayer.addTo(map);
  64808. */
  64809. draw(gl, scene, camera) {// eslint-disable-line no-unused-vars
  64810. return this;
  64811. }
  64812. /**
  64813. * @function mapboxgl.supermap.ThreeLayer.prototype.renderScene
  64814. * @description 渲染场景。
  64815. * @returns {this} this
  64816. */
  64817. renderScene() {
  64818. this.renderer.renderScene();
  64819. /**
  64820. * @event mapboxgl.supermap.ThreeLayer#renderscene
  64821. * @description renderScene 事件,场景渲染后触发。
  64822. */
  64823. this.fire("renderscene");
  64824. return this;
  64825. }
  64826. _resize() {
  64827. this.renderer.resize();
  64828. }
  64829. _update() {
  64830. /**
  64831. * @event mapboxgl.supermap.ThreeLayer#render
  64832. * @description render 事件,地图渲染时(地图状态改变时)触发。
  64833. */
  64834. this.renderScene();
  64835. this.fire('render');
  64836. return this;
  64837. }
  64838. }
  64839. external_mapboxgl_default.a.supermap.ThreeLayer = ThreeLayer_ThreeLayer;
  64840. // CONCATENATED MODULE: ./src/mapboxgl/overlay/HeatMapLayer.js
  64841. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  64842. * This program are made available under the terms of the Apache License, Version 2.0
  64843. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64844. /**
  64845. * @class mapboxgl.supermap.HeatMapLayer
  64846. * @classdesc 热力图层类。
  64847. * @category Visualization HeatMap
  64848. * @param {string} name - 图层名称。
  64849. * @param {Object} options - 构造参数。
  64850. * @param {mapboxgl.Map} options.map - mapboxgl map 对象。
  64851. * @param {string} options.featureWeight - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  64852. * @param {string} [options.id] - 专题图层ID。默认使用 CommonUtil.createUniqueID("HeatMapLayer_") 创建专题图层 ID。
  64853. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  64854. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  64855. * @param {number} [options.opacity=1] - 图层透明度。
  64856. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为canvas所支。
  64857. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。 当设置为 true 时,热点半径和图层地理坐标保持一致。
  64858. * @extends {mapboxgl.Evented}
  64859. * @fires mapboxgl.supermap.HeatMapLayer#featuresadded
  64860. * @fires mapboxgl.supermap.HeatMapLayer#changelayer
  64861. * @fires mapboxgl.supermap.HeatMapLayer#featuresremoved
  64862. *
  64863. */
  64864. class HeatMapLayer_HeatMapLayer extends external_mapboxgl_default.a.Evented {
  64865. constructor(name, options) {
  64866. super();
  64867. var _options = options ? options : {};
  64868. /**
  64869. * @member {string} mapboxgl.supermap.HeatMapLayer.prototype.name
  64870. * @description 图层名字。
  64871. */
  64872. this.name = name;
  64873. /**
  64874. * @member {string} mapboxgl.supermap.HeatMapLayer.prototype.id
  64875. * @description 热力图图层 id。
  64876. */
  64877. this.id = _options.id ? _options.id : Util_Util.createUniqueID("HeatMapLayer_");
  64878. /**
  64879. * @member {mapboxgl.Map} mapboxgl.supermap.HeatMapLayer.prototype.map
  64880. * @description 热力图图层 map。
  64881. */
  64882. this.map = _options.map ? _options.map : null;
  64883. /**
  64884. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.loadWhileAnimating=true]
  64885. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  64886. */
  64887. this.loadWhileAnimating = _options.loadWhileAnimating === undefined ? true : _options.loadWhileAnimating;
  64888. /**
  64889. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.visibility=true]
  64890. * @description 图层显示状态属性。
  64891. */
  64892. this.visibility = true;
  64893. /**
  64894. * @member {number} [mapboxgl.supermap.HeatMapLayer.prototype.opacity=1]
  64895. * @description 图层透明度,取值范围[0,1]。
  64896. */
  64897. this.opacity = _options.opacity ? _options.opacity : 1;
  64898. /**
  64899. * @member {Array.<string>} [mapboxgl.supermap.HeatMapLayer.prototype.colors=['blue','cyan','lime','yellow','red']]
  64900. * @description 颜色线性渐变数组,颜色值必须为 canvas 所支。
  64901. */
  64902. this.colors = _options.colors ? _options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
  64903. /**
  64904. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.useGeoUnit=false]
  64905. * @description 使用地理单位,即默认热点半径默认使用像素单位。 当设置为 true 时,热点半径和图层地理坐标保持一致。
  64906. */
  64907. this.useGeoUnit = _options.useGeoUnit ? _options.useGeoUnit : false;
  64908. /**
  64909. * @member {number} [mapboxgl.supermap.HeatMapLayer.prototype.radius=50]
  64910. * @description 热点渲染的最大半径(热点像素半径),
  64911. * 热点显示的时候以精确点为中心点开始往四周辐射衰减,
  64912. * 其衰减半径和权重值成比列。
  64913. */
  64914. this.radius = _options.radius ? _options.radius : 50;
  64915. /**
  64916. * @member {string} mapboxgl.supermap.HeatMapLayer.prototype.featureWeight
  64917. * @description 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  64918. * @example
  64919. * //feature.attributes中表示权重的字段为 height,则在 HeatMapLayer 的 featureWeight 参数赋值为 "height"。
  64920. * feature1.attributes.height = 7.0;
  64921. * feature2.attributes.height = 6.0;
  64922. * var heatMapLayer = new mapboxgl.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  64923. * heatMapLayer.addFeatures([feature1,feature2]);
  64924. */
  64925. this.featureWeight = _options.featureWeight ? _options.featureWeight : null;
  64926. /**
  64927. * @member {Array.<SuperMap.Feature.Vector>} mapboxgl.supermap.HeatMapLayer.prototype.features
  64928. * @description 热点信息数组,记录存储图层上添加的所有热点信息。
  64929. */
  64930. this.features = [];
  64931. /**
  64932. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.maxWeight
  64933. * @description 设置权重最大值。如果不设置此属性,将按照当前屏幕范围内热点所拥有的权重最大值绘制热点图。
  64934. */
  64935. this.maxWeight = null;
  64936. /**
  64937. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.minWeight
  64938. * @description 设置权重最小值。如果不设置此属性,将按照当前屏幕范围内热点所拥有的权重最小值绘制热点图。
  64939. */
  64940. this.minWeight = null;
  64941. /**
  64942. * @member mapboxgl.supermap.HeatMapLayer.prototype.EVENT_TYPES
  64943. * @description 监听一个自定义事件可用如下方式:
  64944. * 热点图自定义事件信息,事件调用时的属性与具体事件类型相对应。
  64945. *
  64946. * All event objects have at least the following properties:
  64947. * {Object} object - A reference to layer.events.object.
  64948. * {DOMElement} element - A reference to layer.events.element.
  64949. *
  64950. * 支持的事件如下 (另外包含 <SuperMap.Layer 中定义的其他事件>):
  64951. * featuresadded - 热点添加完成时触发。传递参数为添加的热点信息数组和操作成功与否信息。
  64952. * 参数类型:{features: features, succeed: succeed}
  64953. * featuresremoved - 热点被删除时触发。传递参数为删除的热点信息数组和操作成功与否信息。
  64954. * 参数类型:{features: features, succeed: succeed}
  64955. * featuresdrawcompleted - 热点图渲染完成时触发,没有额外属性。
  64956. */
  64957. this.EVENT_TYPES = ["featuresadded", "featuresremoved", "featuresdrawcompleted"];
  64958. /**
  64959. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.supported=false]
  64960. * @description 当前浏览器是否支持 canvas 绘制,
  64961. * 决定了热点图是否可用,内部判断使用。
  64962. */
  64963. this.supported = false;
  64964. /**
  64965. * @member {Object} mapboxgl.supermap.HeatMapLayer.prototype.rootCanvas
  64966. * @description 热点图主绘制面板。
  64967. */
  64968. this.rootCanvas = null;
  64969. /**
  64970. * @member {Object} mapboxgl.supermap.HeatMapLayer.prototype.canvasContext
  64971. * @description 热点图主绘制对象。
  64972. */
  64973. this.canvasContext = null;
  64974. /**
  64975. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.maxWidth
  64976. * @description 当前绘制面板宽度。和当前 map 窗口宽度一致。
  64977. */
  64978. this.maxWidth = null;
  64979. /**
  64980. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.maxHeight
  64981. * @description 当前绘制面板宽度。和当前 map 窗口高度一致。
  64982. */
  64983. this.maxHeight = null;
  64984. }
  64985. /**
  64986. * @function mapboxgl.supermap.HeatMapLayer.prototype.onAdd
  64987. * @description 向底图添加该图层
  64988. */
  64989. onAdd(map) {
  64990. this.map = map;
  64991. if (this.features.length === 0) {
  64992. return;
  64993. }
  64994. //创建热力图绘制容器
  64995. this._createCanvasContainer();
  64996. //绑定图层事件与Map同步
  64997. this.map.on('resize', this._resizeEvent.bind(this));
  64998. this.map.on('zoomstart', this._zoomStartEvent.bind(this));
  64999. this.map.on('zoomend', this._zoomEndEvent.bind(this));
  65000. this.map.on('rotatestart', this._rotateStartEvent.bind(this));
  65001. this.map.on('rotate', this._rotateEvent.bind(this));
  65002. this.map.on('rotateend', this._rotateEndEvent.bind(this));
  65003. this.map.on('dragend', this._dragEndEvent.bind(this));
  65004. this.map.on('movestart', this._moveStartEvent.bind(this));
  65005. this.map.on('move', this._moveEvent.bind(this));
  65006. this.map.on('moveend', this._moveEndEvent.bind(this));
  65007. this.map.on('remove', this.removeFromMap.bind(this));
  65008. this.refresh();
  65009. }
  65010. /**
  65011. * @function mapboxgl.supermap.HeatMapLayer.prototype.removeFromMap
  65012. * @description 从底图删除该图层。
  65013. */
  65014. removeFromMap() {
  65015. this.removeAllFeatures();
  65016. this.map.getCanvasContainer().removeChild(this.rootCanvas);
  65017. }
  65018. /**
  65019. * @function mapboxgl.supermap.HeatMapLayer.prototype._createCanvasContainer
  65020. * @description 创建热力图绘制容器。
  65021. * @private
  65022. */
  65023. _createCanvasContainer() {
  65024. this.supported = true;
  65025. //构建绘图面板
  65026. this.mapContainer = this.map.getCanvasContainer();
  65027. //热点图要求使用canvas绘制,判断是否支持
  65028. this.rootCanvas = document.createElement("canvas");
  65029. this.rootCanvas.id = this.id;
  65030. var mapCanvas = this.map.getCanvas();
  65031. this.rootCanvas.width = this.maxWidth = parseInt(mapCanvas.width);
  65032. this.rootCanvas.height = this.maxHeight = parseInt(mapCanvas.height);
  65033. Util_Util.modifyDOMElement(this.rootCanvas, null, null, null,
  65034. "absolute", null, null, this.opacity);
  65035. this.canvasContext = this.rootCanvas.getContext('2d');
  65036. this.mapContainer.appendChild(this.rootCanvas);
  65037. }
  65038. /**
  65039. * @function mapboxgl.supermap.HeatMapLayer.prototype.addFeatures
  65040. * @description 添加热点信息。
  65041. * @param {GeoJSONObject} features - 待添加的要素数组。
  65042. *
  65043. * @example
  65044. * var geojson = {
  65045. * "type": "FeatureCollection",
  65046. * "features": [
  65047. * {
  65048. * "type": "feature",
  65049. * "geometry": {
  65050. * "type": "Point", //只支持point类型
  65051. * "coordinates": [0, 0]
  65052. * },
  65053. * "properties": {
  65054. * "height": Math.random()*9,
  65055. * "geoRadius": useGeoRadius?radius:null
  65056. * }
  65057. * }
  65058. * ]
  65059. * };
  65060. * var heatMapLayer = new mapboxgl.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"}); pLayer = new mapboxgl.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  65061. * heatMapLayer.addFeatures(geojson);
  65062. * map.addLayer(heatMapLayer);
  65063. */
  65064. addFeatures(features) {
  65065. this.features = this.toiClientFeature(features);
  65066. /**
  65067. * @event mapboxgl.supermap.HeatMapLayer#featuresadded
  65068. * @description 要素添加完成之后触发。
  65069. * @property {GeoJSONObject} features - 被添加的要素。
  65070. * @property {boolean} succeed - 要素是否成功添加。
  65071. */
  65072. this.fire(this.EVENT_TYPES[0], {features: features, succeed: true});
  65073. //支持更新features,刷新底图
  65074. this.refresh();
  65075. }
  65076. /**
  65077. * @function mapboxgl.supermap.HeatMapLayer.prototype.refresh
  65078. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  65079. */
  65080. refresh() {
  65081. if (this.features.length === 0) {
  65082. return;
  65083. }
  65084. if (this.map) {
  65085. var extent = this.map.getBounds();
  65086. this.updateHeatPoints(extent);
  65087. }
  65088. }
  65089. /**
  65090. * @function mapboxgl.supermap.HeatMapLayer.prototype.setOpacity
  65091. * @description 设置图层的不透明度,取值[0-1]之间。
  65092. * @param {number} [opacity] - 透明度。
  65093. */
  65094. setOpacity(opacity) {
  65095. if (opacity !== this.opacity) {
  65096. this.opacity = opacity;
  65097. Util_Util.modifyDOMElement(this.rootCanvas, null, null, null,
  65098. null, null, null, opacity);
  65099. if (this.map !== null) {
  65100. /**
  65101. * @event mapboxgl.supermap.HeatMapLayer#changelayer
  65102. * @description 图层属性改变之后触发。
  65103. * @property {Object} layer - 图层。
  65104. * @property {string} property - 被改变的图层属性。
  65105. */
  65106. this.fire('changelayer', {layer: this, property: "opacity"});
  65107. }
  65108. }
  65109. }
  65110. /**
  65111. * @function mapboxgl.supermap.HeatMapLayer.prototype.updateHeatPoints
  65112. * @description 刷新热点图显示。
  65113. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  65114. */
  65115. updateHeatPoints(bounds) {
  65116. if (this.features && this.features.length > 0) {
  65117. this.convertFastToPixelPoints(bounds);
  65118. } else {
  65119. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  65120. }
  65121. }
  65122. /**
  65123. * @function mapboxgl.supermap.HeatMapLayer.prototype.convertFastToPixelPoints
  65124. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  65125. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  65126. * @private
  65127. */
  65128. convertFastToPixelPoints(bounds) {
  65129. var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
  65130. //获取当前像素下的地理范围
  65131. var dw = bounds.getEast() - bounds.getWest();
  65132. var dh = bounds.getNorth() - bounds.getSouth();
  65133. var mapCanvas = this.map.getCanvas();
  65134. if (dw / mapCanvas.width > dh / mapCanvas.height) {
  65135. resolution = dw / mapCanvas.width;
  65136. } else {
  65137. resolution = dh / mapCanvas.height;
  65138. }
  65139. //热点半径
  65140. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  65141. for (var i = 0; i < this.features.length; i++) {
  65142. var feature = this.features[i];
  65143. var point = feature.geometry;
  65144. //可通过bounds过滤需绘制的features以优化性能,但mapboxgl旋转获取得bounds不适
  65145. var pixelPoint = this.getPixelXY(new LonLat_LonLat(point.x, point.y));
  65146. if (this.featureWeight) {
  65147. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  65148. if (!this.maxWeight) {
  65149. //找出最大最小权重值
  65150. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  65151. minTemp = minTemp ? minTemp : pixelPoint.weight;
  65152. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  65153. minTemp = Math.min(minTemp, pixelPoint.weight);
  65154. }
  65155. } else {
  65156. pixelPoint.weight = 1;
  65157. }
  65158. x = Math.floor(pixelPoint.x);
  65159. y = Math.floor(pixelPoint.y);
  65160. k = pixelPoint.weight;
  65161. data.push([x, y, k]);
  65162. }
  65163. //无最大权重设置
  65164. if (!this.maxWeight) {
  65165. if (maxTemp && minTemp) {
  65166. maxWeightTemp = (maxTemp + minTemp) / 2;
  65167. } else {
  65168. maxWeightTemp = 1;
  65169. }
  65170. this.draw(data, maxWeightTemp);
  65171. } else {
  65172. this.draw(data, this.maxWeight);
  65173. }
  65174. }
  65175. /**
  65176. * @function mapboxgl.supermap.HeatMapLayer.prototype.draw
  65177. * @description 绘制热点图。
  65178. * @param {Array} data - convertToPixelPoints方法计算出的点。
  65179. * @private
  65180. */
  65181. draw(data, maxWeight) {
  65182. if (this.maxHeight > 0 && this.maxWidth > 0) {
  65183. //清空
  65184. var ctx = this.canvasContext;
  65185. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  65186. this.drawCircle(this.useRadius);
  65187. this.createGradient();
  65188. for (var i = 0; i < data.length; i++) {
  65189. var p = data[i];
  65190. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  65191. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  65192. }
  65193. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  65194. this.colorize(colored.data, this.grad);
  65195. ctx.putImageData(colored, 0, 0);
  65196. } else {
  65197. return false;
  65198. }
  65199. }
  65200. /**
  65201. * @function mapboxgl.supermap.HeatMapLayer.prototype.colorize
  65202. * @description 根据渐变色重置热点图rgb值。
  65203. * @param {Array} pixels - 像素 RGBA 值。
  65204. * @param {Array} gradient - 渐变 canvas.getImageData.data。
  65205. * @private
  65206. */
  65207. colorize(pixels, gradient) {
  65208. for (var i = 0, j; i < pixels.length; i += 4) {
  65209. j = pixels[i + 3] * 4;
  65210. if (j) {
  65211. pixels[i] = gradient[j];
  65212. pixels[i + 1] = gradient[j + 1];
  65213. pixels[i + 2] = gradient[j + 2];
  65214. }
  65215. }
  65216. }
  65217. /**
  65218. * @function mapboxgl.supermap.HeatMapLayer.drawCircle
  65219. * @description 绘制热点半径圆。
  65220. * @param {number} r - 热点半径。
  65221. * @private
  65222. */
  65223. drawCircle(r) {
  65224. var blur = r / 2;
  65225. var circle = this.circle = document.createElement('canvas'),
  65226. ctx = circle.getContext("2d");
  65227. circle.height = 2 * r;
  65228. circle.width = 2 * r;
  65229. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  65230. ctx.shadowBlur = blur;
  65231. ctx.shadowColor = "#000000";
  65232. ctx.beginPath();
  65233. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  65234. ctx.closePath();
  65235. ctx.fill();
  65236. }
  65237. /**
  65238. * @function mapboxgl.supermap.HeatMapLayer.createGradient
  65239. * @description 根据 this.colors 设置渐变并 getImageData。
  65240. * @private
  65241. */
  65242. createGradient() {
  65243. var colors = this.colors;
  65244. var canvas = document.createElement('canvas'),
  65245. ctx = canvas.getContext("2d"),
  65246. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  65247. canvas.height = 256;
  65248. canvas.width = 1;
  65249. var index = 1;
  65250. for (var i = 0, len = colors.length; i < len; i++) {
  65251. gradient.addColorStop(index / len, colors[i]);
  65252. index++;
  65253. }
  65254. ctx.fillStyle = gradient;
  65255. ctx.fillRect(0, 0, 1, 256);
  65256. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  65257. }
  65258. /**
  65259. * @function mapboxgl.supermap.HeatMapLayer.prototype.getPixelXY
  65260. * @description 转换地理坐标为相对于当前窗口左上角的像素坐标。
  65261. * @param {number} x - 热点的像素 x 坐标。
  65262. * @param {number} y - 热点的像素 y 坐标。
  65263. */
  65264. getPixelXY(coordinate) {
  65265. var pixelP, map = this.map;
  65266. if (coordinate instanceof Point_Point || coordinate instanceof GeoText_GeoText) {
  65267. let tempPoint = map.project(new external_mapboxgl_default.a.LngLat(coordinate.x, coordinate.y));
  65268. pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
  65269. }
  65270. if (coordinate instanceof LonLat_LonLat) {
  65271. let tempPoint = map.project(new external_mapboxgl_default.a.LngLat(coordinate.lon, coordinate.lat));
  65272. pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
  65273. }
  65274. return pixelP;
  65275. }
  65276. /**
  65277. * @function mapboxgl.supermap.HeatMapLayer.prototype.toiClientFeature
  65278. * @description 转为 iClient 要素。
  65279. * @param {GeoJSONObject} features - 待添加的要素数组。
  65280. */
  65281. toiClientFeature(features) {
  65282. if (!Util_Util.isArray(features)) {
  65283. features = [features];
  65284. }
  65285. let featuresTemp = [];
  65286. for (let i = 0; i < features.length; i++) {
  65287. if (features[i] instanceof Vector_Vector) {
  65288. // 若是 GeometryVector 直接返回
  65289. featuresTemp.push(features[i]);
  65290. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  65291. //GeoJSON 规范数据类型
  65292. let format = new GeoJSON_GeoJSON();
  65293. featuresTemp = featuresTemp.concat(format.read(features[i]));
  65294. } else if (features[i].geometry && features[i].geometry.parts) {
  65295. //iServer服务器返回数据格式
  65296. featuresTemp.push(ServerFeature_ServerFeature.fromJson(features[i]).toFeature());
  65297. } else {
  65298. throw new Error(`Features[${i}]'s type does not match, please check.`);
  65299. }
  65300. }
  65301. return featuresTemp;
  65302. }
  65303. /**
  65304. * @function mapboxgl.supermap.HeatMapLayer.prototype.removeFeatures
  65305. * @description 移除指定的热点信息。
  65306. * @param {Array.<SuperMap.Feature.Vector>} features - 热点信息数组。
  65307. */
  65308. removeFeatures(features) {
  65309. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  65310. return;
  65311. }
  65312. if (features === this.features) {
  65313. return this.removeAllFeatures();
  65314. }
  65315. if (!(Util_Util.isArray(features))) {
  65316. features = [features];
  65317. }
  65318. var heatPoint, index, heatPointsFailedRemoved = [];
  65319. for (var i = 0, len = features.length; i < len; i++) {
  65320. heatPoint = features[i];
  65321. index = Util_Util.indexOf(this.features, heatPoint);
  65322. //找不到视为删除失败
  65323. if (index === -1) {
  65324. heatPointsFailedRemoved.push(heatPoint);
  65325. continue;
  65326. }
  65327. //删除热点
  65328. this.features.splice(index, 1);
  65329. }
  65330. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  65331. //派发删除features成功的事件
  65332. /**
  65333. * @event mapboxgl.supermap.HeatMapLayer#featuresremoved
  65334. * @description 要素删除之后触发。
  65335. * @property {Array.<SuperMap.Feature.Vector>} features - 需要被删除的要素。
  65336. * @property {boolean} succeed - 要素删除成功与否。
  65337. */
  65338. this.fire(this.EVENT_TYPES[1], {features: heatPointsFailedRemoved, succeed: succeed});
  65339. this.refresh();
  65340. }
  65341. /**
  65342. * @function mapboxgl.supermap.HeatMapLayer.prototype.removeAllFeatures
  65343. * @description 移除全部的热点信息。
  65344. */
  65345. removeAllFeatures() {
  65346. this.features = [];
  65347. this.refresh();
  65348. }
  65349. /**
  65350. * @function mapboxgl.supermap.HeatMapLayer.prototype.moveTo
  65351. * @description 将图层移动到某个图层之前。
  65352. * @param {string} layerID - 待插入的图层ID。
  65353. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  65354. */
  65355. moveTo(layerID, before) {
  65356. var layer = document.getElementById(this.rootCanvas.id);
  65357. before = before !== undefined ? before : true;
  65358. if (before) {
  65359. var beforeLayer = document.getElementById(layerID);
  65360. if (layer && beforeLayer) {
  65361. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  65362. }
  65363. return;
  65364. }
  65365. var nextLayer = document.getElementById(layerID);
  65366. if (layer) {
  65367. if (nextLayer.nextSibling) {
  65368. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  65369. return;
  65370. }
  65371. nextLayer.parentNode.appendChild(layer);
  65372. }
  65373. }
  65374. /**
  65375. * @function mapboxgl.supermap.HeatMapLayer.prototype.setVisibility
  65376. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  65377. * @param {boolean} [visibility] - 是否显示图层(当前地图的resolution在最大最小resolution之间)。
  65378. */
  65379. setVisibility(visibility) {
  65380. if (this.rootCanvas && visibility !== this.visibility) {
  65381. this.visibility = visibility;
  65382. this.rootCanvas.style.display = visibility ? "block" : "none";
  65383. }
  65384. }
  65385. //事件绑定
  65386. _resizeEvent() {
  65387. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  65388. var canvas = this.map.getCanvas();
  65389. this.rootCanvas.style.width = canvas.style.width;
  65390. this.rootCanvas.style.height = canvas.style.height;
  65391. this.rootCanvas.width = this.maxWidth = parseInt(canvas.width);
  65392. this.rootCanvas.height = this.maxHeight = parseInt(canvas.height);
  65393. let devicePixelRatio = window.devicePixelRatio || 1;
  65394. devicePixelRatio !== 1 && this.canvasContext && this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
  65395. this.refresh();
  65396. }
  65397. _zoomStartEvent() {
  65398. if (this.loadWhileAnimating || !this.visibility) {
  65399. return;
  65400. }
  65401. this.zooming = true;
  65402. this._hide();
  65403. }
  65404. _zoomEndEvent() {
  65405. if (this.loadWhileAnimating || !this.visibility) {
  65406. return;
  65407. }
  65408. this.zooming = false;
  65409. this._show();
  65410. }
  65411. _rotateStartEvent() {
  65412. if (this.loadWhileAnimating || !this.visibility) {
  65413. return;
  65414. }
  65415. this.rotating = true;
  65416. }
  65417. _rotateEvent() {
  65418. if (this.loadWhileAnimating || !this.visibility) {
  65419. return;
  65420. }
  65421. if (this.map.getPitch() !== 0) {
  65422. this._hide();
  65423. }
  65424. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  65425. var tPitch = this.map.getPitch() - this.startPitch;
  65426. var tBearing = -this.map.getBearing() + this.startBearing;
  65427. this.rootCanvas.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)'
  65428. }
  65429. _rotateEndEvent() {
  65430. if (this.loadWhileAnimating || !this.visibility) {
  65431. return;
  65432. }
  65433. this.rotating = false;
  65434. this._show();
  65435. }
  65436. _dragEndEvent() {
  65437. if (this.loadWhileAnimating || !this.visibility) {
  65438. return;
  65439. }
  65440. this._hide();
  65441. }
  65442. _moveEndEvent() {
  65443. if (this.loadWhileAnimating || !this.visibility) {
  65444. return;
  65445. }
  65446. this.rootCanvas.style.transform = '';
  65447. this.refresh();
  65448. this._show();
  65449. }
  65450. _moveStartEvent() {
  65451. if (this.loadWhileAnimating || !this.visibility) {
  65452. return;
  65453. }
  65454. this.startPitch = this.map.getPitch();
  65455. this.startBearing = this.map.getBearing();
  65456. var startMovePoint = this.map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  65457. this.startMoveX = startMovePoint.x;
  65458. this.startMoveY = startMovePoint.y;
  65459. }
  65460. _moveEvent() {
  65461. if (this.loadWhileAnimating || !this.visibility) {
  65462. this.refresh();
  65463. return;
  65464. }
  65465. if (this.rotating || this.zooming) {
  65466. return;
  65467. }
  65468. if (this.map.getPitch() !== 0) {
  65469. this._hide();
  65470. }
  65471. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  65472. var tPitch = this.map.getPitch() - this.startPitch;
  65473. var tBearing = -this.map.getBearing() + this.startBearing;
  65474. var endMovePoint = this.map.project(new external_mapboxgl_default.a.LngLat(0, 0));
  65475. var tMoveX = endMovePoint.x - this.startMoveX;
  65476. var tMoveY = endMovePoint.y - this.startMoveY;
  65477. this.rootCanvas.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)' + ' translate3d(' + tMoveX + 'px, ' + tMoveY + 'px, 0px)';
  65478. }
  65479. _hide() {
  65480. this.rootCanvas.style.display = 'none';
  65481. }
  65482. _show() {
  65483. this.rootCanvas.style.display = 'block';
  65484. }
  65485. }
  65486. external_mapboxgl_default.a.supermap.HeatMapLayer = HeatMapLayer_HeatMapLayer;
  65487. // CONCATENATED MODULE: ./src/mapboxgl/overlay/DeckglLayer.js
  65488. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  65489. * This program are made available under the terms of the Apache License, Version 2.0
  65490. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65491. /**
  65492. * @class mapboxgl.supermap.DeckglLayer
  65493. * @category Visualization DeckGL
  65494. * @classdesc Deckgl 高效率图层,该图图层为综合图层,通过该图层可创建 高效率点图层、路径图层(线图层)、高效率面图层、曲线图层、
  65495. * 正六边形图层(蜂巢图层)、网格图层,只需给定相依配置,因此,在创建图层之前,请仔细阅读参数配置。
  65496. * @param {string} layerTypeID - 高效率图层类型 ID,包括 "scatter-plot" 高效率点图层、"path-layer" 路径图层(线图层)、
  65497. * "polygon-layer" 高效率面图层、 "arc-layer" 曲线图层、"hexagon-layer" 正六边形图层(蜂巢图层)、"screen-grid-layer" 网格图层。
  65498. * @param {Object} options - 图层配置项,包括以下参数:
  65499. * @param {Array.<GeoJSONObject>} options.data - 图层数据,支持 GeoJSON 规范数据类型。
  65500. * @param {Object} options.callback - deckgl 图层回调函数配置项。
  65501. * @param {Object} options.props - deckgl 图层配置项, 在该参数下配置图层配置项:
  65502. * @param {boolean} options.props.coverage - "hexagon-layer" 配置项:六边形半径乘数,介于0 - 1之间。六边形的最终半径通过覆盖半径计算。 注意:覆盖范围不会影响分数的分配方式。 分配方式的半径仅由半径属性确定;
  65503. * @param {boolean} options.props.hexagonAggregator - "hexagon-layer" 配置项:* @param {boolean}
  65504. * options.props.lightSettings - 公共配置项:光照,包含以下几个配置;
  65505. * @param {Array} options.props.lightSettings.lightsPosition - 光照配置项:指定为`[x,y,z]`的光在平面阵列中的位置`, 在一个平面阵列。 长度应该是 `3 x numberOfLights`。
  65506. * @param {Array} options.props.lightSettings.lightsStrength - 光照配置项:平面阵列中指定为“[x,y]`的灯的强度。 长度应该是`2 x numberOfLights`。
  65507. * @param {number} [options.props.lightSettings.numberOfLights=1] - 光照配置项:光照值,最大值为 `5`。
  65508. * @param {number} [options.props.lightSettings.coordinateSystem=COORDINATE_SYSTEM.LNGLAT] - 光照配置项:指定灯位置的坐标系。
  65509. * @param {number} [options.props.lightSettings.coordinateOrigin=[0, 0, 0]] - 光照配置项:指定灯位置的坐标原点。
  65510. * @param {number} [options.props.lightSettings.modelMatrix] - 光照配置项:光位置的变换矩阵。
  65511. * @param {number} [options.props.lightSettings.ambientRatio=0.4] - 光照配置项:光照的环境比例。
  65512. * @param {number} [options.props.lightSettings.diffuseRatio=0.6] - 光照配置项:光的漫反射率。
  65513. * @param {number} [options.props.lightSettings.specularRatio=0.8] - 光照配置项:光的镜面反射率。
  65514. * @param {Object} [options.layerId] - DeckglLayer 图层 Dom 元素 ID。默认使用 CommonUtil.createUniqueID("graphicLayer_" + this.layerTypeID + "_") 创建专题图层 ID。
  65515. * @param {number} [options.props.opacity=1] - 公共配置项:图层透明度。
  65516. * @param {boolean} [options.props.pickable=false] - 公共配置项:是否响应鼠标事件(鼠标点击,鼠标滑动)。
  65517. * @param {function} [options.props.autoHighlight=false] - 公共配置项:鼠标滑动高亮要素。
  65518. * @param {function} [options.props.highlightColor=[0, 0, 128, 128]] - 公共配置项:鼠标滑动高亮颜色。
  65519. * @param {function} [options.props.onClick] - 公共配置项:鼠标点击事件。
  65520. * @param {function} [options.props.onHover] - 公共配置项:鼠标滑动事件。
  65521. * @param {number} [options.props.radiusScale=1] - "scatter-plot" 配置项:散点半径比例。
  65522. * @param {boolean} [options.props.outline=false] - "scatter-plot" 配置项:是否边线显示。
  65523. * @param {number} [options.props.strokeWidth=1] - "scatter-plot" 配置项:边线宽度。
  65524. * @param {number} [options.props.radiusMinPixels=0] - "scatter-plot" 配置项:半径最小像素值。
  65525. * @param {number} [options.props.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - "scatter-plot" 配置项:半径最大像素值。
  65526. * @param {boolean} [options.props.fp64=false] - "scatter-plot" 配置项:否应以高精度64位模式呈现图层。
  65527. * @param {number} [options.props.widthScale=1] - "path-layer" 配置项:线宽比例。
  65528. * @param {number} [options.props.widthMinPixels=0] - "path-layer" 配置项:线宽最小像素值。
  65529. * @param {number} [options.props.widthMaxPixels=Number.MAX_SAFE_INTEGER] - "path-layer" 配置项:线宽最大像素值。
  65530. * @param {boolean} [options.props.rounded=false] - "path-layer" 配置项:节点是否绘制为弧形。
  65531. * @param {number} [options.props.miterLimit=4] - "path-layer" 配置项:节点相对于线宽的最大范围,仅在 rounded 为 false 时有效;
  65532. * @param {boolean} [options.props.fp64=false] - "path-layer" 配置项:否应以高精度64位模式呈现图层。
  65533. * @param {boolean} [options.props.dashJustified=false] - "path-layer" 配置项:是否虚线形式显示,仅在 getDashArray() 回调函数被指定时有效。
  65534. * @param {boolean} [options.props.filled=true] - "polygon-layer" 配置项:是否填充面。
  65535. * @param {boolean} [options.props.stroked=true] - "polygon-layer" 配置项:是否绘制边线。
  65536. * @param {boolean} [options.props.extruded=false] - "polygon-layer" 配置项:是否拉伸建筑。
  65537. * @param {boolean} [options.props.wireframe=false] - "polygon-layer" 配置项:当面被拉伸为建筑时,是否描绘建筑物边线。
  65538. * @param {boolean} [options.props.elevationScale=1] - "polygon-layer" 配置项:海拔比例。
  65539. * @param {boolean} [options.props.lineWidthScale=1] - "polygon-layer" 配置项:线宽比例。
  65540. * @param {boolean} [options.props.lineWidthMinPixels=0] - "polygon-layer" 配置项:线宽最小像素值。
  65541. * @param {boolean} [options.props.lineWidthMaxPixels=Number.MAX_SAFE_INTEGER] - "polygon-layer" 配置项:线宽最大像素值。
  65542. * @param {boolean} [options.props.lineJointRounded=false] - "polygon-layer" 配置项:节点是否绘制为弧形。
  65543. * @param {boolean} [options.props.lineMiterLimit=4] - "polygon-layer" 配置项:节点相对于线宽的最大范围,仅在 lineJointRounded 为 false 时有效。
  65544. * @param {boolean} [options.props.lineDashJustified=false] - "polygon-layer" 配置项:是否虚线形式显示,仅在 getLineDashArray() 回调函数被指定时有效。
  65545. * @param {boolean} [options.props.fp64=false] - "polygon-layer" 配置项:否应以高精度64位模式呈现图层。
  65546. * @param {boolean} [options.props.fp64=false] - "arc-layer" 配置项:否应以高精度64位模式呈现图层。
  65547. * @param {boolean} [options.props.strokeWidth=1] - "arc-layer" 配置项:线宽。
  65548. * @param {boolean} [options.props.radius=1000] - "hexagon-layer" 配置项:六边形半径值。
  65549. * @param {boolean} [options.props.extruded=false] - "hexagon-layer" 配置项:是否拉伸要素。
  65550. * @param {boolean} [options.props.upperPercentile=100] - "hexagon-layer" 配置项:筛选箱并通过upperPercentile重新计算颜色。 颜色值大于upperPercentile的六边形将被隐藏。
  65551. * @param {boolean} [options.props.elevationScale=1] - "hexagon-layer" 配置项:高程乘数,实际海拔高度由 elevationScale * getElevation(d)计算。 elevationScale是一个方便的属性,可以在不更新数据的情况下缩放所有六边形。
  65552. * @param {boolean} [options.props.colorDomain=false] - "hexagon-layer" 配置项:色阶。
  65553. * @param {boolean} [options.props.colorRange=[[255,255,178,255],[254,217,118,255],[254,178,76,255],[253,141,60,255],[240,59,32,255],[189,0,38,255]]] - "hexagon-layer" 配置项:色带。
  65554. */
  65555. class DeckglLayer_DeckglLayer {
  65556. constructor(layerTypeID, options) {
  65557. // Util.extend(defaultProps, options);
  65558. /**
  65559. * @member {string} mapboxgl.supermap.DeckglLayer.prototype.id
  65560. * @description 高效率点图层 id。
  65561. */
  65562. this.layerTypeID = layerTypeID;
  65563. /**
  65564. * @member {Array.<mapboxgl.supermap.Graphic>} mapboxgl.supermap.DeckglLayer.prototype.graphics
  65565. * @description 点要素对象数组。
  65566. */
  65567. this.data = [].concat(options.data);
  65568. this.props = options.props ? options.props : {};
  65569. this.callback = options.callback ? options.callback : {};
  65570. this.id = options.layerId
  65571. ? options.layerId
  65572. : Util_Util.createUniqueID('graphicLayer_' + this.layerTypeID + '_');
  65573. /**
  65574. * @member {boolean} [mapboxgl.supermap.DeckglLayer.prototype.visibility=true]
  65575. * @description 图层显示状态属性。
  65576. */
  65577. this.visibility = true;
  65578. }
  65579. /**
  65580. * @function mapboxgl.supermap.DeckglLayer.prototype.onAdd
  65581. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  65582. * @returns {mapboxgl.supermap.DeckglLayer}
  65583. */
  65584. onAdd(map) {
  65585. this.map = map;
  65586. if (this.canvas) {
  65587. this.mapContainer = this.map.getCanvasContainer();
  65588. this.mapContainer.appendChild(this.canvas);
  65589. return this;
  65590. }
  65591. //当使用扩展的mapboxgl代码时有效
  65592. if (map.getCRS && map.getCRS() !== external_mapboxgl_default.a.CRS.EPSG3857) {
  65593. this.coordinateSystem = 3;
  65594. this.isGeographicCoordinateSystem = true;
  65595. }
  65596. //创建图层容器
  65597. this._initContainer();
  65598. //创建 deckgl 图层
  65599. this._createLayerByLayerTypeID();
  65600. var mapState = this._getState();
  65601. let deckOptions = {};
  65602. for (let key in mapState) {
  65603. deckOptions[key] = mapState[key];
  65604. }
  65605. deckOptions.layers = [this.layer];
  65606. deckOptions.canvas = this.canvas;
  65607. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  65608. this.map.on('render', this._moveEvent.bind(this));
  65609. this.map.on('resize', this._resizeEvent.bind(this));
  65610. this._draw();
  65611. return this;
  65612. }
  65613. /**
  65614. * @function mapboxgl.supermap.DeckglLayer.prototype.remove
  65615. * @description 删除该图层。
  65616. */
  65617. remove() {
  65618. this.map.off('render', this._moveEvent.bind(this));
  65619. this.map.off('resize', this._resizeEvent.bind(this));
  65620. this.map.getCanvasContainer().removeChild(this.canvas);
  65621. }
  65622. /**
  65623. * @function mapboxgl.supermap.DeckglLayer.prototype.removeFromMap
  65624. * @deprecated
  65625. * @description 删除该图层。
  65626. */
  65627. removeFromMap() {
  65628. this.remove();
  65629. this.clear();
  65630. }
  65631. /**
  65632. * @function mapboxgl.supermap.DeckglLayer.prototype.moveTo
  65633. * @description 将图层移动到某个图层之前。
  65634. * @param {string} layerID - 待插入的图层 ID。
  65635. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  65636. */
  65637. moveTo(layerID, before) {
  65638. var layer = document.getElementById(this.id);
  65639. before = before !== undefined ? before : true;
  65640. if (before) {
  65641. var beforeLayer = document.getElementById(layerID);
  65642. if (layer && beforeLayer) {
  65643. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  65644. }
  65645. return;
  65646. }
  65647. var nextLayer = document.getElementById(layerID);
  65648. if (layer) {
  65649. if (nextLayer.nextSibling) {
  65650. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  65651. return;
  65652. }
  65653. nextLayer.parentNode.appendChild(layer);
  65654. }
  65655. }
  65656. /**
  65657. * @function mapboxgl.supermap.DeckglLayer.prototype.setVisibility
  65658. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  65659. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  65660. */
  65661. setVisibility(visibility) {
  65662. if (this.canvas && visibility !== this.visibility) {
  65663. this.visibility = visibility;
  65664. this.canvas.style.display = visibility ? 'block' : 'none';
  65665. }
  65666. }
  65667. /**
  65668. * @function mapboxgl.supermap.DeckglLayer.prototype.setStyle
  65669. * @description 设置图层整体样式。
  65670. * @param {Object} styleOptions - 样式对象。
  65671. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  65672. * @param {number} [styleOptions.radius=10] - 点半径。
  65673. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  65674. * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  65675. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  65676. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  65677. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  65678. * @param {number} [styleOptions.strokeWidth=12] - 边框大小。
  65679. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  65680. */
  65681. setStyle(styleOptions) {
  65682. core_Util_Util.extend(this.props, styleOptions);
  65683. this._createLayerByLayerTypeID();
  65684. this.update();
  65685. }
  65686. /**
  65687. * @function mapboxgl.supermap.DeckglLayer.prototype.setData
  65688. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  65689. * @param {Array.<Object>} data - 点要素对象数组。
  65690. */
  65691. setData(data) {
  65692. this.data = this.data || [];
  65693. this.data.length = 0;
  65694. let dataTemp = !core_Util_Util.isArray(data) ? [data] : [].concat(data);
  65695. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  65696. if (!this.layer.props.data) {
  65697. this.layer.props.data = [];
  65698. }
  65699. this.layer.props.data.length = 0;
  65700. for (let i = 0; i < dataTemp.length; i++) {
  65701. this.layer.props.data.push(dataTemp[i]);
  65702. }
  65703. this.data = this.layer.props.data;
  65704. this.update();
  65705. }
  65706. /**
  65707. * @function mapboxgl.supermap.DeckglLayer.prototype.addData
  65708. * @description 添加点要素,不会覆盖之前的要素。
  65709. * @param {Array.<Object>} data - 点要素对象数组。
  65710. */
  65711. addData(data) {
  65712. this.data = this.data || [];
  65713. let dataTemp = !core_Util_Util.isArray(data) ? [data] : [].concat(data);
  65714. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  65715. if (!this.layer.props.data) {
  65716. this.layer.props.data = [];
  65717. }
  65718. for (let i = 0; i < dataTemp.length; i++) {
  65719. this.layer.props.data.push(dataTemp[i]);
  65720. }
  65721. this.update();
  65722. }
  65723. /**
  65724. * @function mapboxgl.supermap.DeckglLayer.prototype.update
  65725. * @description 更新图层。
  65726. */
  65727. update() {
  65728. if (this.layer.lifecycle !== 'Awaiting state') {
  65729. let changeFlags = {
  65730. dataChanged: true,
  65731. propsChanged: true,
  65732. viewportChanged: true,
  65733. updateTriggersChanged: true
  65734. };
  65735. this.layer.setChangeFlags(changeFlags);
  65736. }
  65737. this._draw();
  65738. }
  65739. /**
  65740. * @function mapboxgl.supermap.DeckglLayer.prototype.clear
  65741. * @description 释放图层资源。
  65742. */
  65743. // todo 还有哪些资源应该被释放?
  65744. clear() {
  65745. this.removeData();
  65746. this.deckGL.finalize();
  65747. }
  65748. /**
  65749. * @function mapboxgl.supermap.DeckglLayer.prototype.removeData
  65750. * @description 移除所有要素。
  65751. */
  65752. removeData() {
  65753. this.data.length = 0;
  65754. if (this.layer.props.data) {
  65755. this.layer.props.data.length = 0;
  65756. }
  65757. this.update();
  65758. }
  65759. _draw() {
  65760. let deckOptions = this._getState();
  65761. deckOptions.layers = [this.layer];
  65762. deckOptions.canvas = this.canvas;
  65763. // this.deckGL.updateLayers();
  65764. this.deckGL.setProps(deckOptions);
  65765. }
  65766. _getState() {
  65767. //获取地图信息构建state
  65768. let map = this.map;
  65769. let width = parseInt(this.canvas.style.width);
  65770. let height = parseInt(this.canvas.style.height);
  65771. let center = map.getCenter();
  65772. let longitude = center.lng;
  65773. let latitude = center.lat;
  65774. let zoom = map.getZoom();
  65775. let maxZoom = map.getMaxZoom();
  65776. let pitch = map.getPitch();
  65777. let bearing = map.getBearing();
  65778. let mapViewport = {
  65779. width: width,
  65780. height: height,
  65781. longitude: longitude,
  65782. latitude: latitude,
  65783. zoom: zoom,
  65784. maxZoom: maxZoom,
  65785. pitch: pitch,
  65786. bearing: bearing
  65787. };
  65788. let state = {};
  65789. //克隆 mapViewport
  65790. for (let key in mapViewport) {
  65791. state[key] = mapViewport[key];
  65792. }
  65793. //克隆 props
  65794. for (let key in this.props) {
  65795. state[key] = this.props[key];
  65796. }
  65797. //当使用扩展的mapboxgl代码时有效
  65798. if (map.getCRS && map.getCRS() !== external_mapboxgl_default.a.CRS.EPSG3857) {
  65799. state.coordinateSystem = this.coordinateSystem;
  65800. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  65801. }
  65802. //更行数据
  65803. state.data = this.data;
  65804. return state;
  65805. }
  65806. /**
  65807. * @function mapboxgl.supermap.DeckglLayer.prototype._createLayerByLayerTypeID
  65808. * @description 判别当前创建图层类型。
  65809. * @private
  65810. */
  65811. _createLayerByLayerTypeID() {
  65812. //统一处理公共属性:
  65813. this.props.data = this.data;
  65814. this.props.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  65815. this.props.coordinateSystem = this.coordinateSystem;
  65816. //添加事件监听
  65817. this.props.pickable = Boolean(this.props.onClick) || Boolean(this.props.onHover);
  65818. //各类型各自从 defaultProps 取出相形的参数:
  65819. if (this.layerTypeID === 'scatter-plot') {
  65820. this.props.id = 'scatter-plot';
  65821. this._createScatterPlotLayer();
  65822. } else if (this.layerTypeID === 'path-layer') {
  65823. this.props.id = 'path-layer';
  65824. this._createPathLayer();
  65825. } else if (this.layerTypeID === 'polygon-layer') {
  65826. this.props.id = 'polygon-layer';
  65827. this._createPolygonLayer();
  65828. } else if (this.layerTypeID === 'arc-layer') {
  65829. this.props.id = 'arc-layer';
  65830. this._createArcLineLayer();
  65831. } else if (this.layerTypeID === 'hexagon-layer') {
  65832. this.props.id = 'hexagon-layer';
  65833. this._createHexagonLayer();
  65834. } else {
  65835. throw new Error(this.layerTypeID + ' does not support');
  65836. }
  65837. }
  65838. /**
  65839. * @description scatter-plot
  65840. * @private
  65841. */
  65842. _createScatterPlotLayer() {
  65843. //处理回调
  65844. /* this.props.getPosition = this.callback.getPosition ? this.callback.getPosition : function (point) {
  65845. if (!point) {
  65846. return [0, 0, 0];
  65847. }
  65848. return point.geometry.coordinates;
  65849. };*/
  65850. var me = this;
  65851. this.props.getPosition = this.callback.getPosition
  65852. ? this.callback.getPosition
  65853. : function(point) {
  65854. if (!point) {
  65855. return [0, 0, 0];
  65856. }
  65857. let lngLat = point.getLngLat();
  65858. return lngLat && [lngLat.lng, lngLat.lat, 0];
  65859. };
  65860. if (this.callback.getColor) {
  65861. this.props.getColor = this.callback.getColor
  65862. ? this.callback.getColor
  65863. : function(point) {
  65864. let style = point && point.getStyle();
  65865. return (style && style.color) || me.props.color;
  65866. };
  65867. }
  65868. if (this.callback.getRadius) {
  65869. this.props.getRadius = this.callback.getRadius
  65870. ? this.callback.getRadius
  65871. : function(point) {
  65872. let style = point && point.getStyle();
  65873. return (style && style.radius) || me.props.radius;
  65874. };
  65875. }
  65876. if (this.props.color || this.props.radius) {
  65877. this.props.updateTriggers = {};
  65878. if (this.props.radius) {
  65879. this.props.updateTriggers.getRadius = [this.props.radius];
  65880. }
  65881. if (this.props.color) {
  65882. this.props.updateTriggers.getColor = [this.props.color];
  65883. }
  65884. }
  65885. this.layer = new window.DeckGL.ScatterplotLayer(this.props);
  65886. }
  65887. /**
  65888. * @description path-layer
  65889. * @private
  65890. */
  65891. _createPathLayer() {
  65892. this.props.getPath = this.callback.getPath
  65893. ? this.callback.getPath
  65894. : function(feature) {
  65895. return feature.geometry.coordinates;
  65896. };
  65897. //以下几个函数也可走默认值
  65898. if (this.callback.getColor) {
  65899. this.props.getColor = this.callback.getColor;
  65900. }
  65901. if (this.callback.getWidth) {
  65902. this.props.getWidth = this.callback.getWidth;
  65903. }
  65904. if (this.callback.getDashArray) {
  65905. this.props.getDashArray = this.callback.getDashArray;
  65906. }
  65907. this.layer = new window.DeckGL.PathLayer(this.props);
  65908. }
  65909. /**
  65910. * @description polygon-layer
  65911. * @private
  65912. */
  65913. _createPolygonLayer() {
  65914. this.props.getPolygon = this.callback.getPolygon
  65915. ? this.callback.getPolygon
  65916. : function(feature) {
  65917. return feature.geometry.coordinates;
  65918. };
  65919. //todo 思考下真的让用户配这么多回调么,或者先判断下数据属性里面有没有配置的属性值?
  65920. if (this.callback.getElevation) {
  65921. this.props.getElevation = this.callback.getElevation;
  65922. }
  65923. if (this.callback.getFillColor) {
  65924. this.props.getFillColor = this.callback.getFillColor;
  65925. }
  65926. if (this.callback.getLineColor) {
  65927. this.props.getLineColor = this.callback.getLineColor;
  65928. }
  65929. if (this.callback.getLineWidth) {
  65930. this.props.getLineWidth = this.callback.getLineWidth;
  65931. }
  65932. this.props.updateTriggers = {};
  65933. this.props.updateTriggers.getColor = this.props.color ? this.props.color : [0, 0, 128, 128];
  65934. this.layer = new window.DeckGL.PolygonLayer(this.props);
  65935. }
  65936. /**
  65937. * @description arc-layer
  65938. * @private
  65939. */
  65940. _createArcLineLayer() {
  65941. //todo ArcLineLayer geojson coordinates数组中只能有一个线段
  65942. this.props.getSourcePosition = this.callback.getSourcePosition
  65943. ? this.callback.getSourcePosition
  65944. : function(feature) {
  65945. if (!feature) {
  65946. return [0, 0, 0];
  65947. }
  65948. return feature.geometry.coordinates[0];
  65949. };
  65950. this.props.getTargetPosition = this.callback.getTargetPosition
  65951. ? this.callback.getTargetPosition
  65952. : function(feature) {
  65953. if (!feature) {
  65954. return [0, 0, 0];
  65955. }
  65956. return feature.geometry.coordinates[1];
  65957. };
  65958. if (this.callback.getStrokeWidth) {
  65959. this.props.getStrokeWidth = this.callback.getStrokeWidth;
  65960. }
  65961. if (this.callback.getSourceColor) {
  65962. this.props.getSourceColor = this.callback.getSourceColor;
  65963. }
  65964. if (this.callback.getTargetColor) {
  65965. this.props.getTargetColor = this.callback.getTargetColor;
  65966. }
  65967. this.layer = new window.DeckGL.ArcLayer(this.props);
  65968. }
  65969. /**
  65970. * @description hexagon-layer
  65971. * @private
  65972. */
  65973. _createHexagonLayer() {
  65974. this.props.getPosition = this.callback.getPosition
  65975. ? this.callback.getPosition
  65976. : function(feature) {
  65977. if (!feature) {
  65978. return [0, 0, 0];
  65979. }
  65980. return feature.geometry.coordinates;
  65981. };
  65982. if (this.callback.getColorValue) {
  65983. this.props.getColorValue = this.callback.getColorValue;
  65984. }
  65985. if (this.callback.getElevationValue) {
  65986. this.props.getElevationValue = this.callback.getElevationValue;
  65987. }
  65988. this.layer = new window.DeckGL.HexagonLayer(this.props);
  65989. }
  65990. _initContainer() {
  65991. this.canvas = this._createCanvas();
  65992. this.mapContainer = this.map.getCanvasContainer();
  65993. this.mapContainer.appendChild(this.canvas);
  65994. }
  65995. _createCanvas() {
  65996. let canvas = document.createElement('canvas');
  65997. canvas.id = this.id;
  65998. canvas.style.position = 'absolute';
  65999. canvas.style.top = 0 + 'px';
  66000. canvas.style.left = 0 + 'px';
  66001. canvas.style.cursor = '';
  66002. let map = this.map;
  66003. canvas.width = parseInt(map.getCanvas().style.width);
  66004. canvas.height = parseInt(map.getCanvas().style.height);
  66005. canvas.style.width = map.getCanvas().style.width;
  66006. canvas.style.height = map.getCanvas().style.height;
  66007. return canvas;
  66008. }
  66009. _moveEvent() {
  66010. this._draw();
  66011. }
  66012. _resizeEvent() {
  66013. let canvas = this.canvas;
  66014. let map = this.map;
  66015. canvas.width = parseInt(map.getCanvas().style.width);
  66016. canvas.height = parseInt(map.getCanvas().style.height);
  66017. canvas.style.width = map.getCanvas().style.width;
  66018. canvas.style.height = map.getCanvas().style.height;
  66019. this._draw();
  66020. }
  66021. }
  66022. external_mapboxgl_default.a.supermap.DeckglLayer = DeckglLayer_DeckglLayer;
  66023. // CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapvDataSet.js
  66024. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66025. * This program are made available under the terms of the Apache License, Version 2.0
  66026. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66027. var MapvDataSet = {
  66028. /**
  66029. * 返回mapv点数据集
  66030. */
  66031. getPoint: function (center) {
  66032. if (center && (center instanceof Array)) {
  66033. return new external_function_try_return_mapv_catch_e_return_["DataSet"]([{
  66034. geometry: {
  66035. type: 'Point',
  66036. coordinates: center
  66037. }
  66038. }]);
  66039. }
  66040. },
  66041. /**
  66042. * 返回mapv多点数据集
  66043. */
  66044. getPoints: function (points) {
  66045. if (points && (points instanceof Array)) {
  66046. var mPoints = [];
  66047. points.map(function (data) {
  66048. mPoints.push({
  66049. geometry: {
  66050. type: 'Point',
  66051. coordinates: data.geometry.coordinates
  66052. }
  66053. });
  66054. return data;
  66055. });
  66056. return new external_function_try_return_mapv_catch_e_return_["DataSet"](mPoints);
  66057. }
  66058. },
  66059. /**
  66060. * 返回mapv弧形线数据集
  66061. */
  66062. getCurveLines: function (startPoint, LinePoints) {
  66063. if (startPoint && (startPoint instanceof Array) && LinePoints && (LinePoints instanceof Array)) {
  66064. var lineData = [];
  66065. LinePoints.map(function (data) {
  66066. var coords = data.geometry && data.geometry.coordinates;
  66067. var toCenter = {lng: coords[0], lat: coords[1]};
  66068. var fromCenter = {lng: startPoint[0], lat: startPoint[1]};
  66069. var cv = external_function_try_return_mapv_catch_e_return_["utilCurve"].getPoints([fromCenter, toCenter]);
  66070. lineData.push({
  66071. geometry: {
  66072. type: 'LineString',
  66073. coordinates: cv
  66074. }
  66075. });
  66076. return data;
  66077. });
  66078. return new external_function_try_return_mapv_catch_e_return_["DataSet"](lineData);
  66079. }
  66080. },
  66081. /**
  66082. * 返回mapv弧形动态点数据集
  66083. */
  66084. getCurveDynamicPoints: function (center, endPoints) {
  66085. if (center && (center instanceof Array) && endPoints && (endPoints instanceof Array)) {
  66086. var timeData = [];
  66087. endPoints.map(function (data) {
  66088. var coords = data.geometry && data.geometry.coordinates;
  66089. var toCenter = {lng: coords[0], lat: coords[1]};
  66090. var fromCenter = {lng: center[0], lat: center[1]};
  66091. var cv = external_function_try_return_mapv_catch_e_return_["utilCurve"].getPoints([fromCenter, toCenter]);
  66092. for (var j = 0; j < cv.length; j++) {
  66093. timeData.push({
  66094. geometry: {
  66095. type: 'Point',
  66096. coordinates: cv[j]
  66097. },
  66098. time: j
  66099. });
  66100. }
  66101. return data
  66102. });
  66103. return new external_function_try_return_mapv_catch_e_return_["DataSet"](timeData);
  66104. }
  66105. }
  66106. };
  66107. external_mapboxgl_default.a.supermap.MapvDataSet = MapvDataSet;
  66108. // CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapExtend.js
  66109. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66110. * This program are made available under the terms of the Apache License, Version 2.0
  66111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66112. external_mapboxgl_default.a.supermap = external_mapboxgl_default.a.supermap || {};
  66113. external_mapboxgl_default.a.supermap.map = external_mapboxgl_default.a.supermap.map || {};
  66114. var getDefaultVectorTileStyle = function (urlTemplate, options) {
  66115. options = options || {};
  66116. var defaultOptions = {};
  66117. defaultOptions.version = options.version || 8;
  66118. defaultOptions.layers = options.layers || [];
  66119. defaultOptions.light = options.light || {
  66120. "anchor": "viewport",
  66121. "color": "#fcf6ef",
  66122. "intensity": 0.5,
  66123. "position": [1.15, 201, 20]
  66124. };
  66125. var style = {
  66126. "version": defaultOptions.version,
  66127. "sources": {
  66128. "vector-tiles": {
  66129. "type": "vector",
  66130. "tiles": [urlTemplate]
  66131. }
  66132. },
  66133. "layers": defaultOptions.layers,
  66134. "light": defaultOptions.light
  66135. };
  66136. if (options.sprite != null) {
  66137. style.sprite = options.sprite;
  66138. }
  66139. if (options.glyphs != null) {
  66140. style.glyphs = options.glyphs;
  66141. }
  66142. return style;
  66143. };
  66144. var setBackground = function (map, color) {
  66145. if (color && map) {
  66146. map.addLayer({
  66147. "id": "background",
  66148. "type": "background",
  66149. "paint": {
  66150. "background-color": color
  66151. }
  66152. }, "background");
  66153. }
  66154. };
  66155. var setPaintProperty = function (map, layerIds, type, paint, source, sourceLayers) {
  66156. if (layerIds && map) {
  66157. if (Object.prototype.toString.call(layerIds) !== '[object Array]') {
  66158. layerIds = [layerIds];
  66159. }
  66160. for (var i = 0; i < layerIds.length; i++) {
  66161. var sourceLayer = sourceLayers ? sourceLayers[i] : null;
  66162. var layer = getLayer(layerIds[i], type, source, sourceLayer, paint);
  66163. map.addLayer(layer, layerIds[i]);
  66164. map.moveLayer(layerIds[i]);
  66165. }
  66166. }
  66167. };
  66168. function getLayer(id, type, source, sourceLayer, paint) {
  66169. var sourceType = source || "vector-tiles";
  66170. var sLayer = sourceLayer || id;
  66171. var layer = {
  66172. "id": id,
  66173. "type": type,
  66174. "source": sourceType,
  66175. "source-layer": sLayer,
  66176. "paint": paint
  66177. };
  66178. return layer;
  66179. }
  66180. external_mapboxgl_default.a.supermap.map.getDefaultVectorTileStyle = getDefaultVectorTileStyle;
  66181. external_mapboxgl_default.a.supermap.map.setBackground = setBackground;
  66182. external_mapboxgl_default.a.supermap.map.setPaintProperty = setPaintProperty;
  66183. // CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/index.js
  66184. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66185. * This program are made available under the terms of the Apache License, Version 2.0
  66186. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66187. // CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/index.js
  66188. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66189. * This program are made available under the terms of the Apache License, Version 2.0
  66190. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66191. // CONCATENATED MODULE: ./src/mapboxgl/overlay/index.js
  66192. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66193. * This program are made available under the terms of the Apache License, Version 2.0
  66194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66195. // CONCATENATED MODULE: ./src/mapboxgl/services/ServiceBase.js
  66196. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66197. * This program are made available under the terms of the Apache License, Version 2.0
  66198. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66199. /**
  66200. * @class mapboxgl.supermap.ServiceBase
  66201. * @category iServer
  66202. * @description mapboxgl.supermap 服务基类。
  66203. * @param {string} url - 与客户端交互的服务地址。
  66204. * @param {Object} options - 可选参数。
  66205. * @param {string} [options.proxy] - 服务代理地址。
  66206. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66207. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66208. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66209. * @param {Object} [options.headers] - 请求头。
  66210. * @fires mapboxgl.supermap.ServiceBase#initialized
  66211. */
  66212. class ServiceBase_ServiceBase extends external_mapboxgl_default.a.Evented {
  66213. constructor(url, options) {
  66214. super();
  66215. this.options = options || {};
  66216. this.url = url;
  66217. /**
  66218. * @event mapboxgl.supermap.ServiceBase#initialized
  66219. * @description 构造函数构造成功之后触发。
  66220. * @property {Object} this - this 对象。
  66221. */
  66222. this.fire('initialized', this);
  66223. }
  66224. }
  66225. external_mapboxgl_default.a.supermap.ServiceBase = ServiceBase_ServiceBase;
  66226. // CONCATENATED MODULE: ./src/mapboxgl/services/AddressMatchService.js
  66227. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66228. * This program are made available under the terms of the Apache License, Version 2.0
  66229. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66230. /**
  66231. * @class mapboxgl.supermap.AddressMatchService
  66232. * @category iServer AddressMatch
  66233. * @classdesc 地址匹配服务。
  66234. * @example
  66235. * new mapboxgl.supermap.AddressMatchService(url,options)
  66236. * .code(function(result){
  66237. * //doSomething
  66238. * })
  66239. * @param {string} url - 与客户端交互的服务地址。
  66240. * @param {Object} options - 交互时所需可选参数。
  66241. * @param {string} [options.proxy] - 服务代理地址。
  66242. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66243. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66244. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66245. * @param {Object} [options.headers] - 请求头。
  66246. * @extends {mapboxgl.supermap.ServiceBase}
  66247. */
  66248. class services_AddressMatchService_AddressMatchService extends ServiceBase_ServiceBase {
  66249. constructor(url, options) {
  66250. super(url, options);
  66251. }
  66252. /**
  66253. * @function mapboxgl.supermap.AddressMatchService.prototype.code
  66254. * @description 获取正向地址匹配结果。
  66255. * @param {Object} params - 正向匹配参数。
  66256. * @param {RequestCallback} callback - 请求结果的回调函数。
  66257. */
  66258. code(params, callback) {
  66259. var me = this;
  66260. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  66261. proxy: me.options.proxy,
  66262. withCredentials: me.options.withCredentials,
  66263. crossOrigin: me.options.crossOrigin,
  66264. headers: me.options.headers,
  66265. serverType: me.options.serverType,
  66266. eventListeners: {
  66267. scope: me,
  66268. processCompleted: callback,
  66269. processFailed: callback
  66270. }
  66271. });
  66272. addressMatchService.code(Util_Util.urlPathAppend(me.url, 'geocoding'), params);
  66273. }
  66274. /**
  66275. * @function mapboxgl.supermap.AddressMatchService.prototype.decode
  66276. * @description 获取反向地址匹配结果。
  66277. * @param {Object} params -反向匹配参数。
  66278. * @param {RequestCallback} callback - 请求结果的回调函数。
  66279. */
  66280. decode(params, callback) {
  66281. var me = this;
  66282. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  66283. proxy: me.options.proxy,
  66284. withCredentials: me.options.withCredentials,
  66285. crossOrigin: me.options.crossOrigin,
  66286. headers: me.options.headers,
  66287. serverType: me.options.serverType,
  66288. eventListeners: {
  66289. scope: me,
  66290. processCompleted: callback,
  66291. processFailed: callback
  66292. }
  66293. });
  66294. addressMatchService.decode(Util_Util.urlPathAppend(me.url, 'geodecoding'), params);
  66295. }
  66296. }
  66297. external_mapboxgl_default.a.supermap.AddressMatchService = services_AddressMatchService_AddressMatchService;
  66298. // CONCATENATED MODULE: ./src/mapboxgl/services/ChartService.js
  66299. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66300. * This program are made available under the terms of the Apache License, Version 2.0
  66301. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66302. /**
  66303. * @class mapboxgl.supermap.ChartService
  66304. * @category iServer Map Chart
  66305. * @classdesc 海图服务。
  66306. * @extends {mapboxgl.supermap.ServiceBase}
  66307. * @example
  66308. * new mapboxgl.supermap.ChartService(url)
  66309. * .queryChart(param,function(result){
  66310. * //doSomething
  66311. * })
  66312. * @param {string} url - 与客户端交互的海图服务地址。
  66313. * @param {Object} options - 交互时所需可选参数。
  66314. * @param {string} [options.proxy] - 服务代理地址。
  66315. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66316. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66317. * @param {Object} [options.headers] - 请求头。
  66318. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66319. */
  66320. class ChartService_ChartService extends ServiceBase_ServiceBase {
  66321. constructor(url, options) {
  66322. super(url, options);
  66323. }
  66324. /**
  66325. * @function mapboxgl.supermap.ChartService.prototype.queryChart
  66326. * @description 查询海图服务。
  66327. * @param {SuperMap.ChartQueryParameters} params - 海图查询所需参数类。
  66328. * @param {RequestCallback} callback 回调函数。
  66329. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果格式类型。
  66330. */
  66331. queryChart(params, callback, resultFormat) {
  66332. var me = this,
  66333. param = me._processParams(params),
  66334. format = me._processFormat(resultFormat);
  66335. var chartQueryService = new ChartQueryService_ChartQueryService(me.url, {
  66336. proxy: me.options.proxy,
  66337. withCredentials: me.options.withCredentials,
  66338. crossOrigin: me.options.crossOrigin,
  66339. headers: me.options.headers,
  66340. serverType: me.options.serverType,
  66341. eventListeners: {
  66342. scope: me,
  66343. processCompleted: callback,
  66344. processFailed: callback
  66345. },
  66346. format: format
  66347. });
  66348. chartQueryService.processAsync(param);
  66349. }
  66350. /**
  66351. * @function mapboxgl.supermap.ChartService.prototype.getChartFeatureInfo
  66352. * @description 获取海图物标信息服务。
  66353. * @param {RequestCallback} callback 回调函数。
  66354. */
  66355. getChartFeatureInfo(callback) {
  66356. var me = this, url = me.url.concat();
  66357. url = Util_Util.urlPathAppend(url, 'chartFeatureInfoSpecs');
  66358. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService_ChartFeatureInfoSpecsService(url, {
  66359. proxy: me.options.proxy,
  66360. withCredentials: me.options.withCredentials,
  66361. crossOrigin: me.options.crossOrigin,
  66362. headers: me.options.headers,
  66363. serverType: me.options.serverType,
  66364. eventListeners: {
  66365. scope: me,
  66366. processCompleted: callback,
  66367. processFailed: callback
  66368. }
  66369. });
  66370. chartFeatureInfoSpecsService.processAsync();
  66371. }
  66372. _processParams(params) {
  66373. if (!params) {
  66374. return {};
  66375. }
  66376. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  66377. if (params.filter) {
  66378. params.chartQueryFilterParameters = core_Util_Util.isArray(params.filter) ? params.filter : [params.filter];
  66379. }
  66380. if (params.bounds) {
  66381. if (params.bounds instanceof Array) {
  66382. params.bounds = new Bounds_Bounds(
  66383. params.bounds[0],
  66384. params.bounds[1],
  66385. params.bounds[2],
  66386. params.bounds[3]
  66387. );
  66388. }
  66389. if (params.bounds instanceof external_mapboxgl_default.a.LngLatBounds) {
  66390. params.bounds = new Bounds_Bounds(
  66391. params.bounds.getSouthWest().lng,
  66392. params.bounds.getSouthWest().lat,
  66393. params.bounds.getNorthEast().lng,
  66394. params.bounds.getNorthEast().lat
  66395. );
  66396. }
  66397. }
  66398. }
  66399. _processFormat(resultFormat) {
  66400. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  66401. }
  66402. }
  66403. external_mapboxgl_default.a.supermap.ChartService = ChartService_ChartService;
  66404. // CONCATENATED MODULE: ./src/mapboxgl/services/DataFlowService.js
  66405. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66406. * This program are made available under the terms of the Apache License, Version 2.0
  66407. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66408. /**
  66409. * @class mapboxgl.supermap.DataFlowService
  66410. * @category iServer DataFlow
  66411. * @classdesc 数据流服务。
  66412. * @extends {mapboxgl.supermap.ServiceBase}
  66413. * @example
  66414. * new mapboxgl.supermap.DataFlowService(url)
  66415. * .queryChart(param,function(result){
  66416. * //doSomething
  66417. * })
  66418. * @param {string} url - 与客户端交互的实时数据服务地址。
  66419. * @param {Object} options - 加载实时数据可选参数。
  66420. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  66421. * @param {Object} [options.excludeField] - 排除字段。
  66422. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66423. * @param {Object} [options.headers] - 请求头。
  66424. * @fires mapboxgl.supermap.DataFlowService#broadcastSocketConnected
  66425. * @fires mapboxgl.supermap.DataFlowService#broadcastSocketError
  66426. * @fires mapboxgl.supermap.DataFlowService#broadcastFailed
  66427. * @fires mapboxgl.supermap.DataFlowService#broadcastSucceeded
  66428. * @fires mapboxgl.supermap.DataFlowService#subscribeSocketError
  66429. * @fires mapboxgl.supermap.DataFlowService#messageSucceeded
  66430. * @fires mapboxgl.supermap.DataFlowService#setFilterParamSucceeded
  66431. */
  66432. class services_DataFlowService_DataFlowService extends ServiceBase_ServiceBase {
  66433. constructor(url, options) {
  66434. options = options || {};
  66435. if (options.projection) {
  66436. options.prjCoordSys = options.projection;
  66437. }
  66438. super(url, options);
  66439. this.dataFlow = new DataFlowService_DataFlowService(url, options);
  66440. /**
  66441. * @event mapboxgl.supermap.DataFlowService#broadcastSocketConnected
  66442. * @description broadcast Socket 连接成功。
  66443. */
  66444. /**
  66445. * @event mapboxgl.supermap.DataFlowService#broadcastSocketError
  66446. * @description broadcast Socket 连接失败。
  66447. */
  66448. /**
  66449. * @event mapboxgl.supermap.DataFlowService#broadcastFailed
  66450. * @description 广播失败。
  66451. */
  66452. /**
  66453. * @event mapboxgl.supermap.DataFlowService#broadcastSucceeded
  66454. * @description 广播成功。
  66455. */
  66456. /**
  66457. * @event mapboxgl.supermap.DataFlowService#subscribeSocketConnected
  66458. * @description 订阅数据连接成功。
  66459. */
  66460. /**
  66461. * @event mapboxgl.supermap.DataFlowService#subscribeSocketError
  66462. * @description 订阅数据连接失败。
  66463. */
  66464. /**
  66465. * @event mapboxgl.supermap.DataFlowService#messageSucceeded
  66466. * @description 获取信息成功。
  66467. */
  66468. /**
  66469. * @event mapboxgl.supermap.DataFlowService#setFilterParamSucceeded
  66470. * @description 设置过滤参数成功。
  66471. */
  66472. this.dataFlow.events.on({
  66473. "broadcastSocketConnected": this._defaultEvent,
  66474. "broadcastSocketError": this._defaultEvent,
  66475. "broadcastFailed": this._defaultEvent,
  66476. "broadcastSucceeded": this._defaultEvent,
  66477. "subscribeSocketConnected": this._defaultEvent,
  66478. "subscribeSocketError": this._defaultEvent,
  66479. "messageSucceeded": this._defaultEvent,
  66480. "setFilterParamSucceeded": this._defaultEvent,
  66481. scope: this
  66482. });
  66483. var me = this;
  66484. me.on('subscribeSocketConnected', function (e) {
  66485. /**
  66486. * @event mapboxgl.supermap.DataFlowService#subscribesucceeded
  66487. * @description 数据流服务订阅成功后触发。
  66488. * @property {Object} e - 事件对象。
  66489. */
  66490. me.fire('subscribesucceeded', e);
  66491. })
  66492. }
  66493. /**
  66494. * @function mapboxgl.supermap.DataFlowService.prototype.initBroadcast
  66495. * @description 初始化广播。
  66496. * @returns {mapboxgl.supermap.DataFlowService}
  66497. */
  66498. initBroadcast() {
  66499. this.dataFlow.initBroadcast();
  66500. return this;
  66501. }
  66502. /**
  66503. * @function mapboxgl.supermap.DataFlowService.prototype.broadcast
  66504. * @description 加载广播数据。
  66505. * @param {JSON} obj - JSON 格式的要素数据。
  66506. */
  66507. broadcast(obj) {
  66508. this.dataFlow.broadcast(obj);
  66509. }
  66510. /**
  66511. * @function mapboxgl.supermap.DataFlowService.prototype.initSubscribe
  66512. * @description 初始化订阅数据。
  66513. */
  66514. initSubscribe() {
  66515. this.dataFlow.initSubscribe();
  66516. return this;
  66517. }
  66518. /**
  66519. * @function mapboxgl.supermap.DataFlowService.prototype.setExcludeField
  66520. * @description 设置排除字段。
  66521. * @param {Object} excludeField - 排除字段。
  66522. */
  66523. setExcludeField(excludeField) {
  66524. this.dataFlow.setExcludeField(excludeField);
  66525. this.options.excludeField = excludeField;
  66526. return this;
  66527. }
  66528. /**
  66529. * @function mapboxgl.supermap.DataFlowService.prototype.setGeometry
  66530. * @description 设置添加的几何要素数据。
  66531. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  66532. */
  66533. setGeometry(geometry) {
  66534. this.dataFlow.setGeometry(geometry);
  66535. this.options.geometry = geometry;
  66536. return this;
  66537. }
  66538. /**
  66539. * @function mapboxgl.supermap.DataFlowService.prototype.unSubscribe
  66540. * @description 结束订阅数据。
  66541. */
  66542. unSubscribe() {
  66543. this.dataFlow.unSubscribe();
  66544. }
  66545. /**
  66546. * @function mapboxgl.supermap.DataFlowService.prototype.unBroadcast
  66547. * @description 结束加载广播。
  66548. */
  66549. unBroadcast() {
  66550. this.dataFlow.unBroadcast();
  66551. }
  66552. _defaultEvent(e) {
  66553. this.fire(e.eventType || e.type, e);
  66554. }
  66555. }
  66556. external_mapboxgl_default.a.supermap.DataFlowService = services_DataFlowService_DataFlowService;
  66557. // CONCATENATED MODULE: ./src/mapboxgl/services/FeatureService.js
  66558. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66559. * This program are made available under the terms of the Apache License, Version 2.0
  66560. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66561. /**
  66562. * @class mapboxgl.supermap.FeatureService
  66563. * @category iServer Data Feature
  66564. * @classdesc 要素数据集类。提供:ID 查询,范围查询,SQL 查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  66565. * @example
  66566. * new mapboxgl.supermap.FeatureService(url)
  66567. * .getFeaturesByIDs(param,function(result){
  66568. * //doSomething
  66569. * })
  66570. * @extends {mapboxgl.supermap.ServiceBase}
  66571. * @param {string} url - 要素数据集服务地址。
  66572. * @param {Object} options - 创建要素数据集服务类可选参数。
  66573. * @param {string} [options.proxy] - 服务代理地址。
  66574. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66575. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66576. * @param {Object} [options.headers] - 请求头。
  66577. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66578. */
  66579. class FeatureService_FeatureService extends ServiceBase_ServiceBase {
  66580. constructor(url, options) {
  66581. super(url, options);
  66582. }
  66583. /**
  66584. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByIDs
  66585. * @description 数据集 ID 查询服务。
  66586. * @param {SuperMap.GetFeaturesByIDsParameters} params - 查询所需参数类。
  66587. * @param {RequestCallback} callback - 回调函数。
  66588. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66589. */
  66590. getFeaturesByIDs(params, callback, resultFormat) {
  66591. var me = this;
  66592. var getFeaturesByIDsService = new GetFeaturesByIDsService_GetFeaturesByIDsService(me.url, {
  66593. proxy: me.options.proxy,
  66594. withCredentials: me.options.withCredentials,
  66595. crossOrigin: me.options.crossOrigin,
  66596. headers: me.options.headers,
  66597. serverType: me.options.serverType,
  66598. eventListeners: {
  66599. processCompleted: callback,
  66600. processFailed: callback
  66601. },
  66602. format: me._processFormat(resultFormat)
  66603. });
  66604. getFeaturesByIDsService.processAsync(me._processParams(params));
  66605. }
  66606. /**
  66607. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByBounds
  66608. * @description 数据集 Bounds 查询服务。
  66609. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 查询所需参数类。
  66610. * @param {RequestCallback} callback - 回调函数。
  66611. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66612. */
  66613. getFeaturesByBounds(params, callback, resultFormat) {
  66614. var me = this;
  66615. var getFeaturesByBoundsService = new GetFeaturesByBoundsService_GetFeaturesByBoundsService(me.url, {
  66616. proxy: me.options.proxy,
  66617. withCredentials: me.options.withCredentials,
  66618. crossOrigin: me.options.crossOrigin,
  66619. headers: me.options.headers,
  66620. serverType: me.options.serverType,
  66621. eventListeners: {
  66622. processCompleted: callback,
  66623. processFailed: callback
  66624. },
  66625. format: me._processFormat(resultFormat)
  66626. });
  66627. getFeaturesByBoundsService.processAsync(me._processParams(params));
  66628. }
  66629. /**
  66630. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByBuffer
  66631. * @description 数据集 Buffer 查询服务。
  66632. * @param {SuperMap.GetFeaturesByBufferParameters} params - 查询所需参数类。
  66633. * @param {RequestCallback} callback 回调函数。
  66634. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66635. */
  66636. getFeaturesByBuffer(params, callback, resultFormat) {
  66637. var me = this;
  66638. var getFeatureService = new GetFeaturesByBufferService_GetFeaturesByBufferService(me.url, {
  66639. proxy: me.options.proxy,
  66640. withCredentials: me.options.withCredentials,
  66641. crossOrigin: me.options.crossOrigin,
  66642. headers: me.options.headers,
  66643. serverType: me.options.serverType,
  66644. eventListeners: {
  66645. processCompleted: callback,
  66646. processFailed: callback
  66647. },
  66648. format: me._processFormat(resultFormat)
  66649. });
  66650. getFeatureService.processAsync(me._processParams(params));
  66651. }
  66652. /**
  66653. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesBySQL
  66654. * @description 数据集 SQL 查询服务。
  66655. * @param {SuperMap.GetFeaturesBySQLParameters} params - 查询所需参数类。
  66656. * @param {RequestCallback} callback 回调函数。
  66657. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  66658. */
  66659. getFeaturesBySQL(params, callback, resultFormat) {
  66660. var me = this;
  66661. var getFeatureBySQLService = new GetFeaturesBySQLService_GetFeaturesBySQLService(me.url, {
  66662. proxy: me.options.proxy,
  66663. withCredentials: me.options.withCredentials,
  66664. crossOrigin: me.options.crossOrigin,
  66665. headers: me.options.headers,
  66666. serverType: me.options.serverType,
  66667. eventListeners: {
  66668. processCompleted: callback,
  66669. processFailed: callback
  66670. },
  66671. format: me._processFormat(resultFormat)
  66672. });
  66673. getFeatureBySQLService.processAsync(me._processParams(params));
  66674. }
  66675. /**
  66676. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByGeometry
  66677. * @description 数据集几何查询服务类。
  66678. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询所需参数类。
  66679. * @param {RequestCallback} callback - 回调函数。
  66680. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66681. */
  66682. getFeaturesByGeometry(params, callback, resultFormat) {
  66683. var me = this;
  66684. var getFeaturesByGeometryService = new GetFeaturesByGeometryService_GetFeaturesByGeometryService(me.url, {
  66685. proxy: me.options.proxy,
  66686. withCredentials: me.options.withCredentials,
  66687. crossOrigin: me.options.crossOrigin,
  66688. headers: me.options.headers,
  66689. serverType: me.options.serverType,
  66690. eventListeners: {
  66691. processCompleted: callback,
  66692. processFailed: callback
  66693. },
  66694. format: me._processFormat(resultFormat)
  66695. });
  66696. getFeaturesByGeometryService.processAsync(me._processParams(params));
  66697. }
  66698. /**
  66699. * @function mapboxgl.supermap.FeatureService.prototype.editFeatures
  66700. * @description 地物编辑服务。
  66701. * @param {SuperMap.EditFeaturesParameters} params - 查询所需参数类。
  66702. * @param {RequestCallback} callback 回调函数。
  66703. */
  66704. editFeatures(params, callback) {
  66705. if (!params || !params.dataSourceName || !params.dataSetName) {
  66706. return;
  66707. }
  66708. var me = this,
  66709. url = me.url,
  66710. dataSourceName = params.dataSourceName,
  66711. dataSetName = params.dataSetName;
  66712. url = Util_Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  66713. var editFeatureService = new EditFeaturesService_EditFeaturesService(url, {
  66714. proxy: me.options.proxy,
  66715. withCredentials: me.options.withCredentials,
  66716. crossOrigin: me.options.crossOrigin,
  66717. headers: me.options.headers,
  66718. serverType: me.options.serverType,
  66719. eventListeners: {
  66720. processCompleted: callback,
  66721. processFailed: callback
  66722. }
  66723. });
  66724. editFeatureService.processAsync(me._processParams(params));
  66725. }
  66726. /**
  66727. * @private
  66728. * @description 参数类型转换。
  66729. * @param {Object} params - 服务参数 。
  66730. * @returns {Object} params - 转换后的对接 SuperMap 服务的参数。
  66731. */
  66732. _processParams(params) {
  66733. if (!params) {
  66734. return {};
  66735. }
  66736. var me = this;
  66737. params.returnContent = params.returnContent == null ? true : params.returnContent;
  66738. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  66739. params.toIndex = params.toIndex === 0 ? 0 : params.toIndex ? params.toIndex : -1;
  66740. if (params.bounds) {
  66741. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  66742. }
  66743. if (params.editType) {
  66744. params.editType = params.editType.toLowerCase();
  66745. }
  66746. //mapboxgl geojson要素对象转 SuperMap Geometry 对象
  66747. if (params.geometry) {
  66748. if (params.geometry instanceof external_mapboxgl_default.a.LngLatBounds) {
  66749. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  66750. } else {
  66751. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  66752. }
  66753. }
  66754. //editFeature服务参数转换,传入单独得对象或对象数组
  66755. if (params.features) {
  66756. var features = [];
  66757. if (core_Util_Util.isArray(params.features)) {
  66758. params.features.map(function(feature) {
  66759. features.push(me._createServerFeature(feature));
  66760. return features;
  66761. });
  66762. } else {
  66763. features.push(me._createServerFeature(params.features));
  66764. }
  66765. params.features = features;
  66766. }
  66767. return params;
  66768. }
  66769. //geoFeature严格按照 mapboxgl geojson的结构
  66770. _createServerFeature(geoFeature) {
  66771. var feature = {},
  66772. fieldNames = [],
  66773. fieldValues = [];
  66774. var properties = geoFeature.properties;
  66775. for (var key in properties) {
  66776. fieldNames.push(key);
  66777. fieldValues.push(properties[key]);
  66778. }
  66779. feature.fieldNames = fieldNames;
  66780. feature.fieldValues = fieldValues;
  66781. if (geoFeature.id) {
  66782. feature.id = geoFeature.id;
  66783. }
  66784. feature.geometry = core_Util_Util.toSuperMapGeometry(geoFeature);
  66785. return feature;
  66786. }
  66787. _processFormat(resultFormat) {
  66788. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  66789. }
  66790. }
  66791. external_mapboxgl_default.a.supermap.FeatureService = FeatureService_FeatureService;
  66792. // CONCATENATED MODULE: ./src/mapboxgl/services/FieldService.js
  66793. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66794. * This program are made available under the terms of the Apache License, Version 2.0
  66795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66796. /**
  66797. * @class mapboxgl.supermap.FieldService
  66798. * @category iServer Data Field
  66799. * @classdesc 字段服务类。
  66800. * @example
  66801. * new mapboxgl.supermap.FieldService(url).getFields(function(result){
  66802. * //doSomething
  66803. * });
  66804. * @param {string} url - 与客户端交互的服务地址。
  66805. * @param {Object} options - 参数。
  66806. * @param {string} [options.proxy] - 服务代理地址。
  66807. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66808. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66809. * @param {Object} [options.headers] - 请求头。
  66810. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66811. * @extends {mapboxgl.supermap.ServiceBase}
  66812. */
  66813. class FieldService_FieldService extends ServiceBase_ServiceBase {
  66814. constructor(url, options) {
  66815. super(url, options);
  66816. }
  66817. /**
  66818. * @function mapboxgl.supermap.FieldService.prototype.getFields
  66819. * @description 字段查询服务。
  66820. * @param {SuperMap.FieldParameters} params - 字段信息查询参数类。
  66821. * @param {RequestCallback} callback 回调函数。
  66822. */
  66823. getFields(params, callback) {
  66824. var me = this;
  66825. var getFieldsService = new GetFieldsService_GetFieldsService(me.url, {
  66826. proxy: me.options.proxy,
  66827. withCredentials: me.options.withCredentials,
  66828. crossOrigin: me.options.crossOrigin,
  66829. headers: me.options.headers,
  66830. serverType: me.options.serverType,
  66831. eventListeners: {
  66832. scope: me,
  66833. processCompleted: callback,
  66834. processFailed: callback
  66835. },
  66836. datasource: params.datasource,
  66837. dataset: params.dataset
  66838. });
  66839. getFieldsService.processAsync();
  66840. }
  66841. /**
  66842. * @function mapboxgl.supermap.FieldService.prototype.getFieldStatisticsInfo
  66843. * @description 字段统计服务。
  66844. * @param {SuperMap.FieldStatisticsParameters} params - 查询所需参数类。
  66845. * @param {RequestCallback} callback 回调函数。
  66846. */
  66847. getFieldStatisticsInfo(params, callback) {
  66848. var me = this,
  66849. fieldName = params.fieldName,
  66850. modes = params.statisticMode;
  66851. if (modes && !core_Util_Util.isArray(modes)) {
  66852. modes = [modes];
  66853. }
  66854. me.currentStatisticResult = {fieldName: fieldName};
  66855. me._statisticsCallback = callback;
  66856. //针对每种统计方式分别进行请求
  66857. modes.forEach(mode => {
  66858. me.currentStatisticResult[mode] = null;
  66859. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  66860. })
  66861. }
  66862. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  66863. var me = this;
  66864. var statisticService = new FieldStatisticService_FieldStatisticService(me.url, {
  66865. eventListeners: {
  66866. scope: me,
  66867. processCompleted: me._processCompleted,
  66868. processFailed: me._statisticsCallback
  66869. },
  66870. datasource: datasource,
  66871. dataset: dataset,
  66872. field: fieldName,
  66873. statisticMode: statisticMode,
  66874. crossOrigin: me.options.crossOrigin,
  66875. headers: me.options.headers
  66876. });
  66877. statisticService.processAsync();
  66878. }
  66879. _processCompleted(fieldStatisticResult) {
  66880. var me = this;
  66881. var getAll = true,
  66882. result = fieldStatisticResult.result;
  66883. if (this.currentStatisticResult) {
  66884. if (null == me.currentStatisticResult[result.mode]) {
  66885. this.currentStatisticResult[result.mode] = result.result;
  66886. }
  66887. }
  66888. for (var mode in me.currentStatisticResult) {
  66889. if (null == me.currentStatisticResult[mode]) {
  66890. getAll = false;
  66891. break;
  66892. }
  66893. }
  66894. if (getAll) {
  66895. me._statisticsCallback({result: me.currentStatisticResult});
  66896. }
  66897. }
  66898. }
  66899. external_mapboxgl_default.a.supermap.FieldService = FieldService_FieldService;
  66900. // CONCATENATED MODULE: ./src/mapboxgl/services/GridCellInfosService.js
  66901. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  66902. * This program are made available under the terms of the Apache License, Version 2.0
  66903. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66904. /**
  66905. * @class mapboxgl.supermap.GridCellInfosService
  66906. * @category iServer Data Grid
  66907. * @classdesc 数据栅格查询服务。
  66908. * @extends {mapboxgl.supermap.ServiceBase}
  66909. * @example
  66910. * new mapboxgl.supermap.GridCellInfosService(url)
  66911. * .getGridCellInfos(param,function(result){
  66912. * //doSomething
  66913. * })
  66914. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:</br>
  66915. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  66916. * @param {Object} options - 服务所需可选参数。
  66917. * @param {string} [options.proxy] - 服务代理地址。
  66918. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66919. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66920. * @param {Object} [options.headers] - 请求头。
  66921. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66922. */
  66923. class GridCellInfosService_GridCellInfosService extends ServiceBase_ServiceBase {
  66924. constructor(url, options) {
  66925. super(url, options);
  66926. }
  66927. /**
  66928. * @function mapboxgl.supermap.GridCellInfosService.prototype.getGridCellInfos
  66929. * @param {SuperMap.GetGridCellInfosParameters} params - 查询所需参数类。
  66930. * @param {RequestCallback} callback 回调函数。
  66931. */
  66932. getGridCellInfos(params, callback) {
  66933. if (!params) {
  66934. return null;
  66935. }
  66936. var me = this;
  66937. var gridCellQueryService = new GetGridCellInfosService_GetGridCellInfosService(me.url, {
  66938. proxy: me.options.proxy,
  66939. withCredentials: me.options.withCredentials,
  66940. crossOrigin: me.options.crossOrigin,
  66941. headers: me.options.headers,
  66942. serverType: me.options.serverType,
  66943. eventListeners: {
  66944. scope: me,
  66945. processCompleted: callback,
  66946. processFailed: callback
  66947. }
  66948. });
  66949. gridCellQueryService.processAsync(params);
  66950. }
  66951. }
  66952. external_mapboxgl_default.a.supermap.GridCellInfosService = GridCellInfosService_GridCellInfosService;
  66953. // CONCATENATED MODULE: ./src/mapboxgl/services/GeoprocessingService.js
  66954. /**
  66955. * @class mapboxgl.supermap.GeoprocessingService
  66956. * @classdesc 地理处理服务接口类。
  66957. * @version 10.1.0
  66958. * @category iServer GeoprocessingService
  66959. * @extends {mapboxgl.supermap.ServiceBase}
  66960. * @example
  66961. * //为了安全访问受保护的地理处理服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  66962. * SuperMap.SecurityManager.registerToken(serviceUrl, token);
  66963. * var geoprocessingService = new L.supermap.geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  66964. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  66965. console.log(serverResult.result);
  66966. var jobID = serverResult.result.jobID;
  66967. var options = {
  66968. interval: 5000,
  66969. statusCallback: function(state) {
  66970. console.log("Job Status: ", state);
  66971. }
  66972. };
  66973. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  66974. console.log(serverResult);
  66975. })
  66976. })
  66977. * @param {string} url - 服务地址。
  66978. * @param {Object} options - 参数。
  66979. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。
  66980. */
  66981. class services_GeoprocessingService_GeoprocessingService extends ServiceBase_ServiceBase {
  66982. constructor(url, options) {
  66983. super(url, options);
  66984. this.headers = {};
  66985. this.crossOrigin = true;
  66986. this.withCredentials = true;
  66987. this.proxy = true;
  66988. }
  66989. /**
  66990. * @function mapboxgl.supermap.GeoprocessingService.prototype.getTools
  66991. * @description 获取地理处理工具列表。
  66992. * @param {RequestCallback} callback 请求结果的回调函数。
  66993. */
  66994. getTools(callback) {
  66995. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  66996. proxy: this.options.proxy,
  66997. withCredentials: this.options.withCredentials,
  66998. crossOrigin: this.options.crossOrigin,
  66999. headers: this.options.headers,
  67000. serverType: this.options.serverType,
  67001. eventListeners: {
  67002. scope: this,
  67003. processCompleted: callback,
  67004. processFailed: callback
  67005. }
  67006. });
  67007. geoprocessingJobsService.getTools();
  67008. }
  67009. /**
  67010. * @function mapboxgl.supermap.GeoprocessingService.prototype.getTool
  67011. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  67012. * @param {string} identifier - 地理处理工具ID。
  67013. * @param {RequestCallback} callback 请求结果的回调函数。
  67014. */
  67015. getTool(identifier, callback) {
  67016. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67017. proxy: this.options.proxy,
  67018. withCredentials: this.options.withCredentials,
  67019. crossOrigin: this.options.crossOrigin,
  67020. headers: this.options.headers,
  67021. serverType: this.options.serverType,
  67022. eventListeners: {
  67023. scope: this,
  67024. processCompleted: callback,
  67025. processFailed: callback
  67026. }
  67027. });
  67028. geoprocessingJobsService.getTool(identifier);
  67029. }
  67030. /**
  67031. * @function mapboxgl.supermap.GeoprocessingService.prototype.execute
  67032. * @description 同步执行地理处理工具。
  67033. * @param {string} identifier - 地理处理工具ID。
  67034. * @param {Object} parameter - 地理处理工具的输入参数。
  67035. * @param {Object} environment - 地理处理工具的环境参数。
  67036. * @param {RequestCallback} callback 回调函数。
  67037. */
  67038. execute(identifier, parameter, environment, callback) {
  67039. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67040. proxy: this.options.proxy,
  67041. withCredentials: this.options.withCredentials,
  67042. crossOrigin: this.options.crossOrigin,
  67043. headers: this.options.headers,
  67044. serverType: this.options.serverType,
  67045. eventListeners: {
  67046. scope: this,
  67047. processCompleted: callback,
  67048. processFailed: callback
  67049. }
  67050. });
  67051. geoprocessingJobsService.execute(identifier, parameter, environment);
  67052. }
  67053. /**
  67054. * @function mapboxgl.supermap.GeoprocessingService.prototype.submitJob
  67055. * @description 异步执行地理处理工具。
  67056. * @param {string} identifier - 地理处理工具ID。
  67057. * @param {Object} parameter - 地理处理工具的输入参数。
  67058. * @param {Object} environment - 地理处理工具的环境参数。
  67059. * @param {RequestCallback} callback 回调函数。
  67060. */
  67061. submitJob(identifier, parameter, environment, callback) {
  67062. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67063. proxy: this.options.proxy,
  67064. withCredentials: this.options.withCredentials,
  67065. crossOrigin: this.options.crossOrigin,
  67066. headers: this.options.headers,
  67067. serverType: this.options.serverType,
  67068. eventListeners: {
  67069. scope: this,
  67070. processCompleted: callback,
  67071. processFailed: callback
  67072. }
  67073. });
  67074. geoprocessingJobsService.submitJob(identifier, parameter, environment);
  67075. }
  67076. /**
  67077. * @function mapboxgl.supermap.GeoprocessingService.prototype.waitForJobCompletion
  67078. * @description 获取地理处理异步执行状态信息。
  67079. * @param {string} jobId - 地理处理任务ID。
  67080. * @param {string} identifier - 地理处理工具ID。
  67081. * @param {Object} options - 状态信息参数。
  67082. * @param {number} options.interval - 定时器时间间隔。
  67083. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  67084. * @param {RequestCallback} callback 回调函数。
  67085. */
  67086. waitForJobCompletion(jobId, identifier, options, callback) {
  67087. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67088. proxy: this.options.proxy,
  67089. withCredentials: this.options.withCredentials,
  67090. crossOrigin: this.options.crossOrigin,
  67091. headers: this.options.headers,
  67092. serverType: this.options.serverType,
  67093. eventListeners: {
  67094. scope: this,
  67095. processCompleted: callback,
  67096. processFailed: callback
  67097. }
  67098. });
  67099. geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options);
  67100. }
  67101. /**
  67102. * @function mapboxgl.supermap.GeoprocessingService.prototype.getJobInfo
  67103. * @description 获取地理处理任务的执行信息。
  67104. * @param {string} identifier - 地理处理工具ID。
  67105. * @param {string} jobId - 地理处理任务ID。
  67106. * @param {RequestCallback} callback 回调函数。
  67107. */
  67108. getJobInfo(identifier, jobId, callback) {
  67109. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67110. proxy: this.options.proxy,
  67111. withCredentials: this.options.withCredentials,
  67112. crossOrigin: this.options.crossOrigin,
  67113. headers: this.options.headers,
  67114. serverType: this.options.serverType,
  67115. eventListeners: {
  67116. scope: this,
  67117. processCompleted: callback,
  67118. processFailed: callback
  67119. }
  67120. });
  67121. geoprocessingJobsService.getJobInfo(identifier, jobId);
  67122. }
  67123. /**
  67124. * @function mapboxgl.supermap.GeoprocessingService.prototype.cancelJob
  67125. * @description 取消地理处理任务的异步执行。
  67126. * @param {string} identifier - 地理处理工具ID。
  67127. * @param {string} jobId - 地理处理任务ID。
  67128. * @param {RequestCallback} callback 回调函数。
  67129. */
  67130. cancelJob(identifier, jobId, callback) {
  67131. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67132. proxy: this.options.proxy,
  67133. withCredentials: this.options.withCredentials,
  67134. crossOrigin: this.options.crossOrigin,
  67135. headers: this.options.headers,
  67136. serverType: this.options.serverType,
  67137. eventListeners: {
  67138. scope: this,
  67139. processCompleted: callback,
  67140. processFailed: callback
  67141. }
  67142. });
  67143. geoprocessingJobsService.cancelJob(identifier, jobId);
  67144. }
  67145. /**
  67146. * @function mapboxgl.supermap.GeoprocessingService.prototype.getJobs
  67147. * @description 获取地理处理服务任务列表。
  67148. * @param {string} identifier - 地理处理工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  67149. * @param {RequestCallback} callback 回调函数。
  67150. */
  67151. getJobs(identifier, callback) {
  67152. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67153. proxy: this.options.proxy,
  67154. withCredentials: this.options.withCredentials,
  67155. crossOrigin: this.options.crossOrigin,
  67156. headers: this.options.headers,
  67157. serverType: this.options.serverType,
  67158. eventListeners: {
  67159. scope: this,
  67160. processCompleted: callback,
  67161. processFailed: callback
  67162. }
  67163. });
  67164. geoprocessingJobsService.getJobs(identifier);
  67165. }
  67166. /**
  67167. * @function mapboxgl.supermap.GeoprocessingService.prototype.getResults
  67168. * @description 地理处理工具异步执行的结果,支持结果过滤。
  67169. * @param {string} identifier - 地理处理工具ID。
  67170. * @param {string} jobId - 地理处理任务ID。
  67171. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  67172. * @param {RequestCallback} callback 请求结果的回调函数。
  67173. */
  67174. getResults(identifier, jobId, filter, callback) {
  67175. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67176. proxy: this.options.proxy,
  67177. withCredentials: this.options.withCredentials,
  67178. crossOrigin: this.options.crossOrigin,
  67179. headers: this.options.headers,
  67180. serverType: this.options.serverType,
  67181. eventListeners: {
  67182. scope: this,
  67183. processCompleted: callback,
  67184. processFailed: callback
  67185. }
  67186. });
  67187. geoprocessingJobsService.getResults(identifier, jobId, filter);
  67188. }
  67189. }
  67190. external_mapboxgl_default.a.supermap.GeoprocessingService = services_GeoprocessingService_GeoprocessingService;
  67191. // CONCATENATED MODULE: ./src/mapboxgl/services/LayerInfoService.js
  67192. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  67193. * This program are made available under the terms of the Apache License, Version 2.0
  67194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67195. /**
  67196. * @class mapboxgl.supermap.LayerInfoService
  67197. * @category iServer Map Layer
  67198. * @classdesc 图层信息服务类 。
  67199. * @extends {mapboxgl.supermap.ServiceBase}
  67200. * @example
  67201. * new mapboxgl.supermap.LayerInfoService(url).getLayersInfo(function(result){
  67202. * //doSomething
  67203. * })
  67204. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:</br>
  67205. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  67206. * @param {Object} options - 服务所需可选参数。
  67207. * @param {string} [options.proxy] - 服务代理地址。
  67208. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67209. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67210. * @param {Object} [options.headers] - 请求头。
  67211. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67212. */
  67213. class LayerInfoService_LayerInfoService extends ServiceBase_ServiceBase {
  67214. constructor(url, options) {
  67215. super(url, options);
  67216. }
  67217. /**
  67218. * @function mapboxgl.supermap.LayerInfoService.prototype.getLayersInfo
  67219. * @description 获取图层信息服务。
  67220. * @param {RequestCallback} callback - 回调函数。
  67221. * @returns {mapboxgl.supermap.LayerInfoService} 返回图层信息类。
  67222. */
  67223. getLayersInfo(callback) {
  67224. var me = this;
  67225. var getLayersInfoService = new GetLayersInfoService_GetLayersInfoService(me.url, {
  67226. proxy: me.options.proxy,
  67227. withCredentials: me.options.withCredentials,
  67228. crossOrigin: me.options.crossOrigin,
  67229. headers: me.options.headers,
  67230. serverType: me.options.serverType,
  67231. eventListeners: {
  67232. processCompleted: callback,
  67233. processFailed: callback
  67234. }
  67235. });
  67236. getLayersInfoService.processAsync();
  67237. }
  67238. /**
  67239. * @function mapboxgl.supermap.LayerInfoService.prototype.setLayerInfo
  67240. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  67241. * @param {SuperMap.SetLayerInfoParameters} params - 设置图层信息参数类。
  67242. * @param {RequestCallback} callback - 回调函数。
  67243. */
  67244. setLayerInfo(params, callback) {
  67245. if (!params) {
  67246. return;
  67247. }
  67248. var me = this,
  67249. resourceID = params.resourceID,
  67250. tempLayerName = params.tempLayerName,
  67251. layerInfoParams = params.layerInfo;
  67252. if (!resourceID || !tempLayerName) {
  67253. return;
  67254. }
  67255. var url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  67256. var setLayerInfoService = new SetLayerInfoService_SetLayerInfoService(url, {
  67257. proxy: me.options.proxy,
  67258. withCredentials: me.options.withCredentials,
  67259. crossOrigin: me.options.crossOrigin,
  67260. headers: me.options.headers,
  67261. serverType: me.options.serverType,
  67262. eventListeners: {
  67263. processCompleted: callback,
  67264. processFailed: callback
  67265. }
  67266. });
  67267. setLayerInfoService.processAsync(layerInfoParams);
  67268. }
  67269. /**
  67270. * @function mapboxgl.supermap.LayerInfoService.prototype.setLayersInfo
  67271. * @description 设置图层信息服务。可以实现创建新的临时图层和对现有临时图层的修改。
  67272. * @param {SuperMap.SetLayersInfoParameters} params - 设置图层信息参数类,包括临时图层。
  67273. * @param {RequestCallback} callback - 回调函数。
  67274. */
  67275. setLayersInfo(params, callback) {
  67276. if (!params) {
  67277. return;
  67278. }
  67279. var me = this,
  67280. resourceID = params.resourceID,
  67281. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  67282. layersInfo = params.layersInfo;
  67283. if ((isTempLayers && !resourceID) || !layersInfo) {
  67284. return;
  67285. }
  67286. var setLayersInfoService = new SetLayersInfoService_SetLayersInfoService(me.url, {
  67287. proxy: me.options.proxy,
  67288. withCredentials: me.options.withCredentials,
  67289. crossOrigin: me.options.crossOrigin,
  67290. headers: me.options.headers,
  67291. serverType: me.options.serverType,
  67292. eventListeners: {
  67293. processCompleted: callback,
  67294. processFailed: callback
  67295. },
  67296. resourceID: resourceID,
  67297. isTempLayers: isTempLayers
  67298. });
  67299. setLayersInfoService.processAsync(layersInfo);
  67300. }
  67301. /**
  67302. * @function mapboxgl.supermap.LayerInfoService.prototype.setLayerStatus
  67303. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  67304. * @param {SuperMap.SetLayerStatusParameters} params - 子图层显示控制参数类。
  67305. * @param {RequestCallback} callback 回调函数。
  67306. */
  67307. setLayerStatus(params, callback) {
  67308. if (!params) {
  67309. return;
  67310. }
  67311. var me = this;
  67312. var setLayerStatusService = new SetLayerStatusService_SetLayerStatusService(me.url, {
  67313. proxy: me.options.proxy,
  67314. withCredentials: me.options.withCredentials,
  67315. crossOrigin: me.options.crossOrigin,
  67316. headers: me.options.headers,
  67317. serverType: me.options.serverType,
  67318. eventListeners: {
  67319. processCompleted: callback,
  67320. processFailed: callback
  67321. }
  67322. });
  67323. setLayerStatusService.processAsync(params);
  67324. }
  67325. }
  67326. external_mapboxgl_default.a.supermap.LayerInfoService = LayerInfoService_LayerInfoService;
  67327. // CONCATENATED MODULE: ./src/mapboxgl/services/MapService.js
  67328. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  67329. * This program are made available under the terms of the Apache License, Version 2.0
  67330. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67331. /**
  67332. * @class mapboxgl.supermap.MapService
  67333. * @category iServer Map
  67334. * @classdesc 地图信息服务类。
  67335. * @extends {mapboxgl.supermap.ServiceBase}
  67336. * @param {string} url - 地图服务地址。
  67337. * @param {Object} options - 地图服务信息相关参数。
  67338. * @param {string} [options.proxy] - 服务代理地址。
  67339. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67340. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67341. * @param {Object} [options.headers] - 请求头。
  67342. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67343. * @example
  67344. * new mapboxgl.supermap.MapService(url)
  67345. * .getMapInfo(function(result){
  67346. * //doSomething
  67347. * })
  67348. */
  67349. class services_MapService_MapService extends ServiceBase_ServiceBase {
  67350. constructor(url, options) {
  67351. super(url, options);
  67352. }
  67353. /**
  67354. * @function mapboxgl.supermap.MapService.prototype.getMapInfo
  67355. * @description 地图信息查询服务。
  67356. * @param {RequestCallback} callback 回调函数。
  67357. * @returns {mapboxgl.supermap.MapService} 获取服务信息。
  67358. */
  67359. getMapInfo(callback) {
  67360. var me = this;
  67361. var getMapStatusService = new MapService_MapService(me.url, {
  67362. proxy: me.options.proxy,
  67363. withCredentials: me.options.withCredentials,
  67364. crossOrigin: me.options.crossOrigin,
  67365. headers: me.options.headers,
  67366. serverType: me.options.serverType,
  67367. eventListeners: {
  67368. scope: me,
  67369. processCompleted: callback,
  67370. processFailed: callback
  67371. }, projection: me.options.projection
  67372. });
  67373. getMapStatusService.processAsync();
  67374. }
  67375. /**
  67376. * @function mapboxgl.supermap.MapService.prototype.getTilesets
  67377. * @description 切片列表信息查询服务。
  67378. * @param {RequestCallback} callback - 回调函数 。
  67379. * @returns {mapboxgl.supermap.MapService} 获取服务信息。
  67380. */
  67381. getTilesets(callback) {
  67382. var me = this;
  67383. var tilesetsService = new TilesetsService_TilesetsService(me.url, {
  67384. proxy: me.options.proxy,
  67385. withCredentials: me.options.withCredentials,
  67386. crossOrigin: me.options.crossOrigin,
  67387. headers: me.options.headers,
  67388. serverType: me.options.serverType,
  67389. eventListeners: {
  67390. scope: me,
  67391. processCompleted: callback,
  67392. processFailed: callback
  67393. }
  67394. });
  67395. tilesetsService.processAsync();
  67396. }
  67397. }
  67398. external_mapboxgl_default.a.supermap.MapService = services_MapService_MapService;
  67399. // CONCATENATED MODULE: ./src/mapboxgl/services/MeasureService.js
  67400. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  67401. * This program are made available under the terms of the Apache License, Version 2.0
  67402. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67403. /**
  67404. * @class mapboxgl.supermap.MeasureService
  67405. * @category iServer Map Measure
  67406. * @classdesc 测量服务。
  67407. * @extends {mapboxgl.supermap.ServiceBase}
  67408. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map。
  67409. * @param {Object} options - 交互服务时所需可选参数。
  67410. * @param {string} [options.proxy] - 服务代理地址。
  67411. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67412. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67413. * @param {Object} [options.headers] - 请求头。
  67414. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67415. * @param {SuperMap.MeasureMode} [options.measureMode=SuperMap.MeasureMode.DISTANCE] - 量算模式,包括距离量算模式和面积量算模式。
  67416. */
  67417. class services_MeasureService_MeasureService extends ServiceBase_ServiceBase {
  67418. constructor(url, options) {
  67419. super(url, options);
  67420. }
  67421. /**
  67422. * @function mapboxgl.supermap.MeasureService.prototype.measureDistance
  67423. * @description 距离测量。
  67424. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  67425. * @param {RequestCallback} callback 回调函数。
  67426. */
  67427. measureDistance(params, callback) {
  67428. this.measure(params, 'DISTANCE', callback);
  67429. }
  67430. /**
  67431. * @function mapboxgl.supermap.MeasureService.prototype.measureArea
  67432. * @description 面积测量。
  67433. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  67434. * @param {RequestCallback} callback 回调函数。
  67435. */
  67436. measureArea(params, callback) {
  67437. this.measure(params, 'AREA', callback);
  67438. }
  67439. /**
  67440. * @function mapboxgl.supermap.MeasureService.prototype.measure
  67441. * @description 测量。
  67442. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  67443. * @param {string} type - 测量类型。
  67444. * @param {RequestCallback} callback - 回调函数。
  67445. * @returns {mapboxgl.supermap.MeasureService} 测量服务。
  67446. */
  67447. measure(params, type, callback) {
  67448. var me = this;
  67449. var measureService = new MeasureService_MeasureService(me.url, {
  67450. proxy: me.options.proxy,
  67451. withCredentials: me.options.withCredentials,
  67452. crossOrigin: me.options.crossOrigin,
  67453. headers: me.options.headers,
  67454. serverType: me.options.serverType,
  67455. measureMode: type,
  67456. eventListeners: {
  67457. scope: me,
  67458. processCompleted: callback,
  67459. processFailed: callback
  67460. }
  67461. });
  67462. measureService.processAsync(me._processParam(params));
  67463. }
  67464. _processParam(params) {
  67465. if (params && !(params.geometry instanceof Geometry_Geometry)) {
  67466. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  67467. }
  67468. return params;
  67469. }
  67470. }
  67471. external_mapboxgl_default.a.supermap.MeasureService = services_MeasureService_MeasureService;
  67472. // CONCATENATED MODULE: ./src/mapboxgl/services/NetworkAnalystService.js
  67473. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  67474. * This program are made available under the terms of the Apache License, Version 2.0
  67475. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67476. /**
  67477. * @class mapboxgl.supermap.NetworkAnalystService
  67478. * @category iServer NetworkAnalyst
  67479. * @classdesc 网络分析服务类。
  67480. * @extends {mapboxgl.supermap.ServiceBase}
  67481. * @example
  67482. * new mapboxgl.supermap.NetworkAnalystService(url)
  67483. * .findPath(params,function(result){
  67484. * //doSomething
  67485. * })
  67486. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:</br>
  67487. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  67488. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  67489. * @param {Object} options - 服务所需可选参数。
  67490. * @param {string} [options.proxy] - 服务代理地址。
  67491. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67492. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67493. * @param {Object} [options.headers] - 请求头。
  67494. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67495. */
  67496. class NetworkAnalystService_NetworkAnalystService extends ServiceBase_ServiceBase {
  67497. constructor(url, options) {
  67498. super(url, options);
  67499. }
  67500. /**
  67501. * @function mapboxgl.supermap.NetworkAnalystService.prototype.burstPipelineAnalyst
  67502. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  67503. * @param {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  67504. * @param {RequestCallback} callback 回调函数。
  67505. */
  67506. burstPipelineAnalyst(params, callback) {
  67507. var me = this;
  67508. var burstPipelineAnalystService = new BurstPipelineAnalystService_BurstPipelineAnalystService(me.url, {
  67509. proxy: me.options.proxy,
  67510. withCredentials: me.options.withCredentials,
  67511. crossOrigin: me.options.crossOrigin,
  67512. headers: me.options.headers,
  67513. serverType: me.options.serverType,
  67514. eventListeners: {
  67515. scope: me,
  67516. processCompleted: callback,
  67517. processFailed: callback
  67518. }
  67519. });
  67520. burstPipelineAnalystService.processAsync(me._processParams(params));
  67521. }
  67522. /**
  67523. * @function mapboxgl.supermap.NetworkAnalystService.prototype.computeWeightMatrix
  67524. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  67525. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  67526. * @param {RequestCallback} callback - 回调函数。
  67527. */
  67528. computeWeightMatrix(params, callback) {
  67529. var me = this;
  67530. var computeWeightMatrixService = new ComputeWeightMatrixService_ComputeWeightMatrixService(me.url, {
  67531. proxy: me.options.proxy,
  67532. withCredentials: me.options.withCredentials,
  67533. crossOrigin: me.options.crossOrigin,
  67534. headers: me.options.headers,
  67535. serverType: me.options.serverType,
  67536. eventListeners: {
  67537. scope: me,
  67538. processCompleted: callback,
  67539. processFailed: callback
  67540. }
  67541. });
  67542. computeWeightMatrixService.processAsync(me._processParams(params));
  67543. }
  67544. /**
  67545. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findClosestFacilities
  67546. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  67547. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  67548. * @param {RequestCallback} callback 回调函数。
  67549. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  67550. */
  67551. findClosestFacilities(params, callback, resultFormat) {
  67552. var me = this;
  67553. var findClosestFacilitiesService = new FindClosestFacilitiesService_FindClosestFacilitiesService(me.url, {
  67554. proxy: me.options.proxy,
  67555. withCredentials: me.options.withCredentials,
  67556. crossOrigin: me.options.crossOrigin,
  67557. headers: me.options.headers,
  67558. serverType: me.options.serverType,
  67559. eventListeners: {
  67560. scope: me,
  67561. processCompleted: callback,
  67562. processFailed: callback
  67563. },
  67564. format: me._processFormat(resultFormat)
  67565. });
  67566. findClosestFacilitiesService.processAsync(me._processParams(params));
  67567. }
  67568. /**
  67569. * @function mapboxgl.supermap.NetworkAnalystService.prototype.streamFacilityAnalyst
  67570. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  67571. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  67572. * @param {RequestCallback} callback 回调函数。
  67573. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67574. */
  67575. streamFacilityAnalyst(params, callback, resultFormat) {
  67576. var me = this;
  67577. var facilityAnalystStreamService = new FacilityAnalystStreamService_FacilityAnalystStreamService(me.url, {
  67578. proxy: me.options.proxy,
  67579. withCredentials: me.options.withCredentials,
  67580. crossOrigin: me.options.crossOrigin,
  67581. headers: me.options.headers,
  67582. serverType: me.options.serverType,
  67583. eventListeners: {
  67584. scope: me,
  67585. processCompleted: callback,
  67586. processFailed: callback
  67587. },
  67588. format: me._processFormat(resultFormat)
  67589. });
  67590. facilityAnalystStreamService.processAsync(me._processParams(params));
  67591. }
  67592. /**
  67593. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findLocation
  67594. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  67595. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类。
  67596. * @param {RequestCallback} callback 回调函数。
  67597. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67598. */
  67599. findLocation(params, callback, resultFormat) {
  67600. var me = this;
  67601. var findLocationService = new FindLocationService_FindLocationService(me.url, {
  67602. proxy: me.options.proxy,
  67603. withCredentials: me.options.withCredentials,
  67604. crossOrigin: me.options.crossOrigin,
  67605. headers: me.options.headers,
  67606. serverType: me.options.serverType,
  67607. eventListeners: {
  67608. scope: me,
  67609. processCompleted: callback,
  67610. processFailed: callback
  67611. },
  67612. format: me._processFormat(resultFormat)
  67613. });
  67614. findLocationService.processAsync(me._processParams(params));
  67615. }
  67616. /**
  67617. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findPath
  67618. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  67619. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类。
  67620. * @param {RequestCallback} callback - 回调函数。
  67621. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67622. */
  67623. findPath(params, callback, resultFormat) {
  67624. var me = this;
  67625. var findPathService = new FindPathService_FindPathService(me.url, {
  67626. proxy: me.options.proxy,
  67627. withCredentials: me.options.withCredentials,
  67628. crossOrigin: me.options.crossOrigin,
  67629. headers: me.options.headers,
  67630. serverType: me.options.serverType,
  67631. eventListeners: {
  67632. scope: me,
  67633. processCompleted: callback,
  67634. processFailed: callback
  67635. },
  67636. format: me._processFormat(resultFormat)
  67637. });
  67638. findPathService.processAsync(me._processParams(params));
  67639. }
  67640. /**
  67641. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findTSPPaths
  67642. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  67643. * @param {SuperMap.SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  67644. * @param {RequestCallback} callback - 回调函数。
  67645. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67646. */
  67647. findTSPPaths(params, callback, resultFormat) {
  67648. var me = this;
  67649. var findTSPPathsService = new FindTSPPathsService_FindTSPPathsService(me.url, {
  67650. proxy: me.options.proxy,
  67651. withCredentials: me.options.withCredentials,
  67652. crossOrigin: me.options.crossOrigin,
  67653. headers: me.options.headers,
  67654. serverType: me.options.serverType,
  67655. eventListeners: {
  67656. scope: me,
  67657. processCompleted: callback,
  67658. processFailed: callback
  67659. },
  67660. format: me._processFormat(resultFormat)
  67661. });
  67662. findTSPPathsService.processAsync(me._processParams(params));
  67663. }
  67664. /**
  67665. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findMTSPPaths
  67666. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  67667. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  67668. * @param {RequestCallback} callback - 回调函数。
  67669. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67670. */
  67671. findMTSPPaths(params, callback, resultFormat) {
  67672. var me = this;
  67673. var findMTSPPathsService = new FindMTSPPathsService_FindMTSPPathsService(me.url, {
  67674. proxy: me.options.proxy,
  67675. withCredentials: me.options.withCredentials,
  67676. crossOrigin: me.options.crossOrigin,
  67677. headers: me.options.headers,
  67678. serverType: me.options.serverType,
  67679. eventListeners: {
  67680. scope: me,
  67681. processCompleted: callback,
  67682. processFailed: callback
  67683. },
  67684. format: me._processFormat(resultFormat)
  67685. });
  67686. findMTSPPathsService.processAsync(me._processParams(params));
  67687. }
  67688. /**
  67689. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findServiceAreas
  67690. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  67691. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类。
  67692. * @param {RequestCallback} callback 回调函数。
  67693. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67694. */
  67695. findServiceAreas(params, callback, resultFormat) {
  67696. var me = this;
  67697. var findServiceAreasService = new FindServiceAreasService_FindServiceAreasService(me.url, {
  67698. proxy: me.options.proxy,
  67699. withCredentials: me.options.withCredentials,
  67700. crossOrigin: me.options.crossOrigin,
  67701. headers: me.options.headers,
  67702. serverType: me.options.serverType,
  67703. eventListeners: {
  67704. scope: me,
  67705. processCompleted: callback,
  67706. processFailed: callback
  67707. },
  67708. format: me._processFormat(resultFormat)
  67709. });
  67710. findServiceAreasService.processAsync(me._processParams(params));
  67711. }
  67712. /**
  67713. * @function mapboxgl.supermap.NetworkAnalystService.prototype.updateEdgeWeight
  67714. * @description 更新边的耗费权重服务。
  67715. * @param {SuperMap.UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  67716. * @param {RequestCallback} callback 回调函数。
  67717. */
  67718. updateEdgeWeight(params, callback) {
  67719. var me = this;
  67720. var updateEdgeWeightService = new UpdateEdgeWeightService_UpdateEdgeWeightService(me.url, {
  67721. proxy: me.options.proxy,
  67722. withCredentials: me.options.withCredentials,
  67723. crossOrigin: me.options.crossOrigin,
  67724. headers: me.options.headers,
  67725. serverType: me.options.serverType,
  67726. eventListeners: {
  67727. scope: me,
  67728. processCompleted: callback,
  67729. processFailed: callback
  67730. }
  67731. });
  67732. updateEdgeWeightService.processAsync(params);
  67733. }
  67734. /**
  67735. * @function mapboxgl.supermap.NetworkAnalystService.prototype.updateTurnNodeWeight
  67736. * @description 转向耗费权重更新服务。
  67737. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  67738. * @param {RequestCallback} callback - 回调函数。
  67739. */
  67740. updateTurnNodeWeight(params, callback) {
  67741. var me = this;
  67742. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService_UpdateTurnNodeWeightService(me.url, {
  67743. proxy: me.options.proxy,
  67744. withCredentials: me.options.withCredentials,
  67745. crossOrigin: me.options.crossOrigin,
  67746. headers: me.options.headers,
  67747. serverType: me.options.serverType,
  67748. eventListeners: {
  67749. scope: me,
  67750. processCompleted: callback,
  67751. processFailed: callback
  67752. }
  67753. });
  67754. updateTurnNodeWeightService.processAsync(params);
  67755. }
  67756. /**
  67757. * @description 所有 Point 考虑 mapboxgl.lnglat、mapboxgl.Point、[]三种形式。
  67758. * @param {Object} params - 待转换参数。
  67759. * @returns {Object}
  67760. * @private
  67761. */
  67762. _processParams(params) {
  67763. if (!params) {
  67764. return {};
  67765. }
  67766. var me = this;
  67767. if (params.centers && core_Util_Util.isArray(params.centers)) {
  67768. params.centers.map(function (point, key) {
  67769. params.centers[key] = me._toPointObject(point);
  67770. return params.centers[key];
  67771. });
  67772. }
  67773. if (params.nodes && core_Util_Util.isArray(params.nodes)) {
  67774. params.nodes.map(function (point, key) {
  67775. params.nodes[key] = me._toPointObject(point);
  67776. return params.nodes[key];
  67777. });
  67778. }
  67779. if (params.event) {
  67780. params.event = me._toPointObject(params.event);
  67781. }
  67782. if (params.facilities && core_Util_Util.isArray(params.facilities)) {
  67783. params.facilities.map(function (point, key) {
  67784. params.facilities[key] = me._toPointObject(point);
  67785. return params.facilities[key];
  67786. });
  67787. }
  67788. if (params.parameter && params.parameter.barrierPoints) {
  67789. var barrierPoints = params.parameter.barrierPoints;
  67790. if (core_Util_Util.isArray(barrierPoints)) {
  67791. barrierPoints.map(function (point, key) {
  67792. params.parameter[key] = me._toPointObject(point);
  67793. return params.parameter.barrierPoints[key];
  67794. });
  67795. } else {
  67796. params.parameter.barrierPoints = [(barrierPoints instanceof external_mapboxgl_default.a.LngLat) ? {
  67797. x: barrierPoints.lng,
  67798. y: barrierPoints.lat
  67799. } : barrierPoints];
  67800. }
  67801. }
  67802. return params;
  67803. }
  67804. _toPointObject(point) {
  67805. if (core_Util_Util.isArray(point)) {
  67806. return {
  67807. x: point[0],
  67808. y: point[1]
  67809. };
  67810. }
  67811. if (point instanceof external_mapboxgl_default.a.LngLat) {
  67812. return {
  67813. x: point.lng,
  67814. y: point.lat
  67815. };
  67816. }
  67817. return (point instanceof external_mapboxgl_default.a.Point) ? {
  67818. x: point.x,
  67819. y: point.y
  67820. } : point;
  67821. }
  67822. _processFormat(resultFormat) {
  67823. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  67824. }
  67825. }
  67826. external_mapboxgl_default.a.supermap.NetworkAnalystService = NetworkAnalystService_NetworkAnalystService;
  67827. // CONCATENATED MODULE: ./src/mapboxgl/services/NetworkAnalyst3DService.js
  67828. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  67829. * This program are made available under the terms of the Apache License, Version 2.0
  67830. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67831. /**
  67832. * @class mapboxgl.supermap.NetworkAnalyst3DService
  67833. * @category iServer FacilityAnalyst3D
  67834. * @classdesc 3D 网络分析服务类。
  67835. * @extends {mapboxgl.supermap.ServiceBase}
  67836. * @example
  67837. * new mapboxgl.supermap.NetworkAnalyst3DService(url)
  67838. * .sinksFacilityAnalyst(params,function(result){
  67839. * //doSomething
  67840. * })
  67841. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:</br>
  67842. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  67843. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  67844. * @param {Object} options - 服务所需可选参数。
  67845. * @param {string} [options.proxy] - 服务代理地址。
  67846. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67847. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67848. * @param {Object} [options.headers] - 请求头。
  67849. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67850. */
  67851. class NetworkAnalyst3DService_NetworkAnalyst3DService extends ServiceBase_ServiceBase {
  67852. constructor(url, options) {
  67853. super(url, options);
  67854. }
  67855. /**
  67856. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  67857. * @description 汇查找服务。
  67858. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
  67859. * @param {RequestCallback} callback - 回调函数。
  67860. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67861. */
  67862. sinksFacilityAnalyst(params, callback) {
  67863. var me = this;
  67864. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService_FacilityAnalystSinks3DService(me.url, {
  67865. proxy: me.options.proxy,
  67866. withCredentials: me.options.withCredentials,
  67867. crossOrigin: me.options.crossOrigin,
  67868. headers: me.options.headers,
  67869. serverType: me.options.serverType,
  67870. eventListeners: {
  67871. scope: me,
  67872. processCompleted: callback,
  67873. processFailed: callback
  67874. }
  67875. });
  67876. facilityAnalystSinks3DService.processAsync(params);
  67877. }
  67878. /**
  67879. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  67880. * @description 源查找服务。
  67881. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  67882. * @param {RequestCallback} callback - 回调函数。
  67883. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67884. */
  67885. sourcesFacilityAnalyst(params, callback) {
  67886. var me = this;
  67887. var facilityAnalystSources3DService = new FacilityAnalystSources3DService_FacilityAnalystSources3DService(me.url, {
  67888. proxy: me.options.proxy,
  67889. withCredentials: me.options.withCredentials,
  67890. crossOrigin: me.options.crossOrigin,
  67891. headers: me.options.headers,
  67892. serverType: me.options.serverType,
  67893. eventListeners: {
  67894. scope: me,
  67895. processCompleted: callback,
  67896. processFailed: callback
  67897. }
  67898. });
  67899. facilityAnalystSources3DService.processAsync(params);
  67900. }
  67901. /**
  67902. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  67903. * @description 上游追踪资源服务。
  67904. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  67905. * @param {RequestCallback} callback 回调函数。
  67906. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67907. */
  67908. traceUpFacilityAnalyst(params, callback) {
  67909. var me = this;
  67910. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService_FacilityAnalystTraceup3DService(me.url, {
  67911. proxy: me.options.proxy,
  67912. withCredentials: me.options.withCredentials,
  67913. crossOrigin: me.options.crossOrigin,
  67914. headers: me.options.headers,
  67915. serverType: me.options.serverType,
  67916. eventListeners: {
  67917. scope: me,
  67918. processCompleted: callback,
  67919. processFailed: callback
  67920. }
  67921. });
  67922. facilityAnalystTraceup3DService.processAsync(params);
  67923. }
  67924. /**
  67925. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  67926. * @description 下游追踪资源服务。
  67927. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  67928. * @param {RequestCallback} callback 回调函数。
  67929. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67930. */
  67931. traceDownFacilityAnalyst(params, callback) {
  67932. var me = this;
  67933. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService_FacilityAnalystTracedown3DService(me.url, {
  67934. proxy: me.options.proxy,
  67935. withCredentials: me.options.withCredentials,
  67936. crossOrigin: me.options.crossOrigin,
  67937. headers: me.options.headers,
  67938. serverType: me.options.serverType,
  67939. eventListeners: {
  67940. scope: me,
  67941. processCompleted: callback,
  67942. processFailed: callback
  67943. }
  67944. });
  67945. facilityAnalystTracedown3DService.processAsync(params);
  67946. }
  67947. /**
  67948. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  67949. * @description 上游关键设施查找服务。
  67950. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  67951. * @param {RequestCallback} callback 回调函数。
  67952. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67953. */
  67954. upstreamFacilityAnalyst(params, callback) {
  67955. var me = this;
  67956. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService_FacilityAnalystUpstream3DService(me.url, {
  67957. proxy: me.options.proxy,
  67958. withCredentials: me.options.withCredentials,
  67959. crossOrigin: me.options.crossOrigin,
  67960. headers: me.options.headers,
  67961. serverType: me.options.serverType,
  67962. eventListeners: {
  67963. scope: me,
  67964. processCompleted: callback,
  67965. processFailed: callback
  67966. }
  67967. });
  67968. facilityAnalystUpstream3DService.processAsync(params);
  67969. }
  67970. }
  67971. external_mapboxgl_default.a.supermap.NetworkAnalyst3DService = NetworkAnalyst3DService_NetworkAnalyst3DService;
  67972. // CONCATENATED MODULE: ./src/mapboxgl/services/ProcessingService.js
  67973. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  67974. * This program are made available under the terms of the Apache License, Version 2.0
  67975. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67976. /**
  67977. * @class mapboxgl.supermap.ProcessingService
  67978. * @category iServer ProcessingService
  67979. * @classdesc 分布式分析相关服务类。
  67980. * @extends {mapboxgl.supermap.ServiceBase}
  67981. * @example
  67982. * new mapboxgl.supermap.ProcessingService(url,options)
  67983. * .getKernelDensityJobs(function(result){
  67984. * //doSomething
  67985. * })
  67986. * @param {string} url - 分布式分析服务地址。
  67987. * @param {Object} options - 交互服务时所需可选参数。
  67988. * @param {string} [options.proxy] - 服务代理地址。
  67989. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  67990. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67991. * @param {Object} [options.headers] - 请求头。
  67992. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67993. */
  67994. class ProcessingService_ProcessingService extends ServiceBase_ServiceBase {
  67995. constructor(url, options) {
  67996. super(url, options);
  67997. this.kernelDensityJobs = {};
  67998. this.summaryMeshJobs = {};
  67999. this.queryJobs = {};
  68000. this.summaryRegionJobs = {};
  68001. this.vectorClipJobs = {};
  68002. this.overlayGeoJobs = {};
  68003. this.buffersJobs = {};
  68004. this.topologyValidatorJobs = {};
  68005. this.summaryAttributesJobs = {};
  68006. }
  68007. /**
  68008. * @function mapboxgl.supermap.ProcessingService.prototype.getKernelDensityJobs
  68009. * @description 获取密度分析的列表。
  68010. * @param {RequestCallback} callback - 请求结果的回调函数。
  68011. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68012. */
  68013. getKernelDensityJobs(callback, resultFormat) {
  68014. var me = this,
  68015. format = me._processFormat(resultFormat);
  68016. var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, {
  68017. proxy: me.options.proxy,
  68018. withCredentials: me.options.withCredentials,
  68019. crossOrigin: me.options.crossOrigin,
  68020. headers: me.options.headers,
  68021. serverType: me.options.serverType,
  68022. eventListeners: {
  68023. scope: me,
  68024. processCompleted: callback,
  68025. processFailed: callback
  68026. },
  68027. format: format
  68028. });
  68029. kernelDensityJobsService.getKernelDensityJobs();
  68030. }
  68031. /**
  68032. * @function mapboxgl.supermap.ProcessingService.prototype.getKernelDensityJob
  68033. * @description 获取某一个密度分析。
  68034. * @param {string} id - 空间分析的id。
  68035. * @param {RequestCallback} callback - 请求结果的回调函数。
  68036. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68037. */
  68038. getKernelDensityJob(id, callback, resultFormat) {
  68039. var me = this,
  68040. format = me._processFormat(resultFormat);
  68041. var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, {
  68042. proxy: me.options.proxy,
  68043. withCredentials: me.options.withCredentials,
  68044. crossOrigin: me.options.crossOrigin,
  68045. headers: me.options.headers,
  68046. serverType: me.options.serverType,
  68047. eventListeners: {
  68048. scope: me,
  68049. processCompleted: callback,
  68050. processFailed: callback
  68051. },
  68052. format: format
  68053. });
  68054. kernelDensityJobsService.getKernelDensityJob(id);
  68055. }
  68056. /**
  68057. * @function mapboxgl.supermap.ProcessingService.prototype.addKernelDensityJob
  68058. * @description 新建一个密度分析。
  68059. * @param {SuperMap.KernelDensityJobParameter} params -创建一个空间分析的请求参数。
  68060. * @param {RequestCallback} callback 请求结果的回调函数。
  68061. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68062. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68063. */
  68064. addKernelDensityJob(params, callback, seconds, resultFormat) {
  68065. var me = this,
  68066. param = me._processParams(params),
  68067. format = me._processFormat(resultFormat);
  68068. var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, {
  68069. proxy: me.options.proxy,
  68070. withCredentials: me.options.withCredentials,
  68071. crossOrigin: me.options.crossOrigin,
  68072. headers: me.options.headers,
  68073. eventListeners: {
  68074. scope: me,
  68075. processCompleted: callback,
  68076. processFailed: callback,
  68077. processRunning: function (job) {
  68078. me.kernelDensityJobs[job.id] = job.state;
  68079. }
  68080. },
  68081. format: format
  68082. });
  68083. kernelDensityJobsService.addKernelDensityJob(param, seconds);
  68084. }
  68085. /**
  68086. * @function mapboxgl.supermap.ProcessingService.prototype.getKernelDensityJobState
  68087. * @description 获取密度分析的状态。
  68088. * @param {string} id - 密度分析的id。
  68089. * @returns {Object} 密度分析的状态。
  68090. */
  68091. getKernelDensityJobState(id) {
  68092. return this.kernelDensityJobs[id];
  68093. }
  68094. /**
  68095. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryMeshJobs
  68096. * @description 获取点聚合分析的列表。
  68097. * @param {RequestCallback} callback - 请求结果的回调函数。
  68098. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68099. */
  68100. getSummaryMeshJobs(callback, resultFormat) {
  68101. var me = this,
  68102. format = me._processFormat(resultFormat);
  68103. var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, {
  68104. proxy: me.options.proxy,
  68105. withCredentials: me.options.withCredentials,
  68106. crossOrigin: me.options.crossOrigin,
  68107. headers: me.options.headers,
  68108. serverType: me.options.serverType,
  68109. eventListeners: {
  68110. scope: me,
  68111. processCompleted: callback,
  68112. processFailed: callback
  68113. },
  68114. format: format
  68115. });
  68116. summaryMeshJobsService.getSummaryMeshJobs();
  68117. }
  68118. /**
  68119. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryMeshJob
  68120. * @description 获取某一个点聚合分析。
  68121. * @param {string} id - 空间分析的 id。
  68122. * @param {function} callback - 请求结果的回调函数。
  68123. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68124. */
  68125. getSummaryMeshJob(id, callback, resultFormat) {
  68126. var me = this,
  68127. format = me._processFormat(resultFormat);
  68128. var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, {
  68129. proxy: me.options.proxy,
  68130. withCredentials: me.options.withCredentials,
  68131. crossOrigin: me.options.crossOrigin,
  68132. headers: me.options.headers,
  68133. serverType: me.options.serverType,
  68134. eventListeners: {
  68135. scope: me,
  68136. processCompleted: callback,
  68137. processFailed: callback
  68138. },
  68139. format: format
  68140. });
  68141. summaryMeshJobsService.getSummaryMeshJob(id);
  68142. }
  68143. /**
  68144. * @function mapboxgl.supermap.ProcessingService.prototype.addSummaryMeshJob
  68145. * @description 新建一个点聚合分析。
  68146. * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  68147. * @param {RequestCallback} callback 请求结果的回调函数。
  68148. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68149. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68150. */
  68151. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  68152. var me = this,
  68153. param = me._processParams(params),
  68154. format = me._processFormat(resultFormat);
  68155. var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, {
  68156. proxy: me.options.proxy,
  68157. withCredentials: me.options.withCredentials,
  68158. crossOrigin: me.options.crossOrigin,
  68159. headers: me.options.headers,
  68160. eventListeners: {
  68161. scope: me,
  68162. processCompleted: callback,
  68163. processFailed: callback,
  68164. processRunning: function (job) {
  68165. me.summaryMeshJobs[job.id] = job.state;
  68166. }
  68167. },
  68168. format: format
  68169. });
  68170. summaryMeshJobsService.addSummaryMeshJob(param, seconds);
  68171. }
  68172. /**
  68173. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryMeshJobState
  68174. * @description 获取点聚合分析的状态。
  68175. * @param {string} id - 点聚合分析的 ID。
  68176. * @returns {Object} 点聚合分析的状态。
  68177. */
  68178. getSummaryMeshJobState(id) {
  68179. return this.summaryMeshJobs[id];
  68180. }
  68181. /**
  68182. * @function mapboxgl.supermap.ProcessingService.prototype.getQueryJobs
  68183. * @description 获取单对象查询分析的列表。
  68184. * @param {RequestCallback} callback - 请求结果的回调函数。
  68185. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68186. */
  68187. getQueryJobs(callback, resultFormat) {
  68188. var me = this,
  68189. format = me._processFormat(resultFormat);
  68190. var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, {
  68191. proxy: me.options.proxy,
  68192. withCredentials: me.options.withCredentials,
  68193. serverType: me.options.serverType,
  68194. crossOrigin: me.options.crossOrigin,
  68195. headers: me.options.headers,
  68196. eventListeners: {
  68197. scope: me,
  68198. processCompleted: callback,
  68199. processFailed: callback
  68200. },
  68201. format: format
  68202. });
  68203. singleObjectQueryJobsService.getQueryJobs();
  68204. }
  68205. /**
  68206. * @function mapboxgl.supermap.ProcessingService.prototype.getQueryJob
  68207. * @description 获取某一个单对象查询分析。
  68208. * @param {string} id - 空间分析的 id。
  68209. * @param {RequestCallback} callback - 请求结果的回调函数。
  68210. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68211. */
  68212. getQueryJob(id, callback, resultFormat) {
  68213. var me = this,
  68214. format = me._processFormat(resultFormat);
  68215. var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, {
  68216. proxy: me.options.proxy,
  68217. withCredentials: me.options.withCredentials,
  68218. crossOrigin: me.options.crossOrigin,
  68219. headers: me.options.headers,
  68220. serverType: me.options.serverType,
  68221. eventListeners: {
  68222. scope: me,
  68223. processCompleted: callback,
  68224. processFailed: callback
  68225. },
  68226. format: format
  68227. });
  68228. singleObjectQueryJobsService.getQueryJob(id);
  68229. }
  68230. /**
  68231. * @function mapboxgl.supermap.ProcessingService.prototype.addQueryJob
  68232. * @description 新建一个单对象查询分析。
  68233. * @param {SuperMap.SingleObjectQueryJobsParameter} params -创建一个空间分析的请求参数。
  68234. * @param {RequestCallback} callback - 请求结果的回调函数。
  68235. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68236. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68237. */
  68238. addQueryJob(params, callback, seconds, resultFormat) {
  68239. var me = this,
  68240. param = me._processParams(params),
  68241. format = me._processFormat(resultFormat);
  68242. var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, {
  68243. proxy: me.options.proxy,
  68244. withCredentials: me.options.withCredentials,
  68245. crossOrigin: me.options.crossOrigin,
  68246. headers: me.options.headers,
  68247. eventListeners: {
  68248. scope: me,
  68249. processCompleted: callback,
  68250. processFailed: callback,
  68251. processRunning: function (job) {
  68252. me.queryJobs[job.id] = job.state;
  68253. }
  68254. },
  68255. format: format
  68256. });
  68257. singleObjectQueryJobsService.addQueryJob(param, seconds);
  68258. }
  68259. /**
  68260. * @function mapboxgl.supermap.ProcessingService.prototype.getQueryJobState
  68261. * @description 获取单对象查询分析的状态。
  68262. * @param {string} id - 单对象查询分析的 ID。
  68263. * @returns {Object} 单对象查询分析的状态。
  68264. */
  68265. getQueryJobState(id) {
  68266. return this.queryJobs[id];
  68267. }
  68268. /**
  68269. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryRegionJobs
  68270. * @description 获取区域汇总分析的列表。
  68271. * @param {RequestCallback} callback - 请求结果的回调函数。
  68272. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68273. */
  68274. getSummaryRegionJobs(callback, resultFormat) {
  68275. var me = this,
  68276. format = me._processFormat(resultFormat);
  68277. var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, {
  68278. proxy: me.options.proxy,
  68279. withCredentials: me.options.withCredentials,
  68280. crossOrigin: me.options.crossOrigin,
  68281. headers: me.options.headers,
  68282. serverType: me.options.serverType,
  68283. eventListeners: {
  68284. scope: me,
  68285. processCompleted: callback,
  68286. processFailed: callback
  68287. },
  68288. format: format
  68289. });
  68290. summaryRegionJobsService.getSummaryRegionJobs();
  68291. }
  68292. /**
  68293. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryRegionJob
  68294. * @description 获取某一个区域汇总分析。
  68295. * @param {string} id - 区域汇总分析的 id。
  68296. * @param {RequestCallback} callback - 请求结果的回调函数。
  68297. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68298. */
  68299. getSummaryRegionJob(id, callback, resultFormat) {
  68300. var me = this,
  68301. format = me._processFormat(resultFormat);
  68302. var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, {
  68303. proxy: me.options.proxy,
  68304. withCredentials: me.options.withCredentials,
  68305. crossOrigin: me.options.crossOrigin,
  68306. headers: me.options.headers,
  68307. serverType: me.options.serverType,
  68308. eventListeners: {
  68309. scope: me,
  68310. processCompleted: callback,
  68311. processFailed: callback
  68312. },
  68313. format: format
  68314. });
  68315. summaryRegionJobsService.getSummaryRegionJob(id);
  68316. }
  68317. /**
  68318. * @function mapboxgl.supermap.ProcessingService.prototype.addSummaryRegionJob
  68319. * @description 新建一个区域汇总分析。
  68320. * @param {SuperMap.SummaryRegionJobParameter} params - 区域汇总分析参数类。
  68321. * @param {RequestCallback} callback - 请求结果的回调函数。
  68322. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68323. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68324. */
  68325. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  68326. var me = this,
  68327. param = me._processParams(params),
  68328. format = me._processFormat(resultFormat);
  68329. var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, {
  68330. proxy: me.options.proxy,
  68331. withCredentials: me.options.withCredentials,
  68332. crossOrigin: me.options.crossOrigin,
  68333. headers: me.options.headers,
  68334. eventListeners: {
  68335. scope: me,
  68336. processCompleted: callback,
  68337. processFailed: callback,
  68338. processRunning: function (job) {
  68339. me.summaryRegionJobs[job.id] = job.state;
  68340. }
  68341. },
  68342. format: format
  68343. });
  68344. summaryRegionJobsService.addSummaryRegionJob(param, seconds);
  68345. }
  68346. /**
  68347. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryRegionJobState
  68348. * @description 获取区域汇总分析的状态。
  68349. * @param {string} id - 生成区域汇总分析的 id。
  68350. * @returns {Object} 区域汇总分析的状态。
  68351. */
  68352. getSummaryRegionJobState(id) {
  68353. return this.summaryRegionJobs[id];
  68354. }
  68355. /**
  68356. * @function mapboxgl.supermap.ProcessingService.prototype.getVectorClipJobs
  68357. * @description 获取矢量裁剪分析的列表。
  68358. * @param {RequestCallback} callback - 请求结果的回调函数。
  68359. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68360. */
  68361. getVectorClipJobs(callback, resultFormat) {
  68362. var me = this,
  68363. format = me._processFormat(resultFormat);
  68364. var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, {
  68365. proxy: me.options.proxy,
  68366. withCredentials: me.options.withCredentials,
  68367. crossOrigin: me.options.crossOrigin,
  68368. headers: me.options.headers,
  68369. serverType: me.options.serverType,
  68370. eventListeners: {
  68371. scope: me,
  68372. processCompleted: callback,
  68373. processFailed: callback
  68374. },
  68375. format: format
  68376. });
  68377. vectorClipJobsService.getVectorClipJobs();
  68378. }
  68379. /**
  68380. * @function mapboxgl.supermap.ProcessingService.prototype.getVectorClipJob
  68381. * @description 获取某一个矢量裁剪分析。
  68382. * @param {string} id - 空间分析的 id。
  68383. * @param {RequestCallback} callback - 请求结果的回调函数。
  68384. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68385. */
  68386. getVectorClipJob(id, callback, resultFormat) {
  68387. var me = this,
  68388. format = me._processFormat(resultFormat);
  68389. var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, {
  68390. proxy: me.options.proxy,
  68391. withCredentials: me.options.withCredentials,
  68392. serverType: me.options.serverType,
  68393. crossOrigin: me.options.crossOrigin,
  68394. headers: me.options.headers,
  68395. eventListeners: {
  68396. scope: me,
  68397. processCompleted: callback,
  68398. processFailed: callback
  68399. },
  68400. format: format
  68401. });
  68402. vectorClipJobsService.getVectorClipJob(id);
  68403. }
  68404. /**
  68405. * @function mapboxgl.supermap.ProcessingService.prototype.addVectorClipJob
  68406. * @description 新建一个矢量裁剪分析。
  68407. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  68408. * @param {RequestCallback} callback - 请求结果的回调函数。
  68409. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68410. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68411. */
  68412. addVectorClipJob(params, callback, seconds, resultFormat) {
  68413. var me = this,
  68414. param = me._processParams(params),
  68415. format = me._processFormat(resultFormat);
  68416. var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, {
  68417. proxy: me.options.proxy,
  68418. withCredentials: me.options.withCredentials,
  68419. serverType: me.options.serverType,
  68420. crossOrigin: me.options.crossOrigin,
  68421. headers: me.options.headers,
  68422. eventListeners: {
  68423. scope: me,
  68424. processCompleted: callback,
  68425. processFailed: callback,
  68426. processRunning: function (job) {
  68427. me.vectorClipJobs[job.id] = job.state;
  68428. }
  68429. },
  68430. format: format
  68431. });
  68432. vectorClipJobsService.addVectorClipJob(param, seconds);
  68433. }
  68434. /**
  68435. * @function mapboxgl.supermap.ProcessingService.prototype.getVectorClipJobState
  68436. * @description 获取矢量裁剪分析的状态。
  68437. * @param {number} id - 矢量裁剪分析的id。
  68438. * @returns {Object} 矢量裁剪分析的状态。
  68439. */
  68440. getVectorClipJobState(id) {
  68441. return this.vectorClipJobs[id];
  68442. }
  68443. /**
  68444. * @function mapboxgl.supermap.processingService.prototype.getOverlayGeoJobs
  68445. * @description 获取叠加分析的列表。
  68446. * @param {RequestCallback} callback - 请求结果的回调函数。
  68447. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68448. */
  68449. getOverlayGeoJobs(callback, resultFormat) {
  68450. var me = this,
  68451. format = me._processFormat(resultFormat);
  68452. var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, {
  68453. proxy: me.options.proxy,
  68454. withCredentials: me.options.withCredentials,
  68455. serverType: me.options.serverType,
  68456. crossOrigin: me.options.crossOrigin,
  68457. headers: me.options.headers,
  68458. eventListeners: {
  68459. scope: me,
  68460. processCompleted: callback,
  68461. processFailed: callback
  68462. },
  68463. format: format
  68464. });
  68465. overlayGeoJobsService.getOverlayGeoJobs();
  68466. }
  68467. /**
  68468. * @function mapboxgl.supermap.processingService.prototype.getOverlayGeoJob
  68469. * @description 获取某一个叠加分析。
  68470. * @param {string} id - 空间分析的 ID。
  68471. * @param {RequestCallback} callback - 请求结果的回调函数。
  68472. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68473. */
  68474. getOverlayGeoJob(id, callback, resultFormat) {
  68475. var me = this,
  68476. format = me._processFormat(resultFormat);
  68477. var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, {
  68478. proxy: me.options.proxy,
  68479. withCredentials: me.options.withCredentials,
  68480. serverType: me.options.serverType,
  68481. crossOrigin: me.options.crossOrigin,
  68482. headers: me.options.headers,
  68483. eventListeners: {
  68484. scope: me,
  68485. processCompleted: callback,
  68486. processFailed: callback
  68487. },
  68488. format: format
  68489. });
  68490. overlayGeoJobsService.getOverlayGeoJob(id);
  68491. }
  68492. /**
  68493. * @function mapboxgl.supermap.processingService.prototype.addOverlayGeoJob
  68494. * @description 新建一个叠加分析。
  68495. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。
  68496. * @param {RequestCallback} callback - 请求结果的回调函数。
  68497. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68498. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68499. */
  68500. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  68501. var me = this,
  68502. param = me._processParams(params),
  68503. format = me._processFormat(resultFormat);
  68504. var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, {
  68505. proxy: me.options.proxy,
  68506. withCredentials: me.options.withCredentials,
  68507. serverType: me.options.serverType,
  68508. crossOrigin: me.options.crossOrigin,
  68509. headers: me.options.headers,
  68510. eventListeners: {
  68511. scope: me,
  68512. processCompleted: callback,
  68513. processFailed: callback,
  68514. processRunning: function (job) {
  68515. me.overlayGeoJobs[job.id] = job.state;
  68516. }
  68517. },
  68518. format: format
  68519. });
  68520. overlayGeoJobsService.addOverlayGeoJob(param, seconds);
  68521. }
  68522. /**
  68523. * @function mapboxgl.supermap.processingService.prototype.getoverlayGeoJobState
  68524. * @description 获取叠加分析的状态。
  68525. * @param {string} id - 叠加分析的id。
  68526. * @returns {Object} 叠加分析的状态
  68527. */
  68528. getoverlayGeoJobState(id) {
  68529. return this.overlayGeoJobs[id];
  68530. }
  68531. /**
  68532. * @function mapboxgl.supermap.processingService.prototype.getBuffersJobs
  68533. * @description 获取缓冲区分析的列表。
  68534. * @param {RequestCallback} callback - 请求结果的回调函数。
  68535. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68536. */
  68537. getBuffersJobs(callback, resultFormat) {
  68538. var me = this,
  68539. format = me._processFormat(resultFormat);
  68540. var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, {
  68541. proxy: me.options.proxy,
  68542. withCredentials: me.options.withCredentials,
  68543. serverType: me.options.serverType,
  68544. crossOrigin: me.options.crossOrigin,
  68545. headers: me.options.headers,
  68546. eventListeners: {
  68547. scope: me,
  68548. processCompleted: callback,
  68549. processFailed: callback
  68550. },
  68551. format: format
  68552. });
  68553. buffersAnalystJobsService.getBuffersJobs();
  68554. }
  68555. /**
  68556. * @function mapboxgl.supermap.processingService.prototype.getBuffersJob
  68557. * @description 获取某一个缓冲区分析。
  68558. * @param {string} id - 空间分析的 ID。
  68559. * @param {RequestCallback} callback - 请求结果的回调函数。
  68560. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68561. */
  68562. getBuffersJob(id, callback, resultFormat) {
  68563. var me = this,
  68564. format = me._processFormat(resultFormat);
  68565. var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, {
  68566. proxy: me.options.proxy,
  68567. withCredentials: me.options.withCredentials,
  68568. serverType: me.options.serverType,
  68569. crossOrigin: me.options.crossOrigin,
  68570. headers: me.options.headers,
  68571. eventListeners: {
  68572. scope: me,
  68573. processCompleted: callback,
  68574. processFailed: callback
  68575. },
  68576. format: format
  68577. });
  68578. buffersAnalystJobsService.getBuffersJob(id);
  68579. }
  68580. /**
  68581. * @function mapboxgl.supermap.processingService.prototype.addBuffersJob
  68582. * @description 新建一个缓冲区分析。
  68583. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  68584. * @param {RequestCallback} callback - 请求结果的回调函数。
  68585. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  68586. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68587. */
  68588. addBuffersJob(params, callback, seconds, resultFormat) {
  68589. var me = this,
  68590. param = me._processParams(params),
  68591. format = me._processFormat(resultFormat);
  68592. var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, {
  68593. proxy: me.options.proxy,
  68594. withCredentials: me.options.withCredentials,
  68595. serverType: me.options.serverType,
  68596. crossOrigin: me.options.crossOrigin,
  68597. headers: me.options.headers,
  68598. eventListeners: {
  68599. scope: me,
  68600. processCompleted: callback,
  68601. processFailed: callback,
  68602. processRunning: function (job) {
  68603. me.buffersJobs[job.id] = job.state;
  68604. }
  68605. },
  68606. format: format
  68607. });
  68608. buffersAnalystJobsService.addBuffersJob(param, seconds);
  68609. }
  68610. /**
  68611. * @function mapboxgl.supermap.processingService.prototype.getBuffersJobState
  68612. * @description 获取缓冲区分析的状态。
  68613. * @param {string} id - 缓冲区分析的 ID。
  68614. * @returns {Object} 缓冲区分析的状态。
  68615. */
  68616. getBuffersJobState(id) {
  68617. return this.buffersJobs[id];
  68618. }
  68619. /**
  68620. * @function mapboxgl.supermap.processingService.prototype.getTopologyValidatorJobs
  68621. * @description 获取拓扑检查分析的列表。
  68622. * @param {RequestCallback} callback - 请求结果的回调函数。
  68623. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68624. */
  68625. getTopologyValidatorJobs(callback, resultFormat) {
  68626. var me = this,
  68627. format = me._processFormat(resultFormat);
  68628. var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, {
  68629. proxy: me.options.proxy,
  68630. withCredentials: me.options.withCredentials,
  68631. serverType: me.options.serverType,
  68632. crossOrigin: me.options.crossOrigin,
  68633. headers: me.options.headers,
  68634. eventListeners: {
  68635. scope: me,
  68636. processCompleted: callback,
  68637. processFailed: callback
  68638. },
  68639. format: format
  68640. });
  68641. topologyValidatorJobsService.getTopologyValidatorJobs();
  68642. }
  68643. /**
  68644. * @function mapboxgl.supermap.processingService.prototype.getTopologyValidatorJob
  68645. * @description 获取某一个拓扑检查分析。
  68646. * @param {string} id - 空间分析的 ID。
  68647. * @param {RequestCallback} callback - 请求结果的回调函数。
  68648. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68649. */
  68650. getTopologyValidatorJob(id, callback, resultFormat) {
  68651. var me = this,
  68652. format = me._processFormat(resultFormat);
  68653. var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, {
  68654. proxy: me.options.proxy,
  68655. withCredentials: me.options.withCredentials,
  68656. serverType: me.options.serverType,
  68657. crossOrigin: me.options.crossOrigin,
  68658. headers: me.options.headers,
  68659. eventListeners: {
  68660. scope: me,
  68661. processCompleted: callback,
  68662. processFailed: callback
  68663. },
  68664. format: format
  68665. });
  68666. topologyValidatorJobsService.getTopologyValidatorJob(id);
  68667. }
  68668. /**
  68669. * @function mapboxgl.supermap.processingService.prototype.addTopologyValidatorJob
  68670. * @description 新建一个拓扑检查分析。
  68671. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  68672. * @param {RequestCallback} callback - 请求结果的回调函数。
  68673. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68674. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68675. */
  68676. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  68677. var me = this,
  68678. param = me._processParams(params),
  68679. format = me._processFormat(resultFormat);
  68680. var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, {
  68681. proxy: me.options.proxy,
  68682. withCredentials: me.options.withCredentials,
  68683. serverType: me.options.serverType,
  68684. crossOrigin: me.options.crossOrigin,
  68685. headers: me.options.headers,
  68686. eventListeners: {
  68687. scope: me,
  68688. processCompleted: callback,
  68689. processFailed: callback,
  68690. processRunning: function (job) {
  68691. me.topologyValidatorJobs[job.id] = job.state;
  68692. }
  68693. },
  68694. format: format
  68695. });
  68696. topologyValidatorJobsService.addTopologyValidatorJob(param, seconds);
  68697. }
  68698. /**
  68699. * @function mapboxgl.supermap.processingService.prototype.getTopologyValidatorJobState
  68700. * @description 获取拓扑检查分析的状态。
  68701. * @param {string} id - 拓扑检查分析的 ID。
  68702. * @returns {Object} 拓扑检查分析的状态。
  68703. */
  68704. getTopologyValidatorJobState(id) {
  68705. return this.topologyValidatorJobs[id];
  68706. }
  68707. /**
  68708. * @function mapboxgl.supermap.processingService.prototype.getSummaryAttributesJobs
  68709. * @description 获取属性汇总分析的列表。
  68710. * @param {RequestCallback} callback - 请求结果的回调函数。
  68711. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68712. */
  68713. getSummaryAttributesJobs(callback, resultFormat) {
  68714. var me = this,
  68715. format = me._processFormat(resultFormat);
  68716. var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, {
  68717. proxy: me.options.proxy,
  68718. withCredentials: me.options.withCredentials,
  68719. serverType: me.options.serverType,
  68720. crossOrigin: me.options.crossOrigin,
  68721. headers: me.options.headers,
  68722. eventListeners: {
  68723. scope: me,
  68724. processCompleted: callback,
  68725. processFailed: callback
  68726. },
  68727. format: format
  68728. });
  68729. summaryAttributesJobsService.getSummaryAttributesJobs();
  68730. }
  68731. /**
  68732. * @function mapboxgl.supermap.processingService.prototype.getSummaryAttributesJob
  68733. * @description 获取某一个属性汇总分析。
  68734. * @param {string} id - 空间分析的 ID。
  68735. * @param {RequestCallback} callback - 请求结果的回调函数。
  68736. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68737. */
  68738. getSummaryAttributesJob(id, callback, resultFormat) {
  68739. var me = this,
  68740. format = me._processFormat(resultFormat);
  68741. var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, {
  68742. proxy: me.options.proxy,
  68743. withCredentials: me.options.withCredentials,
  68744. serverType: me.options.serverType,
  68745. crossOrigin: me.options.crossOrigin,
  68746. headers: me.options.headers,
  68747. eventListeners: {
  68748. scope: me,
  68749. processCompleted: callback,
  68750. processFailed: callback
  68751. },
  68752. format: format
  68753. });
  68754. summaryAttributesJobsService.getSummaryAttributesJob(id);
  68755. }
  68756. /**
  68757. * @function mapboxgl.supermap.processingService.prototype.addSummaryAttributesJob
  68758. * @description 新建一个属性汇总分析。
  68759. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  68760. * @param {RequestCallback} callback - 请求结果的回调函数。
  68761. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68762. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68763. */
  68764. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  68765. var me = this,
  68766. param = me._processParams(params),
  68767. format = me._processFormat(resultFormat);
  68768. var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, {
  68769. proxy: me.options.proxy,
  68770. withCredentials: me.options.withCredentials,
  68771. serverType: me.options.serverType,
  68772. crossOrigin: me.options.crossOrigin,
  68773. headers: me.options.headers,
  68774. eventListeners: {
  68775. scope: me,
  68776. processCompleted: callback,
  68777. processFailed: callback,
  68778. processRunning: function (job) {
  68779. me.summaryAttributesJobs[job.id] = job.state;
  68780. }
  68781. },
  68782. format: format
  68783. });
  68784. summaryAttributesJobsService.addSummaryAttributesJob(param, seconds);
  68785. }
  68786. /**
  68787. * @function mapboxgl.supermap.processingService.prototype.getSummaryAttributesJobState
  68788. * @description 获取属性汇总分析的状态。
  68789. * @param {string} id - 属性汇总分析的 ID。
  68790. * @returns {Object} 属性汇总分析的状态
  68791. */
  68792. getSummaryAttributesJobState(id) {
  68793. return this.summaryAttributesJobs[id];
  68794. }
  68795. _processFormat(resultFormat) {
  68796. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  68797. }
  68798. _processParams(params) {
  68799. if (!params) {
  68800. return {};
  68801. }
  68802. if (params.bounds) {
  68803. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  68804. }
  68805. //这里只允许传端的bounds
  68806. if (params.query) {
  68807. params.query = core_Util_Util.toSuperMapBounds(params.query);
  68808. }
  68809. if (params.geometryQuery) {
  68810. params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery);
  68811. }
  68812. if (params.geometryClip) {
  68813. params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip);
  68814. }
  68815. return params;
  68816. }
  68817. }
  68818. external_mapboxgl_default.a.supermap.ProcessingService = ProcessingService_ProcessingService;
  68819. // CONCATENATED MODULE: ./src/mapboxgl/services/QueryService.js
  68820. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  68821. * This program are made available under the terms of the Apache License, Version 2.0
  68822. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68823. /**
  68824. * @class mapboxgl.supermap.QueryService
  68825. * @category iServer Map QueryResults
  68826. * @classdesc 地图查询服务类。
  68827. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  68828. * @extends {mapboxgl.supermap.ServiceBase}
  68829. * @param {string} url - 地图查询服务访问地址。
  68830. * @param {Object} options - 服务交互时所需的可选参数。
  68831. * @param {string} [options.proxy] - 服务代理地址。
  68832. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  68833. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68834. * @param {Object} [options.headers] - 请求头。
  68835. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  68836. * @example
  68837. * new mapboxgl.supermap.QueryService(url)
  68838. * .queryByBounds(param,function(result){
  68839. * //doSomething
  68840. * })
  68841. */
  68842. class services_QueryService_QueryService extends ServiceBase_ServiceBase {
  68843. constructor(url, options) {
  68844. super(url, options);
  68845. }
  68846. /**
  68847. * @function mapboxgl.supermap.QueryService.prototype.queryByBounds
  68848. * @description Bounds 查询地图服务。
  68849. * @param {SuperMap.QueryByBoundsParameters} params - 通过 Bounds 查询的相关参数类。
  68850. * @param {RequestCallback} callback - 回调函数。
  68851. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  68852. */
  68853. queryByBounds(params, callback, resultFormat) {
  68854. var me = this;
  68855. var queryService = new QueryByBoundsService_QueryByBoundsService(me.url, {
  68856. proxy: me.options.proxy,
  68857. withCredentials: me.options.withCredentials,
  68858. crossOrigin: me.options.crossOrigin,
  68859. headers: me.options.headers,
  68860. serverType: me.options.serverType,
  68861. eventListeners: {
  68862. scope: me,
  68863. processCompleted: callback,
  68864. processFailed: callback
  68865. },
  68866. format: me._processFormat(resultFormat)
  68867. });
  68868. queryService.processAsync(me._processParams(params));
  68869. }
  68870. /**
  68871. * @function mapboxgl.supermap.QueryService.prototype.queryByDistance
  68872. * @description 地图距离查询服务。
  68873. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询相关参数类。
  68874. * @param {RequestCallback} callback - 回调函数。
  68875. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型
  68876. */
  68877. queryByDistance(params, callback, resultFormat) {
  68878. var me = this;
  68879. var queryByDistanceService = new QueryByDistanceService_QueryByDistanceService(me.url, {
  68880. proxy: me.options.proxy,
  68881. withCredentials: me.options.withCredentials,
  68882. crossOrigin: me.options.crossOrigin,
  68883. headers: me.options.headers,
  68884. serverType: me.options.serverType,
  68885. eventListeners: {
  68886. scope: me,
  68887. processCompleted: callback,
  68888. processFailed: callback
  68889. },
  68890. format: me._processFormat(resultFormat)
  68891. });
  68892. queryByDistanceService.processAsync(me._processParams(params));
  68893. }
  68894. /**
  68895. * @function mapboxgl.supermap.QueryService.prototype.queryBySQL
  68896. * @description 地图 SQL 查询服务。
  68897. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  68898. * @param {RequestCallback} callback - 回调函数。
  68899. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  68900. */
  68901. queryBySQL(params, callback, resultFormat) {
  68902. var me = this;
  68903. var queryBySQLService = new QueryBySQLService_QueryBySQLService(me.url, {
  68904. proxy: me.options.proxy,
  68905. withCredentials: me.options.withCredentials,
  68906. crossOrigin: me.options.crossOrigin,
  68907. headers: me.options.headers,
  68908. serverType: me.options.serverType,
  68909. eventListeners: {
  68910. scope: me,
  68911. processCompleted: callback,
  68912. processFailed: callback
  68913. },
  68914. format: me._processFormat(resultFormat)
  68915. });
  68916. queryBySQLService.processAsync(me._processParams(params));
  68917. }
  68918. /**
  68919. * @function mapboxgl.supermap.QueryService.prototype.queryByGeometry
  68920. * @description 地图几何查询服务。
  68921. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询相关参数类。
  68922. * @param {RequestCallback} callback - 回调函数。
  68923. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  68924. */
  68925. queryByGeometry(params, callback, resultFormat) {
  68926. var me = this;
  68927. var queryByGeometryService = new QueryByGeometryService_QueryByGeometryService(me.url, {
  68928. proxy: me.options.proxy,
  68929. withCredentials: me.options.withCredentials,
  68930. crossOrigin: me.options.crossOrigin,
  68931. headers: me.options.headers,
  68932. serverType: me.options.serverType,
  68933. eventListeners: {
  68934. scope: me,
  68935. processCompleted: callback,
  68936. processFailed: callback
  68937. },
  68938. format: me._processFormat(resultFormat)
  68939. });
  68940. queryByGeometryService.processAsync(me._processParams(params));
  68941. }
  68942. _processParams(params) {
  68943. if (!params) {
  68944. return {};
  68945. }
  68946. params.returnContent = params.returnContent == null ? true : params.returnContent;
  68947. if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
  68948. params.queryParams = [params.queryParams];
  68949. }
  68950. if (params.bounds) {
  68951. if (params.bounds instanceof Array) {
  68952. params.bounds = new Bounds_Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]);
  68953. }
  68954. if (params.bounds instanceof external_mapboxgl_default.a.LngLatBounds) {
  68955. params.bounds = new Bounds_Bounds(
  68956. params.bounds.getSouthWest().lng,
  68957. params.bounds.getSouthWest().lat,
  68958. params.bounds.getNorthEast().lng,
  68959. params.bounds.getNorthEast().lat
  68960. );
  68961. }
  68962. }
  68963. if (params.geometry) {
  68964. if (params.geometry instanceof external_mapboxgl_default.a.LngLat) {
  68965. params.geometry = new Point_Point(params.geometry.lng, params.geometry.lat);
  68966. }
  68967. if (params.geometry instanceof external_mapboxgl_default.a.Point) {
  68968. params.geometry = new Point_Point(params.geometry.x, params.geometry.y);
  68969. }
  68970. if (params.geometry instanceof external_mapboxgl_default.a.LngLatBounds) {
  68971. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  68972. }
  68973. if (!(params.geometry instanceof Geometry_Geometry)) {
  68974. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  68975. }
  68976. }
  68977. return params;
  68978. }
  68979. _processFormat(resultFormat) {
  68980. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  68981. }
  68982. }
  68983. external_mapboxgl_default.a.supermap.QueryService = services_QueryService_QueryService;
  68984. // CONCATENATED MODULE: ./src/mapboxgl/services/SpatialAnalystService.js
  68985. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  68986. * This program are made available under the terms of the Apache License, Version 2.0
  68987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68988. /**
  68989. * @class mapboxgl.supermap.SpatialAnalystService
  68990. * @extends {mapboxgl.supermap.ServiceBase}
  68991. * @category iServer SpatialAnalyst
  68992. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  68993. * @example
  68994. * new mapboxgl.supermap.SpatialAnalystService(url)
  68995. * .bufferAnalysis(params,function(result){
  68996. * //doSomething
  68997. * })
  68998. * @param {string} url - 服务的访问地址。
  68999. * @param {Object} options - 交互服务时所需可选参数。
  69000. * @param {string} [options.proxy] - 服务代理地址。
  69001. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69002. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69003. * @param {Object} [options.headers] - 请求头。
  69004. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  69005. */
  69006. class SpatialAnalystService_SpatialAnalystService extends ServiceBase_ServiceBase {
  69007. constructor(url, options) {
  69008. super(url, options);
  69009. }
  69010. /**
  69011. * @function mapboxgl.supermap.SpatialAnalystService.prototype.getAreaSolarRadiationResult
  69012. * @description 地区太阳辐射。
  69013. * @param {SuperMap.mapboxgl} params -查询相关参数类。
  69014. * @param {RequestCallback} callback - 回调函数。
  69015. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69016. */
  69017. getAreaSolarRadiationResult(params, callback, resultFormat) {
  69018. var me = this;
  69019. var areaSolarRadiationService = new AreaSolarRadiationService_AreaSolarRadiationService(me.url, {
  69020. proxy: me.options.proxy,
  69021. withCredentials: me.options.withCredentials,
  69022. crossOrigin: me.options.crossOrigin,
  69023. headers: me.options.headers,
  69024. serverType: me.options.serverType,
  69025. eventListeners: {
  69026. scope: me,
  69027. processCompleted: callback,
  69028. processFailed: callback
  69029. },
  69030. format: me._processFormat(resultFormat)
  69031. });
  69032. areaSolarRadiationService.processAsync(params);
  69033. }
  69034. /**
  69035. * @function mapboxgl.supermap.SpatialAnalystService.prototype.bufferAnalysis
  69036. * @description 缓冲区分析。
  69037. * @param {SuperMap.DatasetBufferAnalystParameters} params - 查询相关参数类。
  69038. * @param {RequestCallback} callback - 回调函数。
  69039. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69040. */
  69041. bufferAnalysis(params, callback, resultFormat) {
  69042. var me = this;
  69043. var bufferAnalystService = new BufferAnalystService_BufferAnalystService(me.url, {
  69044. proxy: me.options.proxy,
  69045. withCredentials: me.options.withCredentials,
  69046. crossOrigin: me.options.crossOrigin,
  69047. headers: me.options.headers,
  69048. serverType: me.options.serverType,
  69049. eventListeners: {
  69050. scope: me,
  69051. processCompleted: callback,
  69052. processFailed: callback
  69053. },
  69054. format: me._processFormat(resultFormat)
  69055. });
  69056. bufferAnalystService.processAsync(me._processParams(params));
  69057. }
  69058. /**
  69059. * @function mapboxgl.supermap.SpatialAnalystService.prototype.densityAnalysis
  69060. * @description 点密度分析。
  69061. * @param {SuperMap.DensityKernelAnalystParameters} params - 查询相关参数类。
  69062. * @param {RequestCallback} callback - 回调函数。
  69063. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69064. */
  69065. densityAnalysis(params, callback, resultFormat) {
  69066. var me = this;
  69067. var densityAnalystService = new DensityAnalystService_DensityAnalystService(me.url, {
  69068. proxy: me.options.proxy,
  69069. withCredentials: me.options.withCredentials,
  69070. crossOrigin: me.options.crossOrigin,
  69071. headers: me.options.headers,
  69072. serverType: me.options.serverType,
  69073. eventListeners: {
  69074. scope: me,
  69075. processCompleted: callback,
  69076. processFailed: callback
  69077. },
  69078. format: me._processFormat(resultFormat)
  69079. });
  69080. densityAnalystService.processAsync(me._processParams(params));
  69081. }
  69082. /**
  69083. * @function mapboxgl.supermap.SpatialAnalystService.prototype.generateSpatialData
  69084. * @description 动态分段分析。
  69085. * @param {SuperMap.GenerateSpatialDataParameters} params - 查询相关参数类。
  69086. * @param {RequestCallback} callback - 回调函数。
  69087. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69088. */
  69089. generateSpatialData(params, callback, resultFormat) {
  69090. var me = this;
  69091. var generateSpatialDataService = new GenerateSpatialDataService_GenerateSpatialDataService(me.url, {
  69092. proxy: me.options.proxy,
  69093. withCredentials: me.options.withCredentials,
  69094. crossOrigin: me.options.crossOrigin,
  69095. headers: me.options.headers,
  69096. serverType: me.options.serverType,
  69097. eventListeners: {
  69098. scope: me,
  69099. processCompleted: callback,
  69100. processFailed: callback
  69101. },
  69102. format: me._processFormat(resultFormat)
  69103. });
  69104. generateSpatialDataService.processAsync(params);
  69105. }
  69106. /**
  69107. * @function mapboxgl.supermap.SpatialAnalystService.prototype.geoRelationAnalysis
  69108. * @description 空间关系分析。
  69109. * @param {SuperMap.GeoRelationAnalystParameters} params - 查询相关参数类。
  69110. * @param {RequestCallback} callback - 回调函数。
  69111. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69112. */
  69113. geoRelationAnalysis(params, callback, resultFormat) {
  69114. var me = this;
  69115. var geoRelationAnalystService = new GeoRelationAnalystService_GeoRelationAnalystService(me.url, {
  69116. proxy: me.options.proxy,
  69117. withCredentials: me.options.withCredentials,
  69118. crossOrigin: me.options.crossOrigin,
  69119. headers: me.options.headers,
  69120. serverType: me.options.serverType,
  69121. eventListeners: {
  69122. scope: me,
  69123. processCompleted: callback,
  69124. processFailed: callback
  69125. },
  69126. format: me._processFormat(resultFormat)
  69127. });
  69128. geoRelationAnalystService.processAsync(params);
  69129. }
  69130. /**
  69131. * @function mapboxgl.supermap.SpatialAnalystService.prototype.interpolationAnalysis
  69132. * @description 插值分析。
  69133. * @param {SuperMap.InterpolationRBFAnalystParameters} params - 查询相关参数类。
  69134. * @param {RequestCallback} callback - 回调函数。
  69135. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69136. */
  69137. interpolationAnalysis(params, callback, resultFormat) {
  69138. var me = this;
  69139. var interpolationAnalystService = new InterpolationAnalystService_InterpolationAnalystService(me.url, {
  69140. proxy: me.options.proxy,
  69141. withCredentials: me.options.withCredentials,
  69142. crossOrigin: me.options.crossOrigin,
  69143. headers: me.options.headers,
  69144. serverType: me.options.serverType,
  69145. eventListeners: {
  69146. scope: me,
  69147. processCompleted: callback,
  69148. processFailed: callback
  69149. },
  69150. format: me._processFormat(resultFormat)
  69151. });
  69152. interpolationAnalystService.processAsync(me._processParams(params));
  69153. }
  69154. /**
  69155. * @function mapboxgl.supermap.SpatialAnalystService.prototype.mathExpressionAnalysis
  69156. * @description 栅格代数运算。
  69157. * @param {SuperMap.MathExpressionAnalysisParameters} params - 查询相关参数类。
  69158. * @param {RequestCallback} callback - 回调函数。
  69159. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69160. */
  69161. mathExpressionAnalysis(params, callback, resultFormat) {
  69162. var me = this;
  69163. var mathExpressionAnalysisService = new MathExpressionAnalysisService_MathExpressionAnalysisService(me.url, {
  69164. proxy: me.options.proxy,
  69165. withCredentials: me.options.withCredentials,
  69166. crossOrigin: me.options.crossOrigin,
  69167. headers: me.options.headers,
  69168. serverType: me.options.serverType,
  69169. eventListeners: {
  69170. scope: me,
  69171. processCompleted: callback,
  69172. processFailed: callback
  69173. },
  69174. format: me._processFormat(resultFormat)
  69175. });
  69176. mathExpressionAnalysisService.processAsync(me._processParams(params));
  69177. }
  69178. /**
  69179. * @function mapboxgl.supermap.SpatialAnalystService.prototype.overlayAnalysis
  69180. * @description 叠加分析。
  69181. * @param {(SuperMap.DatasetOverlayAnalystParameters|SuperMap.GeometryOverlayAnalystParameters)} params - 叠加分析参数类,支持批量几何要素叠加分析。
  69182. * @param {RequestCallback} callback - 回调函数。
  69183. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69184. */
  69185. overlayAnalysis(params, callback, resultFormat) {
  69186. var me = this;
  69187. var overlayAnalystService = new OverlayAnalystService_OverlayAnalystService(me.url, {
  69188. proxy: me.options.proxy,
  69189. withCredentials: me.options.withCredentials,
  69190. crossOrigin: me.options.crossOrigin,
  69191. headers: me.options.headers,
  69192. serverType: me.options.serverType,
  69193. eventListeners: {
  69194. scope: me,
  69195. processCompleted: callback,
  69196. processFailed: callback
  69197. },
  69198. format: me._processFormat(resultFormat)
  69199. });
  69200. overlayAnalystService.processAsync(me._processParams(params));
  69201. }
  69202. /**
  69203. * @function mapboxgl.supermap.SpatialAnalystService.prototype.routeCalculateMeasure
  69204. * @description 路由测量计算。
  69205. * @param {SuperMap.RouteCalculateMeasureParameters} params - 查询相关参数类。
  69206. * @param {RequestCallback} callback - 回调函数。
  69207. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69208. */
  69209. routeCalculateMeasure(params, callback, resultFormat) {
  69210. var me = this;
  69211. var routeCalculateMeasureService = new RouteCalculateMeasureService_RouteCalculateMeasureService(me.url, {
  69212. proxy: me.options.proxy,
  69213. withCredentials: me.options.withCredentials,
  69214. crossOrigin: me.options.crossOrigin,
  69215. headers: me.options.headers,
  69216. serverType: me.options.serverType,
  69217. eventListeners: {
  69218. scope: me,
  69219. processCompleted: callback,
  69220. processFailed: callback
  69221. },
  69222. format: me._processFormat(resultFormat)
  69223. });
  69224. routeCalculateMeasureService.processAsync(me._processParams(params));
  69225. }
  69226. /**
  69227. * @function mapboxgl.supermap.SpatialAnalystService.prototype.routeLocate
  69228. * @description 路由定位。
  69229. * @param {SuperMap.RouteLocatorParameters} params - 查询相关参数类。
  69230. * @param {RequestCallback} callback - 回调函数。
  69231. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69232. */
  69233. routeLocate(params, callback, resultFormat) {
  69234. var me = this;
  69235. var routeLocatorService = new RouteLocatorService_RouteLocatorService(me.url, {
  69236. proxy: me.options.proxy,
  69237. withCredentials: me.options.withCredentials,
  69238. crossOrigin: me.options.crossOrigin,
  69239. headers: me.options.headers,
  69240. serverType: me.options.serverType,
  69241. eventListeners: {
  69242. scope: me,
  69243. processCompleted: callback,
  69244. processFailed: callback
  69245. },
  69246. format: me._processFormat(resultFormat)
  69247. });
  69248. routeLocatorService.processAsync(me._processParams(params));
  69249. }
  69250. /**
  69251. * @function mapboxgl.supermap.SpatialAnalystService.prototype.surfaceAnalysis
  69252. * @description 表面分析。
  69253. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析参数类。
  69254. * @param {RequestCallback} callback - 回调函数。
  69255. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69256. */
  69257. surfaceAnalysis(params, callback, resultFormat) {
  69258. var me = this;
  69259. var surfaceAnalystService = new SurfaceAnalystService_SurfaceAnalystService(me.url, {
  69260. proxy: me.options.proxy,
  69261. withCredentials: me.options.withCredentials,
  69262. crossOrigin: me.options.crossOrigin,
  69263. headers: me.options.headers,
  69264. serverType: me.options.serverType,
  69265. eventListeners: {
  69266. scope: me,
  69267. processCompleted: callback,
  69268. processFailed: callback
  69269. },
  69270. format: me._processFormat(resultFormat)
  69271. });
  69272. surfaceAnalystService.processAsync(me._processParams(params));
  69273. }
  69274. /**
  69275. * @function mapboxgl.supermap.SpatialAnalystService.prototype.terrainCurvatureCalculate
  69276. * @description 地形曲率计算。
  69277. * @param {SuperMap.TerrainCurvatureCalculationParameters} params - 查询相关参数类。
  69278. * @param {RequestCallback} callback - 回调函数。
  69279. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69280. */
  69281. terrainCurvatureCalculate(params, callback, resultFormat) {
  69282. var me = this;
  69283. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService_TerrainCurvatureCalculationService(me.url, {
  69284. proxy: me.options.proxy,
  69285. withCredentials: me.options.withCredentials,
  69286. crossOrigin: me.options.crossOrigin,
  69287. headers: me.options.headers,
  69288. serverType: me.options.serverType,
  69289. eventListeners: {
  69290. scope: me,
  69291. processCompleted: callback,
  69292. processFailed: callback
  69293. },
  69294. format: me._processFormat(resultFormat)
  69295. });
  69296. terrainCurvatureCalculationService.processAsync(params);
  69297. }
  69298. /**
  69299. * @function mapboxgl.supermap.SpatialAnalystService.prototype.thiessenAnalysis
  69300. * @description 泰森多边形分析。
  69301. * @param {SuperMap.DatasetThiessenAnalystParameters} params - 查询相关参数类。
  69302. * @param {RequestCallback} callback - 回调函数。
  69303. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69304. */
  69305. thiessenAnalysis(params, callback, resultFormat) {
  69306. var me = this;
  69307. var thiessenAnalystService = new ThiessenAnalystService_ThiessenAnalystService(me.url, {
  69308. proxy: me.options.proxy,
  69309. withCredentials: me.options.withCredentials,
  69310. crossOrigin: me.options.crossOrigin,
  69311. headers: me.options.headers,
  69312. serverType: me.options.serverType,
  69313. eventListeners: {
  69314. scope: me,
  69315. processCompleted: callback,
  69316. processFailed: callback
  69317. },
  69318. format: me._processFormat(resultFormat)
  69319. });
  69320. thiessenAnalystService.processAsync(me._processParams(params));
  69321. }
  69322. /**
  69323. * @function mapboxgl.supermap.SpatialAnalystService.prototype.geometrybatchAnalysis
  69324. * @description 批量空间分析。
  69325. * @param {Array} params - 批量分析参数对象数组,包括:
  69326. * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
  69327. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  69328. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  69329. * {SuperMap.GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  69330. * {SuperMap.GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  69331. * {SuperMap.InterpolationAnalystParameters} 插值分析参数类。</br>
  69332. * {SuperMap.SurfaceAnalystParameters} 表面分析参数类。</br>
  69333. * @param {RequestCallback} callback - 回调函数。
  69334. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69335. */
  69336. geometrybatchAnalysis(params, callback, resultFormat) {
  69337. var me = this;
  69338. var geometryBatchAnalystService = new GeometryBatchAnalystService_GeometryBatchAnalystService(me.url, {
  69339. serverType: me.options.serverType,
  69340. eventListeners: {
  69341. scope: me,
  69342. processCompleted: callback,
  69343. processFailed: callback
  69344. },
  69345. format: me._processFormat(resultFormat)
  69346. });
  69347. //处理批量分析中各个分类类型的参数:
  69348. var analystParameters = [];
  69349. for (var i = 0; i < params.length; i++) {
  69350. var tempParameter = params[i];
  69351. analystParameters.push({
  69352. analystName: tempParameter.analystName,
  69353. param: me._processParams(tempParameter.param)
  69354. })
  69355. }
  69356. geometryBatchAnalystService.processAsync(analystParameters);
  69357. }
  69358. _processParams(params) {
  69359. if (!params) {
  69360. return {};
  69361. }
  69362. if (params.bounds) {
  69363. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  69364. }
  69365. //插值分析点数组转换
  69366. if (params.inputPoints) {
  69367. for (var i = 0; i < params.inputPoints.length; i++) {
  69368. var inputPoint = params.inputPoints[i];
  69369. if (core_Util_Util.isArray(inputPoint)) {
  69370. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  69371. }
  69372. }
  69373. }
  69374. //点数组转换
  69375. if (params.points) {
  69376. for (let i = 0; i < params.points.length; i++) {
  69377. var point = params.points[i];
  69378. params.points[i] = core_Util_Util.toSuperMapPoint(point);
  69379. }
  69380. }
  69381. //mapboxgl点对象转SuperMap点对象
  69382. if (params.point) {
  69383. params.point = core_Util_Util.toSuperMapPoint(params.point);
  69384. }
  69385. //初步判断mapbox数据就为geojson格式 ,进行转json格式即可
  69386. //栅格代数运算的范围
  69387. if (params.extractRegion) {
  69388. params.extractRegion = core_Util_Util.toSuperMapGeometry(params.extractRegion);
  69389. }
  69390. //获取或设置表面分析参数
  69391. if (params.extractParameter && params.extractParameter.clipRegion) {
  69392. params.extractParameter.clipRegion = core_Util_Util.toSuperMapGeometry(params.extractParameter.clipRegion);
  69393. }
  69394. if (params.clipParam && params.clipParam.clipRegion) {
  69395. params.clipParam.clipRegion = core_Util_Util.toSuperMapGeometry(params.clipParam.clipRegion);
  69396. }
  69397. //sourceRoute 路由对象。用于里程分析,该对象可以是用户自己生 成或在数据源中查询得到的符合标准的路由对象;geojson格式
  69398. if (params.sourceRoute) {
  69399. if (params.sourceRoute) {
  69400. var target = {};
  69401. target.type = "LINEM";
  69402. target.parts = [params.sourceRoute.geometry.coordinates.length];
  69403. target.points = [];
  69404. for (let i = 0; i < params.sourceRoute.geometry.coordinates.length; i++) {
  69405. var lnglat = params.sourceRoute.geometry.coordinates[i];
  69406. //measure 应该在传值时设置,
  69407. target.points = target.points.concat({x: lnglat[0], y: lnglat[1], measure: lnglat[2]})
  69408. }
  69409. params.sourceRoute = target;
  69410. }
  69411. }
  69412. //operateRegions 操作面对象集合,数据集叠加分析,表示与这些面对象进行叠加分析
  69413. if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) {
  69414. params.operateRegions.map(function (geometry, key) {
  69415. params.operateRegions[key] = core_Util_Util.toSuperMapGeometry(geometry);
  69416. return params.operateRegions[key];
  69417. });
  69418. }
  69419. //叠加分析,几何数据源 支持格式:GeoJson
  69420. if (params.sourceGeometry) {
  69421. var SRID = null;
  69422. if (params.sourceGeometrySRID) {
  69423. SRID = params.sourceGeometrySRID;
  69424. }
  69425. params.sourceGeometry = core_Util_Util.toSuperMapGeometry(params.sourceGeometry);
  69426. if (SRID) {
  69427. params.sourceGeometry.SRID = SRID;
  69428. }
  69429. delete params.sourceGeometry.sourceGeometrySRID;
  69430. }
  69431. if (params.operateGeometry) {
  69432. params.operateGeometry = core_Util_Util.toSuperMapGeometry(params.operateGeometry);
  69433. }
  69434. //支持传入多个几何要素进行叠加分析:
  69435. if (params.sourceGeometries) {
  69436. var sourceGeometries = [];
  69437. for (var k = 0; k < params.sourceGeometries.length; k++) {
  69438. sourceGeometries.push(core_Util_Util.toSuperMapGeometry(params.sourceGeometries[k]));
  69439. }
  69440. params.sourceGeometries = sourceGeometries;
  69441. }
  69442. //支持传入多个几何要素进行叠加分析:
  69443. if (params.operateGeometries) {
  69444. var operateGeometries = [];
  69445. for (var j = 0; j < params.operateGeometries.length; j++) {
  69446. operateGeometries.push(core_Util_Util.toSuperMapGeometry(params.operateGeometries[j]));
  69447. }
  69448. params.operateGeometries = operateGeometries;
  69449. }
  69450. //components 几何对象数组
  69451. if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) {
  69452. params.sourceRoute.components.map(function (geometry, key) {
  69453. params.sourceRoute.components[key] = core_Util_Util.toSuperMapGeometry(geometry);
  69454. return params.sourceRoute.components[key];
  69455. });
  69456. }
  69457. return params;
  69458. }
  69459. _processFormat(resultFormat) {
  69460. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  69461. }
  69462. }
  69463. external_mapboxgl_default.a.supermap.SpatialAnalystService = SpatialAnalystService_SpatialAnalystService;
  69464. // CONCATENATED MODULE: ./src/mapboxgl/services/ThemeService.js
  69465. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  69466. * This program are made available under the terms of the Apache License, Version 2.0
  69467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69468. /**
  69469. * @class mapboxgl.supermap.ThemeService
  69470. * @category iServer Map Theme
  69471. * @classdesc 专题图服务类。
  69472. * @extends {mapboxgl.supermap.ServiceBase}
  69473. * @example
  69474. * new mapboxgl.supermap.ThemeService(url,{
  69475. * projection:projection
  69476. * }).getThemeInfo(params,function(result){
  69477. * //doSomething
  69478. * });
  69479. * @param {string} url - 服务的访问地址。
  69480. * @param {Object} options - 交互服务时所需可选参数。
  69481. * @param {string} [options.proxy] - 服务代理地址。
  69482. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69483. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69484. * @param {Object} [options.headers] - 请求头。
  69485. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  69486. */
  69487. class services_ThemeService_ThemeService extends ServiceBase_ServiceBase {
  69488. constructor(url, options) {
  69489. super(url, options);
  69490. }
  69491. /**
  69492. * @function mapboxgl.supermap.ThemeService.prototype.getThemeInfo
  69493. * @description 获取专题图信息。
  69494. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  69495. * @param {RequestCallback} callback - 回调函数。
  69496. */
  69497. getThemeInfo(params, callback) {
  69498. var me = this;
  69499. var themeService = new ThemeService_ThemeService(me.url, {
  69500. proxy: me.options.proxy,
  69501. withCredentials: me.options.withCredentials,
  69502. crossOrigin: me.options.crossOrigin,
  69503. headers: me.options.headers,
  69504. serverType: me.options.serverType,
  69505. eventListeners: {
  69506. scope: me,
  69507. processCompleted: callback,
  69508. processFailed: callback
  69509. }
  69510. });
  69511. themeService.processAsync(params);
  69512. }
  69513. }
  69514. external_mapboxgl_default.a.supermap.ThemeService = services_ThemeService_ThemeService;
  69515. // CONCATENATED MODULE: ./src/mapboxgl/services/TrafficTransferAnalystService.js
  69516. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  69517. * This program are made available under the terms of the Apache License, Version 2.0
  69518. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69519. /**
  69520. * @class mapboxgl.supermap.TrafficTransferAnalystService
  69521. * @extends mapboxgl.supermap.ServiceBase
  69522. * @category iServer TrafficTransferAnalyst
  69523. * @classdesc 交通换乘分析服务类。
  69524. * @example
  69525. * new mapboxgl.supermap.TrafficTransferAnalystService(url)
  69526. * .queryStop(params,function(result){
  69527. * //doSomething
  69528. * })
  69529. * @param {string} url - 服务地址。
  69530. * @param {Object} option - 参数。
  69531. * @param {string} [options.proxy] - 服务代理地址。
  69532. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69533. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69534. * @param {Object} [options.headers] - 请求头。
  69535. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  69536. */
  69537. class TrafficTransferAnalystService_TrafficTransferAnalystService extends ServiceBase_ServiceBase {
  69538. constructor(url, options) {
  69539. super(url, options);
  69540. }
  69541. /**
  69542. * @function mapboxgl.supermap.TrafficTransferAnalystService.prototype.queryStop
  69543. * @description 站点查询服务。
  69544. * @param {SuperMap.StopQueryParameters} params - 查询相关参数类。
  69545. * @param {RequestCallback} callback - 回调函数。
  69546. */
  69547. queryStop(params, callback) {
  69548. var me = this;
  69549. var stopQueryService = new StopQueryService_StopQueryService(me.url, {
  69550. proxy: me.options.proxy,
  69551. withCredentials: me.options.withCredentials,
  69552. crossOrigin: me.options.crossOrigin,
  69553. headers: me.options.headers,
  69554. serverType: me.options.serverType,
  69555. eventListeners: {
  69556. scope: me,
  69557. processCompleted: callback,
  69558. processFailed: callback
  69559. }
  69560. });
  69561. stopQueryService.processAsync(params);
  69562. }
  69563. /**
  69564. * @function mapboxgl.supermap.TrafficTransferAnalystService.prototype.analysisTransferPath
  69565. * @description 交通换乘线路查询服务。
  69566. * @param {SuperMap.TransferPathParameters} params - 查询相关参数类。
  69567. * @param {RequestCallback} callback - 回调函数。
  69568. */
  69569. analysisTransferPath(params, callback) {
  69570. var me = this;
  69571. var transferPathService = new TransferPathService_TransferPathService(me.url, {
  69572. proxy: me.options.proxy,
  69573. withCredentials: me.options.withCredentials,
  69574. crossOrigin: me.options.crossOrigin,
  69575. headers: me.options.headers,
  69576. serverType: me.options.serverType,
  69577. eventListeners: {
  69578. scope: me,
  69579. processCompleted: callback,
  69580. processFailed: callback
  69581. }
  69582. });
  69583. transferPathService.processAsync(me._processParams(params));
  69584. }
  69585. /**
  69586. * @function mapboxgl.supermap.TrafficTransferAnalystService.prototype.analysisTransferSolution
  69587. * @description 交通换乘方案查询服务。
  69588. * @param {SuperMap.TransferSolutionParameters} params - 查询相关参数类。
  69589. * @param {RequestCallback} callback - 回调函数。
  69590. */
  69591. analysisTransferSolution(params, callback) {
  69592. var me = this;
  69593. var transferSolutionService = new TransferSolutionService_TransferSolutionService(me.url, {
  69594. proxy: me.options.proxy,
  69595. withCredentials: me.options.withCredentials,
  69596. crossOrigin: me.options.crossOrigin,
  69597. headers: me.options.headers,
  69598. serverType: me.options.serverType,
  69599. eventListeners: {
  69600. scope: me,
  69601. processCompleted: callback,
  69602. processFailed: callback
  69603. }
  69604. });
  69605. transferSolutionService.processAsync(me._processParams(params));
  69606. }
  69607. _processParams(params) {
  69608. if (!params) {
  69609. return {};
  69610. }
  69611. if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) {
  69612. params.transferLines = [params.transferLines];
  69613. }
  69614. if (params.points && core_Util_Util.isArray(params.points)) {
  69615. params.points.map(function (point, key) {
  69616. params.points[key] = (point instanceof external_mapboxgl_default.a.LngLat) ? {
  69617. x: point.lng,
  69618. y: point.lat
  69619. } : point;
  69620. return params.points[key];
  69621. });
  69622. }
  69623. return params;
  69624. }
  69625. }
  69626. external_mapboxgl_default.a.supermap.TrafficTransferAnalystService = TrafficTransferAnalystService_TrafficTransferAnalystService;
  69627. // CONCATENATED MODULE: ./src/mapboxgl/services/WebPrintingJobService.js
  69628. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  69629. * This program are made available under the terms of the Apache License, Version 2.0
  69630. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69631. /**
  69632. * @class mapboxgl.supermap.WebPrintingJobService
  69633. * @category iServer WebPrintingJob
  69634. * @version 10.1.0
  69635. * @classdesc Web 打印服务类。
  69636. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  69637. * @extends {mapboxgl.supermap.ServiceBase}
  69638. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  69639. * @param {Object} options - 服务交互时所需的可选参数。
  69640. * @param {string} [options.proxy] - 服务代理地址。
  69641. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69642. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69643. * @param {Object} [options.headers] - 请求头。
  69644. * @example
  69645. * new mapboxgl.supermap.WebPrintingJobService(url)
  69646. * .createWebPrintingJob(param,function(result){
  69647. * //doSomething
  69648. * })
  69649. */
  69650. class WebPrintingJobService_WebPrintingJobService extends ServiceBase_ServiceBase {
  69651. constructor(url, options) {
  69652. super(url, options);
  69653. }
  69654. /**
  69655. * @function mapboxgl.supermap.WebPrintingJobService.prototype.createWebPrintingJob
  69656. * @description 创建 Web 打印任务。
  69657. * @param {SuperMap.WebPrintingJobParameters} params - 打印的请求参数。
  69658. * @param {RequestCallback} callback - 回调函数。
  69659. */
  69660. createWebPrintingJob(params, callback) {
  69661. if (!params) {
  69662. return;
  69663. }
  69664. var me = this;
  69665. var webPrintingService = new WebPrintingService_WebPrintingService(me.url, {
  69666. proxy: me.options.proxy,
  69667. withCredentials: me.options.withCredentials,
  69668. crossOrigin: me.options.crossOrigin,
  69669. headers: me.options.headers,
  69670. serverType: me.options.serverType,
  69671. eventListeners: {
  69672. scope: me,
  69673. processCompleted: callback,
  69674. processFailed: callback
  69675. }
  69676. });
  69677. webPrintingService.createWebPrintingJob(me._processParams(params));
  69678. }
  69679. /**
  69680. * @function mapboxgl.supermap.WebPrintingJobService.prototype.getPrintingJob
  69681. * @description 获取 Web 打印输出文档任务。
  69682. * @param {String} jobId - Web 打印输入文档任务 Id。
  69683. * @param {RequestCallback} callback - 回调函数。
  69684. */
  69685. getPrintingJob(jobId, callback) {
  69686. var me = this;
  69687. var webPrintingService = new WebPrintingService_WebPrintingService(me.url, {
  69688. proxy: me.options.proxy,
  69689. withCredentials: me.options.withCredentials,
  69690. crossOrigin: me.options.crossOrigin,
  69691. headers: me.options.headers,
  69692. serverType: me.options.serverType,
  69693. eventListeners: {
  69694. scope: me,
  69695. processCompleted: callback,
  69696. processFailed: callback
  69697. }
  69698. });
  69699. webPrintingService.getPrintingJob(jobId);
  69700. }
  69701. /**
  69702. * @function mapboxgl.supermap.WebPrintingJobService.prototype.getPrintingJobResult
  69703. * @description 获取 Web 打印任务的输出文档。
  69704. * @param {String} jobId - Web 打印输入文档任务 Id。
  69705. * @param {RequestCallback} callback - 回调函数。
  69706. */
  69707. getPrintingJobResult(jobId, callback) {
  69708. var me = this;
  69709. var webPrintingService = new WebPrintingService_WebPrintingService(me.url, {
  69710. proxy: me.options.proxy,
  69711. withCredentials: me.options.withCredentials,
  69712. crossOrigin: me.options.crossOrigin,
  69713. headers: me.options.headers,
  69714. serverType: me.options.serverType,
  69715. eventListeners: {
  69716. scope: me,
  69717. processCompleted: callback,
  69718. processFailed: callback
  69719. }
  69720. });
  69721. webPrintingService.getPrintingJobResult(jobId);
  69722. }
  69723. /**
  69724. * @function mapboxgl.supermap.WebPrintingJobService.prototype.getLayoutTemplates
  69725. * @description 查询 Web 打印服务所有可用的模板信息。
  69726. * @param {RequestCallback} callback - 回调函数。
  69727. */
  69728. getLayoutTemplates(callback) {
  69729. var me = this;
  69730. var webPrintingService = new WebPrintingService_WebPrintingService(me.url, {
  69731. proxy: me.options.proxy,
  69732. withCredentials: me.options.withCredentials,
  69733. crossOrigin: me.options.crossOrigin,
  69734. headers: me.options.headers,
  69735. serverType: me.options.serverType,
  69736. eventListeners: {
  69737. scope: me,
  69738. processCompleted: callback,
  69739. processFailed: callback
  69740. }
  69741. });
  69742. webPrintingService.getLayoutTemplates();
  69743. }
  69744. _processParams(params) {
  69745. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  69746. params.layoutOptions.littleMapOptions.center = this._toPointObject(params.layoutOptions.littleMapOptions.center);
  69747. }
  69748. if (params.exportOptions) {
  69749. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  69750. }
  69751. return params;
  69752. }
  69753. _toPointObject(point) {
  69754. if (core_Util_Util.isArray(point)) {
  69755. return {
  69756. x: point[0],
  69757. y: point[1]
  69758. };
  69759. } else if (point instanceof SuperMap.Geometry.Point || point instanceof external_mapboxgl_default.a.Point) {
  69760. return {
  69761. x: point.x,
  69762. y: point.y
  69763. };
  69764. } else if (point instanceof external_mapboxgl_default.a.LngLat) {
  69765. return {
  69766. x: point.lng,
  69767. y: point.lat
  69768. };
  69769. }
  69770. return point;
  69771. }
  69772. }
  69773. external_mapboxgl_default.a.supermap.WebPrintingJobService = WebPrintingJobService_WebPrintingJobService;
  69774. // CONCATENATED MODULE: ./src/mapboxgl/services/index.js
  69775. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  69776. * This program are made available under the terms of the Apache License, Version 2.0
  69777. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69778. // EXTERNAL MODULE: external "function(){try{return convert}catch(e){return {}}}()"
  69779. var external_function_try_return_convert_catch_e_return_ = __webpack_require__(6);
  69780. var external_function_try_return_convert_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_convert_catch_e_return_);
  69781. // EXTERNAL MODULE: external "function(){try{return canvg}catch(e){return {}}}()"
  69782. var external_function_try_return_canvg_catch_e_return_ = __webpack_require__(10);
  69783. var external_function_try_return_canvg_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_canvg_catch_e_return_);
  69784. // CONCATENATED MODULE: ./src/mapboxgl/mapping/WebMap.js
  69785. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  69786. * This program are made available under the terms of the Apache License, Version 2.0
  69787. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69788. external_mapboxgl_default.a.supermap = external_mapboxgl_default.a.supermap || {};
  69789. const MB_SCALEDENOMINATOR_3857 = [
  69790. '559082264.0287178',
  69791. '279541132.0143589',
  69792. '139770566.0071794',
  69793. '69885283.00358972',
  69794. '34942641.50179486',
  69795. '17471320.75089743',
  69796. '8735660.375448715',
  69797. '4367830.1877224357',
  69798. '2183915.093862179',
  69799. '1091957.546931089',
  69800. '545978.7734655447',
  69801. '272989.7734655447',
  69802. '272989.3867327723',
  69803. '136494.6933663862',
  69804. '68247.34668319309',
  69805. '34123.67334159654',
  69806. '17061.83667079827',
  69807. '8530.918335399136',
  69808. '4265.459167699568',
  69809. '2132.729583849784'
  69810. ];
  69811. const MB_SCALEDENOMINATOR_4326 = [
  69812. '5.590822640287176E8',
  69813. '2.795411320143588E8',
  69814. '1.397705660071794E8',
  69815. '6.98852830035897E7',
  69816. '3.494264150179485E7',
  69817. '1.7471320750897426E7',
  69818. '8735660.375448713',
  69819. '4367830.187724357',
  69820. '2183915.0938621783',
  69821. '1091957.5469310891',
  69822. '545978.7734655446',
  69823. '272989.3867327723',
  69824. '136494.69336638614',
  69825. '68247.34668319307',
  69826. '34123.673341596535',
  69827. '17061.836670798268',
  69828. '8530.918335399134'
  69829. ];
  69830. const DEFAULT_WELLKNOWNSCALESET = ['GoogleCRS84Quad', 'GoogleMapsCompatible'];
  69831. /**
  69832. * @class mapboxgl.supermap.WebMap
  69833. * @version 9.1.2
  69834. * @category iPortal/Online
  69835. * @classdesc 对接 iPortal/Online 地图类。目前支持地图坐标系包括:'EPSG:3857','EPSG:4326','EPSG:4490','EPSG:4214','EPSG:4610'。
  69836. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  69837. * <p style="color: #ce4844">Notice</p>
  69838. * <p style="font-size: 13px">该功能依赖 <a href='https://iclient.supermap.io/web/libs/geostats/geostats.js'>geostats</a> 和 <a href='https://iclient.supermap.io/web/libs/jsonsql/jsonsql.js'>JsonSql</a> 插件,请确认引入该插件。</p>
  69839. * `<script type="text/javascript" src="https://iclient.supermap.io/web/libs/geostats/geostats.js"></script>`</br>
  69840. * `<script type="text/javascript" src="https://iclient.supermap.io/web/libs/jsonsql/jsonsql.js"></script>`
  69841. * </div>
  69842. * @param {number} id - iPortal|Online 地图 ID。
  69843. * @param {Object} options - 参数。
  69844. * @param {string} [options.target='map'] - 地图容器 ID。
  69845. * @param {string} [options.server="https://www.supermapol.com"] - 地图的地址。
  69846. * @param {string} [options.credentialKey] - 凭证密钥。
  69847. * @param {string} [options.credentialValue] - 凭证值。
  69848. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69849. * @param {boolean} [options.excludePortalProxyUrl] - server 传递过来的 URL 是否带有代理。
  69850. * @fires mapboxgl.supermap.WebMap#getmapfailed
  69851. * @fires mapboxgl.supermap.WebMap#getwmtsfailed
  69852. * @fires mapboxgl.supermap.WebMap#getlayersfailed
  69853. * @fires mapboxgl.supermap.WebMap#getfeaturesfailed
  69854. * @fires mapboxgl.supermap.WebMap#addlayerssucceeded
  69855. * @extends {mapboxgl.Evented}
  69856. */
  69857. class WebMap_WebMap extends external_mapboxgl_default.a.Evented {
  69858. /**
  69859. * @constructs
  69860. * @version 9.1.2
  69861. */
  69862. constructor(id, options) {
  69863. super();
  69864. this.mapId = id;
  69865. options = options || {};
  69866. this.server = options.server || 'https://www.supermapol.com';
  69867. this.credentialKey = options.credentialKey;
  69868. this.credentialValue = options.credentialValue;
  69869. this.withCredentials = options.withCredentials || false;
  69870. this.target = options.target || 'map';
  69871. this._createWebMap();
  69872. }
  69873. /**
  69874. * @function mapboxgl.supermap.WebMap.prototype.resize
  69875. * @description map resize。
  69876. * @version 9.1.2
  69877. */
  69878. resize() {
  69879. this.map.resize();
  69880. }
  69881. /**
  69882. * @function mapboxgl.supermap.WebMap.prototype.setMapId
  69883. * @param {string} mapId - webMap 地图 ID。
  69884. * @description 设置 WebMap ID。
  69885. * @version 9.1.2
  69886. */
  69887. setMapId(mapId) {
  69888. this.mapId = mapId;
  69889. this._createWebMap();
  69890. }
  69891. /**
  69892. * @function mapboxgl.supermap.WebMap.prototype.setWebMapOptions
  69893. * @param {Object} webMapOptions - webMap 参数。
  69894. * @description 设置 webMap 参数。
  69895. * @version 9.1.2
  69896. */
  69897. setWebMapOptions(webMapOptions) {
  69898. this.server = webMapOptions.server;
  69899. this._createWebMap();
  69900. }
  69901. /**
  69902. * @function mapboxgl.supermap.WebMap.prototype.setMapOptions
  69903. * @param {Object} mapOptions - map 参数。
  69904. * @description 设置 map 参数。
  69905. * @version 9.1.2
  69906. */
  69907. setMapOptions(mapOptions) {
  69908. let { center, zoom, maxBounds, minZoom, maxZoom, isWorldCopy, bearing, pitch } = mapOptions;
  69909. center && center.length && this.map.setCenter(center);
  69910. zoom && this.map.setZoom(zoom);
  69911. maxBounds && this.map.setMaxBounds(maxBounds);
  69912. minZoom && this.map.setMinZoom(minZoom);
  69913. maxZoom && this.map.setMaxZoom(maxZoom);
  69914. isWorldCopy && this.map.setRenderWorldCopies(isWorldCopy);
  69915. bearing && this.map.setBearing(bearing);
  69916. pitch && this.map.setPitch(pitch);
  69917. }
  69918. /**
  69919. * @private
  69920. * @function mapboxgl.supermap.WebMap.prototype._createWebMap
  69921. * @description 登陆窗口后添加地图图层。
  69922. */
  69923. _createWebMap() {
  69924. let urlArr = this.server.split('');
  69925. if (urlArr[urlArr.length - 1] !== '/') {
  69926. this.server += '/';
  69927. }
  69928. let mapUrl = this.server + 'web/maps/' + this.mapId + '/map';
  69929. if (this.credentialValue && this.credentialKey) {
  69930. mapUrl += '?' + this.credentialKey + '=' + this.credentialValue;
  69931. }
  69932. let filter = 'getUrlResource.json?url=';
  69933. if (this.excludePortalProxyUrl && this.server.indexOf(filter) > -1) {
  69934. //大屏需求,或者有加上代理的
  69935. let urlArray = this.server.split(filter);
  69936. if (urlArray.length > 1) {
  69937. mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
  69938. }
  69939. }
  69940. this._getMapInfo(mapUrl);
  69941. }
  69942. /**
  69943. * @private
  69944. * @function mapboxgl.supermap.WebMap.prototype._createMap
  69945. * @description 创建地图。
  69946. */
  69947. _createMap(mapInfo) {
  69948. // 获取字体样式
  69949. let fonts = [];
  69950. let layers = mapInfo.layers;
  69951. // 获取 label 图层字体类型
  69952. if (layers && layers.length > 0) {
  69953. layers.forEach(layer => {
  69954. layer.labelStyle && fonts.push(layer.labelStyle.fontFamily);
  69955. }, this);
  69956. }
  69957. fonts.push("'supermapol-icons'");
  69958. let fontFamilys = fonts.join(',');
  69959. // zoom center
  69960. let oldcenter = mapInfo.center,
  69961. zoom = mapInfo.level || 0,
  69962. center,
  69963. zoomBase = 0;
  69964. // zoom = zoom === 0 ? 0 : zoom - 1;
  69965. if (mapInfo.minScale && mapInfo.maxScale) {
  69966. zoomBase = this._transformScaleToZoom(mapInfo.minScale, external_mapboxgl_default.a.CRS ? external_mapboxgl_default.a.CRS.get(this.baseProjection):'EPSG:3857');
  69967. } else {
  69968. zoomBase = +Math.log2(
  69969. this._getResolution(external_mapboxgl_default.a.CRS ? external_mapboxgl_default.a.CRS.get(this.baseProjection).getExtent():[-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892]) / this._getResolution(mapInfo.extent)
  69970. ).toFixed(2);
  69971. }
  69972. zoom += zoomBase;
  69973. center = oldcenter ? this._unproject([oldcenter.x, oldcenter.y]) : new external_mapboxgl_default.a.LngLat(0, 0);
  69974. // 初始化 map
  69975. this.map = new external_mapboxgl_default.a.Map({
  69976. container: this.target,
  69977. center: center,
  69978. zoom: zoom,
  69979. style: {
  69980. version: 8,
  69981. sources: {},
  69982. // "glyphs": 'https://iclient.supermap.io/iserver/services/map-beijing/rest/maps/beijingMap/tileFeature/sdffonts/{fontstack}/{range}.pbf',
  69983. layers: []
  69984. },
  69985. crs: this.baseProjection,
  69986. localIdeographFontFamily: fontFamilys || ''
  69987. });
  69988. this.fire('mapinitialized');
  69989. }
  69990. /**
  69991. * @private
  69992. * @function mapboxgl.supermap.WebMap.prototype._getMapInfo
  69993. * @description 获取地图的 JSON 信息。
  69994. * @param {string} url - 请求地图的 url。
  69995. */
  69996. _getMapInfo(url) {
  69997. let mapUrl = url.indexOf('.json') === -1 ? `${url}.json` : url;
  69998. FetchRequest.get(mapUrl, null, { withCredentials: this.withCredentials })
  69999. .then(response => {
  70000. return response.json();
  70001. })
  70002. .then(mapInfo => {
  70003. this.baseProjection = mapInfo.projection;
  70004. //存储地图的名称以及描述等信息,返回给用户
  70005. this.mapParams = {
  70006. title: mapInfo.title,
  70007. description: mapInfo.description
  70008. };
  70009. const projectionMap = {
  70010. 'EPSG:4490': 'EPSG:4490',
  70011. 'EPSG:4214': 'EPSG:4214',
  70012. 'EPSG:4610': 'EPSG:4610',
  70013. 'EPSG:3857': 'EPSG:3857',
  70014. 'EPSG:4326': 'EPSG:4326'
  70015. }; // 坐标系异常处理
  70016. if (this.baseProjection in projectionMap) {
  70017. this._createMap(mapInfo, this.mapSetting);
  70018. let layers = mapInfo.layers;
  70019. this.map.on('load', () => {
  70020. this._addBaseMap(mapInfo);
  70021. if (!layers || layers.length === 0) {
  70022. this._sendMapToUser(0, 0);
  70023. } else {
  70024. this._addLayers(layers);
  70025. }
  70026. });
  70027. } else {
  70028. throw Error(Lang.i18n('msg_crsunsupport'));
  70029. }
  70030. })
  70031. .catch(error => {
  70032. /**
  70033. * @event mapboxgl.supermap.WebMap#getmapfailed
  70034. * @description 获取地图信息失败。
  70035. * @property {Object} error - 失败原因。
  70036. */
  70037. this.fire('getmapfailed', { error: error });
  70038. });
  70039. }
  70040. /**
  70041. * @private
  70042. * @function mapboxgl.supermap.WebMap.prototype._addBaseMap
  70043. * @description 添加底图。
  70044. * @param {Object} mapInfo - map 信息。
  70045. */
  70046. _addBaseMap(mapInfo) {
  70047. this._createBaseLayer(mapInfo);
  70048. }
  70049. /**
  70050. * @private
  70051. * @function mapboxgl.supermap.WebMap.prototype._createBaseLayer
  70052. * @description 创建底图。
  70053. * @param {Object} mapInfo - map 信息。
  70054. */
  70055. _createBaseLayer(mapInfo) {
  70056. let layerInfo = mapInfo.baseLayer || mapInfo;
  70057. let layerType = layerInfo.layerType; //底图和rest地图兼容
  70058. if (
  70059. layerType.indexOf('TIANDITU_VEC') > -1 ||
  70060. layerType.indexOf('TIANDITU_IMG') > -1 ||
  70061. layerType.indexOf('TIANDITU_TER') > -1
  70062. ) {
  70063. layerType = layerType.substr(0, 12);
  70064. }
  70065. let mapUrls = {
  70066. CLOUD: 'http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}',
  70067. CLOUD_BLACK: 'http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}',
  70068. OSM: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
  70069. GOOGLE:
  70070. 'https://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0',
  70071. GOOGLE_CN: 'https://mt{0-3}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',
  70072. JAPAN_STD: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
  70073. JAPAN_PALE: 'https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png',
  70074. JAPAN_RELIEF: 'https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png',
  70075. JAPAN_ORT: 'https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg'
  70076. },
  70077. url;
  70078. switch (layerType) {
  70079. case 'TIANDITU_VEC':
  70080. case 'TIANDITU_IMG':
  70081. case 'TIANDITU_TER':
  70082. this._createTiandituLayer(mapInfo);
  70083. break;
  70084. case 'BING':
  70085. this._createBingLayer(layerInfo.name);
  70086. break;
  70087. case 'WMS':
  70088. this._createWMSLayer(layerInfo);
  70089. break;
  70090. case 'WMTS':
  70091. this._createWMTSLayer(layerInfo);
  70092. break;
  70093. case 'TILE':
  70094. case 'SUPERMAP_REST':
  70095. this._createDynamicTiledLayer(layerInfo);
  70096. break;
  70097. case 'CLOUD':
  70098. case 'CLOUD_BLACK':
  70099. case 'OSM':
  70100. case 'JAPAN_ORT':
  70101. case 'JAPAN_RELIEF':
  70102. case 'JAPAN_PALE':
  70103. case 'JAPAN_STD':
  70104. case 'GOOGLE_CN':
  70105. case 'GOOGLE':
  70106. url = mapUrls[layerType];
  70107. this._createXYZLayer(layerInfo, url);
  70108. break;
  70109. case 'MAPBOXSTYLE':
  70110. this._createMapboxStyle(layerInfo);
  70111. break;
  70112. default:
  70113. break;
  70114. }
  70115. }
  70116. /**
  70117. * @private
  70118. * @function mapboxgl.supermap.WebMap.prototype._createMapboxStyle
  70119. * @description 创建 Mapbox 样式。
  70120. * @param {Object} mapInfo - map 信息。
  70121. */
  70122. _createMapboxStyle(mapInfo) {
  70123. let _this = this,
  70124. { dataSource = {} } = mapInfo,
  70125. { serverId, url } = dataSource,
  70126. styleUrl;
  70127. styleUrl = serverId !== undefined ? `${this.server}web/datas/${serverId}/download` : url;
  70128. FetchRequest.get(styleUrl, null, {
  70129. withCredentials: this.withCredentials,
  70130. withoutFormatSuffix: true,
  70131. headers: {
  70132. 'Content-Type': 'application/json;chartset=uft-8'
  70133. }
  70134. }).then(response => {
  70135. return response.json();
  70136. }).then(style => {
  70137. _this._matchStyleObject(style);
  70138. _this.map.setStyle(style);
  70139. })
  70140. }
  70141. /**
  70142. * @private
  70143. * @function mapboxgl.supermap.WebMap.prototype._matchStyleObject
  70144. * @description 恢复 style 为标准格式。
  70145. * @param {Object} style - mapbox 样式。
  70146. */
  70147. _matchStyleObject(style) {
  70148. let { sprite, glyphs } = style;
  70149. if (sprite && typeof sprite === 'object'){
  70150. style.sprite = Object.values(sprite)[0];
  70151. }
  70152. if (glyphs && typeof glyphs === 'object'){
  70153. style.glyphs = Object.values(glyphs)[0];
  70154. }
  70155. }
  70156. /**
  70157. * @private
  70158. * @function mapboxgl.supermap.WebMap.prototype._createTiandituLayer
  70159. * @description 创建天地图底图。
  70160. * @param {Object} mapInfo - map 信息。
  70161. */
  70162. _createTiandituLayer(mapInfo) {
  70163. let tiandituUrls = this._getTiandituUrl(mapInfo);
  70164. let layerType = mapInfo.baseLayer.layerType;
  70165. let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
  70166. let labelUrl = tiandituUrls['labelUrl'];
  70167. let tiandituUrl = tiandituUrls['tiandituUrl'];
  70168. this._addBaselayer(tiandituUrl, 'tianditu-layers-' + layerType);
  70169. isLabel && this._addBaselayer(labelUrl, 'tianditu-label-layers-' + layerType);
  70170. }
  70171. /**
  70172. * @private
  70173. * @function mapboxgl.supermap.WebMap.prototype._createWMTSLayer
  70174. * @description 创建 WMTS 底图。
  70175. * @param {Object} mapInfo - map 信息。
  70176. */
  70177. _createWMTSLayer(layerInfo) {
  70178. let wmtsUrl = this._getWMTSUrl(layerInfo);
  70179. this._filterWMTSIsMatched(layerInfo, (isMatched, matchMaxZoom) => {
  70180. isMatched && this._addBaselayer([wmtsUrl], 'wmts-layers' + layerInfo.name, 0, matchMaxZoom);
  70181. });
  70182. }
  70183. /**
  70184. * @private
  70185. * @function mapboxgl.supermap.WebMap.prototype._filterWMTSIsMatched
  70186. * @description 过滤能够跟mapboxgl匹配的wmts服务。
  70187. * @param {Object} mapInfo - map 信息。
  70188. * @callback matchedCallback
  70189. */
  70190. _filterWMTSIsMatched(mapInfo, matchedCallback) {
  70191. let isMatched = false,
  70192. matchMaxZoom = 22,
  70193. url = mapInfo.url;
  70194. let options = {
  70195. withCredentials: false,
  70196. withoutFormatSuffix: true
  70197. };
  70198. FetchRequest.get(url, null, options)
  70199. .then(response => {
  70200. return response.text();
  70201. })
  70202. .then(capabilitiesText => {
  70203. let converts = external_function_try_return_convert_catch_e_return_default.a ? external_function_try_return_convert_catch_e_return_default.a : window.convert;
  70204. let tileMatrixSet = JSON.parse(converts.xml2json(capabilitiesText, { compact: true, spaces: 4 }))
  70205. .Capabilities.Contents.TileMatrixSet;
  70206. if (!Array.isArray(tileMatrixSet)) {
  70207. tileMatrixSet = [tileMatrixSet];
  70208. }
  70209. for (let i = 0; i < tileMatrixSet.length; i++) {
  70210. if (
  70211. tileMatrixSet[i]['ows:Identifier'] &&
  70212. tileMatrixSet[i]['ows:Identifier']['_text'] === mapInfo.tileMatrixSet
  70213. ) {
  70214. if (DEFAULT_WELLKNOWNSCALESET.indexOf(tileMatrixSet[i]['WellKnownScaleSet']['_text']) > -1) {
  70215. isMatched = true;
  70216. } else if (
  70217. tileMatrixSet[i]['WellKnownScaleSet'] &&
  70218. tileMatrixSet[i]['WellKnownScaleSet']['_text'] === 'Custom'
  70219. ) {
  70220. let matchedScaleDenominator = [];
  70221. //坐标系判断
  70222. let defaultCRSScaleDenominators =
  70223. this.map.crs === 'EPSG:3857' ? MB_SCALEDENOMINATOR_3857 : MB_SCALEDENOMINATOR_4326;
  70224. for (let j = 0, len = defaultCRSScaleDenominators.length; j < len; j++) {
  70225. if (!tileMatrixSet[i].TileMatrix[j]) {
  70226. break;
  70227. }
  70228. if (
  70229. defaultCRSScaleDenominators[j] !==
  70230. tileMatrixSet[i].TileMatrix[j]['ScaleDenominator']['_text']
  70231. ) {
  70232. break;
  70233. }
  70234. matchedScaleDenominator.push(defaultCRSScaleDenominators[j]);
  70235. }
  70236. matchMaxZoom = matchedScaleDenominator.length - 1;
  70237. if (matchedScaleDenominator.length !== 0) {
  70238. isMatched = true;
  70239. } else {
  70240. throw Error(Lang.i18n('msg_tilematrixsetunsupport'));
  70241. }
  70242. } else {
  70243. throw Error(Lang.i18n('msg_tilematrixsetunsupport'));
  70244. }
  70245. }
  70246. }
  70247. matchedCallback(isMatched, matchMaxZoom);
  70248. })
  70249. .catch(error => {
  70250. /**
  70251. * @event mapboxgl.supermap.WebMap#getwmtsfailed
  70252. * @description 获取 WMTS 图层信息失败。
  70253. * @property {Object} error - 失败原因。
  70254. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  70255. */
  70256. this.fire('getwmtsfailed', { error: error, map: this.map });
  70257. });
  70258. }
  70259. /**
  70260. * @private
  70261. * @function mapboxgl.supermap.WebMap.prototype._createBingLayer
  70262. * @description 创建 Bing 图层。
  70263. */
  70264. _createBingLayer(layerName) {
  70265. let bingUrl =
  70266. 'https://dynamic.t0.tiles.ditu.live.com/comp/ch/{quadkey}?it=G,TW,L,LA&mkt=zh-cn&og=109&cstl=w4c&ur=CN&n=z';
  70267. this.addLayer([bingUrl], 'bing-layers-' + layerName);
  70268. }
  70269. /**
  70270. * @private
  70271. * @function mapboxgl.supermap.WebMap.prototype._createXYZLayer
  70272. * @description 创建 XYZ 底图。
  70273. * @param {String} url - url 地址。
  70274. */
  70275. _createXYZLayer(layerInfo, url) {
  70276. let urlArr = [];
  70277. if (layerInfo.layerType === 'OSM') {
  70278. let res = url.match(/\w\-\w/g)[0];
  70279. let start = res[0];
  70280. let end = res[2];
  70281. let alphabet = '';
  70282. for (let i = 97; i < 123; i++) {
  70283. alphabet += String.fromCharCode(i);
  70284. }
  70285. let alphabetArr = alphabet.split('');
  70286. let startIndex = alphabetArr.indexOf(start);
  70287. let endIndex = alphabetArr.indexOf(end);
  70288. let res3 = alphabetArr.slice(startIndex, endIndex + 1);
  70289. for (let i = 0; i < res3.length; i++) {
  70290. let replaceRes = url.replace(/{\w\-\w}/g, res3[i]);
  70291. urlArr.push(replaceRes);
  70292. }
  70293. } else if (layerInfo.layerType === 'GOOGLE_CN') {
  70294. let res = url.match(/\d\-\d/g)[0];
  70295. let start = res[0];
  70296. let end = res[2];
  70297. for (let i = start; i <= end; i++) {
  70298. let replaceRes = url.replace(/{\d\-\d}/g, i);
  70299. urlArr.push(replaceRes);
  70300. }
  70301. } else {
  70302. urlArr = [url];
  70303. }
  70304. this._addBaselayer(urlArr, 'XYZ-layers-' + layerInfo.name);
  70305. }
  70306. /**
  70307. * @private
  70308. * @function mapboxgl.supermap.WebMap.prototype._createDynamicTiledLayer
  70309. * @description 创建 iserver 底图。
  70310. * @param {Object} layerInfo - 图层信息。
  70311. */
  70312. _createDynamicTiledLayer(layerInfo) {
  70313. let url = layerInfo.url;
  70314. const layerId = layerInfo.layerID || layerInfo.name;
  70315. const { minzoom, maxzoom } = layerInfo;
  70316. this._addBaselayer([url], layerId, minzoom, maxzoom, true);
  70317. }
  70318. /**
  70319. * @private
  70320. * @function mapboxgl.supermap.WebMap.prototype._createWMSLayer
  70321. * @description 创建 WMS 图层。
  70322. * @param {Object} mapInfo - map 信息。
  70323. */
  70324. _createWMSLayer(layerInfo) {
  70325. let WMSUrl = this._getWMSUrl(layerInfo);
  70326. this._addBaselayer([WMSUrl], 'WMS-layers-' + layerInfo.name);
  70327. }
  70328. /**
  70329. * @private
  70330. * @function mapboxgl.supermap.WebMap.prototype._createVectorLayer
  70331. * @description 创建 Vector 图层。
  70332. * @param {Object} layerInfo - map 信息。
  70333. * @param {Array} features - 属性 信息。
  70334. */
  70335. _createVectorLayer(layerInfo, features) {
  70336. let style = layerInfo.style;
  70337. let type = layerInfo.featureType;
  70338. let layerID = layerInfo.layerID;
  70339. let visible = layerInfo.visible;
  70340. let layerStyle = {};
  70341. layerStyle.style = this._transformStyleToMapBoxGl(style, type);
  70342. layerStyle.layout = { visibility: visible };
  70343. let source = {
  70344. type: 'geojson',
  70345. data: {
  70346. type: 'FeatureCollection',
  70347. features: features
  70348. }
  70349. };
  70350. this._addOverlayToMap(type, source, layerID, layerStyle);
  70351. // 如果面有边框
  70352. type === 'POLYGON' &&
  70353. style.strokeColor &&
  70354. this._addStrokeLineForPoly(style, source, layerID + '-strokeLine', visible);
  70355. }
  70356. /**
  70357. * @function mapboxgl.supermap.WebMap.prototype._getTiandituUrl
  70358. * @private
  70359. * @description 创建天地图url;
  70360. * @param {Object} mapInfo - map 信息。
  70361. */
  70362. _getTiandituUrl(mapInfo) {
  70363. let re = /t0/gi;
  70364. let tiandituUrls = {};
  70365. let layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase();
  70366. let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
  70367. // let isLabel = true;
  70368. let url = 'https://t0.tianditu.gov.cn/{layer}_{proj}/wmts?';
  70369. let labelUrl = url;
  70370. let layerLabelMap = {
  70371. vec: 'cva',
  70372. ter: 'cta',
  70373. img: 'cia'
  70374. };
  70375. let tilematrixSet = this.baseProjection === 'EPSG:4326' ? 'c' : 'w';
  70376. let options = {
  70377. service: 'WMTS',
  70378. request: 'GetTile',
  70379. style: 'default',
  70380. version: '1.0.0',
  70381. layer: layerType,
  70382. tilematrixSet: tilematrixSet,
  70383. format: 'tiles',
  70384. width: 256,
  70385. height: 256
  70386. };
  70387. url += this._getParamString(options, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  70388. let tiandituUrl = url.replace('{layer}', layerType).replace('{proj}', tilematrixSet);
  70389. let tiandituUrlArr = [];
  70390. for (let i = 0; i < 8; i++) {
  70391. tiandituUrlArr.push(tiandituUrl.replace(re, `t${i}`));
  70392. }
  70393. tiandituUrls['tiandituUrl'] = tiandituUrlArr;
  70394. // 如果有 label 图层
  70395. if (isLabel) {
  70396. let labelLayer = layerLabelMap[layerType];
  70397. options.layer = labelLayer;
  70398. labelUrl += this._getParamString(options, labelUrl) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  70399. labelUrl = labelUrl.replace('{layer}', labelLayer).replace('{proj}', tilematrixSet);
  70400. let labelUrlArr = [];
  70401. for (let i = 0; i < 8; i++) {
  70402. labelUrlArr.push(labelUrl.replace(re, `t${i}`));
  70403. }
  70404. tiandituUrls['labelUrl'] = labelUrlArr;
  70405. }
  70406. return tiandituUrls;
  70407. }
  70408. /**
  70409. * @function mapboxgl.supermap.WebMap.prototype._getWMSUrl
  70410. * @private
  70411. * @description 创建 WMS url;
  70412. * @param {Object} mapInfo - map 信息。
  70413. */
  70414. _getWMSUrl(mapInfo) {
  70415. let url = mapInfo.url;
  70416. url = url.split('?')[0];
  70417. let strArr = url.split('/');
  70418. let options = {
  70419. service: 'WMS',
  70420. request: 'GetMap',
  70421. layers: strArr[strArr.length - 1],
  70422. styles: '',
  70423. format: 'image/png',
  70424. transparent: 'true',
  70425. version: '1.1.1',
  70426. width: 256,
  70427. height: 256,
  70428. srs: this.baseProjection
  70429. };
  70430. let bbox = this.baseProjection === 'EPSG:4326' ? '{bbox-epsg-4326}' : '{bbox-epsg-3857}';
  70431. url += this._getParamString(options, url) + `&bbox=${bbox}`;
  70432. return url;
  70433. }
  70434. /**
  70435. * @private
  70436. * @function mapboxgl.supermap.WebMap.prototype._addLayers
  70437. * @description 添加叠加图层。
  70438. * @param {Object} mapInfo - 图层信息。
  70439. */
  70440. _addLayers(layers) {
  70441. //存储地图上所有的图层对象
  70442. this.layers = layers;
  70443. let features,
  70444. layerAdded = 0,
  70445. len = layers.length;
  70446. layers.forEach((layer, index) => {
  70447. if ((layer.dataSource && layer.dataSource.serverId) || layer.layerType === 'MARKER') {
  70448. // 获取 serverID
  70449. let serverId = layer.dataSource ? layer.dataSource.serverId : layer.serverId;
  70450. let url = `${this.server}web/datas/${serverId}/content.json?pageSize=9999999&currentPage=1`;
  70451. // 获取图层数据
  70452. serverId &&
  70453. FetchRequest.get(url, null, { withCredentials: this.withCredentials })
  70454. .then(response => {
  70455. return response.json();
  70456. })
  70457. .then(data => {
  70458. if (data.succeed === false) {
  70459. //请求失败
  70460. layerAdded++;
  70461. this._sendMapToUser(layerAdded, len);
  70462. /**
  70463. * @event mapboxgl.supermap.WebMap#getlayersfailed
  70464. * @description 获取图层信息失败。
  70465. * @property {Object} error - 失败原因。
  70466. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  70467. */
  70468. this.fire('getlayersfailed', { error: data.error, map: this.map });
  70469. return;
  70470. }
  70471. if (data.type) {
  70472. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  70473. data.content = JSON.parse(data.content.trim());
  70474. features = this._formatGeoJSON(data.content, layer);
  70475. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  70476. features = this._excelData2Feature(data.content, layer);
  70477. }
  70478. this._addLayer(layer, features, index);
  70479. layerAdded++;
  70480. this._sendMapToUser(layerAdded, len);
  70481. }
  70482. })
  70483. .catch(error => {
  70484. layerAdded++;
  70485. this._sendMapToUser(layerAdded, len);
  70486. this.fire('getlayersfailed', { error: error, map: this.map });
  70487. });
  70488. } else if (
  70489. layer.layerType === 'SUPERMAP_REST' ||
  70490. layer.layerType === 'TILE' ||
  70491. layer.layerType === 'WMS' ||
  70492. layer.layerType === 'WMTS'
  70493. ) {
  70494. this._createBaseLayer(layer);
  70495. layerAdded++;
  70496. this._sendMapToUser(layerAdded, len);
  70497. } else if (layer.dataSource && layer.dataSource.type === 'REST_DATA') {
  70498. let dataSource = layer.dataSource;
  70499. //从restData获取数据
  70500. this._getFeatureBySQL(
  70501. dataSource.url,
  70502. [dataSource.dataSourseName || layer.name],
  70503. result => {
  70504. features = this._parseGeoJsonData2Feature({
  70505. allDatas: { features: result.result.features.features },
  70506. fileCode: layer.projection,
  70507. featureProjection: this.baseProjection
  70508. });
  70509. this._addLayer(layer, features, index);
  70510. layerAdded++;
  70511. this._sendMapToUser(layerAdded, len);
  70512. },
  70513. err => {
  70514. layerAdded++;
  70515. this._sendMapToUser(layerAdded, len);
  70516. /**
  70517. * @event mapboxgl.supermap.WebMap#getfeaturesfailed
  70518. * @description 获取图层要素失败。
  70519. * @property {Object} error - 失败原因。
  70520. */
  70521. this.fire('getfeaturesfailed', { error: err });
  70522. }
  70523. );
  70524. } else if (layer.dataSource && layer.dataSource.type === 'REST_MAP' && layer.dataSource.url) {
  70525. this._queryFeatureBySQL(
  70526. layer.dataSource.url,
  70527. layer.dataSource.layerName,
  70528. 'smid=1',
  70529. null,
  70530. null,
  70531. result => {
  70532. let recordsets = result && result.result.recordsets;
  70533. let recordset = recordsets && recordsets[0];
  70534. let attributes = recordset.fields;
  70535. if (recordset && attributes) {
  70536. let fileterAttrs = [];
  70537. for (let i in attributes) {
  70538. let value = attributes[i];
  70539. if (value.indexOf('Sm') !== 0 || value === 'SmID') {
  70540. fileterAttrs.push(value);
  70541. }
  70542. }
  70543. this._getFeatures(
  70544. fileterAttrs,
  70545. layer,
  70546. features => {
  70547. this._addLayer(layer, features, index);
  70548. layerAdded++;
  70549. this._sendMapToUser(layerAdded, len);
  70550. },
  70551. err => {
  70552. layerAdded++;
  70553. this.fire('getfeaturesfailed', { error: err, map: this.map });
  70554. }
  70555. );
  70556. }
  70557. },
  70558. err => {
  70559. this.fire('getlayersfailed', { error: err, map: this.map });
  70560. }
  70561. );
  70562. }
  70563. }, this);
  70564. }
  70565. /**
  70566. * @private
  70567. * @function mapboxgl.supermap.WebMap.prototype._getFeatures
  70568. * @description 将单个图层添加到地图上。
  70569. * @param layerInfo 某个图层的图层信息
  70570. * @param {Array.<GeoJSON>} features - feature。
  70571. */
  70572. _getFeatures(fields, layerInfo, resolve, reject) {
  70573. let source = layerInfo.dataSource;
  70574. //示例数据
  70575. let fileCode = layerInfo.projection;
  70576. this._queryFeatureBySQL(
  70577. source.url,
  70578. source.layerName,
  70579. null,
  70580. fields,
  70581. null,
  70582. result => {
  70583. let recordsets = result.result.recordsets[0];
  70584. let features = recordsets.features.features;
  70585. let featuresObj = this._parseGeoJsonData2Feature(
  70586. {
  70587. allDatas: { features },
  70588. fileCode: fileCode,
  70589. featureProjection: this.baseProjection
  70590. },
  70591. 'JSON'
  70592. );
  70593. resolve(featuresObj);
  70594. },
  70595. err => {
  70596. reject(err);
  70597. }
  70598. );
  70599. }
  70600. /**
  70601. * @private
  70602. * @function mapboxgl.supermap.WebMap.prototype._addLayer
  70603. * @description 将单个图层添加到地图上。
  70604. * @param layerInfo 某个图层的图层信息
  70605. * @param {Array.<GeoJSON>} features - feature。
  70606. */
  70607. _addLayer(layerInfo, features, index) {
  70608. let layerType = layerInfo.layerType;
  70609. layerInfo.layerID = layerType + '-' + layerInfo.name + '-' + index;
  70610. layerInfo.visible = layerInfo.visible ? 'visible' : 'none';
  70611. // mbgl 目前不能处理 geojson 复杂面情况
  70612. // mbgl isssue https://github.com/mapbox/mapbox-gl-js/issues/7023
  70613. if (features[0] && features[0].geometry.type === 'Polygon') {
  70614. features = this._handleMultyPolygon(features);
  70615. }
  70616. if (layerInfo.style && layerInfo.filterCondition) {
  70617. //将 feature 根据过滤条件进行过滤, 分段专题图和单值专题图因为要计算 styleGroup 所以暂时不过滤
  70618. if (layerType !== 'RANGE' && layerType !== 'UNIQUE') {
  70619. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  70620. }
  70621. }
  70622. if (layerType === 'VECTOR') {
  70623. if (layerInfo.featureType === 'POINT') {
  70624. if (layerInfo.style.type === 'SYMBOL_POINT') {
  70625. this._createSymbolLayer(layerInfo, features);
  70626. } else {
  70627. this._createGraphicLayer(layerInfo, features);
  70628. }
  70629. } else {
  70630. //线和面
  70631. this._createVectorLayer(layerInfo, features);
  70632. }
  70633. } else if (layerType === 'UNIQUE') {
  70634. this._createUniqueLayer(layerInfo, features);
  70635. } else if (layerType === 'RANGE') {
  70636. this._createRangeLayer(layerInfo, features);
  70637. } else if (layerType === 'HEAT') {
  70638. this._createHeatLayer(layerInfo, features);
  70639. } else if (layerType === 'MARKER') {
  70640. this._createMarkerLayer(layerInfo, features);
  70641. }
  70642. if (layerInfo.labelStyle && layerInfo.labelStyle.labelField) {
  70643. // 存在标签专题图
  70644. this._addLabelLayer(layerInfo, features);
  70645. }
  70646. }
  70647. /**
  70648. * @private
  70649. * @function mapboxgl.supermap.WebMap.prototype._addLabelLayer
  70650. * @description 添加标签图层。
  70651. * @param layerInfo 某个图层的图层信息。
  70652. * @param {Array.<GeoJSON>} features - feature。
  70653. */
  70654. _addLabelLayer(layerInfo, features) {
  70655. let labelStyle = layerInfo.labelStyle;
  70656. this.map.addLayer({
  70657. id: layerInfo.layerID + 'label',
  70658. type: 'symbol',
  70659. source: {
  70660. type: 'geojson',
  70661. data: {
  70662. type: 'FeatureCollection',
  70663. features: features
  70664. }
  70665. },
  70666. paint: {
  70667. 'text-color': labelStyle.fill
  70668. },
  70669. layout: {
  70670. 'text-field': `{${labelStyle.labelField}}`,
  70671. 'text-size': parseFloat(labelStyle.fontSize) || 12,
  70672. 'text-offset': labelStyle.offsetX
  70673. ? [labelStyle.offsetX / 10 || 0, labelStyle.offsetY / 10 || 0]
  70674. : [0, -1.5],
  70675. 'text-font': ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'],
  70676. visibility: layerInfo.visible
  70677. }
  70678. });
  70679. }
  70680. /**
  70681. * @private
  70682. * @function mapboxgl.supermap.WebMap.prototype._createSymbolLayer
  70683. * @description 添加 symbol 图层。
  70684. * @param layerInfo 某个图层的图层信息。
  70685. * @param {Array.<GeoJSON>} features - feature。
  70686. */
  70687. _createSymbolLayer(layerInfo, features) {
  70688. //用来请求symbol_point字体文件
  70689. let target = document.getElementById(`${this.target}`);
  70690. target.classList.add('supermapol-icons-map');
  70691. let style = layerInfo.style;
  70692. let unicode = layerInfo.style.unicode;
  70693. let text = String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16));
  70694. let layerID = layerInfo.layerID;
  70695. this.map.addSource(layerID + '-source', {
  70696. type: 'geojson',
  70697. data: {
  70698. type: 'FeatureCollection',
  70699. features: []
  70700. }
  70701. });
  70702. this.map.addLayer({
  70703. id: layerID,
  70704. type: 'symbol',
  70705. source: layerID + '-source',
  70706. paint: {
  70707. 'text-color': style.fillColor
  70708. },
  70709. layout: {
  70710. 'text-field': text,
  70711. 'text-font': ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'],
  70712. visibility: layerInfo.visible
  70713. }
  70714. });
  70715. this.map.getSource(layerID + '-source').setData({
  70716. type: 'FeatureCollection',
  70717. features: features
  70718. });
  70719. }
  70720. /**
  70721. * @private
  70722. * @function mapboxgl.supermap.WebMap.prototype._createGraphicLayer
  70723. * @description 创建 Graphic 图层。
  70724. * @param {Object} layerInfo - map 信息。
  70725. * @param {Array} features - 属性 信息。
  70726. */
  70727. _createGraphicLayer(layerInfo, features) {
  70728. let style = layerInfo.style;
  70729. let layerStyle = {};
  70730. let layerID = layerInfo.layerID;
  70731. let source = {
  70732. type: 'geojson',
  70733. data: {
  70734. type: 'FeatureCollection',
  70735. features: features
  70736. }
  70737. };
  70738. if (style.type === 'IMAGE_POINT') {
  70739. let imageInfo = style.imageInfo;
  70740. let imgDom = imageInfo.img;
  70741. if (!imgDom || !imgDom.src) {
  70742. //要组装成完整的url
  70743. imageInfo.url = this.server + imageInfo.url;
  70744. }
  70745. this.map.loadImage(imageInfo.url || imgDom.src, (error, image) => {
  70746. if (error) {
  70747. console.log(error);
  70748. }
  70749. let iconSize = Number.parseFloat((style.radius / image.height).toFixed(2)) * 2;
  70750. this.map.addImage('imageIcon', image);
  70751. this.map.addLayer({
  70752. id: layerID,
  70753. type: 'symbol',
  70754. source: source,
  70755. layout: {
  70756. 'icon-image': 'imageIcon',
  70757. 'icon-size': iconSize,
  70758. visibility: layerInfo.visible
  70759. }
  70760. });
  70761. });
  70762. } else if (style.type === 'SVG_POINT') {
  70763. let svg_url = style.url;
  70764. if (!this.svgDiv) {
  70765. this.svgDiv = document.createElement('div');
  70766. document.body.appendChild(this.svgDiv);
  70767. }
  70768. this._getCanvasFromSVG(svg_url, this.svgDiv, canvas => {
  70769. let imgUrl = canvas.toDataURL('img/png');
  70770. imgUrl &&
  70771. this.map.loadImage(
  70772. imgUrl,
  70773. (error, image) => {
  70774. if (error) {
  70775. console.log(error);
  70776. }
  70777. let iconSize = Number.parseFloat((style.radius / canvas.width).toFixed(2));
  70778. this.map.addImage('imageIcon', image);
  70779. this.map.addLayer({
  70780. id: layerID,
  70781. type: 'symbol',
  70782. source: source,
  70783. layout: {
  70784. 'icon-image': 'imageIcon',
  70785. 'icon-size': iconSize,
  70786. visibility: layerInfo.visible
  70787. }
  70788. });
  70789. },
  70790. this
  70791. );
  70792. });
  70793. } else {
  70794. layerStyle.style = this._transformStyleToMapBoxGl(style, layerInfo.featureType);
  70795. layerStyle.layout = { visibility: layerInfo.visible };
  70796. this._addOverlayToMap('POINT', source, layerID, layerStyle);
  70797. }
  70798. }
  70799. /**
  70800. * @private
  70801. * @function mapboxgl.supermap.WebMap.prototype._createUniqueLayer
  70802. * @description 创建单值图层。
  70803. * @param layerInfo 某个图层的图层信息
  70804. * @param features 图层上的 feature
  70805. */
  70806. _createUniqueLayer(layerInfo, features) {
  70807. let styleGroup = this._getUniqueStyleGroup(layerInfo, features);
  70808. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  70809. let style = layerInfo.style;
  70810. let layerStyle = {};
  70811. let themeField = layerInfo.themeSetting.themeField;
  70812. let type = layerInfo.featureType;
  70813. let expression = ['match', ['get', 'index']];
  70814. let layerID = layerInfo.layerID;
  70815. features.forEach(row => {
  70816. styleGroup.forEach(item => {
  70817. if (item.value === row.properties[themeField]) {
  70818. expression.push(row.properties['index'], item.color);
  70819. }
  70820. });
  70821. });
  70822. expression.push('#ffffff');
  70823. layerStyle.style = this._transformStyleToMapBoxGl(style, type, expression);
  70824. let visible = layerInfo.visible;
  70825. layerStyle.layout = { visibility: visible };
  70826. let source = {
  70827. type: 'geojson',
  70828. data: {
  70829. type: 'FeatureCollection',
  70830. features: features
  70831. }
  70832. };
  70833. this._addOverlayToMap(type, source, layerID, layerStyle);
  70834. type === 'POLYGON' &&
  70835. style.strokeColor &&
  70836. this._addStrokeLineForPoly(style, source, layerID + '-strokeLine', visible);
  70837. }
  70838. /**
  70839. * @private
  70840. * @function mapboxgl.supermap.WebMap.prototype._getUniqueStyleGroup
  70841. * @description 获取单值的目标字段与颜色的对应数组。
  70842. * @param layerInfo 某个图层的图层信息
  70843. * @param features 图层上的 feature
  70844. */
  70845. _getUniqueStyleGroup(parameters, features) {
  70846. // 找出所有的单值
  70847. let featureType = parameters.featureType,
  70848. style = parameters.style,
  70849. themeSetting = parameters.themeSetting;
  70850. let fieldName = themeSetting.themeField,
  70851. colors = themeSetting.colors;
  70852. let names = [],
  70853. customSettings = themeSetting.customSettings;
  70854. for (let i in features) {
  70855. let properties = features[i].properties;
  70856. let name = properties[fieldName];
  70857. let isSaved = false;
  70858. for (let j in names) {
  70859. if (names[j] === name) {
  70860. isSaved = true;
  70861. break;
  70862. }
  70863. }
  70864. if (!isSaved) {
  70865. names.push(name);
  70866. }
  70867. }
  70868. //获取一定量的颜色
  70869. let curentColors = colors || this.defaultParameters.colors;
  70870. curentColors = ColorsPickerUtil.getGradientColors(curentColors, names.length);
  70871. //生成styleGroup
  70872. let styleGroup = [];
  70873. names.forEach((name, index) => {
  70874. let color = curentColors[index];
  70875. if (name in customSettings) {
  70876. color = customSettings[name];
  70877. }
  70878. if (featureType === 'LINE') {
  70879. style.strokeColor = color;
  70880. } else {
  70881. style.fillColor = color;
  70882. }
  70883. styleGroup.push({ color: color, value: name });
  70884. }, this);
  70885. return styleGroup;
  70886. }
  70887. /**
  70888. * @private
  70889. * @function mapboxgl.supermap.WebMap.prototype._getWMTSUrl
  70890. * @description 根据传入的配置信息拼接wmts url。
  70891. * @param options 配置对象
  70892. */
  70893. _getWMTSUrl(options) {
  70894. let obj = {
  70895. service: 'WMTS',
  70896. request: 'GetTile',
  70897. version: '1.0.0',
  70898. style: 'default',
  70899. layer: options.layer,
  70900. tilematrixSet: options.tileMatrixSet,
  70901. format: 'image/png'
  70902. };
  70903. let url = options.url;
  70904. url += this._getParamString(obj, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  70905. return url;
  70906. }
  70907. /**
  70908. * @private
  70909. * @function mapboxgl.supermap.WebMap.prototype._createMarkerLayer
  70910. * @description 添加标记图层。
  70911. * @param {Array.<GeoJSON>} features - feature。
  70912. */
  70913. _createMarkerLayer(layerInfo, features) {
  70914. features &&
  70915. features.forEach(feature => {
  70916. let geomType = feature.geometry.type.toUpperCase();
  70917. let defaultStyle = feature.dv_v5_markerStyle;
  70918. if (geomType === 'POINT' && defaultStyle.text) {
  70919. //说明是文字的feature类型
  70920. geomType = 'TEXT';
  70921. }
  70922. let featureInfo = this.setFeatureInfo(feature);
  70923. feature.properties['useStyle'] = defaultStyle;
  70924. feature.properties['featureInfo'] = featureInfo;
  70925. if (
  70926. geomType === 'POINT' &&
  70927. defaultStyle.src &&
  70928. (defaultStyle.src.indexOf('http://') === -1 && defaultStyle.src.indexOf('https://') === -1)
  70929. ) {
  70930. //说明地址不完整
  70931. defaultStyle.src = this.server + defaultStyle.src;
  70932. }
  70933. let source = {
  70934. type: 'geojson',
  70935. data: feature
  70936. };
  70937. let index = feature.properties.index;
  70938. let layerID = geomType + '-' + index;
  70939. // image-marker
  70940. geomType === 'POINT' &&
  70941. defaultStyle.src &&
  70942. defaultStyle.src.indexOf('svg') <= -1 &&
  70943. this.map.loadImage(
  70944. defaultStyle.src,
  70945. (error, image) => {
  70946. if (error) {
  70947. console.log(error);
  70948. }
  70949. this.map.addImage(index + '', image);
  70950. this.map.addLayer({
  70951. id: layerID,
  70952. type: 'symbol',
  70953. source: source,
  70954. layout: {
  70955. 'icon-image': index + '',
  70956. 'icon-size': defaultStyle.scale,
  70957. visibility: layerInfo.visible
  70958. }
  70959. });
  70960. },
  70961. this
  70962. );
  70963. // svg-marker
  70964. if (geomType === 'POINT' && defaultStyle.src && defaultStyle.src.indexOf('svg') > -1) {
  70965. if (!this.svgDiv) {
  70966. this.svgDiv = document.createElement('div');
  70967. document.body.appendChild(this.svgDiv);
  70968. }
  70969. this._getCanvasFromSVG(defaultStyle.src, this.svgDiv, canvas => {
  70970. let imgUrl = canvas.toDataURL('img/png');
  70971. imgUrl &&
  70972. this.map.loadImage(
  70973. imgUrl,
  70974. (error, image) => {
  70975. if (error) {
  70976. console.log(error);
  70977. }
  70978. this.map.addImage(index + '', image);
  70979. this.map.addLayer({
  70980. id: layerID,
  70981. type: 'symbol',
  70982. source: source,
  70983. layout: {
  70984. 'icon-image': index + '',
  70985. 'icon-size': defaultStyle.scale,
  70986. visibility: layerInfo.visible
  70987. }
  70988. });
  70989. },
  70990. this
  70991. );
  70992. });
  70993. }
  70994. // point-line-polygon-marker
  70995. if (!defaultStyle.src) {
  70996. let layeStyle = { layout: {} };
  70997. if (geomType === 'LINESTRING' && defaultStyle.lineCap) {
  70998. geomType = 'LINE';
  70999. layeStyle.layout = { 'line-cap': defaultStyle.lineCap };
  71000. }
  71001. let visible = layerInfo.visible;
  71002. layeStyle.layout.visibility = visible;
  71003. // get style
  71004. layeStyle.style = this._transformStyleToMapBoxGl(defaultStyle, geomType);
  71005. this._addOverlayToMap(geomType, source, layerID, layeStyle);
  71006. // 若面有边框
  71007. geomType === 'POLYGON' &&
  71008. defaultStyle.strokeColor &&
  71009. this._addStrokeLineForPoly(defaultStyle, source, layerID + '-strokeLine', visible);
  71010. }
  71011. }, this);
  71012. }
  71013. /**
  71014. * @private
  71015. * @function mapboxgl.supermap.WebMap.prototype.setFeatureInfo
  71016. * @description 设置 feature 信息。
  71017. * @param {Array.<GeoJSON>} features - feature。
  71018. */
  71019. setFeatureInfo(feature) {
  71020. let featureInfo;
  71021. let info = feature.dv_v5_markerInfo;
  71022. if (info && info.dataViz_title) {
  71023. //有featureInfo信息就不需要再添加
  71024. featureInfo = info;
  71025. } else {
  71026. // featureInfo = this.getDefaultAttribute();
  71027. return info;
  71028. }
  71029. let properties = feature.properties;
  71030. for (let key in featureInfo) {
  71031. if (properties[key]) {
  71032. featureInfo[key] = properties[key];
  71033. delete properties[key];
  71034. }
  71035. }
  71036. return featureInfo;
  71037. }
  71038. /**
  71039. * @private
  71040. * @function mapboxgl.supermap.WebMap.prototype._createHeatLayer
  71041. * @description 添加热力图。
  71042. * @param {Array.<GeoJSON>} features - feature。
  71043. */
  71044. _createHeatLayer(layerInfo, features) {
  71045. let style = layerInfo.themeSetting;
  71046. let layerOption = {};
  71047. layerOption.gradient = style.colors.slice();
  71048. layerOption.radius = parseInt(style.radius);
  71049. //自定义颜色
  71050. let customSettings = style.customSettings;
  71051. for (let i in customSettings) {
  71052. layerOption.gradient[i] = customSettings[i];
  71053. }
  71054. // 权重字段恢复
  71055. if (style.weight) {
  71056. this._changeWeight(features, style.weight);
  71057. }
  71058. let color = ['interpolate', ['linear'], ['heatmap-density']];
  71059. let length = layerOption.gradient.length;
  71060. let step = (1 / length).toFixed(2);
  71061. layerOption.gradient.forEach((item, index) => {
  71062. color.push(index * step);
  71063. if (index === 0) {
  71064. item = core_Util_Util.hexToRgba(item, 0);
  71065. }
  71066. color.push(item);
  71067. });
  71068. let paint = {
  71069. 'heatmap-color': color,
  71070. 'heatmap-radius': style.radius + 15,
  71071. 'heatmap-intensity': { base: 1, stops: [[0, 0.8], [22, 1]] }
  71072. };
  71073. if (features[0].weight && features.length >= 4) {
  71074. let weight = [];
  71075. features.forEach(item => {
  71076. weight.push(item.weight);
  71077. });
  71078. let max = ArrayStatistic.getMax(weight);
  71079. let min = ArrayStatistic.getMin(weight);
  71080. paint['heatmap-weight'] = ['interpolate', ['linear'], ['get', 'weight'], min, 0, max, 1];
  71081. }
  71082. this.map.addLayer({
  71083. id: layerInfo.layerID,
  71084. type: 'heatmap',
  71085. source: {
  71086. type: 'geojson',
  71087. data: {
  71088. type: 'FeatureCollection',
  71089. features: features
  71090. }
  71091. },
  71092. paint: paint
  71093. });
  71094. }
  71095. /**
  71096. * @private
  71097. * @function mapboxgl.supermap.WebMap.prototype._changeWeight
  71098. * @description 改变当前权重字段
  71099. * @param {Array.<GeoJSON>} features - feature。
  71100. * @param {String} weightFeild - 权重字段
  71101. */
  71102. _changeWeight(features, weightFeild) {
  71103. this.fieldMaxValue = {};
  71104. this._getMaxValue(features, weightFeild);
  71105. let maxValue = this.fieldMaxValue[weightFeild];
  71106. features.forEach(feature => {
  71107. let attributes = feature.properties;
  71108. let value = attributes[weightFeild];
  71109. feature['weight'] = value / maxValue;
  71110. });
  71111. }
  71112. /**
  71113. * @private
  71114. * @function mapboxgl.supermap.WebMap.prototype._getMaxValue
  71115. * @description 获取当前字段对应的最大值,用于计算权重。
  71116. * @param {Array.<GeoJSON>} features - feature。
  71117. * @param {String} weightFeild - 权重字段
  71118. */
  71119. _getMaxValue(features, weightField) {
  71120. let values = [],
  71121. attributes;
  71122. let field = weightField;
  71123. if (this.fieldMaxValue[field]) {
  71124. return;
  71125. }
  71126. features.forEach(feature => {
  71127. //收集当前权重字段对应的所有值
  71128. attributes = feature.properties;
  71129. attributes && parseFloat(attributes[field]) && values.push(parseFloat(attributes[field]));
  71130. });
  71131. this.fieldMaxValue[field] = ArrayStatistic.getArrayStatistic(values, 'Maximum');
  71132. }
  71133. /**
  71134. * @private
  71135. * @function mapboxgl.supermap.WebMap.prototype._createRangeLayer
  71136. * @description 添加分段专题图。
  71137. * @param {Array.<GeoJSON>} features - feature。
  71138. */
  71139. _createRangeLayer(layerInfo, features) {
  71140. let fieldName = layerInfo.themeSetting.themeField;
  71141. let style = layerInfo.style;
  71142. let featureType = layerInfo.featureType;
  71143. let styleGroups = this._getRangeStyleGroup(layerInfo, features);
  71144. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  71145. let source = {
  71146. type: 'geojson',
  71147. data: {
  71148. type: 'FeatureCollection',
  71149. features: features
  71150. }
  71151. };
  71152. // 获取 expression
  71153. let expression = ['match', ['get', 'index']];
  71154. features.forEach(row => {
  71155. let tartget = parseFloat(row.properties[fieldName]);
  71156. for (let i = 0; i < styleGroups.length; i++) {
  71157. if (styleGroups[i].start <= tartget && tartget < styleGroups[i].end) {
  71158. expression.push(row.properties['index'], styleGroups[i].color);
  71159. // return;
  71160. }
  71161. }
  71162. !tartget && expression.push(row.properties['index'], 'rgba(0, 0, 0, 0)');
  71163. }, this);
  71164. expression.push('rgba(0, 0, 0, 0)');
  71165. // 获取样式
  71166. let layerStyle = { layout: {} };
  71167. if (featureType === 'LINE' && style.lineCap) {
  71168. layerStyle.layout = { 'line-cap': style.lineCap };
  71169. }
  71170. let visible = layerInfo.visible;
  71171. layerStyle.layout.visibility = visible;
  71172. layerStyle.style = this._transformStyleToMapBoxGl(style, featureType, expression);
  71173. // 添加图层
  71174. let layerID = layerInfo.layerID;
  71175. this._addOverlayToMap(featureType, source, layerID, layerStyle);
  71176. // 如果面有边框
  71177. featureType === 'POLYGON' &&
  71178. style.strokeColor &&
  71179. this._addStrokeLineForPoly(style, source, layerID + '-strokeline', visible);
  71180. }
  71181. /**
  71182. * @private
  71183. * @function mapboxgl.supermap.WebMap.prototype._getFiterFeatures
  71184. * @description 通过过滤条件查询满足的 feature。
  71185. * @param {String} filterCondition - 过滤条件。
  71186. * @param {array} allFeatures - 图层上的 feature 集合
  71187. */
  71188. _getFiterFeatures(filterCondition, allFeatures) {
  71189. if (!filterCondition) {
  71190. return allFeatures;
  71191. }
  71192. let condition = this._replaceFilterCharacter(filterCondition);
  71193. let sql = 'select * from json where (' + condition + ')';
  71194. let filterFeatures = [];
  71195. for (let i = 0; i < allFeatures.length; i++) {
  71196. let feature = allFeatures[i];
  71197. let filterResult = false;
  71198. try {
  71199. filterResult = window.jsonsql.query(sql, {
  71200. properties: feature.properties
  71201. });
  71202. } catch (err) {
  71203. //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
  71204. continue;
  71205. }
  71206. if (filterResult && filterResult.length > 0) {
  71207. //afterFilterFeatureIdx.push(i);
  71208. filterFeatures.push(feature);
  71209. }
  71210. }
  71211. return filterFeatures;
  71212. }
  71213. /**
  71214. * @private
  71215. * @function mapboxgl.supermap.WebMap.prototype._replaceFilterCharacter
  71216. * @description 获取过滤字符串。
  71217. * @param {String} filterString - 过滤条件。
  71218. */
  71219. _replaceFilterCharacter(filterString) {
  71220. filterString = filterString
  71221. .replace(/=/g, '==')
  71222. .replace(/AND|and/g, '&&')
  71223. .replace(/or|OR/g, '||')
  71224. .replace(/<==/g, '<=')
  71225. .replace(/>==/g, '>=');
  71226. return filterString;
  71227. }
  71228. /**
  71229. * @private
  71230. * @function mapboxgl.supermap.WebMap.prototype._getRangeStyleGroup
  71231. * @description 获取分段样式。
  71232. * @param {Array.<GeoJSON>} features - feature。
  71233. */
  71234. _getRangeStyleGroup(layerInfo, features) {
  71235. // 找出分段值
  71236. let featureType = layerInfo.featureType;
  71237. let style = layerInfo.style;
  71238. let values = [],
  71239. attributes;
  71240. let themeSetting = layerInfo.themeSetting;
  71241. let customSettings = themeSetting.customSettings;
  71242. let fieldName = themeSetting.themeField;
  71243. let segmentCount = themeSetting.segmentCount;
  71244. features.forEach(feature => {
  71245. attributes = feature.properties || feature.get('Properties');
  71246. if (attributes) {
  71247. //过滤掉非数值的数据
  71248. attributes[fieldName] &&
  71249. core_Util_Util.isNumber(attributes[fieldName]) &&
  71250. values.push(parseFloat(attributes[fieldName]));
  71251. } else if (feature.get(fieldName) && core_Util_Util.isNumber(feature.get(fieldName))) {
  71252. feature.get(fieldName) && values.push(parseFloat(feature.get(fieldName)));
  71253. }
  71254. }, this);
  71255. let segements = ArrayStatistic.getArraySegments(values, themeSetting.segmentMethod, segmentCount);
  71256. if (segements) {
  71257. let itemNum = segmentCount;
  71258. if (attributes && segements[0] === segements[attributes.length - 1]) {
  71259. itemNum = 1;
  71260. segements.length = 2;
  71261. }
  71262. //保留两位有效数
  71263. for (let key in segements) {
  71264. let value = segements[key];
  71265. value = key == 0 ? Math.floor(value * 100) / 100 : Math.ceil(value * 100) / 100 + 0.1; // 加0.1 解决最大值没有样式问题
  71266. segements[key] = Number(value.toFixed(2));
  71267. }
  71268. //获取一定量的颜色
  71269. let curentColors = themeSetting.colors;
  71270. // curentColors = ColorsPickerUtil.getGradientColors(curentColors, itemNum, 'RANGE');
  71271. for (let index = 0; index < itemNum; index++) {
  71272. if (index in customSettings) {
  71273. if (customSettings[index]['segment']['start']) {
  71274. segements[index] = customSettings[index]['segment']['start'];
  71275. }
  71276. if (customSettings[index]['segment']['end']) {
  71277. segements[index + 1] = customSettings[index]['segment']['end'];
  71278. }
  71279. }
  71280. }
  71281. //生成styleGroup
  71282. let styleGroups = [];
  71283. for (let i = 0; i < itemNum; i++) {
  71284. let color = curentColors[i];
  71285. if (i in customSettings) {
  71286. if (customSettings[i].color) {
  71287. color = customSettings[i].color;
  71288. }
  71289. }
  71290. if (featureType === 'LINE') {
  71291. style.strokeColor = color;
  71292. } else {
  71293. style.fillColor = color;
  71294. }
  71295. let start = segements[i];
  71296. let end = segements[i + 1];
  71297. let styleObj = JSON.parse(JSON.stringify(style));
  71298. styleGroups.push({ style: styleObj, color: color, start: start, end: end });
  71299. }
  71300. return styleGroups;
  71301. }
  71302. }
  71303. /**
  71304. * @private
  71305. * @function mapboxgl.supermap.WebMap.prototype._formatGeoJSON
  71306. * @description 格式 GeoJSON。
  71307. * @param {GeoJSON} data - GeoJSON 数据。
  71308. */
  71309. _formatGeoJSON(data) {
  71310. let features = data.features;
  71311. features.forEach((row, index) => {
  71312. row.properties['index'] = index;
  71313. // TODO 待优化 坐标转换
  71314. // if (fileCode !== 'EPSG:4326') {
  71315. // if(row.geometry.coordinates[0] instanceof Array){
  71316. // row.geometry.coordinates.forEach((coords, index) => {
  71317. // let lnglat = this._unproject(coords);
  71318. // row.geometry.coordinates[index] = [lnglat.lng, lnglat.lat];
  71319. // }, this)
  71320. // return;
  71321. // }
  71322. // let lnglat = this._unproject(row.geometry.coordinates);
  71323. // row.geometry.coordinates = [lnglat.lng, lnglat.lat];
  71324. // }
  71325. });
  71326. return features;
  71327. }
  71328. /**
  71329. * @private
  71330. * @function mapboxgl.supermap.WebMap.prototype._excelData2Feature将
  71331. * @description csv 和 xls 文件内容转换成 geojson
  71332. * @param content 文件内容
  71333. * @param layerInfo 图层信息
  71334. * @returns {Array} feature的数组集合
  71335. */
  71336. _excelData2Feature(dataContent) {
  71337. let fieldCaptions = dataContent.colTitles;
  71338. // let fileCode = layerInfo.projection;
  71339. //位置属性处理
  71340. let xfieldIndex = -1,
  71341. yfieldIndex = -1;
  71342. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  71343. if (this._isXField(fieldCaptions[i])) {
  71344. xfieldIndex = i;
  71345. }
  71346. if (this._isYField(fieldCaptions[i])) {
  71347. yfieldIndex = i;
  71348. }
  71349. }
  71350. // feature 构建后期支持坐标系 4326/3857
  71351. let features = [];
  71352. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  71353. let row = dataContent.rows[i];
  71354. let x = Number(row[xfieldIndex]),
  71355. y = Number(row[yfieldIndex]);
  71356. // let coordinates = [x, y];
  71357. // TODO 待优化 坐标转换
  71358. // if (fileCode !== 'EPSG:4326') {
  71359. // if(row.geometry.coordinates[0] instanceof Array){
  71360. // row.geometry.coordinates.forEach((coords, index) => {
  71361. // let lnglat = this._unproject(coords);
  71362. // row.geometry.coordinates[index] = [lnglat.lng, lnglat.lat];
  71363. // }, this)
  71364. // return;
  71365. // }
  71366. // let lnglat = this._unproject(row.geometry.coordinates);
  71367. // row.geometry.coordinates = [lnglat.lng, lnglat.lat];
  71368. // }
  71369. //属性信息
  71370. let attributes = {};
  71371. for (let index in dataContent.colTitles) {
  71372. let key = dataContent.colTitles[index];
  71373. attributes[key] = dataContent.rows[i][index];
  71374. }
  71375. attributes['index'] = i + '';
  71376. //目前csv 只支持处理点,所以先生成点类型的 geojson
  71377. let feature = {
  71378. type: 'Feature',
  71379. geometry: {
  71380. type: 'Point',
  71381. coordinates: [x, y]
  71382. },
  71383. properties: attributes
  71384. };
  71385. features.push(feature);
  71386. }
  71387. return features;
  71388. }
  71389. /**
  71390. * @private
  71391. * @function mapboxgl.supermap.WebMap.prototype._sendMapToUser
  71392. * @description 返回最终的 map 对象给用户,供他们操作使用。
  71393. * @param count
  71394. * @param layersLen
  71395. */
  71396. _sendMapToUser(count, layersLen) {
  71397. if (count === layersLen) {
  71398. /**
  71399. * @event mapboxgl.supermap.WebMap#addlayerssucceeded
  71400. * @description 添加图层成功。
  71401. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  71402. * @property {Object} mapparams - 地图信息。
  71403. * @property {string} mapParams.title - 地图标题。
  71404. * @property {string} mapParams.description - 地图描述。
  71405. * @property {Array.<Object>} layers - 地图上所有的图层对象
  71406. */
  71407. this.fire('addlayerssucceeded', { map: this.map, mapparams: this.mapParams, layers: this.layers });
  71408. }
  71409. }
  71410. /**
  71411. * @function mapboxgl.supermap.WebMap.prototype._unproject
  71412. * @private
  71413. * @description 墨卡托转经纬度。
  71414. * @param {} point - 待转换的点。
  71415. */
  71416. _unproject(point) {
  71417. var d = 180 / Math.PI,
  71418. r = 6378137,
  71419. ts = Math.exp(-point[1] / r),
  71420. phi = Math.PI / 2 - 2 * Math.atan(ts);
  71421. for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {
  71422. con = 1;
  71423. dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;
  71424. phi += dphi;
  71425. }
  71426. return new external_mapboxgl_default.a.LngLat((point[0] * d) / r, phi * d);
  71427. }
  71428. /**
  71429. * @function mapboxgl.supermap.WebMap.prototype._getParamString
  71430. * @private
  71431. * @param {Object} obj - 待添加的参数。
  71432. * @param {string} existingUrl - 待添加参数的 url。
  71433. * @param {Boolean} [uppercase] - 参数是否转换为大写。
  71434. */
  71435. _getParamString(obj, existingUrl, uppercase) {
  71436. var params = [];
  71437. for (var i in obj) {
  71438. params.push((uppercase ? i.toUpperCase() : i) + '=' + obj[i]);
  71439. }
  71440. return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');
  71441. }
  71442. /**
  71443. * @private
  71444. * @description 判断是否地理X坐标
  71445. * @param data
  71446. */
  71447. _isXField(data) {
  71448. var lowerdata = data.toLowerCase();
  71449. return (
  71450. lowerdata === 'x' ||
  71451. lowerdata === 'smx' ||
  71452. lowerdata === 'jd' ||
  71453. lowerdata === '经度' ||
  71454. lowerdata === '东经' ||
  71455. lowerdata === 'longitude' ||
  71456. lowerdata === 'lot' ||
  71457. lowerdata === 'lon' ||
  71458. lowerdata === 'lng'
  71459. );
  71460. }
  71461. /**
  71462. * @private
  71463. * @description 判断是否地理Y坐标
  71464. * @param data
  71465. */
  71466. _isYField(data) {
  71467. var lowerdata = data.toLowerCase();
  71468. return (
  71469. lowerdata === 'y' ||
  71470. lowerdata === 'smy' ||
  71471. lowerdata === 'wd' ||
  71472. lowerdata === '纬度' ||
  71473. lowerdata === '北纬' ||
  71474. lowerdata === 'latitude' ||
  71475. lowerdata === 'lat'
  71476. );
  71477. }
  71478. /**
  71479. * @private
  71480. * @function mapboxgl.supermap.WebMap.prototype._transformStyleToMapBoxGl
  71481. * @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxgl 中的 style 格式。
  71482. * @param {Object} style - layerInfo中的style属性
  71483. * @param {String} type - 图层类型
  71484. * @param {Array} [expression] - 存储颜色值得表达式
  71485. */
  71486. _transformStyleToMapBoxGl(style, type, expression) {
  71487. let transTable = {};
  71488. if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') {
  71489. transTable = {
  71490. fillColor: 'circle-color',
  71491. strokeWidth: 'circle-stroke-width',
  71492. fillOpacity: 'circle-opacity',
  71493. radius: 'circle-radius',
  71494. strokeColor: 'circle-stroke-color',
  71495. strokeOpacity: 'circle-stroke-opacity'
  71496. };
  71497. } else if (type === 'LINE') {
  71498. transTable = {
  71499. strokeWidth: 'line-width',
  71500. strokeColor: 'line-color',
  71501. strokeOpacity: 'line-opacity'
  71502. };
  71503. } else if (type === 'POLYGON') {
  71504. transTable = {
  71505. fillColor: 'fill-color',
  71506. fillOpacity: 'fill-opacity',
  71507. strokeColor: 'fill-outline-color'
  71508. };
  71509. }
  71510. let newObj = {};
  71511. for (let item in style) {
  71512. if (transTable[item]) {
  71513. newObj[transTable[item]] = style[item];
  71514. }
  71515. }
  71516. if (expression) {
  71517. if (newObj['circle-color']) {
  71518. newObj['circle-color'] = expression;
  71519. } else if (newObj['line-color']) {
  71520. newObj['line-color'] = expression;
  71521. } else {
  71522. newObj['fill-color'] = expression;
  71523. }
  71524. }
  71525. if (style.lineDash && style.lineDash !== 'solid' && type === 'LINE') {
  71526. newObj['line-dasharray'] = this._dashStyle(style);
  71527. }
  71528. return newObj;
  71529. }
  71530. /**
  71531. * @private
  71532. * @function mapboxgl.supermap.WebMap.prototype.._dashStyle
  71533. * @description 符号样式。
  71534. * @param {Object} style - 样式参数。
  71535. * @param {number} widthFactor - 宽度系数。
  71536. */
  71537. _dashStyle(style) {
  71538. if (!style) {
  71539. return [];
  71540. }
  71541. // var w = style.strokeWidth * widthFactor;
  71542. var w = 1;
  71543. var str = style.strokeDashstyle || style.lineDash;
  71544. switch (str) {
  71545. case 'solid':
  71546. return [];
  71547. case 'dot':
  71548. return [1, 4 * w];
  71549. case 'dash':
  71550. return [4 * w, 4 * w];
  71551. case 'dashdot':
  71552. return [4 * w, 4 * w, 1 * w, 4 * w];
  71553. case 'longdash':
  71554. return [8 * w, 4 * w];
  71555. case 'longdashdot':
  71556. return [8 * w, 4 * w, 1, 4 * w];
  71557. default:
  71558. if (!str) {
  71559. return [];
  71560. }
  71561. if (Util_Util.isArray(str)) {
  71562. return str;
  71563. }
  71564. str = StringExt.trim(str).replace(/\s+/g, ',');
  71565. return str.replace(/\[|\]/gi, '').split(',');
  71566. }
  71567. }
  71568. /**
  71569. * @private
  71570. * @description 将SVG转换成Canvas
  71571. * @param svgUrl
  71572. * @param divDom
  71573. * @param callBack
  71574. */
  71575. _getCanvasFromSVG(svgUrl, divDom, callBack) {
  71576. //一个图层对应一个canvas
  71577. let canvas = document.createElement('canvas');
  71578. canvas.id = 'dataviz-canvas-' + core_Util_Util.newGuid(8);
  71579. canvas.style.display = 'none';
  71580. divDom.appendChild(canvas);
  71581. let canvgs = window.canvg ? window.canvg : external_function_try_return_canvg_catch_e_return_default.a;
  71582. canvgs(canvas.id, svgUrl, {
  71583. ignoreMouse: true,
  71584. ignoreAnimation: true,
  71585. renderCallback: () => {
  71586. if (canvas.width > 300 || canvas.height > 300) {
  71587. return;
  71588. }
  71589. callBack(canvas);
  71590. },
  71591. forceRedraw: () => {
  71592. return false;
  71593. }
  71594. });
  71595. }
  71596. /**
  71597. * @private
  71598. * @function mapboxgl.supermap.WebMap.prototype._addOverlayToMap
  71599. * @description 添加基础矢量图层到 MAP
  71600. * @param {Object} style - mabgl style
  71601. * @param {String} type - 图层类型
  71602. */
  71603. _addOverlayToMap(type, source, layerID, layerStyle) {
  71604. let mbglTypeMap = {
  71605. POINT: 'circle',
  71606. LINE: 'line',
  71607. POLYGON: 'fill'
  71608. };
  71609. type = mbglTypeMap[type];
  71610. if (type === 'circle' || type === 'line' || type === 'fill') {
  71611. this.map.addLayer({
  71612. id: layerID,
  71613. type: type,
  71614. source: source,
  71615. paint: layerStyle.style,
  71616. layout: layerStyle.layout || {}
  71617. });
  71618. }
  71619. }
  71620. _addBaselayer(url, layerID, minzoom = 0, maxzoom = 22, isIserver) {
  71621. this.map.addLayer({
  71622. id: layerID,
  71623. type: 'raster',
  71624. source: {
  71625. type: 'raster',
  71626. tiles: url,
  71627. tileSize: 256,
  71628. rasterSource: isIserver ? 'iserver' : '',
  71629. prjCoordSys: isIserver ? { epsgCode: this.baseProjection.split(':')[1] } : ''
  71630. },
  71631. minzoom: minzoom,
  71632. maxzoom: maxzoom
  71633. });
  71634. }
  71635. /**
  71636. * @private
  71637. * @function mapboxgl.supermap.WebMap.prototype._addStrokeLineForPoly
  71638. * @description 添加面的边框。
  71639. * @param {Object} style - mabgl style
  71640. */
  71641. _addStrokeLineForPoly(style, source, layerID, visible) {
  71642. let lineStyle = {};
  71643. lineStyle.style = this._transformStyleToMapBoxGl(style, 'LINE');
  71644. lineStyle.layout = { visibility: visible };
  71645. this._addOverlayToMap('LINE', source, layerID, lineStyle);
  71646. }
  71647. /**
  71648. * @private
  71649. * @function mapboxgl.supermap.WebMap.prototype._parseGeoJsonData2Feature
  71650. * @description 将从restData地址上获取的json转换成feature(从iserver中获取的json转换成feature)
  71651. * @param {object} metaData - json内容
  71652. * @returns {Array} ol.feature的数组集合
  71653. */
  71654. _parseGeoJsonData2Feature(metaData) {
  71655. let allFeatures = metaData.allDatas.features,
  71656. features = [];
  71657. for (let i = 0, len = allFeatures.length; i < len; i++) {
  71658. // TODO 坐标转换
  71659. let feature = allFeatures[i];
  71660. let coordinate = feature.geometry.coordinates;
  71661. if (allFeatures[i].geometry.type === 'Point') {
  71662. // 标注图层 还没有属性值时候不加
  71663. if (allFeatures[i].properties) {
  71664. allFeatures[i].properties.lon = coordinate[0];
  71665. allFeatures[i].properties.lat = coordinate[1];
  71666. }
  71667. }
  71668. features.properties['index'] = i + '';
  71669. features.push(feature);
  71670. }
  71671. return features;
  71672. }
  71673. /**
  71674. * @private
  71675. * @function mapboxgl.supermap.WebMap.prototype._getFeatureBySQL
  71676. * @description 通过 sql 方式查询数据。
  71677. */
  71678. _getFeatureBySQL(url, datasetNames, processCompleted, processFaild) {
  71679. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  71680. getFeatureParam = new FilterParameter_FilterParameter({
  71681. name: datasetNames.join().replace(':', '@'),
  71682. attributeFilter: 'SMID > 0'
  71683. });
  71684. getFeatureBySQLParams = new GetFeaturesBySQLParameters_GetFeaturesBySQLParameters({
  71685. queryParameter: getFeatureParam,
  71686. datasetNames: datasetNames,
  71687. fromIndex: 0,
  71688. toIndex: 100000,
  71689. returnContent: true
  71690. });
  71691. let options = {
  71692. eventListeners: {
  71693. processCompleted: getFeaturesEventArgs => {
  71694. processCompleted && processCompleted(getFeaturesEventArgs);
  71695. },
  71696. processFailed: e => {
  71697. processFaild && processFaild(e);
  71698. }
  71699. }
  71700. };
  71701. getFeatureBySQLService = new GetFeaturesBySQLService_GetFeaturesBySQLService(url, options);
  71702. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  71703. }
  71704. /**
  71705. * @private
  71706. * @function mapboxgl.supermap.WebMap.prototype._queryFeatureBySQL
  71707. * @description 通过 sql 方式查询数据。
  71708. */
  71709. _queryFeatureBySQL(
  71710. url,
  71711. layerName,
  71712. attributeFilter,
  71713. fields,
  71714. epsgCode,
  71715. processCompleted,
  71716. processFaild,
  71717. startRecord,
  71718. recordLength,
  71719. onlyAttribute
  71720. ) {
  71721. var queryParam, queryBySQLParams, queryBySQLService;
  71722. queryParam = new FilterParameter_FilterParameter({
  71723. name: layerName,
  71724. attributeFilter: attributeFilter
  71725. });
  71726. if (fields) {
  71727. queryParam.fields = fields;
  71728. }
  71729. var params = {
  71730. queryParams: [queryParam]
  71731. };
  71732. if (onlyAttribute) {
  71733. params.queryOption = QueryOption.ATTRIBUTE;
  71734. }
  71735. startRecord && (params.startRecord = startRecord);
  71736. recordLength && (params.expectCount = recordLength);
  71737. if (epsgCode) {
  71738. params.prjCoordSys = {
  71739. epsgCode: epsgCode
  71740. };
  71741. }
  71742. queryBySQLParams = new QueryBySQLParameters_QueryBySQLParameters(params);
  71743. queryBySQLService = new external_mapboxgl_default.a.supermap.QueryService(url);
  71744. queryBySQLService.queryBySQL(queryBySQLParams, data => {
  71745. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  71746. });
  71747. }
  71748. /**
  71749. * @private
  71750. * @function mapboxgl.supermap.WebMap.prototype._handleMultyPolygon
  71751. * @description 处理复杂面情况
  71752. */
  71753. _handleMultyPolygon(features) {
  71754. features.forEach(feature => {
  71755. if (feature.geometry.type !== 'Polygon') {
  71756. return;
  71757. }
  71758. let coords = feature.geometry.coordinates;
  71759. if (coords.length > 1) {
  71760. let coordinates = [];
  71761. coords.forEach(coord => {
  71762. coordinates.push([coord]);
  71763. });
  71764. feature.geometry.coordinates = coordinates;
  71765. feature.geometry.type = 'MultiPolygon';
  71766. }
  71767. });
  71768. return features;
  71769. }
  71770. _transformScaleToZoom(scale, crs) {
  71771. let scale_0 = 295829515.2024169;
  71772. if ((crs || this.map.getCRS()).epsgCode !== 'EPSG:3857') {
  71773. scale_0 = 295295895;
  71774. }
  71775. const scaleDenominator = scale.split(':')[1];
  71776. return Math.min(24, +Math.log2(scale_0 / +scaleDenominator).toFixed(2));
  71777. }
  71778. _getResolution(bounds, tileSize = 512.0) {
  71779. if (bounds.leftBottom && bounds.rightTop) {
  71780. return Math.max(bounds.rightTop.x - bounds.leftBottom.x, bounds.rightTop.y - bounds.leftBottom.y) / tileSize;
  71781. }
  71782. return Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) / tileSize;
  71783. }
  71784. }
  71785. external_mapboxgl_default.a.supermap.WebMap = WebMap_WebMap;
  71786. // CONCATENATED MODULE: ./src/mapboxgl/mapping/index.js
  71787. // CONCATENATED MODULE: ./src/mapboxgl/index.js
  71788. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  71789. * This program are made available under the terms of the Apache License, Version 2.0
  71790. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71791. /***/ }),
  71792. /* 19 */
  71793. /***/ (function(module, exports) {
  71794. // removed by extract-text-webpack-plugin
  71795. /***/ }),
  71796. /* 20 */,
  71797. /* 21 */,
  71798. /* 22 */,
  71799. /* 23 */,
  71800. /* 24 */,
  71801. /* 25 */
  71802. /***/ (function(module, exports) {
  71803. // removed by extract-text-webpack-plugin
  71804. /***/ })
  71805. /******/ ]);