iclient-mapboxgl-es6.js 3.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441
  1. /*!
  2. *
  3. * iclient-mapboxgl.(https://iclient.supermap.io)
  4. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd
  5. * license: Apache-2.0
  6. * version: v10.1.1
  7. *
  8. */
  9. /******/ (() => { // webpackBootstrap
  10. /******/ var __webpack_modules__ = ({
  11. /***/ 693:
  12. /***/ (function(module) {
  13. (function(self) {
  14. 'use strict';
  15. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  16. // with Ajax.
  17. if (!self.__disableNativeFetch && self.fetch) {
  18. return
  19. }
  20. function normalizeName(name) {
  21. if (typeof name !== 'string') {
  22. name = String(name)
  23. }
  24. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  25. throw new TypeError('Invalid character in header field name')
  26. }
  27. return name.toLowerCase()
  28. }
  29. function normalizeValue(value) {
  30. if (typeof value !== 'string') {
  31. value = String(value)
  32. }
  33. return value
  34. }
  35. function Headers(headers) {
  36. this.map = {}
  37. if (headers instanceof Headers) {
  38. headers.forEach(function(value, name) {
  39. this.append(name, value)
  40. }, this)
  41. } else if (headers) {
  42. Object.getOwnPropertyNames(headers).forEach(function(name) {
  43. this.append(name, headers[name])
  44. }, this)
  45. }
  46. }
  47. Headers.prototype.append = function(name, value) {
  48. name = normalizeName(name)
  49. value = normalizeValue(value)
  50. var list = this.map[name]
  51. if (!list) {
  52. list = []
  53. this.map[name] = list
  54. }
  55. list.push(value)
  56. }
  57. Headers.prototype['delete'] = function(name) {
  58. delete this.map[normalizeName(name)]
  59. }
  60. Headers.prototype.get = function(name) {
  61. var values = this.map[normalizeName(name)]
  62. return values ? values[0] : null
  63. }
  64. Headers.prototype.getAll = function(name) {
  65. return this.map[normalizeName(name)] || []
  66. }
  67. Headers.prototype.has = function(name) {
  68. return this.map.hasOwnProperty(normalizeName(name))
  69. }
  70. Headers.prototype.set = function(name, value) {
  71. this.map[normalizeName(name)] = [normalizeValue(value)]
  72. }
  73. Headers.prototype.forEach = function(callback, thisArg) {
  74. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  75. this.map[name].forEach(function(value) {
  76. callback.call(thisArg, value, name, this)
  77. }, this)
  78. }, this)
  79. }
  80. function consumed(body) {
  81. if (body.bodyUsed) {
  82. return Promise.reject(new TypeError('Already read'))
  83. }
  84. body.bodyUsed = true
  85. }
  86. function fileReaderReady(reader) {
  87. return new Promise(function(resolve, reject) {
  88. reader.onload = function() {
  89. resolve(reader.result)
  90. }
  91. reader.onerror = function() {
  92. reject(reader.error)
  93. }
  94. })
  95. }
  96. function readBlobAsArrayBuffer(blob) {
  97. var reader = new FileReader()
  98. reader.readAsArrayBuffer(blob)
  99. return fileReaderReady(reader)
  100. }
  101. function readBlobAsText(blob, options) {
  102. var reader = new FileReader()
  103. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  104. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  105. var _charset = blob.type.match(regex) || contentType.match(regex)
  106. var args = [blob]
  107. if(_charset) {
  108. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  109. }
  110. reader.readAsText.apply(reader, args)
  111. return fileReaderReady(reader)
  112. }
  113. var support = {
  114. blob: 'FileReader' in self && 'Blob' in self && (function() {
  115. try {
  116. new Blob();
  117. return true
  118. } catch(e) {
  119. return false
  120. }
  121. })(),
  122. formData: 'FormData' in self,
  123. arrayBuffer: 'ArrayBuffer' in self
  124. }
  125. function Body() {
  126. this.bodyUsed = false
  127. this._initBody = function(body, options) {
  128. this._bodyInit = body
  129. if (typeof body === 'string') {
  130. this._bodyText = body
  131. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  132. this._bodyBlob = body
  133. this._options = options
  134. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  135. this._bodyFormData = body
  136. } else if (!body) {
  137. this._bodyText = ''
  138. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  139. // Only support ArrayBuffers for POST method.
  140. // Receiving ArrayBuffers happens via Blobs, instead.
  141. } else {
  142. throw new Error('unsupported BodyInit type')
  143. }
  144. }
  145. if (support.blob) {
  146. this.blob = function() {
  147. var rejected = consumed(this)
  148. if (rejected) {
  149. return rejected
  150. }
  151. if (this._bodyBlob) {
  152. return Promise.resolve(this._bodyBlob)
  153. } else if (this._bodyFormData) {
  154. throw new Error('could not read FormData body as blob')
  155. } else {
  156. return Promise.resolve(new Blob([this._bodyText]))
  157. }
  158. }
  159. this.arrayBuffer = function() {
  160. return this.blob().then(readBlobAsArrayBuffer)
  161. }
  162. this.text = function() {
  163. var rejected = consumed(this)
  164. if (rejected) {
  165. return rejected
  166. }
  167. if (this._bodyBlob) {
  168. return readBlobAsText(this._bodyBlob, this._options)
  169. } else if (this._bodyFormData) {
  170. throw new Error('could not read FormData body as text')
  171. } else {
  172. return Promise.resolve(this._bodyText)
  173. }
  174. }
  175. } else {
  176. this.text = function() {
  177. var rejected = consumed(this)
  178. return rejected ? rejected : Promise.resolve(this._bodyText)
  179. }
  180. }
  181. if (support.formData) {
  182. this.formData = function() {
  183. return this.text().then(decode)
  184. }
  185. }
  186. this.json = function() {
  187. return this.text().then(JSON.parse)
  188. }
  189. return this
  190. }
  191. // HTTP methods whose capitalization should be normalized
  192. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  193. function normalizeMethod(method) {
  194. var upcased = method.toUpperCase()
  195. return (methods.indexOf(upcased) > -1) ? upcased : method
  196. }
  197. function Request(input, options) {
  198. options = options || {}
  199. var body = options.body
  200. if (Request.prototype.isPrototypeOf(input)) {
  201. if (input.bodyUsed) {
  202. throw new TypeError('Already read')
  203. }
  204. this.url = input.url
  205. this.credentials = input.credentials
  206. if (!options.headers) {
  207. this.headers = new Headers(input.headers)
  208. }
  209. this.method = input.method
  210. this.mode = input.mode
  211. if (!body) {
  212. body = input._bodyInit
  213. input.bodyUsed = true
  214. }
  215. } else {
  216. this.url = input
  217. }
  218. this.credentials = options.credentials || this.credentials || 'omit'
  219. if (options.headers || !this.headers) {
  220. this.headers = new Headers(options.headers)
  221. }
  222. this.method = normalizeMethod(options.method || this.method || 'GET')
  223. this.mode = options.mode || this.mode || null
  224. this.referrer = null
  225. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  226. throw new TypeError('Body not allowed for GET or HEAD requests')
  227. }
  228. this._initBody(body, options)
  229. }
  230. Request.prototype.clone = function() {
  231. return new Request(this)
  232. }
  233. function decode(body) {
  234. var form = new FormData()
  235. body.trim().split('&').forEach(function(bytes) {
  236. if (bytes) {
  237. var split = bytes.split('=')
  238. var name = split.shift().replace(/\+/g, ' ')
  239. var value = split.join('=').replace(/\+/g, ' ')
  240. form.append(decodeURIComponent(name), decodeURIComponent(value))
  241. }
  242. })
  243. return form
  244. }
  245. function headers(xhr) {
  246. var head = new Headers()
  247. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  248. pairs.forEach(function(header) {
  249. var split = header.trim().split(':')
  250. var key = split.shift().trim()
  251. var value = split.join(':').trim()
  252. head.append(key, value)
  253. })
  254. return head
  255. }
  256. Body.call(Request.prototype)
  257. function Response(bodyInit, options) {
  258. if (!options) {
  259. options = {}
  260. }
  261. this._initBody(bodyInit, options)
  262. this.type = 'default'
  263. this.status = options.status
  264. this.ok = this.status >= 200 && this.status < 300
  265. this.statusText = options.statusText
  266. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  267. this.url = options.url || ''
  268. }
  269. Body.call(Response.prototype)
  270. Response.prototype.clone = function() {
  271. return new Response(this._bodyInit, {
  272. status: this.status,
  273. statusText: this.statusText,
  274. headers: new Headers(this.headers),
  275. url: this.url
  276. })
  277. }
  278. Response.error = function() {
  279. var response = new Response(null, {status: 0, statusText: ''})
  280. response.type = 'error'
  281. return response
  282. }
  283. var redirectStatuses = [301, 302, 303, 307, 308]
  284. Response.redirect = function(url, status) {
  285. if (redirectStatuses.indexOf(status) === -1) {
  286. throw new RangeError('Invalid status code')
  287. }
  288. return new Response(null, {status: status, headers: {location: url}})
  289. }
  290. self.Headers = Headers;
  291. self.Request = Request;
  292. self.Response = Response;
  293. self.fetch = function(input, init) {
  294. return new Promise(function(resolve, reject) {
  295. var request
  296. if (Request.prototype.isPrototypeOf(input) && !init) {
  297. request = input
  298. } else {
  299. request = new Request(input, init)
  300. }
  301. var xhr = new XMLHttpRequest()
  302. function responseURL() {
  303. if ('responseURL' in xhr) {
  304. return xhr.responseURL
  305. }
  306. // Avoid security warnings on getResponseHeader when not allowed by CORS
  307. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  308. return xhr.getResponseHeader('X-Request-URL')
  309. }
  310. return;
  311. }
  312. var __onLoadHandled = false;
  313. function onload() {
  314. if (xhr.readyState !== 4) {
  315. return
  316. }
  317. var status = (xhr.status === 1223) ? 204 : xhr.status
  318. if (status < 100 || status > 599) {
  319. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  320. reject(new TypeError('Network request failed'))
  321. return
  322. }
  323. var options = {
  324. status: status,
  325. statusText: xhr.statusText,
  326. headers: headers(xhr),
  327. url: responseURL()
  328. }
  329. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  330. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  331. resolve(new Response(body, options))
  332. }
  333. xhr.onreadystatechange = onload;
  334. xhr.onload = onload;
  335. xhr.onerror = function() {
  336. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  337. reject(new TypeError('Network request failed'))
  338. }
  339. xhr.open(request.method, request.url, true)
  340. // `withCredentials` should be setted after calling `.open` in IE10
  341. // http://stackoverflow.com/a/19667959/1219343
  342. try {
  343. if (request.credentials === 'include') {
  344. if ('withCredentials' in xhr) {
  345. xhr.withCredentials = true;
  346. } else {
  347. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  348. }
  349. }
  350. } catch (e) {
  351. console && console.warn && console.warn('set withCredentials error:' + e);
  352. }
  353. if ('responseType' in xhr && support.blob) {
  354. xhr.responseType = 'blob'
  355. }
  356. request.headers.forEach(function(value, name) {
  357. xhr.setRequestHeader(name, value)
  358. })
  359. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  360. })
  361. }
  362. self.fetch.polyfill = true
  363. // Support CommonJS
  364. if ( true && module.exports) {
  365. module.exports = self.fetch;
  366. }
  367. })(typeof self !== 'undefined' ? self : this);
  368. /***/ }),
  369. /***/ 144:
  370. /***/ (function(module, exports) {
  371. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  372. if (true) {
  373. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  374. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  375. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  376. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  377. } else { var mod; }
  378. })(this, function (exports, module) {
  379. 'use strict';
  380. var defaultOptions = {
  381. timeout: 5000,
  382. jsonpCallback: 'callback',
  383. jsonpCallbackFunction: null
  384. };
  385. function generateCallbackFunction() {
  386. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  387. }
  388. function clearFunction(functionName) {
  389. // IE8 throws an exception when you try to delete a property on window
  390. // http://stackoverflow.com/a/1824228/751089
  391. try {
  392. delete window[functionName];
  393. } catch (e) {
  394. window[functionName] = undefined;
  395. }
  396. }
  397. function removeScript(scriptId) {
  398. var script = document.getElementById(scriptId);
  399. if (script) {
  400. document.getElementsByTagName('head')[0].removeChild(script);
  401. }
  402. }
  403. function fetchJsonp(_url) {
  404. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  405. // to avoid param reassign
  406. var url = _url;
  407. var timeout = options.timeout || defaultOptions.timeout;
  408. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  409. var timeoutId = undefined;
  410. return new Promise(function (resolve, reject) {
  411. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  412. var scriptId = jsonpCallback + '_' + callbackFunction;
  413. window[callbackFunction] = function (response) {
  414. resolve({
  415. ok: true,
  416. // keep consistent with fetch API
  417. json: function json() {
  418. return Promise.resolve(response);
  419. }
  420. });
  421. if (timeoutId) clearTimeout(timeoutId);
  422. removeScript(scriptId);
  423. clearFunction(callbackFunction);
  424. };
  425. // Check if the user set their own params, and if not add a ? to start a list of params
  426. url += url.indexOf('?') === -1 ? '?' : '&';
  427. var jsonpScript = document.createElement('script');
  428. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  429. if (options.charset) {
  430. jsonpScript.setAttribute('charset', options.charset);
  431. }
  432. jsonpScript.id = scriptId;
  433. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  434. timeoutId = setTimeout(function () {
  435. reject(new Error('JSONP request to ' + _url + ' timed out'));
  436. clearFunction(callbackFunction);
  437. removeScript(scriptId);
  438. window[callbackFunction] = function () {
  439. clearFunction(callbackFunction);
  440. };
  441. }, timeout);
  442. // Caught if got 404/500
  443. jsonpScript.onerror = function () {
  444. reject(new Error('JSONP request to ' + _url + ' failed'));
  445. clearFunction(callbackFunction);
  446. removeScript(scriptId);
  447. if (timeoutId) clearTimeout(timeoutId);
  448. };
  449. });
  450. }
  451. // export as global function
  452. /*
  453. let local;
  454. if (typeof global !== 'undefined') {
  455. local = global;
  456. } else if (typeof self !== 'undefined') {
  457. local = self;
  458. } else {
  459. try {
  460. local = Function('return this')();
  461. } catch (e) {
  462. throw new Error('polyfill failed because global object is unavailable in this environment');
  463. }
  464. }
  465. local.fetchJsonp = fetchJsonp;
  466. */
  467. module.exports = fetchJsonp;
  468. });
  469. /***/ }),
  470. /***/ 52:
  471. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  472. /**
  473. * lodash (Custom Build) <https://lodash.com/>
  474. * Build: `lodash modularize exports="npm" -o ./`
  475. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  476. * Released under MIT license <https://lodash.com/license>
  477. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  478. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  479. */
  480. /** Used as references for various `Number` constants. */
  481. var MAX_SAFE_INTEGER = 9007199254740991;
  482. /** `Object#toString` result references. */
  483. var argsTag = '[object Arguments]',
  484. funcTag = '[object Function]',
  485. genTag = '[object GeneratorFunction]',
  486. mapTag = '[object Map]',
  487. objectTag = '[object Object]',
  488. promiseTag = '[object Promise]',
  489. setTag = '[object Set]',
  490. weakMapTag = '[object WeakMap]';
  491. var dataViewTag = '[object DataView]';
  492. /**
  493. * Used to match `RegExp`
  494. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  495. */
  496. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  497. /** Used to detect host constructors (Safari). */
  498. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  499. /** Used to detect unsigned integer values. */
  500. var reIsUint = /^(?:0|[1-9]\d*)$/;
  501. /** Detect free variable `global` from Node.js. */
  502. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  503. /** Detect free variable `self`. */
  504. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  505. /** Used as a reference to the global object. */
  506. var root = freeGlobal || freeSelf || Function('return this')();
  507. /**
  508. * A specialized version of `_.map` for arrays without support for iteratee
  509. * shorthands.
  510. *
  511. * @private
  512. * @param {Array} [array] The array to iterate over.
  513. * @param {Function} iteratee The function invoked per iteration.
  514. * @returns {Array} Returns the new mapped array.
  515. */
  516. function arrayMap(array, iteratee) {
  517. var index = -1,
  518. length = array ? array.length : 0,
  519. result = Array(length);
  520. while (++index < length) {
  521. result[index] = iteratee(array[index], index, array);
  522. }
  523. return result;
  524. }
  525. /**
  526. * The base implementation of `_.times` without support for iteratee shorthands
  527. * or max array length checks.
  528. *
  529. * @private
  530. * @param {number} n The number of times to invoke `iteratee`.
  531. * @param {Function} iteratee The function invoked per iteration.
  532. * @returns {Array} Returns the array of results.
  533. */
  534. function baseTimes(n, iteratee) {
  535. var index = -1,
  536. result = Array(n);
  537. while (++index < n) {
  538. result[index] = iteratee(index);
  539. }
  540. return result;
  541. }
  542. /**
  543. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  544. * of key-value pairs for `object` corresponding to the property names of `props`.
  545. *
  546. * @private
  547. * @param {Object} object The object to query.
  548. * @param {Array} props The property names to get values for.
  549. * @returns {Object} Returns the key-value pairs.
  550. */
  551. function baseToPairs(object, props) {
  552. return arrayMap(props, function(key) {
  553. return [key, object[key]];
  554. });
  555. }
  556. /**
  557. * Gets the value at `key` of `object`.
  558. *
  559. * @private
  560. * @param {Object} [object] The object to query.
  561. * @param {string} key The key of the property to get.
  562. * @returns {*} Returns the property value.
  563. */
  564. function getValue(object, key) {
  565. return object == null ? undefined : object[key];
  566. }
  567. /**
  568. * Checks if `value` is a host object in IE < 9.
  569. *
  570. * @private
  571. * @param {*} value The value to check.
  572. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  573. */
  574. function isHostObject(value) {
  575. // Many host objects are `Object` objects that can coerce to strings
  576. // despite having improperly defined `toString` methods.
  577. var result = false;
  578. if (value != null && typeof value.toString != 'function') {
  579. try {
  580. result = !!(value + '');
  581. } catch (e) {}
  582. }
  583. return result;
  584. }
  585. /**
  586. * Converts `map` to its key-value pairs.
  587. *
  588. * @private
  589. * @param {Object} map The map to convert.
  590. * @returns {Array} Returns the key-value pairs.
  591. */
  592. function mapToArray(map) {
  593. var index = -1,
  594. result = Array(map.size);
  595. map.forEach(function(value, key) {
  596. result[++index] = [key, value];
  597. });
  598. return result;
  599. }
  600. /**
  601. * Creates a unary function that invokes `func` with its argument transformed.
  602. *
  603. * @private
  604. * @param {Function} func The function to wrap.
  605. * @param {Function} transform The argument transform.
  606. * @returns {Function} Returns the new function.
  607. */
  608. function overArg(func, transform) {
  609. return function(arg) {
  610. return func(transform(arg));
  611. };
  612. }
  613. /**
  614. * Converts `set` to its value-value pairs.
  615. *
  616. * @private
  617. * @param {Object} set The set to convert.
  618. * @returns {Array} Returns the value-value pairs.
  619. */
  620. function setToPairs(set) {
  621. var index = -1,
  622. result = Array(set.size);
  623. set.forEach(function(value) {
  624. result[++index] = [value, value];
  625. });
  626. return result;
  627. }
  628. /** Used for built-in method references. */
  629. var funcProto = Function.prototype,
  630. objectProto = Object.prototype;
  631. /** Used to detect overreaching core-js shims. */
  632. var coreJsData = root['__core-js_shared__'];
  633. /** Used to detect methods masquerading as native. */
  634. var maskSrcKey = (function() {
  635. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  636. return uid ? ('Symbol(src)_1.' + uid) : '';
  637. }());
  638. /** Used to resolve the decompiled source of functions. */
  639. var funcToString = funcProto.toString;
  640. /** Used to check objects for own properties. */
  641. var hasOwnProperty = objectProto.hasOwnProperty;
  642. /**
  643. * Used to resolve the
  644. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  645. * of values.
  646. */
  647. var objectToString = objectProto.toString;
  648. /** Used to detect if a method is native. */
  649. var reIsNative = RegExp('^' +
  650. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  651. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  652. );
  653. /** Built-in value references. */
  654. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  655. /* Built-in method references for those with the same name as other `lodash` methods. */
  656. var nativeKeys = overArg(Object.keys, Object);
  657. /* Built-in method references that are verified to be native. */
  658. var DataView = getNative(root, 'DataView'),
  659. Map = getNative(root, 'Map'),
  660. Promise = getNative(root, 'Promise'),
  661. Set = getNative(root, 'Set'),
  662. WeakMap = getNative(root, 'WeakMap');
  663. /** Used to detect maps, sets, and weakmaps. */
  664. var dataViewCtorString = toSource(DataView),
  665. mapCtorString = toSource(Map),
  666. promiseCtorString = toSource(Promise),
  667. setCtorString = toSource(Set),
  668. weakMapCtorString = toSource(WeakMap);
  669. /**
  670. * Creates an array of the enumerable property names of the array-like `value`.
  671. *
  672. * @private
  673. * @param {*} value The value to query.
  674. * @param {boolean} inherited Specify returning inherited property names.
  675. * @returns {Array} Returns the array of property names.
  676. */
  677. function arrayLikeKeys(value, inherited) {
  678. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  679. // Safari 9 makes `arguments.length` enumerable in strict mode.
  680. var result = (isArray(value) || isArguments(value))
  681. ? baseTimes(value.length, String)
  682. : [];
  683. var length = result.length,
  684. skipIndexes = !!length;
  685. for (var key in value) {
  686. if ((inherited || hasOwnProperty.call(value, key)) &&
  687. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  688. result.push(key);
  689. }
  690. }
  691. return result;
  692. }
  693. /**
  694. * The base implementation of `getTag`.
  695. *
  696. * @private
  697. * @param {*} value The value to query.
  698. * @returns {string} Returns the `toStringTag`.
  699. */
  700. function baseGetTag(value) {
  701. return objectToString.call(value);
  702. }
  703. /**
  704. * The base implementation of `_.isNative` without bad shim checks.
  705. *
  706. * @private
  707. * @param {*} value The value to check.
  708. * @returns {boolean} Returns `true` if `value` is a native function,
  709. * else `false`.
  710. */
  711. function baseIsNative(value) {
  712. if (!isObject(value) || isMasked(value)) {
  713. return false;
  714. }
  715. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  716. return pattern.test(toSource(value));
  717. }
  718. /**
  719. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  720. *
  721. * @private
  722. * @param {Object} object The object to query.
  723. * @returns {Array} Returns the array of property names.
  724. */
  725. function baseKeys(object) {
  726. if (!isPrototype(object)) {
  727. return nativeKeys(object);
  728. }
  729. var result = [];
  730. for (var key in Object(object)) {
  731. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  732. result.push(key);
  733. }
  734. }
  735. return result;
  736. }
  737. /**
  738. * Creates a `_.toPairs` or `_.toPairsIn` function.
  739. *
  740. * @private
  741. * @param {Function} keysFunc The function to get the keys of a given object.
  742. * @returns {Function} Returns the new pairs function.
  743. */
  744. function createToPairs(keysFunc) {
  745. return function(object) {
  746. var tag = getTag(object);
  747. if (tag == mapTag) {
  748. return mapToArray(object);
  749. }
  750. if (tag == setTag) {
  751. return setToPairs(object);
  752. }
  753. return baseToPairs(object, keysFunc(object));
  754. };
  755. }
  756. /**
  757. * Gets the native function at `key` of `object`.
  758. *
  759. * @private
  760. * @param {Object} object The object to query.
  761. * @param {string} key The key of the method to get.
  762. * @returns {*} Returns the function if it's native, else `undefined`.
  763. */
  764. function getNative(object, key) {
  765. var value = getValue(object, key);
  766. return baseIsNative(value) ? value : undefined;
  767. }
  768. /**
  769. * Gets the `toStringTag` of `value`.
  770. *
  771. * @private
  772. * @param {*} value The value to query.
  773. * @returns {string} Returns the `toStringTag`.
  774. */
  775. var getTag = baseGetTag;
  776. // Fallback for data views, maps, sets, and weak maps in IE 11,
  777. // for data views in Edge < 14, and promises in Node.js.
  778. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  779. (Map && getTag(new Map) != mapTag) ||
  780. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  781. (Set && getTag(new Set) != setTag) ||
  782. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  783. getTag = function(value) {
  784. var result = objectToString.call(value),
  785. Ctor = result == objectTag ? value.constructor : undefined,
  786. ctorString = Ctor ? toSource(Ctor) : undefined;
  787. if (ctorString) {
  788. switch (ctorString) {
  789. case dataViewCtorString: return dataViewTag;
  790. case mapCtorString: return mapTag;
  791. case promiseCtorString: return promiseTag;
  792. case setCtorString: return setTag;
  793. case weakMapCtorString: return weakMapTag;
  794. }
  795. }
  796. return result;
  797. };
  798. }
  799. /**
  800. * Checks if `value` is a valid array-like index.
  801. *
  802. * @private
  803. * @param {*} value The value to check.
  804. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  805. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  806. */
  807. function isIndex(value, length) {
  808. length = length == null ? MAX_SAFE_INTEGER : length;
  809. return !!length &&
  810. (typeof value == 'number' || reIsUint.test(value)) &&
  811. (value > -1 && value % 1 == 0 && value < length);
  812. }
  813. /**
  814. * Checks if `func` has its source masked.
  815. *
  816. * @private
  817. * @param {Function} func The function to check.
  818. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  819. */
  820. function isMasked(func) {
  821. return !!maskSrcKey && (maskSrcKey in func);
  822. }
  823. /**
  824. * Checks if `value` is likely a prototype object.
  825. *
  826. * @private
  827. * @param {*} value The value to check.
  828. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  829. */
  830. function isPrototype(value) {
  831. var Ctor = value && value.constructor,
  832. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  833. return value === proto;
  834. }
  835. /**
  836. * Converts `func` to its source code.
  837. *
  838. * @private
  839. * @param {Function} func The function to process.
  840. * @returns {string} Returns the source code.
  841. */
  842. function toSource(func) {
  843. if (func != null) {
  844. try {
  845. return funcToString.call(func);
  846. } catch (e) {}
  847. try {
  848. return (func + '');
  849. } catch (e) {}
  850. }
  851. return '';
  852. }
  853. /**
  854. * Checks if `value` is likely an `arguments` object.
  855. *
  856. * @static
  857. * @memberOf _
  858. * @since 0.1.0
  859. * @category Lang
  860. * @param {*} value The value to check.
  861. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  862. * else `false`.
  863. * @example
  864. *
  865. * _.isArguments(function() { return arguments; }());
  866. * // => true
  867. *
  868. * _.isArguments([1, 2, 3]);
  869. * // => false
  870. */
  871. function isArguments(value) {
  872. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  873. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  874. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  875. }
  876. /**
  877. * Checks if `value` is classified as an `Array` object.
  878. *
  879. * @static
  880. * @memberOf _
  881. * @since 0.1.0
  882. * @category Lang
  883. * @param {*} value The value to check.
  884. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  885. * @example
  886. *
  887. * _.isArray([1, 2, 3]);
  888. * // => true
  889. *
  890. * _.isArray(document.body.children);
  891. * // => false
  892. *
  893. * _.isArray('abc');
  894. * // => false
  895. *
  896. * _.isArray(_.noop);
  897. * // => false
  898. */
  899. var isArray = Array.isArray;
  900. /**
  901. * Checks if `value` is array-like. A value is considered array-like if it's
  902. * not a function and has a `value.length` that's an integer greater than or
  903. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  904. *
  905. * @static
  906. * @memberOf _
  907. * @since 4.0.0
  908. * @category Lang
  909. * @param {*} value The value to check.
  910. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  911. * @example
  912. *
  913. * _.isArrayLike([1, 2, 3]);
  914. * // => true
  915. *
  916. * _.isArrayLike(document.body.children);
  917. * // => true
  918. *
  919. * _.isArrayLike('abc');
  920. * // => true
  921. *
  922. * _.isArrayLike(_.noop);
  923. * // => false
  924. */
  925. function isArrayLike(value) {
  926. return value != null && isLength(value.length) && !isFunction(value);
  927. }
  928. /**
  929. * This method is like `_.isArrayLike` except that it also checks if `value`
  930. * is an object.
  931. *
  932. * @static
  933. * @memberOf _
  934. * @since 4.0.0
  935. * @category Lang
  936. * @param {*} value The value to check.
  937. * @returns {boolean} Returns `true` if `value` is an array-like object,
  938. * else `false`.
  939. * @example
  940. *
  941. * _.isArrayLikeObject([1, 2, 3]);
  942. * // => true
  943. *
  944. * _.isArrayLikeObject(document.body.children);
  945. * // => true
  946. *
  947. * _.isArrayLikeObject('abc');
  948. * // => false
  949. *
  950. * _.isArrayLikeObject(_.noop);
  951. * // => false
  952. */
  953. function isArrayLikeObject(value) {
  954. return isObjectLike(value) && isArrayLike(value);
  955. }
  956. /**
  957. * Checks if `value` is classified as a `Function` object.
  958. *
  959. * @static
  960. * @memberOf _
  961. * @since 0.1.0
  962. * @category Lang
  963. * @param {*} value The value to check.
  964. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  965. * @example
  966. *
  967. * _.isFunction(_);
  968. * // => true
  969. *
  970. * _.isFunction(/abc/);
  971. * // => false
  972. */
  973. function isFunction(value) {
  974. // The use of `Object#toString` avoids issues with the `typeof` operator
  975. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  976. var tag = isObject(value) ? objectToString.call(value) : '';
  977. return tag == funcTag || tag == genTag;
  978. }
  979. /**
  980. * Checks if `value` is a valid array-like length.
  981. *
  982. * **Note:** This method is loosely based on
  983. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  984. *
  985. * @static
  986. * @memberOf _
  987. * @since 4.0.0
  988. * @category Lang
  989. * @param {*} value The value to check.
  990. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  991. * @example
  992. *
  993. * _.isLength(3);
  994. * // => true
  995. *
  996. * _.isLength(Number.MIN_VALUE);
  997. * // => false
  998. *
  999. * _.isLength(Infinity);
  1000. * // => false
  1001. *
  1002. * _.isLength('3');
  1003. * // => false
  1004. */
  1005. function isLength(value) {
  1006. return typeof value == 'number' &&
  1007. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  1008. }
  1009. /**
  1010. * Checks if `value` is the
  1011. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  1012. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1013. *
  1014. * @static
  1015. * @memberOf _
  1016. * @since 0.1.0
  1017. * @category Lang
  1018. * @param {*} value The value to check.
  1019. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1020. * @example
  1021. *
  1022. * _.isObject({});
  1023. * // => true
  1024. *
  1025. * _.isObject([1, 2, 3]);
  1026. * // => true
  1027. *
  1028. * _.isObject(_.noop);
  1029. * // => true
  1030. *
  1031. * _.isObject(null);
  1032. * // => false
  1033. */
  1034. function isObject(value) {
  1035. var type = typeof value;
  1036. return !!value && (type == 'object' || type == 'function');
  1037. }
  1038. /**
  1039. * Checks if `value` is object-like. A value is object-like if it's not `null`
  1040. * and has a `typeof` result of "object".
  1041. *
  1042. * @static
  1043. * @memberOf _
  1044. * @since 4.0.0
  1045. * @category Lang
  1046. * @param {*} value The value to check.
  1047. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1048. * @example
  1049. *
  1050. * _.isObjectLike({});
  1051. * // => true
  1052. *
  1053. * _.isObjectLike([1, 2, 3]);
  1054. * // => true
  1055. *
  1056. * _.isObjectLike(_.noop);
  1057. * // => false
  1058. *
  1059. * _.isObjectLike(null);
  1060. * // => false
  1061. */
  1062. function isObjectLike(value) {
  1063. return !!value && typeof value == 'object';
  1064. }
  1065. /**
  1066. * Creates an array of the own enumerable property names of `object`.
  1067. *
  1068. * **Note:** Non-object values are coerced to objects. See the
  1069. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  1070. * for more details.
  1071. *
  1072. * @static
  1073. * @since 0.1.0
  1074. * @memberOf _
  1075. * @category Object
  1076. * @param {Object} object The object to query.
  1077. * @returns {Array} Returns the array of property names.
  1078. * @example
  1079. *
  1080. * function Foo() {
  1081. * this.a = 1;
  1082. * this.b = 2;
  1083. * }
  1084. *
  1085. * Foo.prototype.c = 3;
  1086. *
  1087. * _.keys(new Foo);
  1088. * // => ['a', 'b'] (iteration order is not guaranteed)
  1089. *
  1090. * _.keys('hi');
  1091. * // => ['0', '1']
  1092. */
  1093. function keys(object) {
  1094. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1095. }
  1096. /**
  1097. * Creates an array of own enumerable string keyed-value pairs for `object`
  1098. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  1099. * entries are returned.
  1100. *
  1101. * @static
  1102. * @memberOf _
  1103. * @since 4.0.0
  1104. * @alias entries
  1105. * @category Object
  1106. * @param {Object} object The object to query.
  1107. * @returns {Array} Returns the key-value pairs.
  1108. * @example
  1109. *
  1110. * function Foo() {
  1111. * this.a = 1;
  1112. * this.b = 2;
  1113. * }
  1114. *
  1115. * Foo.prototype.c = 3;
  1116. *
  1117. * _.toPairs(new Foo);
  1118. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  1119. */
  1120. var toPairs = createToPairs(keys);
  1121. module.exports = toPairs;
  1122. /***/ }),
  1123. /***/ 107:
  1124. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  1125. (function (global, factory) {
  1126. true ? factory() :
  1127. 0;
  1128. }(this, (function () { 'use strict';
  1129. /**
  1130. * @this {Promise}
  1131. */
  1132. function finallyConstructor(callback) {
  1133. var constructor = this.constructor;
  1134. return this.then(
  1135. function(value) {
  1136. // @ts-ignore
  1137. return constructor.resolve(callback()).then(function() {
  1138. return value;
  1139. });
  1140. },
  1141. function(reason) {
  1142. // @ts-ignore
  1143. return constructor.resolve(callback()).then(function() {
  1144. // @ts-ignore
  1145. return constructor.reject(reason);
  1146. });
  1147. }
  1148. );
  1149. }
  1150. // Store setTimeout reference so promise-polyfill will be unaffected by
  1151. // other code modifying setTimeout (like sinon.useFakeTimers())
  1152. var setTimeoutFunc = setTimeout;
  1153. function isArray(x) {
  1154. return Boolean(x && typeof x.length !== 'undefined');
  1155. }
  1156. function noop() {}
  1157. // Polyfill for Function.prototype.bind
  1158. function bind(fn, thisArg) {
  1159. return function() {
  1160. fn.apply(thisArg, arguments);
  1161. };
  1162. }
  1163. /**
  1164. * @constructor
  1165. * @param {Function} fn
  1166. */
  1167. function Promise(fn) {
  1168. if (!(this instanceof Promise))
  1169. throw new TypeError('Promises must be constructed via new');
  1170. if (typeof fn !== 'function') throw new TypeError('not a function');
  1171. /** @type {!number} */
  1172. this._state = 0;
  1173. /** @type {!boolean} */
  1174. this._handled = false;
  1175. /** @type {Promise|undefined} */
  1176. this._value = undefined;
  1177. /** @type {!Array<!Function>} */
  1178. this._deferreds = [];
  1179. doResolve(fn, this);
  1180. }
  1181. function handle(self, deferred) {
  1182. while (self._state === 3) {
  1183. self = self._value;
  1184. }
  1185. if (self._state === 0) {
  1186. self._deferreds.push(deferred);
  1187. return;
  1188. }
  1189. self._handled = true;
  1190. Promise._immediateFn(function() {
  1191. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  1192. if (cb === null) {
  1193. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  1194. return;
  1195. }
  1196. var ret;
  1197. try {
  1198. ret = cb(self._value);
  1199. } catch (e) {
  1200. reject(deferred.promise, e);
  1201. return;
  1202. }
  1203. resolve(deferred.promise, ret);
  1204. });
  1205. }
  1206. function resolve(self, newValue) {
  1207. try {
  1208. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  1209. if (newValue === self)
  1210. throw new TypeError('A promise cannot be resolved with itself.');
  1211. if (
  1212. newValue &&
  1213. (typeof newValue === 'object' || typeof newValue === 'function')
  1214. ) {
  1215. var then = newValue.then;
  1216. if (newValue instanceof Promise) {
  1217. self._state = 3;
  1218. self._value = newValue;
  1219. finale(self);
  1220. return;
  1221. } else if (typeof then === 'function') {
  1222. doResolve(bind(then, newValue), self);
  1223. return;
  1224. }
  1225. }
  1226. self._state = 1;
  1227. self._value = newValue;
  1228. finale(self);
  1229. } catch (e) {
  1230. reject(self, e);
  1231. }
  1232. }
  1233. function reject(self, newValue) {
  1234. self._state = 2;
  1235. self._value = newValue;
  1236. finale(self);
  1237. }
  1238. function finale(self) {
  1239. if (self._state === 2 && self._deferreds.length === 0) {
  1240. Promise._immediateFn(function() {
  1241. if (!self._handled) {
  1242. Promise._unhandledRejectionFn(self._value);
  1243. }
  1244. });
  1245. }
  1246. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  1247. handle(self, self._deferreds[i]);
  1248. }
  1249. self._deferreds = null;
  1250. }
  1251. /**
  1252. * @constructor
  1253. */
  1254. function Handler(onFulfilled, onRejected, promise) {
  1255. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  1256. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  1257. this.promise = promise;
  1258. }
  1259. /**
  1260. * Take a potentially misbehaving resolver function and make sure
  1261. * onFulfilled and onRejected are only called once.
  1262. *
  1263. * Makes no guarantees about asynchrony.
  1264. */
  1265. function doResolve(fn, self) {
  1266. var done = false;
  1267. try {
  1268. fn(
  1269. function(value) {
  1270. if (done) return;
  1271. done = true;
  1272. resolve(self, value);
  1273. },
  1274. function(reason) {
  1275. if (done) return;
  1276. done = true;
  1277. reject(self, reason);
  1278. }
  1279. );
  1280. } catch (ex) {
  1281. if (done) return;
  1282. done = true;
  1283. reject(self, ex);
  1284. }
  1285. }
  1286. Promise.prototype['catch'] = function(onRejected) {
  1287. return this.then(null, onRejected);
  1288. };
  1289. Promise.prototype.then = function(onFulfilled, onRejected) {
  1290. // @ts-ignore
  1291. var prom = new this.constructor(noop);
  1292. handle(this, new Handler(onFulfilled, onRejected, prom));
  1293. return prom;
  1294. };
  1295. Promise.prototype['finally'] = finallyConstructor;
  1296. Promise.all = function(arr) {
  1297. return new Promise(function(resolve, reject) {
  1298. if (!isArray(arr)) {
  1299. return reject(new TypeError('Promise.all accepts an array'));
  1300. }
  1301. var args = Array.prototype.slice.call(arr);
  1302. if (args.length === 0) return resolve([]);
  1303. var remaining = args.length;
  1304. function res(i, val) {
  1305. try {
  1306. if (val && (typeof val === 'object' || typeof val === 'function')) {
  1307. var then = val.then;
  1308. if (typeof then === 'function') {
  1309. then.call(
  1310. val,
  1311. function(val) {
  1312. res(i, val);
  1313. },
  1314. reject
  1315. );
  1316. return;
  1317. }
  1318. }
  1319. args[i] = val;
  1320. if (--remaining === 0) {
  1321. resolve(args);
  1322. }
  1323. } catch (ex) {
  1324. reject(ex);
  1325. }
  1326. }
  1327. for (var i = 0; i < args.length; i++) {
  1328. res(i, args[i]);
  1329. }
  1330. });
  1331. };
  1332. Promise.resolve = function(value) {
  1333. if (value && typeof value === 'object' && value.constructor === Promise) {
  1334. return value;
  1335. }
  1336. return new Promise(function(resolve) {
  1337. resolve(value);
  1338. });
  1339. };
  1340. Promise.reject = function(value) {
  1341. return new Promise(function(resolve, reject) {
  1342. reject(value);
  1343. });
  1344. };
  1345. Promise.race = function(arr) {
  1346. return new Promise(function(resolve, reject) {
  1347. if (!isArray(arr)) {
  1348. return reject(new TypeError('Promise.race accepts an array'));
  1349. }
  1350. for (var i = 0, len = arr.length; i < len; i++) {
  1351. Promise.resolve(arr[i]).then(resolve, reject);
  1352. }
  1353. });
  1354. };
  1355. // Use polyfill for setImmediate for performance gains
  1356. Promise._immediateFn =
  1357. // @ts-ignore
  1358. (typeof setImmediate === 'function' &&
  1359. function(fn) {
  1360. // @ts-ignore
  1361. setImmediate(fn);
  1362. }) ||
  1363. function(fn) {
  1364. setTimeoutFunc(fn, 0);
  1365. };
  1366. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  1367. if (typeof console !== 'undefined' && console) {
  1368. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  1369. }
  1370. };
  1371. /** @suppress {undefinedVars} */
  1372. var globalNS = (function() {
  1373. // the only reliable means to get the global object is
  1374. // `Function('return this')()`
  1375. // However, this causes CSP violations in Chrome apps.
  1376. if (typeof self !== 'undefined') {
  1377. return self;
  1378. }
  1379. if (typeof window !== 'undefined') {
  1380. return window;
  1381. }
  1382. if (typeof __webpack_require__.g !== 'undefined') {
  1383. return __webpack_require__.g;
  1384. }
  1385. throw new Error('unable to locate global object');
  1386. })();
  1387. if (!('Promise' in globalNS)) {
  1388. globalNS['Promise'] = Promise;
  1389. } else if (!globalNS.Promise.prototype['finally']) {
  1390. globalNS.Promise.prototype['finally'] = finallyConstructor;
  1391. }
  1392. })));
  1393. /***/ })
  1394. /******/ });
  1395. /************************************************************************/
  1396. /******/ // The module cache
  1397. /******/ var __webpack_module_cache__ = {};
  1398. /******/
  1399. /******/ // The require function
  1400. /******/ function __webpack_require__(moduleId) {
  1401. /******/ // Check if module is in cache
  1402. /******/ if(__webpack_module_cache__[moduleId]) {
  1403. /******/ return __webpack_module_cache__[moduleId].exports;
  1404. /******/ }
  1405. /******/ // Create a new module (and put it into the cache)
  1406. /******/ var module = __webpack_module_cache__[moduleId] = {
  1407. /******/ // no module.id needed
  1408. /******/ // no module.loaded needed
  1409. /******/ exports: {}
  1410. /******/ };
  1411. /******/
  1412. /******/ // Execute the module function
  1413. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1414. /******/
  1415. /******/ // Return the exports of the module
  1416. /******/ return module.exports;
  1417. /******/ }
  1418. /******/
  1419. /************************************************************************/
  1420. /******/ /* webpack/runtime/compat get default export */
  1421. /******/ (() => {
  1422. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1423. /******/ __webpack_require__.n = (module) => {
  1424. /******/ var getter = module && module.__esModule ?
  1425. /******/ () => module['default'] :
  1426. /******/ () => module;
  1427. /******/ __webpack_require__.d(getter, { a: getter });
  1428. /******/ return getter;
  1429. /******/ };
  1430. /******/ })();
  1431. /******/
  1432. /******/ /* webpack/runtime/define property getters */
  1433. /******/ (() => {
  1434. /******/ // define getter functions for harmony exports
  1435. /******/ __webpack_require__.d = (exports, definition) => {
  1436. /******/ for(var key in definition) {
  1437. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  1438. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  1439. /******/ }
  1440. /******/ }
  1441. /******/ };
  1442. /******/ })();
  1443. /******/
  1444. /******/ /* webpack/runtime/global */
  1445. /******/ (() => {
  1446. /******/ __webpack_require__.g = (function() {
  1447. /******/ if (typeof globalThis === 'object') return globalThis;
  1448. /******/ try {
  1449. /******/ return this || new Function('return this')();
  1450. /******/ } catch (e) {
  1451. /******/ if (typeof window === 'object') return window;
  1452. /******/ }
  1453. /******/ })();
  1454. /******/ })();
  1455. /******/
  1456. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  1457. /******/ (() => {
  1458. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
  1459. /******/ })();
  1460. /******/
  1461. /************************************************************************/
  1462. (() => {
  1463. "use strict";
  1464. // UNUSED EXPORTS: AddressMatchService, AggQueryBuilderParameter, AggregationParameter, AggregationQueryBuilderType, AggregationType, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CityTabsPage, ClientType, ClipAnalystMode, ClipParameter, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, ComponentsUtil, ComputeWeightMatrixParameters, DataFlowService, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DeckglLayer, DensityKernelAnalystParameters, DirectionType, DropDownBox, EditFeaturesParameters, EditType, ElasticSearch, EngineType, Exponent, FacilityAnalyst3DParameters, FacilityAnalystSinks3DParameters, FacilityAnalystSources3DParameters, FacilityAnalystStreamParameters, FacilityAnalystTracedown3DParameters, FacilityAnalystTraceup3DParameters, FacilityAnalystUpstream3DParameters, FeatureService, FetchRequest, FieldParameters, FieldService, FieldStatisticsParameters, FileConfig, FileModel, FileReaderUtil, FileTypes, FillGradientMode, FilterAggParameter, FilterField, FilterParameter, FindClosestFacilitiesParameters, FindLocationParameters, FindMTSPPathsParameters, FindPathParameters, FindServiceAreasParameters, FindTSPPathsParameters, GenerateSpatialDataParameters, GeoBoundingBoxQueryBuilderParameter, GeoCodingParameter, GeoDecodingParameter, GeoFeature, GeoHashGridAggParameter, GeoRelationAnalystParameters, GeometryBufferAnalystParameters, GeometryOverlayAnalystParameters, GeometrySurfaceAnalystParameters, GeometryThiessenAnalystParameters, GeometryType, GeoprocessingService, GetFeatureMode, GetFeaturesByBoundsParameters, GetFeaturesByBufferParameters, GetFeaturesByGeometryParameters, GetFeaturesByIDsParameters, GetFeaturesBySQLParameters, GetGridCellInfosParameters, GraduatedMode, Graph, GraphAxesTextDisplayMode, Graphic, GraphicLayer, GraticuleLayer, Grid, GridCellInfosService, GridType, HeatMapLayer, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, Image, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, Label, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, MapExtend, MapService, MappingParameters, MapvDataSet, MapvLayer, MapvRenderer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayOperationType, PaginationContainer, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, Range, RangeMode, RangeTheme3DLayer, RankSymbol, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, SearchMode, SecurityManager, Select, ServerColor, ServerFeature, ServerGeometry, ServerInfo, ServerStyle, ServerTextStyle, ServerTheme, ServerType, ServiceBase, ServiceStatus, SetLayerInfoParameters, SetLayerStatusParameters, SetLayersInfoParameters, SideType, SingleObjectQueryJobsParameter, SmoothMethod, SpatialAnalystService, SpatialQueryMode, SpatialRelationType, StatisticAnalystMode, StatisticMode, StopQueryParameters, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, TerrainCurvatureCalculationParameters, TextAlignment, Theme, Theme3DLayer, ThemeDotDensity, ThemeFeature, ThemeFlow, ThemeGraduatedSymbol, ThemeGraduatedSymbolStyle, ThemeGraph, ThemeGraphAxes, ThemeGraphItem, ThemeGraphSize, ThemeGraphText, ThemeGraphTextFormat, ThemeGraphType, ThemeGridRange, ThemeGridRangeItem, ThemeGridUnique, ThemeGridUniqueItem, ThemeLabel, ThemeLabelAlongLine, ThemeLabelBackground, ThemeLabelItem, ThemeLabelText, ThemeLabelUniqueItem, ThemeLayer, ThemeMemoryData, ThemeOffset, ThemeParameters, ThemeRange, ThemeRangeItem, ThemeService, ThemeType, ThemeUnique, ThemeUniqueItem, ThiessenAnalystParameters, ThreeLayer, ThreeLayerRenderer, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, Transform, TransportationAnalystParameter, TransportationAnalystResultSetting, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, Unique, UniqueTheme3DLayer, Unit, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, Util, VariogramMode, Vector, VectorClipJobsParameter, WebMap, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebPrintingService, getDefaultVectorTileStyle, setBackground, setPaintProperty
  1465. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  1466. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  1467. * This program are made available under the terms of the Apache License, Version 2.0
  1468. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1469. var SuperMap = window.SuperMap = window.SuperMap || {};
  1470. SuperMap.Components = window.SuperMap.Components || {};
  1471. ;// CONCATENATED MODULE: ./src/common/REST.js
  1472. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  1473. * This program are made available under the terms of the Apache License, Version 2.0
  1474. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1475. /**
  1476. * @enum DataFormat
  1477. * @memberOf SuperMap
  1478. * @description 服务请求返回结果数据类型
  1479. * @type {string}
  1480. */
  1481. var DataFormat = SuperMap.DataFormat = {
  1482. /** GEOJSON */
  1483. GEOJSON: "GEOJSON",
  1484. /** ISERVER */
  1485. ISERVER: "ISERVER"
  1486. };
  1487. /**
  1488. * @enum ServerType
  1489. * @memberOf SuperMap
  1490. * @description 服务器类型
  1491. * @type {string}
  1492. */
  1493. var ServerType = SuperMap.ServerType = {
  1494. /** ISERVER */
  1495. ISERVER: "ISERVER",
  1496. /** IPORTAL */
  1497. IPORTAL: "IPORTAL",
  1498. /** ONLINE */
  1499. ONLINE: "ONLINE"
  1500. };
  1501. /**
  1502. * @enum GeometryType
  1503. * @memberOf SuperMap
  1504. * @description 几何对象枚举,定义了一系列几何对象类型。
  1505. * @type {string}
  1506. */
  1507. var GeometryType = SuperMap.GeometryType = {
  1508. /** LINE */
  1509. LINE: "LINE",
  1510. /** LINEM */
  1511. LINEM: "LINEM",
  1512. /** POINT */
  1513. POINT: "POINT",
  1514. /** REGION */
  1515. REGION: "REGION",
  1516. /** POINTEPS */
  1517. POINTEPS: "POINTEPS",
  1518. /** LINEEPS */
  1519. LINEEPS: "LINEEPS",
  1520. /** REGIONEPS */
  1521. REGIONEPS: "REGIONEPS",
  1522. /** ELLIPSE */
  1523. ELLIPSE: "ELLIPSE",
  1524. /** CIRCLE */
  1525. CIRCLE: "CIRCLE",
  1526. /** TEXT */
  1527. TEXT: "TEXT",
  1528. /** RECTANGLE */
  1529. RECTANGLE: "RECTANGLE",
  1530. /** UNKNOWN */
  1531. UNKNOWN: "UNKNOWN",
  1532. /** GEOCOMPOUND */
  1533. GEOCOMPOUND:"GEOCOMPOUND"
  1534. };
  1535. /**
  1536. * @enum QueryOption
  1537. * @memberOf SuperMap
  1538. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  1539. * @type {string}
  1540. */
  1541. var QueryOption = SuperMap.QueryOption = {
  1542. /** 属性 */
  1543. ATTRIBUTE: "ATTRIBUTE",
  1544. /** 属性和几何对象 */
  1545. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  1546. /** 几何对象 */
  1547. GEOMETRY: "GEOMETRY"
  1548. };
  1549. /**
  1550. * @enum JoinType
  1551. * @memberOf SuperMap
  1552. * @description 关联查询时的关联类型常量。
  1553. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  1554. * @type {string}
  1555. */
  1556. var JoinType = SuperMap.JoinType = {
  1557. /** INNERJOIN */
  1558. INNERJOIN: "INNERJOIN",
  1559. /** LEFTJOIN */
  1560. LEFTJOIN: "LEFTJOIN"
  1561. };
  1562. /**
  1563. * @enum SpatialQueryMode
  1564. * @memberOf SuperMap
  1565. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  1566. * @type {string}
  1567. */
  1568. var SpatialQueryMode = SuperMap.SpatialQueryMode = {
  1569. /** 包含空间查询模式 */
  1570. CONTAIN: "CONTAIN",
  1571. /** 交叉空间查询模式 */
  1572. CROSS: "CROSS",
  1573. /** 分离空间查询模式 */
  1574. DISJOINT: "DISJOINT",
  1575. /** 重合空间查询模式 */
  1576. IDENTITY: "IDENTITY",
  1577. /** 相交空间查询模式 */
  1578. INTERSECT: "INTERSECT",
  1579. /** 无空间查询 */
  1580. NONE: "NONE",
  1581. /** 叠加空间查询模式 */
  1582. OVERLAP: "OVERLAP",
  1583. /** 邻接空间查询模式 */
  1584. TOUCH: "TOUCH",
  1585. /** 被包含空间查询模式 */
  1586. WITHIN: "WITHIN"
  1587. };
  1588. /**
  1589. * @enum SpatialRelationType
  1590. * @memberOf SuperMap
  1591. * @description 数据集对象间的空间关系枚举。
  1592. * 该类定义了数据集对象间的空间关系类型常量。
  1593. * @type {string}
  1594. */
  1595. var SpatialRelationType = SuperMap.SpatialRelationType = {
  1596. /** 包含关系 */
  1597. CONTAIN: "CONTAIN",
  1598. /** 相交关系 */
  1599. INTERSECT: "INTERSECT",
  1600. /** 被包含关系 */
  1601. WITHIN: "WITHIN"
  1602. };
  1603. /**
  1604. * @enum MeasureMode
  1605. * @memberOf SuperMap
  1606. * @type {string}
  1607. * @description 量算模式枚举。
  1608. * 该类定义了两种测量模式:距离测量和面积测量。
  1609. */
  1610. var MeasureMode = SuperMap.MeasureMode = {
  1611. /** 距离测量 */
  1612. DISTANCE: "DISTANCE",
  1613. /** 面积测量 */
  1614. AREA: "AREA"
  1615. };
  1616. /**
  1617. * @enum Unit
  1618. * @memberOf SuperMap
  1619. * @description 距离单位枚举。
  1620. * 该类定义了一系列距离单位类型。
  1621. * @type {string}
  1622. */
  1623. var Unit = SuperMap.Unit = {
  1624. /** 米 */
  1625. METER: "METER",
  1626. /** 千米 */
  1627. KILOMETER: "KILOMETER",
  1628. /** 英里 */
  1629. MILE: "MILE",
  1630. /** 码 */
  1631. YARD: "YARD",
  1632. /** 度 */
  1633. DEGREE: "DEGREE",
  1634. /** 毫米 */
  1635. MILLIMETER: "MILLIMETER",
  1636. /** 厘米 */
  1637. CENTIMETER: "CENTIMETER",
  1638. /** 英寸 */
  1639. INCH: "INCH",
  1640. /** 分米 */
  1641. DECIMETER: "DECIMETER",
  1642. /** 英尺 */
  1643. FOOT: "FOOT",
  1644. /** 秒 */
  1645. SECOND: "SECOND",
  1646. /** 分 */
  1647. MINUTE: "MINUTE",
  1648. /** 弧度 */
  1649. RADIAN: "RADIAN"
  1650. };
  1651. /**
  1652. * @enum BufferRadiusUnit
  1653. * @memberOf SuperMap
  1654. * @description 缓冲区距离单位枚举。
  1655. * 该类定义了一系列缓冲距离单位类型。
  1656. * @type {string}
  1657. */
  1658. var BufferRadiusUnit = SuperMap.BufferRadiusUnit = {
  1659. /** 厘米 */
  1660. CENTIMETER: "CENTIMETER",
  1661. /** 分米 */
  1662. DECIMETER: "DECIMETER",
  1663. /** 英尺 */
  1664. FOOT: "FOOT",
  1665. /** 英寸 */
  1666. INCH: "INCH",
  1667. /** 千米 */
  1668. KILOMETER: "KILOMETER",
  1669. /** 米 */
  1670. METER: "METER",
  1671. /** 英里 */
  1672. MILE: "MILE",
  1673. /** 毫米 */
  1674. MILLIMETER: "MILLIMETER",
  1675. /** 码 */
  1676. YARD: "YARD"
  1677. }
  1678. /**
  1679. * @enum EngineType
  1680. * @memberOf SuperMap
  1681. * @description 数据源引擎类型枚举。
  1682. * @type {string}
  1683. */
  1684. var EngineType = SuperMap.EngineType = {
  1685. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  1686. IMAGEPLUGINS: "IMAGEPLUGINS",
  1687. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  1688. OGC: "OGC",
  1689. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  1690. ORACLEPLUS: "ORACLEPLUS",
  1691. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  1692. SDBPLUS: "SDBPLUS",
  1693. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
  1694. SQLPLUS: "SQLPLUS",
  1695. /** UDB 引擎类型,文件引擎。 */
  1696. UDB: "UDB"
  1697. };
  1698. /**
  1699. * @enum ThemeGraphTextFormat
  1700. * @memberOf SuperMap
  1701. * @description 统计专题图文本显示格式枚举。
  1702. * @type {string}
  1703. */
  1704. var ThemeGraphTextFormat = SuperMap.ThemeGraphTextFormat = {
  1705. /** 标题。以各子项的标题来进行标注。 */
  1706. CAPTION: "CAPTION",
  1707. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  1708. CAPTION_PERCENT: "CAPTION_PERCENT",
  1709. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  1710. CAPTION_VALUE: "CAPTION_VALUE",
  1711. /** 百分数。以各子项所占的百分比来进行标注。 */
  1712. PERCENT: "PERCENT",
  1713. /** 实际数值。以各子项的真实数值来进行标注。 */
  1714. VALUE: "VALUE"
  1715. };
  1716. /**
  1717. * @enum ThemeGraphType
  1718. * @memberOf SuperMap
  1719. * @description 统计专题图类型枚举。
  1720. * @type {string}
  1721. */
  1722. var ThemeGraphType = SuperMap.ThemeGraphType = {
  1723. /** 面积图。 */
  1724. AREA: "AREA",
  1725. /** 柱状图。 */
  1726. BAR: "BAR",
  1727. /** 三维柱状图。 */
  1728. BAR3D: "BAR3D",
  1729. /** 折线图。 */
  1730. LINE: "LINE",
  1731. /** 饼图。 */
  1732. PIE: "PIE",
  1733. /** 三维饼图。 */
  1734. PIE3D: "PIE3D",
  1735. /** 点状图。 */
  1736. POINT: "POINT",
  1737. /** 环状图。 */
  1738. RING: "RING",
  1739. /** 玫瑰图。 */
  1740. ROSE: "ROSE",
  1741. /** 三维玫瑰图。 */
  1742. ROSE3D: "ROSE3D",
  1743. /** 堆叠柱状图。 */
  1744. STACK_BAR: "STACK_BAR",
  1745. /** 三维堆叠柱状图。 */
  1746. STACK_BAR3D: "STACK_BAR3D",
  1747. /** 阶梯图。 */
  1748. STEP: "STEP"
  1749. };
  1750. /**
  1751. * @enum GraphAxesTextDisplayMode
  1752. * @memberOf SuperMap
  1753. * @description 统计专题图坐标轴文本显示模式。
  1754. * @type {string}
  1755. */
  1756. var GraphAxesTextDisplayMode = SuperMap.GraphAxesTextDisplayMode = {
  1757. /** 显示全部文本。 */
  1758. ALL: "ALL",
  1759. /** 不显示。 */
  1760. NONE: "NONE",
  1761. /** 显示Y轴的文本。 */
  1762. YAXES: "YAXES"
  1763. };
  1764. /**
  1765. * @enum GraduatedMode
  1766. * @memberOf SuperMap
  1767. * @description 专题图分级模式枚举。
  1768. *
  1769. * @type {string}
  1770. */
  1771. var GraduatedMode = SuperMap.GraduatedMode = {
  1772. /** 常量分级模式。 */
  1773. CONSTANT: "CONSTANT",
  1774. /** 对数分级模式。 */
  1775. LOGARITHM: "LOGARITHM",
  1776. /** 平方根分级模式。 */
  1777. SQUAREROOT: "SQUAREROOT"
  1778. };
  1779. /**
  1780. * @enum RangeMode
  1781. * @memberOf SuperMap
  1782. * @description 范围分段专题图分段方式枚举。
  1783. * @type {string}
  1784. */
  1785. var RangeMode = SuperMap.RangeMode = {
  1786. /** 自定义分段法。 */
  1787. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  1788. /** 等距离分段法。 */
  1789. EQUALINTERVAL: "EQUALINTERVAL",
  1790. /** 对数分段法。 */
  1791. LOGARITHM: "LOGARITHM",
  1792. /** 等计数分段法。 */
  1793. QUANTILE: "QUANTILE",
  1794. /** 平方根分段法。 */
  1795. SQUAREROOT: "SQUAREROOT",
  1796. /** 标准差分段法。 */
  1797. STDDEVIATION: "STDDEVIATION"
  1798. };
  1799. /**
  1800. * @enum ThemeType
  1801. * @memberOf SuperMap
  1802. * @description 专题图类型枚举。
  1803. * @type {string}
  1804. */
  1805. var ThemeType = SuperMap.ThemeType = {
  1806. /** 点密度专题图。 */
  1807. DOTDENSITY: "DOTDENSITY",
  1808. /** 等级符号专题图。 */
  1809. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  1810. /** 统计专题图。 */
  1811. GRAPH: "GRAPH",
  1812. /** 标签专题图。 */
  1813. LABEL: "LABEL",
  1814. /** 分段专题图。 */
  1815. RANGE: "RANGE",
  1816. /** 単值专题图。 */
  1817. UNIQUE: "UNIQUE"
  1818. };
  1819. /**
  1820. * @enum ColorGradientType
  1821. * @memberOf SuperMap
  1822. * @description 渐变颜色枚举。
  1823. * @type {string}
  1824. */
  1825. var ColorGradientType = SuperMap.ColorGradientType = {
  1826. /** 黑白渐变色。 */
  1827. BLACK_WHITE: "BLACKWHITE",
  1828. /** 蓝黑渐变色。 */
  1829. BLUE_BLACK: "BLUEBLACK",
  1830. /** 蓝红渐变色。 */
  1831. BLUE_RED: "BLUERED",
  1832. /** 蓝白渐变色。 */
  1833. BLUE_WHITE: "BLUEWHITE",
  1834. /** 青黑渐变色。 */
  1835. CYAN_BLACK: "CYANBLACK",
  1836. /** 青蓝渐变色。 */
  1837. CYAN_BLUE: "CYANBLUE",
  1838. /** 青绿渐变色。 */
  1839. CYAN_GREEN: "CYANGREEN",
  1840. /** 青白渐变色。 */
  1841. CYAN_WHITE: "CYANWHITE",
  1842. /** 绿黑渐变色。 */
  1843. GREEN_BLACK: "GREENBLACK",
  1844. /** 绿蓝渐变色。 */
  1845. GREEN_BLUE: "GREENBLUE",
  1846. /** 绿橙紫渐变色。 */
  1847. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  1848. /** 绿红渐变色。 */
  1849. GREEN_RED: "GREENRED",
  1850. /** 蓝红渐变色。 */
  1851. GREEN_WHITE: "GREENWHITE",
  1852. /** 粉黑渐变色。 */
  1853. PINK_BLACK: "PINKBLACK",
  1854. /** 粉蓝渐变色。 */
  1855. PINK_BLUE: "PINKBLUE",
  1856. /** 粉红渐变色。 */
  1857. PINK_RED: "PINKRED",
  1858. /** 粉白渐变色。 */
  1859. PINK_WHITE: "PINKWHITE",
  1860. /** 彩虹色。 */
  1861. RAIN_BOW: "RAINBOW",
  1862. /** 红黑渐变色。 */
  1863. RED_BLACK: "REDBLACK",
  1864. /** 红白渐变色。 */
  1865. RED_WHITE: "REDWHITE",
  1866. /** 光谱渐变。 */
  1867. SPECTRUM: "SPECTRUM",
  1868. /** 地形渐变,用于三维显示效果较好。 */
  1869. TERRAIN: "TERRAIN",
  1870. /** 黄黑渐变色。 */
  1871. YELLOW_BLACK: "YELLOWBLACK",
  1872. /** 黄蓝渐变色。 */
  1873. YELLOW_BLUE: "YELLOWBLUE",
  1874. /** 黄绿渐变色。 */
  1875. YELLOW_GREEN: "YELLOWGREEN",
  1876. /** 黄红渐变色。 */
  1877. YELLOW_RED: "YELLOWRED",
  1878. /** 黄白渐变色。 */
  1879. YELLOW_WHITE: "YELLOWWHITE"
  1880. };
  1881. /**
  1882. * @enum TextAlignment
  1883. * @memberOf SuperMap
  1884. * @description 文本对齐枚举。
  1885. * @type {string}
  1886. */
  1887. var TextAlignment = SuperMap.TextAlignment = {
  1888. /** 左上角对齐。 */
  1889. TOPLEFT: "TOPLEFT",
  1890. /** 顶部居中对齐。 */
  1891. TOPCENTER: "TOPCENTER",
  1892. /** 右上角对齐。 */
  1893. TOPRIGHT: "TOPRIGHT",
  1894. /** 基准线左对齐。 */
  1895. BASELINELEFT: "BASELINELEFT",
  1896. /** 基准线居中对齐。 */
  1897. BASELINECENTER: "BASELINECENTER",
  1898. /** 基准线右对齐。 */
  1899. BASELINERIGHT: "BASELINERIGHT",
  1900. /** 左下角对齐。 */
  1901. BOTTOMLEFT: "BOTTOMLEFT",
  1902. /** 底部居中对齐。 */
  1903. BOTTOMCENTER: "BOTTOMCENTER",
  1904. /** 右下角对齐。 */
  1905. BOTTOMRIGHT: "BOTTOMRIGHT",
  1906. /** 左中对齐。 */
  1907. MIDDLELEFT: "MIDDLELEFT",
  1908. /** 中心对齐。 */
  1909. MIDDLECENTER: "MIDDLECENTER",
  1910. /** 右中对齐。 */
  1911. MIDDLERIGHT: "MIDDLERIGHT"
  1912. };
  1913. /**
  1914. * @enum FillGradientMode
  1915. * @memberOf SuperMap
  1916. * @description 渐变填充风格的渐变类型枚举。
  1917. * @type {string}
  1918. */
  1919. var FillGradientMode = SuperMap.FillGradientMode = {
  1920. /** 无渐变。 */
  1921. NONE: "NONE",
  1922. /** 线性渐变填充。 */
  1923. LINEAR: "LINEAR",
  1924. /** 辐射渐变填充。 */
  1925. RADIAL: "RADIAL",
  1926. /** 圆锥渐变填充。 */
  1927. CONICAL: "CONICAL",
  1928. /** 四角渐变填充。 */
  1929. SQUARE: "SQUARE"
  1930. };
  1931. /**
  1932. * @enum AlongLineDirection
  1933. * @memberOf SuperMap
  1934. * @description 标签沿线标注方向枚举。
  1935. * @type {string}
  1936. */
  1937. var AlongLineDirection = SuperMap.AlongLineDirection = {
  1938. /** 沿线的法线方向放置标签。 */
  1939. NORMAL: "ALONG_LINE_NORMAL",
  1940. /** 从下到上,从左到右放置。 */
  1941. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  1942. /** 从上到下,从左到右放置。 */
  1943. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  1944. /** 从下到上,从右到左放置。 */
  1945. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  1946. /** 从上到下,从右到左放置。 */
  1947. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  1948. };
  1949. /**
  1950. * @enum LabelBackShape
  1951. * @memberOf SuperMap
  1952. * @description 标签专题图中标签背景的形状枚举。
  1953. * @type {string}
  1954. */
  1955. var LabelBackShape = SuperMap.LabelBackShape = {
  1956. /** 菱形背景,即标签背景的形状为菱形。 */
  1957. DIAMOND: "DIAMOND",
  1958. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  1959. ELLIPSE: "ELLIPSE",
  1960. /** 符号背景,即标签背景的形状为设定的符号。 */
  1961. MARKER: "MARKER",
  1962. /** 空背景,即不使用任何形状作为标签的背景。 */
  1963. NONE: "NONE",
  1964. /** 矩形背景,即标签背景的形状为矩形。 */
  1965. RECT: "RECT",
  1966. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  1967. ROUNDRECT: "ROUNDRECT",
  1968. /** 三角形背景,即标签背景的形状为三角形。 */
  1969. TRIANGLE: "TRIANGLE"
  1970. };
  1971. /**
  1972. * @enum LabelOverLengthMode
  1973. * @memberOf SuperMap
  1974. * @description 标签专题图中超长标签的处理模式枚举。
  1975. * @type {string}
  1976. */
  1977. var LabelOverLengthMode = SuperMap.LabelOverLengthMode = {
  1978. /** 换行显示。 */
  1979. NEWLINE: "NEWLINE",
  1980. /** 对超长标签不进行处理。 */
  1981. NONE: "NONE",
  1982. /** 省略超出部分。 */
  1983. OMIT: "OMIT"
  1984. };
  1985. /**
  1986. * @enum DirectionType
  1987. * @memberOf SuperMap
  1988. * @description 网络分析中方向枚举。
  1989. * 在行驶引导子项中使用。
  1990. * @type {string}
  1991. */
  1992. var DirectionType = SuperMap.DirectionType = {
  1993. /** 东。 */
  1994. EAST: "EAST",
  1995. /** 无方向。 */
  1996. NONE: "NONE",
  1997. /** 北。 */
  1998. NORTH: "NORTH",
  1999. /** 南。 */
  2000. SOURTH: "SOURTH",
  2001. /** 西。 */
  2002. WEST: "WEST"
  2003. };
  2004. /**
  2005. * @enum SideType
  2006. * @memberOf SuperMap
  2007. * @description 行驶位置枚举。
  2008. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  2009. * @type {string}
  2010. */
  2011. var SideType = SuperMap.SideType = {
  2012. /** 路的左侧。 */
  2013. LEFT: "LEFT",
  2014. /** 在路上(即路的中间)。 */
  2015. MIDDLE: "MIDDLE",
  2016. /** 无效值。 */
  2017. NONE: "NONE",
  2018. /** 路的右侧。 */
  2019. RIGHT: "RIGHT"
  2020. };
  2021. /**
  2022. * @enum SupplyCenterType
  2023. * @memberOf SuperMap
  2024. * @description 资源供给中心类型枚举。
  2025. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  2026. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  2027. * @type {string}
  2028. */
  2029. var SupplyCenterType = SuperMap.SupplyCenterType = {
  2030. /** 固定中心点。 */
  2031. FIXEDCENTER: "FIXEDCENTER",
  2032. /** 非中心点。 */
  2033. NULL: "NULL",
  2034. /** 可选中心点。 */
  2035. OPTIONALCENTER: "OPTIONALCENTER"
  2036. };
  2037. /**
  2038. * @enum TurnType
  2039. * @memberOf SuperMap
  2040. * @description 转弯方向枚举。
  2041. * 用在行驶引导子项类中,表示转弯的方向。
  2042. * @type {string}
  2043. */
  2044. var TurnType = SuperMap.TurnType = {
  2045. /** 向前直行。 */
  2046. AHEAD: "AHEAD",
  2047. /** 掉头。 */
  2048. BACK: "BACK",
  2049. /** 终点,不拐弯。 */
  2050. END: "END",
  2051. /** 左转弯。 */
  2052. LEFT: "LEFT",
  2053. /** 无效值。 */
  2054. NONE: "NONE",
  2055. /** 右转弯。 */
  2056. RIGHT: "RIGHT"
  2057. };
  2058. /**
  2059. * @enum BufferEndType
  2060. * @memberOf SuperMap
  2061. * @description 缓冲区分析BufferEnd类型。
  2062. * @type {string}
  2063. */
  2064. var BufferEndType = SuperMap.BufferEndType = {
  2065. /** FLAT */
  2066. FLAT: "FLAT",
  2067. /** ROUND */
  2068. ROUND: "ROUND"
  2069. };
  2070. /**
  2071. * @enum OverlayOperationType
  2072. * @memberOf SuperMap
  2073. * @description 叠加分析类型枚举。
  2074. * @type {string}
  2075. */
  2076. var OverlayOperationType = SuperMap.OverlayOperationType = {
  2077. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  2078. CLIP: "CLIP",
  2079. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  2080. ERASE: "ERASE",
  2081. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  2082. IDENTITY: "IDENTITY",
  2083. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  2084. INTERSECT: "INTERSECT",
  2085. /** 对两个面数据集(几何对象)进行合并操作。 */
  2086. UNION: "UNION",
  2087. /** 对两个面数据集(几何对象)进行更新操作。 */
  2088. UPDATE: "UPDATE",
  2089. /** 对两个面数据集(几何对象)进行对称差操作。 */
  2090. XOR: "XOR"
  2091. };
  2092. /**
  2093. * @enum OutputType
  2094. * @memberOf SuperMap
  2095. * @description 分布式分析输出类型枚举。
  2096. * @type {string}
  2097. */
  2098. var OutputType = SuperMap.OutputType = {
  2099. /** INDEXEDHDFS */
  2100. INDEXEDHDFS: "INDEXEDHDFS",
  2101. /** UDB */
  2102. UDB: "UDB",
  2103. /** MONGODB */
  2104. MONGODB: "MONGODB",
  2105. /** PG */
  2106. PG: "PG"
  2107. };
  2108. /**
  2109. * @enum SmoothMethod
  2110. * @memberOf SuperMap
  2111. * @description 光滑方法枚举。
  2112. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  2113. * @type {string}
  2114. */
  2115. var SmoothMethod = SuperMap.SmoothMethod = {
  2116. /** B 样条法。 */
  2117. BSPLINE: "BSPLINE",
  2118. /** 磨角法。 */
  2119. POLISH: "POLISH"
  2120. };
  2121. /**
  2122. * @enum SurfaceAnalystMethod
  2123. * @memberOf SuperMap
  2124. * @description 表面分析方法枚举。
  2125. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  2126. * @type {string}
  2127. */
  2128. var SurfaceAnalystMethod = SuperMap.SurfaceAnalystMethod = {
  2129. /** 等值线提取。 */
  2130. ISOLINE: "ISOLINE",
  2131. /** 等值面提取。 */
  2132. ISOREGION: "ISOREGION"
  2133. };
  2134. /**
  2135. * @enum DataReturnMode
  2136. * @memberOf SuperMap
  2137. * @description 数据返回模式枚举。
  2138. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  2139. * @type {string}
  2140. */
  2141. var DataReturnMode = SuperMap.DataReturnMode = {
  2142. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  2143. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  2144. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  2145. DATASET_ONLY: "DATASET_ONLY",
  2146. /** 只返回记录集(RecordSet)。 */
  2147. RECORDSET_ONLY: "RECORDSET_ONLY"
  2148. };
  2149. /**
  2150. * @enum EditType
  2151. * @memberOf SuperMap
  2152. * @description 要素集更新模式枚举。
  2153. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  2154. * @type {string}
  2155. */
  2156. var EditType = SuperMap.EditType = {
  2157. /** 增加操作。 */
  2158. ADD: "add",
  2159. /** 修改操作。 */
  2160. UPDATE: "update",
  2161. /** 删除操作。 */
  2162. DELETE: "delete"
  2163. };
  2164. /**
  2165. * @enum TransferTactic
  2166. * @memberOf SuperMap
  2167. * @description 公交换乘策略枚举。
  2168. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  2169. * @type {string}
  2170. */
  2171. var TransferTactic = SuperMap.TransferTactic = {
  2172. /** 时间短。 */
  2173. LESS_TIME: "LESS_TIME",
  2174. /** 少换乘。 */
  2175. LESS_TRANSFER: "LESS_TRANSFER",
  2176. /** 少步行。 */
  2177. LESS_WALK: "LESS_WALK",
  2178. /** 距离最短。 */
  2179. MIN_DISTANCE: "MIN_DISTANCE"
  2180. };
  2181. /**
  2182. * @enum TransferPreference
  2183. * @memberOf SuperMap
  2184. * @description 公交换乘策略枚举。
  2185. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  2186. * @type {string}
  2187. */
  2188. var TransferPreference = SuperMap.TransferPreference = {
  2189. /** 公交汽车优先。 */
  2190. BUS: "BUS",
  2191. /** 地铁优先。 */
  2192. SUBWAY: "SUBWAY",
  2193. /** 不乘坐地铁。 */
  2194. NO_SUBWAY: "NO_SUBWAY",
  2195. /** 无乘车偏好。 */
  2196. NONE: "NONE"
  2197. };
  2198. /**
  2199. * @enum GridType
  2200. * @memberOf SuperMap
  2201. * @description 地图背景格网类型枚举。
  2202. * @type {string}
  2203. */
  2204. var GridType = SuperMap.GridType = {
  2205. /** 十字叉丝。 */
  2206. CROSS: "CROSS",
  2207. /** 网格线。 */
  2208. GRID: "GRID",
  2209. /** 点。 */
  2210. POINT: "POINT"
  2211. };
  2212. /**
  2213. * @enum ColorSpaceType
  2214. * @memberOf SuperMap
  2215. * @description 色彩空间枚举。
  2216. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  2217. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  2218. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  2219. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  2220. * @type {string}
  2221. */
  2222. var ColorSpaceType = SuperMap.ColorSpaceType = {
  2223. /** 该类型主要在印刷系统使用。 */
  2224. CMYK: "CMYK",
  2225. /** 该类型主要在显示系统中使用。 */
  2226. RGB: "RGB"
  2227. };
  2228. /**
  2229. * @enum LayerType
  2230. * @memberOf SuperMap
  2231. * @description 图层类型。
  2232. * @type {string}
  2233. */
  2234. var LayerType = SuperMap.LayerType = {
  2235. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  2236. UGC: "UGC",
  2237. /** WMS 图层。 */
  2238. WMS: "WMS",
  2239. /** WFS 图层。 */
  2240. WFS: "WFS",
  2241. /** 自定义图层。 */
  2242. CUSTOM: "CUSTOM"
  2243. };
  2244. /**
  2245. * @enum UGCLayerType
  2246. * @memberOf SuperMap
  2247. * @description UGC图层类型。
  2248. * @type {string}
  2249. */
  2250. var UGCLayerType = SuperMap.UGCLayerType = {
  2251. /** 专题图层。 */
  2252. THEME: "THEME",
  2253. /** 矢量图层。 */
  2254. VECTOR: "VECTOR",
  2255. /** 栅格图层。。 */
  2256. GRID: "GRID",
  2257. /** 影像图层。 */
  2258. IMAGE: "IMAGE"
  2259. };
  2260. /**
  2261. * @enum StatisticMode
  2262. * @memberOf SuperMap
  2263. * @description 字段统计方法类型。
  2264. * @type {string}
  2265. */
  2266. var StatisticMode = SuperMap.StatisticMode = {
  2267. /** 统计所选字段的平均值。 */
  2268. AVERAGE: "AVERAGE",
  2269. /** 统计所选字段的最大值。 */
  2270. MAX: "MAX",
  2271. /** 统计所选字段的最小值。 */
  2272. MIN: "MIN",
  2273. /** 统计所选字段的标准差 */
  2274. STDDEVIATION: "STDDEVIATION",
  2275. /** 统计所选字段的总和。 */
  2276. SUM: "SUM",
  2277. /** 统计所选字段的方差。 */
  2278. VARIANCE: "VARIANCE"
  2279. };
  2280. /**
  2281. * @enum PixelFormat
  2282. * @memberOf SuperMap
  2283. * @description 栅格与影像数据存储的像素格式枚举。
  2284. * @type {string}
  2285. */
  2286. var PixelFormat = SuperMap.PixelFormat = {
  2287. /** 每个像元用16个比特(即2个字节)表示。 */
  2288. BIT16: "BIT16",
  2289. /** 每个像元用32个比特(即4个字节)表示。 */
  2290. BIT32: "BIT32",
  2291. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  2292. BIT64: "BIT64",
  2293. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  2294. SINGLE: "SINGLE",
  2295. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  2296. DOUBLE: "DOUBLE",
  2297. /** 每个像元用1个比特表示。 */
  2298. UBIT1: "UBIT1",
  2299. /** 每个像元用4个比特来表示。 */
  2300. UBIT4: "UBIT4",
  2301. /** 每个像元用8个比特(即1个字节)来表示。 */
  2302. UBIT8: "UBIT8",
  2303. /** 每个像元用24个比特(即3个字节)来表示。 */
  2304. UBIT24: "UBIT24",
  2305. /** 每个像元用32个比特(即4个字节)来表示。 */
  2306. UBIT32: "UBIT32"
  2307. };
  2308. /**
  2309. * @enum SearchMode
  2310. * @memberOf SuperMap
  2311. * @description 内插时使用的样本点的查找方式枚举
  2312. * @type {string}
  2313. */
  2314. var SearchMode = SuperMap.SearchMode = {
  2315. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  2316. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  2317. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  2318. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  2319. /** 不进行查找,使用所有的输入点进行内插分析。 */
  2320. NONE: "NONE",
  2321. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  2322. QUADTREE: "QUADTREE"
  2323. };
  2324. /**
  2325. * @enum InterpolationAlgorithmType
  2326. * @memberOf SuperMap
  2327. * @description 插值分析的算法的类型
  2328. * @type {string}
  2329. */
  2330. var InterpolationAlgorithmType = SuperMap.InterpolationAlgorithmType = {
  2331. /** 普通克吕金插值法。 */
  2332. KRIGING: "KRIGING",
  2333. /** 简单克吕金插值法。 */
  2334. SimpleKriging: "SimpleKriging",
  2335. /** 泛克吕金插值法。 */
  2336. UniversalKriging: "UniversalKriging"
  2337. };
  2338. /**
  2339. * @enum VariogramMode
  2340. * @memberOf SuperMap
  2341. * @description 克吕金(Kriging)插值时的半变函数类型枚举
  2342. * @type {string}
  2343. */
  2344. var VariogramMode = SuperMap.VariogramMode = {
  2345. /** 指数函数。 */
  2346. EXPONENTIAL: "EXPONENTIAL",
  2347. /** 高斯函数。 */
  2348. GAUSSIAN: "GAUSSIAN",
  2349. /** 球型函数。 */
  2350. SPHERICAL: "SPHERICAL"
  2351. };
  2352. /**
  2353. * @enum Exponent
  2354. * @memberOf SuperMap
  2355. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
  2356. * @type {string}
  2357. */
  2358. var Exponent = SuperMap.Exponent = {
  2359. /** 阶数为1。 */
  2360. EXP1: "EXP1",
  2361. /** 阶数为2。 */
  2362. EXP2: "EXP2"
  2363. };
  2364. /**
  2365. * @enum ClientType
  2366. * @memberOf SuperMap
  2367. * @description token申请的客户端标识类型
  2368. * @type {string}
  2369. */
  2370. var ClientType = SuperMap.ClientType = {
  2371. /** 指定的 IP 地址。 */
  2372. IP: "IP",
  2373. /** 指定的 URL。 */
  2374. REFERER: "Referer",
  2375. /** 发送申请令牌请求的客户端 IP。 */
  2376. REQUESTIP: "RequestIP",
  2377. /** 不做任何验证。 */
  2378. NONE: "NONE",
  2379. /** SERVER。 */
  2380. SERVER: "SERVER",
  2381. /** WEB。 */
  2382. WEB: "WEB"
  2383. };
  2384. /**
  2385. * @enum ChartType
  2386. * @memberOf SuperMap
  2387. * @description 客户端专题图图表类型
  2388. * @type {string}
  2389. */
  2390. var ChartType = SuperMap.ChartType = {
  2391. /** 柱状图。 */
  2392. BAR: "Bar",
  2393. /** 三维柱状图。 */
  2394. BAR3D: "Bar3D",
  2395. /** 圆形图。 */
  2396. CIRCLE: "Circle",
  2397. /** 饼图。 */
  2398. PIE: "Pie",
  2399. /** 散点图。 */
  2400. POINT: "Point",
  2401. /** 折线图。 */
  2402. LINE: "Line",
  2403. /** 环状图。 */
  2404. RING: "Ring"
  2405. };
  2406. /**
  2407. * @enum ClipAnalystMode
  2408. * @memberOf SuperMap
  2409. * @description 裁剪分析模式
  2410. * @type {string}
  2411. */
  2412. var ClipAnalystMode = SuperMap.ClipAnalystMode = {
  2413. /** CLIP。 */
  2414. CLIP: "clip",
  2415. /** INTERSECT。 */
  2416. INTERSECT: "intersect"
  2417. };
  2418. /**
  2419. * @enum AnalystAreaUnit
  2420. * @memberOf SuperMap
  2421. * @description 分布式分析面积单位
  2422. * @type {string}
  2423. */
  2424. var AnalystAreaUnit = SuperMap.AnalystAreaUnit = {
  2425. /** 平方米。 */
  2426. "SQUAREMETER": "SquareMeter",
  2427. /** 平方千米。 */
  2428. "SQUAREKILOMETER": "SquareKiloMeter",
  2429. /** 公顷。 */
  2430. "HECTARE": "Hectare",
  2431. /** 公亩。 */
  2432. "ARE": "Are",
  2433. /** 英亩。 */
  2434. "ACRE": "Acre",
  2435. /** 平方英尺。 */
  2436. "SQUAREFOOT": "SquareFoot",
  2437. /** 平方码。 */
  2438. "SQUAREYARD": "SquareYard",
  2439. /** 平方英里。 */
  2440. "SQUAREMILE": "SquareMile"
  2441. };
  2442. /**
  2443. * @enum AnalystSizeUnit
  2444. * @memberOf SuperMap
  2445. * @description 分布式分析单位
  2446. * @type {string}
  2447. */
  2448. var AnalystSizeUnit = SuperMap.AnalystSizeUnit = {
  2449. /** 米。 */
  2450. "METER": "Meter",
  2451. /** 千米。 */
  2452. "KILOMETER": "Kilometer",
  2453. /** 码。 */
  2454. "YARD": "Yard",
  2455. /** 英尺。 */
  2456. "FOOT": "Foot",
  2457. /** 英里。 */
  2458. "MILE": "Mile"
  2459. };
  2460. /**
  2461. * @enum StatisticAnalystMode
  2462. * @memberOf SuperMap
  2463. * @description 分布式分析统计模式
  2464. * @type {string}
  2465. */
  2466. var StatisticAnalystMode = SuperMap.StatisticAnalystMode = {
  2467. /** 统计所选字段的最大值。 */
  2468. "MAX": "max",
  2469. /** 统计所选字段的最小值。 */
  2470. "MIN": "min",
  2471. /** 统计所选字段的平均值。 */
  2472. "AVERAGE": "average",
  2473. /** 统计所选字段的总和。 */
  2474. "SUM": "sum",
  2475. /** 统计所选字段的方差。 */
  2476. "VARIANCE": "variance",
  2477. /** 统计所选字段的标准差 */
  2478. "STDDEVIATION": "stdDeviation"
  2479. };
  2480. /**
  2481. * @enum SummaryType
  2482. * @memberOf SuperMap
  2483. * @description 分布式分析聚合类型
  2484. * @type {string}
  2485. */
  2486. var SummaryType = SuperMap.SummaryType = {
  2487. /** 格网聚合。 */
  2488. "SUMMARYMESH": "SUMMARYMESH",
  2489. /** 多边形聚合。 */
  2490. "SUMMARYREGION": "SUMMARYREGION"
  2491. };
  2492. /**
  2493. * @enum TopologyValidatorRule
  2494. * @memberOf SuperMap
  2495. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  2496. * @type {string}
  2497. */
  2498. var TopologyValidatorRule = SuperMap.TopologyValidatorRule = {
  2499. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  2500. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  2501. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  2502. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  2503. /** 面被面包含,用于对面数据进行拓扑检查。 */
  2504. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  2505. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  2506. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  2507. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  2508. LINENOOVERLAP: "LINENOOVERLAP",
  2509. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  2510. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  2511. /** 点不相同,用于对点数据进行拓扑检查。 */
  2512. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  2513. };
  2514. /**
  2515. * @enum AggregationType
  2516. * @memberOf SuperMap
  2517. * @description 聚合查询枚举类,该类定义了Es数据服务中聚合查询模式常量
  2518. * @type {string}
  2519. */
  2520. var AggregationType = SuperMap.AggregationType = {
  2521. /** 格网聚合类型。 */
  2522. GEOHASH_GRID: "geohash_grid",
  2523. /** 过滤聚合类型。 */
  2524. FILTER: "filter"
  2525. };
  2526. /**
  2527. * @enum AggregationType
  2528. * @memberOf SuperMap
  2529. * @description 聚合查询中filter查询枚举类
  2530. * @type {string}
  2531. */
  2532. var AggregationQueryBuilderType = SuperMap.AggregationQueryBuilderType = {
  2533. /** 范围查询。 */
  2534. GEO_BOUNDING_BOX: "geo_bounding_box"
  2535. }
  2536. /**
  2537. * @enum GetFeatureMode
  2538. * @memberOf SuperMap
  2539. * @description feature 查询方式。
  2540. * @type {string}
  2541. */
  2542. var GetFeatureMode = SuperMap.GetFeatureMode = {
  2543. /** 通过范围查询来获取要素。 */
  2544. BOUNDS: "BOUNDS",
  2545. /** 通过几何对象的缓冲区来获取要素。 */
  2546. BUFFER: "BUFFER",
  2547. /** 通过 ID 来获取要素。 */
  2548. ID: "ID",
  2549. /** 通过空间查询模式来获取要素。 */
  2550. SPATIAL: "SPATIAL",
  2551. /** 通过 SQL 查询来获取要素。 */
  2552. SQL: 'SQL'
  2553. }
  2554. /**
  2555. * @enum RasterFunctionType
  2556. * @memberOf SuperMap
  2557. * @description 栅格分析方法。
  2558. * @type {string}
  2559. */
  2560. var RasterFunctionType = SuperMap.RasterFunctionType = {
  2561. /** 归一化植被指数。 */
  2562. NDVI: "NDVI",
  2563. /** 阴影面分析。 */
  2564. HILLSHADE: "HILLSHADE"
  2565. }
  2566. /**
  2567. * @enum ResourceType
  2568. * @memberOf SuperMap
  2569. * @description iportal资源类型。
  2570. * @version 10.0.1
  2571. * @type {string}
  2572. */
  2573. var ResourceType = SuperMap.ResourceType = {
  2574. /** 地图。 */
  2575. MAP: "MAP",
  2576. /** 服务。 */
  2577. SERVICE: "SERVICE",
  2578. /** 场景。 */
  2579. SCENE: "SCENE",
  2580. /** 数据。 */
  2581. DATA: "DATA",
  2582. /** 洞察。 */
  2583. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  2584. /** 大屏。 */
  2585. MAP_DASHBOARD: "MAP_DASHBOARD"
  2586. }
  2587. /**
  2588. * @enum OrderBy
  2589. * @memberOf SuperMap
  2590. * @description iportal资源排序字段。
  2591. * @version 10.0.1
  2592. * @type {string}
  2593. */
  2594. var OrderBy = SuperMap.OrderBy = {
  2595. /** 按更新时间排序 */
  2596. UPDATETIME: "UPDATETIME",
  2597. /** 按热度(可能是访问量、下载量)排序 */
  2598. HEATLEVEL: "HEATLEVEL",
  2599. /** 按相关性排序 */
  2600. RELEVANCE: "RELEVANCE"
  2601. }
  2602. /**
  2603. * @enum OrderType
  2604. * @memberOf SuperMap
  2605. * @description iportal资源升序还是降序过滤
  2606. * @version 10.0.1
  2607. * @type {string}
  2608. */
  2609. var OrderType = SuperMap.OrderType = {
  2610. /** 升序 */
  2611. ASC: "ASC",
  2612. /** 降序 */
  2613. DESC: "DESC"
  2614. }
  2615. /**
  2616. * @enum SearchType
  2617. * @memberOf SuperMap
  2618. * @description iportal资源查询的范围进行过滤
  2619. * @version 10.0.1
  2620. * @type {string}
  2621. */
  2622. var SearchType = SuperMap.SearchType = {
  2623. /** 公开资源。 */
  2624. PUBLIC: "PUBLIC",
  2625. /** 我的资源。 */
  2626. MY_RES: "MY_RES",
  2627. /** 我的群组资源。 */
  2628. MYGROUP_RES: "MYGROUP_RES",
  2629. /** 我的部门资源。 */
  2630. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  2631. /** 分享给我的资源。 */
  2632. SHARETOME_RES: "SHARETOME_RES"
  2633. }
  2634. /**
  2635. * @enum AggregationTypes
  2636. * @memberOf SuperMap
  2637. * @description iportal资源聚合查询的类型
  2638. * @version 10.0.1
  2639. * @type {string}
  2640. */
  2641. var AggregationTypes = SuperMap.AggregationTypes = {
  2642. /** 标签 */
  2643. TAG: "TAG",
  2644. /** 资源类型 */
  2645. TYPE: "TYPE"
  2646. }
  2647. /**
  2648. * @enum PermissionType
  2649. * @memberOf SuperMap
  2650. * @description iportal资源权限类型。
  2651. * @version 10.0.1
  2652. * @type {string}
  2653. */
  2654. var PermissionType = SuperMap.PermissionType = {
  2655. /** 可检索 */
  2656. SEARCH:"SEARCH",
  2657. /** 可查看 */
  2658. READ: "READ",
  2659. /** 可编辑 */
  2660. READWRITE: "READWRITE",
  2661. /** 可删除 */
  2662. DELETE: "DELETE",
  2663. /** 可下载,包括可读、可检索 */
  2664. DOWNLOAD:"DOWNLOAD"
  2665. }
  2666. /**
  2667. * @enum EntityType
  2668. * @memberOf SuperMap
  2669. * @description iportal资源实体类型。
  2670. * @version 10.0.1
  2671. * @type {string}
  2672. */
  2673. var EntityType = SuperMap.EntityType = {
  2674. /** 部门 */
  2675. DEPARTMENT: "DEPARTMENT",
  2676. /** 用户组 */
  2677. GROUP: "GROUP",
  2678. /** 群组 */
  2679. IPORTALGROUP: "IPORTALGROUP",
  2680. /** 角色 */
  2681. ROLE: "ROLE",
  2682. /** 用户 */
  2683. USER: "USER"
  2684. }
  2685. /**
  2686. * @enum DataItemType
  2687. * @memberOf SuperMap
  2688. * @description iportal数据类型。
  2689. * @version 10.0.1
  2690. * @type {string}
  2691. */
  2692. var DataItemType = SuperMap.DataItemType = {
  2693. /** 工作空间 sxwu, smwu, sxw, smw */
  2694. WORKSPACE: "WORKSPACE",
  2695. /** udb 数据源 */
  2696. UDB: "UDB",
  2697. /** shp空间数据 */
  2698. SHP: "SHP",
  2699. /** excel数据 */
  2700. EXCEL: "EXCEL",
  2701. /** csv数据 */
  2702. CSV: "CSV",
  2703. /** geojson数据。 */
  2704. GEOJSON: "GEOJSON",
  2705. /** smtiles */
  2706. SMTILES: "SMTILES",
  2707. /** svtiles */
  2708. SVTILES: "SVTILES",
  2709. /** mbtiles */
  2710. MBTILES: "MBTILES",
  2711. /** tpk */
  2712. TPK: "TPK",
  2713. /** ugc v5 */
  2714. UGCV5: "UGCV5",
  2715. /** UGCV5_MVT */
  2716. UGCV5_MVT: "UGCV5_MVT",
  2717. /** json数据 */
  2718. JSON: "JSON"
  2719. }
  2720. /**
  2721. * @enum WebExportFormatType
  2722. * @memberOf SuperMap
  2723. * @description Web 打印输出的格式。
  2724. * @version 10.0.1
  2725. * @type {string}
  2726. */
  2727. var WebExportFormatType = SuperMap.WebExportFormatType = {
  2728. /** png */
  2729. PNG: "PNG",
  2730. /** pdf */
  2731. PDF: "PDF"
  2732. }
  2733. /**
  2734. * @enum WebScaleOrientationType
  2735. * @memberOf SuperMap
  2736. * @description Web 比例尺的方位样式。
  2737. * @version 10.0.1
  2738. * @type {string}
  2739. */
  2740. var WebScaleOrientationType = SuperMap.WebScaleOrientationType = {
  2741. /** horizontal labels below */
  2742. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  2743. /** horizontal labels above */
  2744. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  2745. /** vertical labels left */
  2746. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  2747. /** vertical labels right */
  2748. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  2749. }
  2750. /**
  2751. * @enum WebScaleType
  2752. * @memberOf SuperMap
  2753. * @description Web 比例尺的样式。
  2754. * @version 10.0.1
  2755. * @type {string}
  2756. */
  2757. var WebScaleType = SuperMap.WebScaleType = {
  2758. /** line */
  2759. LINE: "LINE",
  2760. /** bar */
  2761. BAR: "BAR",
  2762. /** bar sub */
  2763. BAR_SUB: "BAR_SUB"
  2764. }
  2765. /**
  2766. * @enum WebScaleUnit
  2767. * @memberOf SuperMap
  2768. * @description Web 比例尺的单位制。
  2769. * @version 10.0.1
  2770. * @type {string}
  2771. */
  2772. var WebScaleUnit = SuperMap.WebScaleUnit = {
  2773. /** meter */
  2774. METER: "METER",
  2775. /** foot */
  2776. FOOT: "FOOT",
  2777. /** degrees */
  2778. DEGREES: "DEGREES"
  2779. }
  2780. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  2781. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  2782. * This program are made available under the terms of the Apache License, Version 2.0
  2783. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2784. /**
  2785. * @class SuperMap.Size
  2786. * @category BaseTypes Style
  2787. * @classdesc 此类描绘一对高宽值的实例。
  2788. * @param {number} [w=0.0] - 宽度。
  2789. * @param {number} [h=0.0] - 高度。
  2790. *
  2791. * @example
  2792. * var size = new SuperMap.Size(31,46);
  2793. */
  2794. class Size {
  2795. constructor(w, h) {
  2796. /**
  2797. * @member {number} [SuperMap.Size.prototype.w=0.0]
  2798. * @description 宽度。
  2799. */
  2800. this.w = w ? parseFloat(w) : 0.0;
  2801. /**
  2802. * @member {number} [SuperMap.Size.prototype.h=0.0]
  2803. * @description 高度。
  2804. */
  2805. this.h = w ? parseFloat(h) : 0.0;
  2806. this.CLASS_NAME = "SuperMap.Size";
  2807. }
  2808. /**
  2809. * @function SuperMap.Size.prototype.toString
  2810. * @description 返回此对象的字符串形式。
  2811. * @example
  2812. * var size = new SuperMap.Size(10,5);
  2813. * var str = size.toString();
  2814. * @returns {string} 例如:"w=10,h=5"。
  2815. */
  2816. toString() {
  2817. return ("w=" + this.w + ",h=" + this.h);
  2818. }
  2819. /**
  2820. * @function SuperMap.Size.prototype.clone
  2821. * @description 克隆当前size对象。
  2822. * @example
  2823. * var size = new SuperMap.Size(31,46);
  2824. * var size2 = size.clone();
  2825. * @returns {SuperMap.Size} 返回一个新的与当前 size 对象有相同宽、高的 Size 对象。
  2826. */
  2827. clone() {
  2828. return new Size(this.w, this.h);
  2829. }
  2830. /**
  2831. *
  2832. * @function SuperMap.Size.prototype.equals
  2833. * @description 比较两个 size 对象是否相等。
  2834. * @example
  2835. * var size = new SuperMap.Size(31,46);
  2836. * var size2 = new SuperMap.Size(31,46);
  2837. * var isEquals = size.equals(size2);
  2838. *
  2839. * @param {SuperMap.Size} sz - 用于比较相等的 Size 对象。
  2840. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  2841. *
  2842. */
  2843. equals(sz) {
  2844. var equals = false;
  2845. if (sz != null) {
  2846. equals = ((this.w === sz.w && this.h === sz.h) ||
  2847. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  2848. }
  2849. return equals;
  2850. }
  2851. /**
  2852. *
  2853. * @function SuperMap.Size.prototype.destroy
  2854. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  2855. * @example
  2856. * var size = new SuperMap.Size(31,46);
  2857. * size.destroy();
  2858. */
  2859. destroy() {
  2860. this.w = null;
  2861. this.h = null;
  2862. }
  2863. }
  2864. SuperMap.Size = Size;
  2865. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  2866. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  2867. * This program are made available under the terms of the Apache License, Version 2.0
  2868. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2869. /**
  2870. * @class SuperMap.Pixel
  2871. * @category BaseTypes Geometry
  2872. * @classdesc 此类用 x,y 坐标描绘屏幕坐标(像素点)。
  2873. * @param {number} [x=0.0] - x 坐标。
  2874. * @param {number} [y=0.0] - y 坐标。
  2875. * @param {SuperMap.Pixel.Mode} [mode=SuperMap.Pixel.Mode.LeftTop] - 坐标模式。
  2876. *
  2877. * @example
  2878. * //单独创建一个对象
  2879. * var pixcel = new SuperMap.Pixel(100,50);
  2880. *
  2881. * //依据 size 创建
  2882. * var size = new SuperMap.Size(21,25);
  2883. * var offset = new SuperMap.Pixel(-(size.w/2), -size.h);
  2884. */
  2885. class Pixel {
  2886. constructor(x, y, mode) {
  2887. /**
  2888. * @member {number} [SuperMap.Pixel.prototype.x=0.0]
  2889. * @description x 坐标。
  2890. */
  2891. this.x = x ? parseFloat(x) : 0.0;
  2892. /**
  2893. * @member {number} [SuperMap.Pixel.prototype.y=0.0]
  2894. * @description y 坐标。
  2895. */
  2896. this.y = y ? parseFloat(y) : 0.0;
  2897. /**
  2898. * @member {SuperMap.Pixel.Mode} [SuperMap.Pixel.prototype.mode=SuperMap.Pixel.Mode.LeftTop]
  2899. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  2900. */
  2901. this.mode = mode;
  2902. this.CLASS_NAME = "SuperMap.Pixel";
  2903. /**
  2904. * @enum SuperMap.Pixel.Mode
  2905. * @readonly
  2906. * @description 模式。
  2907. * @type {string}
  2908. */
  2909. SuperMap.Pixel.Mode = {
  2910. /** 左上模式。*/
  2911. LeftTop: "lefttop",
  2912. /** 右上模式。 */
  2913. RightTop: "righttop",
  2914. /** 右下模式。 */
  2915. RightBottom: "rightbottom",
  2916. /** 左下模式。 */
  2917. LeftBottom: "leftbottom"
  2918. };
  2919. }
  2920. /**
  2921. * @function SuperMap.Pixel.prototype.toString
  2922. * @description 返回此对象的字符串形式。
  2923. * @example
  2924. *
  2925. * var pixcel = new SuperMap.Pixel(100,50);
  2926. * var str = pixcel.toString();
  2927. *
  2928. * @returns {string} 例如: "x=200.4,y=242.2"
  2929. */
  2930. toString() {
  2931. return ("x=" + this.x + ",y=" + this.y);
  2932. }
  2933. /**
  2934. * @function SuperMap.Pixel.prototype.clone
  2935. * @description 克隆当前的 pixel 对象。
  2936. * @example
  2937. * var pixcel = new SuperMap.Pixel(100,50);
  2938. * var pixcel2 = pixcel.clone();
  2939. * @returns {SuperMap.Pixel} 返回一个新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  2940. */
  2941. clone() {
  2942. return new Pixel(this.x, this.y, this.mode);
  2943. }
  2944. /**
  2945. * @function SuperMap.Pixel.prototype.equals
  2946. * @description 比较两 pixel 是否相等。
  2947. * @example
  2948. * var pixcel = new SuperMap.Pixel(100,50);
  2949. * var pixcel2 = new SuperMap.Pixel(100,50);
  2950. * var isEquals = pixcel.equals(pixcel2);
  2951. *
  2952. * @param {SuperMap.Pixel} px - 用于比较相等的 pixel 对象。
  2953. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  2954. */
  2955. equals(px) {
  2956. var equals = false;
  2957. if (px != null) {
  2958. equals = ((this.x == px.x && this.y == px.y) ||
  2959. (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));
  2960. }
  2961. return equals;
  2962. }
  2963. /**
  2964. * @function SuperMap.Pixel.prototype.distanceTo
  2965. * @description 返回两个 pixel 的距离。
  2966. * @example
  2967. * var pixcel = new SuperMap.Pixel(100,50);
  2968. * var pixcel2 = new SuperMap.Pixel(110,30);
  2969. * var distance = pixcel.distanceTo(pixcel2);
  2970. *
  2971. * @param {SuperMap.Pixel} px - 用于计算的一个 pixel。
  2972. * @returns {float} 作为参数传入的像素与当前像素点的距离。
  2973. */
  2974. distanceTo(px) {
  2975. return Math.sqrt(
  2976. Math.pow(this.x - px.x, 2) +
  2977. Math.pow(this.y - px.y, 2)
  2978. );
  2979. }
  2980. /**
  2981. * @function SuperMap.Pixel.prototype.add
  2982. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  2983. * @example
  2984. * var pixcel = new SuperMap.Pixel(100,50);
  2985. * //pixcel2是新的对象
  2986. * var pixcel2 = pixcel.add(20,30);
  2987. *
  2988. * @param {number} x - 传入的 x 值。
  2989. * @param {number} y - 传入的 y 值。
  2990. * @returns {SuperMap.Pixel} 返回一个新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  2991. */
  2992. add(x, y) {
  2993. if ((x == null) || (y == null)) {
  2994. throw new TypeError('Pixel.add cannot receive null values');
  2995. }
  2996. return new Pixel(this.x + x, this.y + y);
  2997. }
  2998. /**
  2999. * @function SuperMap.Pixel.prototype.offset
  3000. * @description 通过传入的 {@link SuperMap.Pixel} 参数对原屏幕坐标进行偏移。
  3001. * @example
  3002. * var pixcel = new SuperMap.Pixel(100,50);
  3003. * var pixcel2 = new SuperMap.Pixel(130,20);
  3004. * //pixcel3 是新的对象
  3005. * var pixcel3 = pixcel.offset(pixcel2);
  3006. *
  3007. * @param {SuperMap.Pixel} px - 传入的 <SuperMap.Pixel> 对象。
  3008. * @returns {SuperMap.Pixel} 返回一个新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  3009. */
  3010. offset(px) {
  3011. var newPx = this.clone();
  3012. if (px) {
  3013. newPx = this.add(px.x, px.y);
  3014. }
  3015. return newPx;
  3016. }
  3017. /**
  3018. *
  3019. * @function SuperMap.Pixel.prototype.destroy
  3020. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  3021. * @example
  3022. * var pixcel = new SuperMap.Pixel(100,50);
  3023. * pixcel.destroy();
  3024. */
  3025. destroy() {
  3026. this.x = null;
  3027. this.y = null;
  3028. this.mode = null;
  3029. }
  3030. }
  3031. SuperMap.Pixel = Pixel;
  3032. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  3033. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3034. * This program are made available under the terms of the Apache License, Version 2.0
  3035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3036. /**
  3037. *@namespace SuperMap
  3038. *@category BaseTypes Namespace
  3039. */
  3040. /**
  3041. * @function SuperMap.inherit
  3042. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  3043. * @memberOf SuperMap
  3044. * @param {Object} C - 继承的类。
  3045. * @param {Object} P - 被继承的父类。
  3046. */
  3047. SuperMap.inherit = function (C, P) {
  3048. var F = function () {
  3049. };
  3050. F.prototype = P.prototype;
  3051. C.prototype = new F;
  3052. var i, l, o;
  3053. for (i = 2, l = arguments.length; i < l; i++) {
  3054. o = arguments[i];
  3055. if (typeof o === "function") {
  3056. o = o.prototype;
  3057. }
  3058. SuperMap.Util.extend(C.prototype, o);
  3059. }
  3060. };
  3061. /**
  3062. * @function SuperMap.mixin
  3063. * @description 实现多重继承。
  3064. * @memberOf SuperMap
  3065. * @param {Class|Object} ...mixins - 继承的类。
  3066. */
  3067. SuperMap.mixin = function (...mixins) {
  3068. class Mix {
  3069. constructor(options) {
  3070. for (var index = 0; index < mixins.length; index++) {
  3071. copyProperties(this, new mixins[index](options));
  3072. }
  3073. }
  3074. }
  3075. for (var index = 0; index < mixins.length; index++) {
  3076. var mixin = mixins[index];
  3077. copyProperties(Mix, mixin);
  3078. copyProperties(Mix.prototype, mixin.prototype);
  3079. copyProperties(Mix.prototype, new mixin());
  3080. }
  3081. return Mix;
  3082. function copyProperties(target, source) {
  3083. var ownKeys = Object.getOwnPropertyNames(source);
  3084. if (Object.getOwnPropertySymbols) {
  3085. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  3086. }
  3087. for (var index = 0; index < ownKeys.length; index++) {
  3088. var key = ownKeys[index];
  3089. if (key !== "constructor"
  3090. && key !== "prototype"
  3091. && key !== "name" && key !== "length") {
  3092. let desc = Object.getOwnPropertyDescriptor(source, key);
  3093. if (window["ActiveXObject"]) {
  3094. Object.defineProperty(target, key, desc || {});
  3095. } else {
  3096. Object.defineProperty(target, key, desc);
  3097. }
  3098. }
  3099. }
  3100. }
  3101. };
  3102. /**
  3103. * @name String
  3104. * @namespace
  3105. * @memberOf SuperMap
  3106. * @category BaseTypes Util
  3107. * @description 字符串操作的一系列常用扩展函数。
  3108. */
  3109. var StringExt = SuperMap.String = {
  3110. /**
  3111. * @function SuperMap.String.startsWith
  3112. * @description 判断目标字符串是否以指定的子字符串开头。
  3113. * @param {string} str - 目标字符串。
  3114. * @param {string} sub - 查找的子字符串。
  3115. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  3116. */
  3117. startsWith: function (str, sub) {
  3118. return (str.indexOf(sub) == 0);
  3119. },
  3120. /**
  3121. * @function SuperMap.String.contains
  3122. * @description 判断目标字符串是否包含指定的子字符串。
  3123. * @param {string} str - 目标字符串。
  3124. * @param {string} sub - 查找的子字符串。
  3125. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  3126. */
  3127. contains: function (str, sub) {
  3128. return (str.indexOf(sub) != -1);
  3129. },
  3130. /**
  3131. * @function SuperMap.String.trim
  3132. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  3133. * @param {string} str - (可能)存在空白字符填塞的字符串。
  3134. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  3135. */
  3136. trim: function (str) {
  3137. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  3138. },
  3139. /**
  3140. * @function SuperMap.String.camelize
  3141. * @description 骆驼式("-")连字符的字符串处理。
  3142. * 例如:"chicken-head" becomes "chickenHead",
  3143. * "-chicken-head" becomes "ChickenHead"。
  3144. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  3145. * @returns {string}
  3146. */
  3147. camelize: function (str) {
  3148. var oStringList = str.split('-');
  3149. var camelizedString = oStringList[0];
  3150. for (var i = 1, len = oStringList.length; i < len; i++) {
  3151. var s = oStringList[i];
  3152. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  3153. }
  3154. return camelizedString;
  3155. },
  3156. /**
  3157. * @function SuperMap.String.format
  3158. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  3159. * @example
  3160. * 示例:
  3161. * (code)
  3162. * 1、template = "${value,getValue}";
  3163. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  3164. * args = [2,23,12,36,21];
  3165. * 返回值:36
  3166. * (end)
  3167. * 示例:
  3168. * (code)
  3169. * 2、template = "$${{value,getValue}}";
  3170. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  3171. * args = [2,23,12,36,21];
  3172. * 返回值:"${36}"
  3173. * (end)
  3174. * 示例:
  3175. * (code)
  3176. * 3、template = "${a,b}";
  3177. * context = {a: {b:"format"}};
  3178. * args = null;
  3179. * 返回值:"format"
  3180. * (end)
  3181. * 示例:
  3182. * (code)
  3183. * 3、template = "${a,b}";
  3184. * context = null;
  3185. * args = null;
  3186. * 返回值:"${a.b}"
  3187. * (end)
  3188. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  3189. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  3190. * @param {Array} [args] - 可选参数传递给在 context 对象上找到的函数。
  3191. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  3192. */
  3193. format: function (template, context, args) {
  3194. if (!context) {
  3195. context = window;
  3196. }
  3197. // Example matching:
  3198. // str = ${foo.bar}
  3199. // match = foo.bar
  3200. var replacer = function (str, match) {
  3201. var replacement;
  3202. // Loop through all subs. Example: ${a.b.c}
  3203. // 0 -> replacement = context[a];
  3204. // 1 -> replacement = context[a][b];
  3205. // 2 -> replacement = context[a][b][c];
  3206. var subs = match.split(/\.+/);
  3207. for (var i = 0; i < subs.length; i++) {
  3208. if (i == 0) {
  3209. replacement = context;
  3210. }
  3211. replacement = replacement[subs[i]];
  3212. }
  3213. if (typeof replacement === "function") {
  3214. replacement = args ?
  3215. replacement.apply(null, args) :
  3216. replacement();
  3217. }
  3218. // If replacement is undefined, return the string 'undefined'.
  3219. // This is a workaround for a bugs in browsers not properly
  3220. // dealing with non-participating groups in regular expressions:
  3221. // http://blog.stevenlevithan.com/archives/npcg-javascript
  3222. if (typeof replacement == 'undefined') {
  3223. return 'undefined';
  3224. } else {
  3225. return replacement;
  3226. }
  3227. };
  3228. return template.replace(SuperMap.String.tokenRegEx, replacer);
  3229. },
  3230. /**
  3231. * @member {RegExp} [SuperMap.String.tokenRegEx]
  3232. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  3233. * @example
  3234. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  3235. */
  3236. tokenRegEx: /\$\{([\w.]+?)\}/g,
  3237. /**
  3238. * @member {RegExp} [SuperMap.String.numberRegEx]
  3239. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  3240. */
  3241. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  3242. /**
  3243. * @function SuperMap.String.isNumeric
  3244. * @description 判断一个字符串是否只包含一个数值。
  3245. * @example
  3246. * (code)
  3247. * SuperMap.String.isNumeric("6.02e23") // true
  3248. * SuperMap.String.isNumeric("12 dozen") // false
  3249. * SuperMap.String.isNumeric("4") // true
  3250. * SuperMap.String.isNumeric(" 4 ") // false
  3251. * (end)
  3252. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  3253. */
  3254. isNumeric: function (value) {
  3255. return SuperMap.String.numberRegEx.test(value);
  3256. },
  3257. /**
  3258. * @function SuperMap.String.numericIf
  3259. * @description 把一个看似数值型的字符串转化为一个数值。
  3260. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  3261. */
  3262. numericIf: function (value) {
  3263. return SuperMap.String.isNumeric(value) ? parseFloat(value) : value;
  3264. }
  3265. };
  3266. /**
  3267. * @name Number
  3268. * @memberOf SuperMap
  3269. * @namespace
  3270. * @category BaseTypes Util
  3271. * @description 数值操作的一系列常用扩展函数。
  3272. */
  3273. var NumberExt = SuperMap.Number = {
  3274. /**
  3275. * @member {string} [SuperMap.Number.decimalSeparator='.']
  3276. * @description 格式化数字时默认的小数点分隔符。
  3277. * @constant
  3278. */
  3279. decimalSeparator: ".",
  3280. /**
  3281. * @member {string} [SuperMap.Number.thousandsSeparator=',']
  3282. * @description 格式化数字时默认的千位分隔符。
  3283. * @constant
  3284. */
  3285. thousandsSeparator: ",",
  3286. /**
  3287. * @function SuperMap.Number.limitSigDigs
  3288. * @description 限制浮点数的有效数字位数。
  3289. * @param {number} num - 浮点数。
  3290. * @param {integer} sig - 有效位数。
  3291. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  3292. */
  3293. limitSigDigs: function (num, sig) {
  3294. var fig = 0;
  3295. if (sig > 0) {
  3296. fig = parseFloat(num.toPrecision(sig));
  3297. }
  3298. return fig;
  3299. },
  3300. /**
  3301. * @function SuperMap.Number.format
  3302. * @description 数字格式化输出。
  3303. * @param {number} num - 数字。
  3304. * @param {integer} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  3305. * @param {string} [tsep=','] - 千位分隔符。
  3306. * @param {string} [dsep='.'] - 小数点分隔符。
  3307. * @returns {string} 数字格式化后的字符串。
  3308. */
  3309. format: function (num, dec, tsep, dsep) {
  3310. dec = (typeof dec != "undefined") ? dec : 0;
  3311. tsep = (typeof tsep != "undefined") ? tsep :
  3312. SuperMap.Number.thousandsSeparator;
  3313. dsep = (typeof dsep != "undefined") ? dsep :
  3314. SuperMap.Number.decimalSeparator;
  3315. if (dec != null) {
  3316. num = parseFloat(num.toFixed(dec));
  3317. }
  3318. var parts = num.toString().split(".");
  3319. if (parts.length === 1 && dec == null) {
  3320. // integer where we do not want to touch the decimals
  3321. dec = 0;
  3322. }
  3323. var integer = parts[0];
  3324. if (tsep) {
  3325. var thousands = /(-?[0-9]+)([0-9]{3})/;
  3326. while (thousands.test(integer)) {
  3327. integer = integer.replace(thousands, "$1" + tsep + "$2");
  3328. }
  3329. }
  3330. var str;
  3331. if (dec == 0) {
  3332. str = integer;
  3333. } else {
  3334. var rem = parts.length > 1 ? parts[1] : "0";
  3335. if (dec != null) {
  3336. rem = rem + new Array(dec - rem.length + 1).join("0");
  3337. }
  3338. str = integer + dsep + rem;
  3339. }
  3340. return str;
  3341. }
  3342. };
  3343. if (!Number.prototype.limitSigDigs) {
  3344. /**
  3345. * APIMethod: Number.limitSigDigs
  3346. * 限制浮点数的有效数字位数.
  3347. * @param {integer} sig -有效位数。
  3348. * @returns {integer} 将数字四舍五入到指定数量的有效位数。
  3349. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  3350. */
  3351. Number.prototype.limitSigDigs = function (sig) {
  3352. return NumberExt.limitSigDigs(this, sig);
  3353. };
  3354. }
  3355. /**
  3356. * @name Function
  3357. * @memberOf SuperMap
  3358. * @namespace
  3359. * @category BaseTypes Util
  3360. * @description 函数操作的一系列常用扩展函数。
  3361. */
  3362. var FunctionExt = SuperMap.Function = {
  3363. /**
  3364. * @function SuperMap.Function.bind
  3365. * @description 绑定函数到对象。方便创建 this 的作用域。
  3366. * @param {function} func - 输入函数。
  3367. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  3368. * @returns {function} object 参数作为 func 函数的 this 对象。
  3369. */
  3370. bind: function (func, object) {
  3371. // create a reference to all arguments past the second one
  3372. var args = Array.prototype.slice.apply(arguments, [2]);
  3373. return function () {
  3374. // Push on any additional arguments from the actual function call.
  3375. // These will come after those sent to the bind call.
  3376. var newArgs = args.concat(
  3377. Array.prototype.slice.apply(arguments, [0])
  3378. );
  3379. return func.apply(object, newArgs);
  3380. };
  3381. },
  3382. /**
  3383. * @function SuperMap.Function.bindAsEventListener
  3384. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  3385. * @param {function} func - 用于监听事件的函数。
  3386. * @param {Object} object - this 对象的引用。
  3387. * @returns {function}
  3388. */
  3389. bindAsEventListener: function (func, object) {
  3390. return function (event) {
  3391. return func.call(object, event || window.event);
  3392. };
  3393. },
  3394. /**
  3395. * @function SuperMap.Function.False
  3396. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  3397. * @example
  3398. * document.onclick = SuperMap.Function.False;
  3399. * @returns {boolean}
  3400. */
  3401. False: function () {
  3402. return false;
  3403. },
  3404. /**
  3405. * @function SuperMap.Function.True
  3406. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  3407. * @example
  3408. * document.onclick = SuperMap.Function.True;
  3409. * @returns {boolean}
  3410. */
  3411. True: function () {
  3412. return true;
  3413. },
  3414. /**
  3415. * @function SuperMap.Function.Void
  3416. * @description 可重用函数,仅仅返回 "undefined"。
  3417. * @returns {undefined}
  3418. */
  3419. Void: function () {
  3420. }
  3421. };
  3422. /**
  3423. * @name Array
  3424. * @memberOf SuperMap
  3425. * @namespace
  3426. * @category BaseTypes Util
  3427. * @description 数组操作的一系列常用扩展函数。
  3428. */
  3429. var ArrayExt = SuperMap.Array = {
  3430. /**
  3431. * @function SuperMap.Array.filter
  3432. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  3433. * @param {Array} array - 要过滤的数组。
  3434. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  3435. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  3436. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  3437. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  3438. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  3439. */
  3440. filter: function (array, callback, caller) {
  3441. var selected = [];
  3442. if (Array.prototype.filter) {
  3443. selected = array.filter(callback, caller);
  3444. } else {
  3445. var len = array.length;
  3446. if (typeof callback != "function") {
  3447. throw new TypeError();
  3448. }
  3449. for (var i = 0; i < len; i++) {
  3450. if (i in array) {
  3451. var val = array[i];
  3452. if (callback.call(caller, val, i, array)) {
  3453. selected.push(val);
  3454. }
  3455. }
  3456. }
  3457. }
  3458. return selected;
  3459. }
  3460. };
  3461. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  3462. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3463. * This program are made available under the terms of the Apache License, Version 2.0
  3464. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3465. var Util = SuperMap.Util = SuperMap.Util || {};
  3466. /**
  3467. * @name Util
  3468. * @memberOf SuperMap
  3469. * @namespace
  3470. * @category BaseTypes Util
  3471. * @description common 工具类。
  3472. */
  3473. /**
  3474. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  3475. * @example
  3476. * 要复制 SuperMap.Size 对象的所有属性到自定义对象上,使用方法如下:
  3477. * var size = new SuperMap.Size(100, 100);
  3478. * var obj = {};
  3479. * SuperMap.Util.extend(obj, size);
  3480. * @param {Object} [destination] - 目标对象。
  3481. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  3482. * @returns {Object} 目标对象。
  3483. */
  3484. SuperMap.Util.extend = function (destination, source) {
  3485. destination = destination || {};
  3486. if (source) {
  3487. for (var property in source) {
  3488. var value = source[property];
  3489. if (value !== undefined) {
  3490. destination[property] = value;
  3491. }
  3492. }
  3493. /**
  3494. * IE doesn't include the toString property when iterating over an object's
  3495. * properties with the for(property in object) syntax. Explicitly check if
  3496. * the source has its own toString property.
  3497. */
  3498. /*
  3499. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  3500. * prototype object" when calling hawOwnProperty if the source object
  3501. * is an instance of window.Event.
  3502. */
  3503. var sourceIsEvt = typeof window.Event === "function"
  3504. && source instanceof window.Event;
  3505. if (!sourceIsEvt
  3506. && source.hasOwnProperty && source.hasOwnProperty("toString")) {
  3507. destination.toString = source.toString;
  3508. }
  3509. }
  3510. return destination;
  3511. };
  3512. /**
  3513. * @description 对象拷贝。
  3514. * @param {Object} [des] - 目标对象。
  3515. * @param {Object} soc - 源对象。
  3516. */
  3517. SuperMap.Util.copy = function (des, soc) {
  3518. des = des || {};
  3519. var v;
  3520. if (soc) {
  3521. for (var p in des) {
  3522. v = soc[p];
  3523. if (typeof v !== 'undefined') {
  3524. des[p] = v;
  3525. }
  3526. }
  3527. }
  3528. };
  3529. /**
  3530. * @description 销毁对象,将其属性置空。
  3531. * @param {Object} [obj] - 目标对象。
  3532. */
  3533. SuperMap.Util.reset = function (obj) {
  3534. obj = obj || {};
  3535. for (var p in obj) {
  3536. if (obj.hasOwnProperty(p)) {
  3537. if (typeof obj[p] === "object" && obj[p] instanceof Array) {
  3538. for (var i in obj[p]) {
  3539. if (obj[p][i].destroy) {
  3540. obj[p][i].destroy();
  3541. }
  3542. }
  3543. obj[p].length = 0;
  3544. } else if (typeof obj[p] === "object" && obj[p] instanceof Object) {
  3545. if (obj[p].destroy) {
  3546. obj[p].destroy();
  3547. }
  3548. }
  3549. obj[p] = null;
  3550. }
  3551. }
  3552. };
  3553. /**
  3554. * @description 获取 HTML 元素数组。
  3555. * @returns {Array.<HTMLElement>} HTML 元素数组。
  3556. */
  3557. SuperMap.Util.getElement = function () {
  3558. var elements = [];
  3559. for (var i = 0, len = arguments.length; i < len; i++) {
  3560. var element = arguments[i];
  3561. if (typeof element === 'string') {
  3562. element = document.getElementById(element);
  3563. }
  3564. if (arguments.length === 1) {
  3565. return element;
  3566. }
  3567. elements.push(element);
  3568. }
  3569. return elements;
  3570. };
  3571. /**
  3572. * @description instance of 的跨浏览器实现。
  3573. * @param {Object} o - 对象。
  3574. * @returns {boolean} 是否是页面元素。
  3575. */
  3576. SuperMap.Util.isElement = function (o) {
  3577. return !!(o && o.nodeType === 1);
  3578. };
  3579. /**
  3580. * @description 判断一个对象是否是数组。
  3581. * @param {Object} a - 对象。
  3582. * @returns {boolean} 是否是数组。
  3583. */
  3584. SuperMap.Util.isArray = function (a) {
  3585. return (Object.prototype.toString.call(a) === '[object Array]');
  3586. };
  3587. /**
  3588. * @description 从数组中删除某一项。
  3589. * @param {Array} array - 数组。
  3590. * @param {Object} item - 数组中要删除的一项。
  3591. * @returns {Array} 执行删除操作后的数组。
  3592. */
  3593. SuperMap.Util.removeItem = function (array, item) {
  3594. for (var i = array.length - 1; i >= 0; i--) {
  3595. if (array[i] === item) {
  3596. array.splice(i, 1);
  3597. //break;more than once??
  3598. }
  3599. }
  3600. return array;
  3601. };
  3602. /**
  3603. * @description 获取某对象再数组中的索引值。
  3604. * @param {Array} array - 数组。
  3605. * @param {Object} obj - 对象。
  3606. * @returns {number} 某对象再数组中的索引值。
  3607. */
  3608. SuperMap.Util.indexOf = function (array, obj) {
  3609. if (array == null) {
  3610. return -1;
  3611. } else {
  3612. // use the build-in function if available.
  3613. if (typeof array.indexOf === "function") {
  3614. return array.indexOf(obj);
  3615. } else {
  3616. for (var i = 0, len = array.length; i < len; i++) {
  3617. if (array[i] === obj) {
  3618. return i;
  3619. }
  3620. }
  3621. return -1;
  3622. }
  3623. }
  3624. };
  3625. /**
  3626. * @description 修改某 DOM 元素的许多属性。
  3627. * @param {HTMLElement} element - 待修改的 DOM 元素。
  3628. * @param {string} [id] - DOM 元素的 ID。
  3629. * @param {SuperMap.Pixel} [px] - 包含 DOM 元素的 style 属性的 left 和 top 属性。
  3630. * @param {SuperMap.Size} [sz] - 包含 DOM 元素的 width 和 height 属性。
  3631. * @param {string} [position] - DOM 元素的 position 属性。
  3632. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  3633. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  3634. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  3635. */
  3636. SuperMap.Util.modifyDOMElement = function (element, id, px, sz, position,
  3637. border, overflow, opacity) {
  3638. if (id) {
  3639. element.id = id;
  3640. }
  3641. if (px) {
  3642. element.style.left = px.x + "px";
  3643. element.style.top = px.y + "px";
  3644. }
  3645. if (sz) {
  3646. element.style.width = sz.w + "px";
  3647. element.style.height = sz.h + "px";
  3648. }
  3649. if (position) {
  3650. element.style.position = position;
  3651. }
  3652. if (border) {
  3653. element.style.border = border;
  3654. }
  3655. if (overflow) {
  3656. element.style.overflow = overflow;
  3657. }
  3658. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  3659. element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
  3660. element.style.opacity = opacity;
  3661. } else if (parseFloat(opacity) === 1.0) {
  3662. element.style.filter = '';
  3663. element.style.opacity = '';
  3664. }
  3665. };
  3666. /**
  3667. * @description Takes an object and copies any properties that don't exist from
  3668. * another properties, by analogy with SuperMap.Util.extend() from
  3669. * Prototype.js.
  3670. *
  3671. * @param {Object} [to] - 目标对象。
  3672. * @param {Object} from - 源对象。Any properties of this object that
  3673. * are undefined in the to object will be set on the to object.
  3674. *
  3675. * @returns {Object} A reference to the to object. Note that the to argument is modified
  3676. * in place and returned by this function.
  3677. */
  3678. SuperMap.Util.applyDefaults = function (to, from) {
  3679. to = to || {};
  3680. /*
  3681. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  3682. * prototype object" when calling hawOwnProperty if the source object is an
  3683. * instance of window.Event.
  3684. */
  3685. var fromIsEvt = typeof window.Event === "function"
  3686. && from instanceof window.Event;
  3687. for (var key in from) {
  3688. if (to[key] === undefined ||
  3689. (!fromIsEvt && from.hasOwnProperty
  3690. && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) {
  3691. to[key] = from[key];
  3692. }
  3693. }
  3694. /**
  3695. * IE doesn't include the toString property when iterating over an object's
  3696. * properties with the for(property in object) syntax. Explicitly check if
  3697. * the source has its own toString property.
  3698. */
  3699. if (!fromIsEvt && from && from.hasOwnProperty
  3700. && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
  3701. to.toString = from.toString;
  3702. }
  3703. return to;
  3704. };
  3705. /**
  3706. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  3707. * @param {Object} params - 参数对象。
  3708. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  3709. */
  3710. SuperMap.Util.getParameterString = function (params) {
  3711. var paramsArray = [];
  3712. for (var key in params) {
  3713. var value = params[key];
  3714. if ((value != null) && (typeof value !== 'function')) {
  3715. var encodedValue;
  3716. if (Array.isArray(value) || value.toString() === '[object Object]') {
  3717. encodedValue = encodeURIComponent(JSON.stringify(value));
  3718. } else {
  3719. /* value is a string; simply encode */
  3720. encodedValue = encodeURIComponent(value);
  3721. }
  3722. paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
  3723. }
  3724. }
  3725. return paramsArray.join("&");
  3726. };
  3727. /**
  3728. * @description 给 URL 追加查询参数。
  3729. * @param {string} url - 待追加参数的 URL 字符串。
  3730. * @param {string} paramStr - 待追加的查询参数。
  3731. * @returns {string} 新的 URL。
  3732. */
  3733. SuperMap.Util.urlAppend = function (url, paramStr) {
  3734. var newUrl = url;
  3735. if (paramStr) {
  3736. if(paramStr.indexOf('?') === 0){
  3737. paramStr = paramStr.substring(1);
  3738. }
  3739. var parts = (url + " ").split(/[?&]/);
  3740. newUrl += (parts.pop() === " " ?
  3741. paramStr :
  3742. parts.length ? "&" + paramStr : "?" + paramStr);
  3743. }
  3744. return newUrl;
  3745. };
  3746. /**
  3747. * @description 给 URL 追加 path 参数。
  3748. * @param {string} url - 待追加参数的 URL 字符串。
  3749. * @param {string} paramStr - 待追加的path参数。
  3750. * @returns {string} 新的 URL。
  3751. */
  3752. SuperMap.Util.urlPathAppend = function (url, pathStr) {
  3753. let newUrl = url;
  3754. if (!pathStr) {
  3755. return newUrl;
  3756. }
  3757. if (pathStr.indexOf('/') === 0) {
  3758. pathStr = pathStr.substring(1);
  3759. }
  3760. const parts = url.split('?');
  3761. if(parts[0].indexOf('/', parts[0].length - 1) < 0){
  3762. parts[0] += '/'
  3763. }
  3764. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  3765. return newUrl;
  3766. };
  3767. /**
  3768. * @description 为了避免浮点精度错误而保留的有效位数。
  3769. * @type {number}
  3770. * @default 14
  3771. */
  3772. SuperMap.Util.DEFAULT_PRECISION = 14;
  3773. /**
  3774. * @description 将字符串以接近的精度转换为数字。
  3775. * @param {string} number - 字符串。
  3776. * @param {number} [precision=14] - 精度。
  3777. * @returns {number} 数字。
  3778. */
  3779. SuperMap.Util.toFloat = function (number, precision) {
  3780. if (precision == null) {
  3781. precision = SuperMap.Util.DEFAULT_PRECISION;
  3782. }
  3783. if (typeof number !== "number") {
  3784. number = parseFloat(number);
  3785. }
  3786. return precision === 0 ? number :
  3787. parseFloat(number.toPrecision(precision));
  3788. };
  3789. /**
  3790. * @description 角度转弧度。
  3791. * @param {number} x - 角度。
  3792. * @returns {number} 弧度。
  3793. */
  3794. SuperMap.Util.rad = function (x) {
  3795. return x * Math.PI / 180;
  3796. };
  3797. /**
  3798. * @description 从 URL 字符串中解析出参数对象。
  3799. * @param {string} url - URL。
  3800. * @returns {Object} 解析出的参数对象。
  3801. */
  3802. SuperMap.Util.getParameters = function (url) {
  3803. // if no url specified, take it from the location bar
  3804. url = (url === null || url === undefined) ? window.location.href : url;
  3805. //parse out parameters portion of url string
  3806. var paramsString = "";
  3807. if (SuperMap.String.contains(url, '?')) {
  3808. var start = url.indexOf('?') + 1;
  3809. var end = SuperMap.String.contains(url, "#") ?
  3810. url.indexOf('#') : url.length;
  3811. paramsString = url.substring(start, end);
  3812. }
  3813. var parameters = {};
  3814. var pairs = paramsString.split(/[&;]/);
  3815. for (var i = 0, len = pairs.length; i < len; ++i) {
  3816. var keyValue = pairs[i].split('=');
  3817. if (keyValue[0]) {
  3818. var key = keyValue[0];
  3819. try {
  3820. key = decodeURIComponent(key);
  3821. } catch (err) {
  3822. key = unescape(key);
  3823. }
  3824. // being liberal by replacing "+" with " "
  3825. var value = (keyValue[1] || '').replace(/\+/g, " ");
  3826. try {
  3827. value = decodeURIComponent(value);
  3828. } catch (err) {
  3829. value = unescape(value);
  3830. }
  3831. // follow OGC convention of comma delimited values
  3832. value = value.split(",");
  3833. //if there's only one value, do not return as array
  3834. if (value.length == 1) {
  3835. value = value[0];
  3836. }
  3837. parameters[key] = value;
  3838. }
  3839. }
  3840. return parameters;
  3841. };
  3842. /**
  3843. * @description 不断递增计数变量,用于生成唯一 ID。
  3844. * @type {number}
  3845. * @default 0
  3846. */
  3847. SuperMap.Util.lastSeqID = 0;
  3848. /**
  3849. * @description 创建唯一 ID 值。
  3850. * @param {string} [prefix] - 前缀。
  3851. * @returns {string} 唯一的 ID 值。
  3852. */
  3853. SuperMap.Util.createUniqueID = function (prefix) {
  3854. if (prefix == null) {
  3855. prefix = "id_";
  3856. }
  3857. SuperMap.Util.lastSeqID += 1;
  3858. return prefix + SuperMap.Util.lastSeqID;
  3859. };
  3860. /**
  3861. * @memberOf SuperMap
  3862. * @description 每单位的英尺数。
  3863. * @type {Object}
  3864. * @constant
  3865. */
  3866. SuperMap.INCHES_PER_UNIT = {
  3867. 'inches': 1.0,
  3868. 'ft': 12.0,
  3869. 'mi': 63360.0,
  3870. 'm': 39.3701,
  3871. 'km': 39370.1,
  3872. 'dd': 4374754,
  3873. 'yd': 36
  3874. };
  3875. SuperMap.INCHES_PER_UNIT.in = SuperMap.INCHES_PER_UNIT.inches;
  3876. SuperMap.INCHES_PER_UNIT.degrees = SuperMap.INCHES_PER_UNIT.dd;
  3877. SuperMap.INCHES_PER_UNIT.nmi = 1852 * SuperMap.INCHES_PER_UNIT.m;
  3878. // Units from CS-Map
  3879. SuperMap.METERS_PER_INCH = 0.02540005080010160020;
  3880. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  3881. "Inch": SuperMap.INCHES_PER_UNIT.inches,
  3882. "Meter": 1.0 / SuperMap.METERS_PER_INCH, //EPSG:9001
  3883. "Foot": 0.30480060960121920243 / SuperMap.METERS_PER_INCH, //EPSG:9003
  3884. "IFoot": 0.30480000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9002
  3885. "ClarkeFoot": 0.3047972651151 / SuperMap.METERS_PER_INCH, //EPSG:9005
  3886. "SearsFoot": 0.30479947153867624624 / SuperMap.METERS_PER_INCH, //EPSG:9041
  3887. "GoldCoastFoot": 0.30479971018150881758 / SuperMap.METERS_PER_INCH, //EPSG:9094
  3888. "IInch": 0.02540000000000000000 / SuperMap.METERS_PER_INCH,
  3889. "MicroInch": 0.00002540000000000000 / SuperMap.METERS_PER_INCH,
  3890. "Mil": 0.00000002540000000000 / SuperMap.METERS_PER_INCH,
  3891. "Centimeter": 0.01000000000000000000 / SuperMap.METERS_PER_INCH,
  3892. "Kilometer": 1000.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9036
  3893. "Yard": 0.91440182880365760731 / SuperMap.METERS_PER_INCH,
  3894. "SearsYard": 0.914398414616029 / SuperMap.METERS_PER_INCH, //EPSG:9040
  3895. "IndianYard": 0.91439853074444079983 / SuperMap.METERS_PER_INCH, //EPSG:9084
  3896. "IndianYd37": 0.91439523 / SuperMap.METERS_PER_INCH, //EPSG:9085
  3897. "IndianYd62": 0.9143988 / SuperMap.METERS_PER_INCH, //EPSG:9086
  3898. "IndianYd75": 0.9143985 / SuperMap.METERS_PER_INCH, //EPSG:9087
  3899. "IndianFoot": 0.30479951 / SuperMap.METERS_PER_INCH, //EPSG:9080
  3900. "IndianFt37": 0.30479841 / SuperMap.METERS_PER_INCH, //EPSG:9081
  3901. "IndianFt62": 0.3047996 / SuperMap.METERS_PER_INCH, //EPSG:9082
  3902. "IndianFt75": 0.3047995 / SuperMap.METERS_PER_INCH, //EPSG:9083
  3903. "Mile": 1609.34721869443738887477 / SuperMap.METERS_PER_INCH,
  3904. "IYard": 0.91440000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9096
  3905. "IMile": 1609.34400000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9093
  3906. "NautM": 1852.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9030
  3907. "Lat-66": 110943.316488932731 / SuperMap.METERS_PER_INCH,
  3908. "Lat-83": 110946.25736872234125 / SuperMap.METERS_PER_INCH,
  3909. "Decimeter": 0.10000000000000000000 / SuperMap.METERS_PER_INCH,
  3910. "Millimeter": 0.00100000000000000000 / SuperMap.METERS_PER_INCH,
  3911. "Dekameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  3912. "Decameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  3913. "Hectometer": 100.00000000000000000000 / SuperMap.METERS_PER_INCH,
  3914. "GermanMeter": 1.0000135965 / SuperMap.METERS_PER_INCH, //EPSG:9031
  3915. "CaGrid": 0.999738 / SuperMap.METERS_PER_INCH,
  3916. "ClarkeChain": 20.1166194976 / SuperMap.METERS_PER_INCH, //EPSG:9038
  3917. "GunterChain": 20.11684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9033
  3918. "BenoitChain": 20.116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9062
  3919. "SearsChain": 20.11676512155 / SuperMap.METERS_PER_INCH, //EPSG:9042
  3920. "ClarkeLink": 0.201166194976 / SuperMap.METERS_PER_INCH, //EPSG:9039
  3921. "GunterLink": 0.2011684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9034
  3922. "BenoitLink": 0.20116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9063
  3923. "SearsLink": 0.2011676512155 / SuperMap.METERS_PER_INCH, //EPSG:9043
  3924. "Rod": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  3925. "IntnlChain": 20.1168 / SuperMap.METERS_PER_INCH, //EPSG:9097
  3926. "IntnlLink": 0.201168 / SuperMap.METERS_PER_INCH, //EPSG:9098
  3927. "Perch": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  3928. "Pole": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  3929. "Furlong": 201.1684023368046 / SuperMap.METERS_PER_INCH,
  3930. "Rood": 3.778266898 / SuperMap.METERS_PER_INCH,
  3931. "CapeFoot": 0.3047972615 / SuperMap.METERS_PER_INCH,
  3932. "Brealey": 375.00000000000000000000 / SuperMap.METERS_PER_INCH,
  3933. "ModAmFt": 0.304812252984505969011938 / SuperMap.METERS_PER_INCH,
  3934. "Fathom": 1.8288 / SuperMap.METERS_PER_INCH,
  3935. "NautM-UK": 1853.184 / SuperMap.METERS_PER_INCH,
  3936. "50kilometers": 50000.0 / SuperMap.METERS_PER_INCH,
  3937. "150kilometers": 150000.0 / SuperMap.METERS_PER_INCH
  3938. });
  3939. //unit abbreviations supported by PROJ.4
  3940. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  3941. "mm": SuperMap.INCHES_PER_UNIT.Meter / 1000.0,
  3942. "cm": SuperMap.INCHES_PER_UNIT.Meter / 100.0,
  3943. "dm": SuperMap.INCHES_PER_UNIT.Meter * 100.0,
  3944. "km": SuperMap.INCHES_PER_UNIT.Meter * 1000.0,
  3945. "kmi": SuperMap.INCHES_PER_UNIT.nmi, //International Nautical Mile
  3946. "fath": SuperMap.INCHES_PER_UNIT.Fathom, //International Fathom
  3947. "ch": SuperMap.INCHES_PER_UNIT.IntnlChain, //International Chain
  3948. "link": SuperMap.INCHES_PER_UNIT.IntnlLink, //International Link
  3949. "us-in": SuperMap.INCHES_PER_UNIT.inches, //U.S. Surveyor's Inch
  3950. "us-ft": SuperMap.INCHES_PER_UNIT.Foot, //U.S. Surveyor's Foot
  3951. "us-yd": SuperMap.INCHES_PER_UNIT.Yard, //U.S. Surveyor's Yard
  3952. "us-ch": SuperMap.INCHES_PER_UNIT.GunterChain, //U.S. Surveyor's Chain
  3953. "us-mi": SuperMap.INCHES_PER_UNIT.Mile, //U.S. Surveyor's Statute Mile
  3954. "ind-yd": SuperMap.INCHES_PER_UNIT.IndianYd37, //Indian Yard
  3955. "ind-ft": SuperMap.INCHES_PER_UNIT.IndianFt37, //Indian Foot
  3956. "ind-ch": 20.11669506 / SuperMap.METERS_PER_INCH //Indian Chain
  3957. });
  3958. /**
  3959. * @memberOf SuperMap
  3960. * @member [SuperMap.DOTS_PER_INCH=96]
  3961. * @description 分辨率与比例尺之间转换的常量。
  3962. * @type {Object}
  3963. */
  3964. SuperMap.DOTS_PER_INCH = 96;
  3965. /**
  3966. * @param {number} scale - 比例尺。
  3967. * @returns {number} 返回正常的 scale 值。
  3968. */
  3969. SuperMap.Util.normalizeScale = function (scale) {
  3970. var normScale = (scale > 1.0) ? (1.0 / scale) : scale;
  3971. return normScale;
  3972. };
  3973. /**
  3974. * @description 比例尺转分辨率。
  3975. * @param {number} scale - 比例尺。
  3976. * @param {string} [units='degrees'] - 比例尺单位。
  3977. * @returns {number} 分辨率。
  3978. */
  3979. SuperMap.Util.getResolutionFromScale = function (scale, units) {
  3980. var resolution;
  3981. if (scale) {
  3982. if (units == null) {
  3983. units = "degrees";
  3984. }
  3985. var normScale = SuperMap.Util.normalizeScale(scale);
  3986. resolution = 1 / (normScale * SuperMap.INCHES_PER_UNIT[units]
  3987. * SuperMap.DOTS_PER_INCH);
  3988. }
  3989. return resolution;
  3990. };
  3991. /**
  3992. * @description 分辨率转比例尺。
  3993. * @param {number} resolution - 分辨率。
  3994. * @param {string} [units='degrees'] - 分辨率单位。
  3995. * @returns {number} 比例尺。
  3996. */
  3997. SuperMap.Util.getScaleFromResolution = function (resolution, units) {
  3998. if (units == null) {
  3999. units = "degrees";
  4000. }
  4001. var scale = resolution * SuperMap.INCHES_PER_UNIT[units] *
  4002. SuperMap.DOTS_PER_INCH;
  4003. return scale;
  4004. };
  4005. /**
  4006. * @memberOf SuperMap
  4007. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  4008. * @constant
  4009. */
  4010. SuperMap.IS_GECKO = (function () {
  4011. var ua = navigator.userAgent.toLowerCase();
  4012. return ua.indexOf("webkit") === -1 && ua.indexOf("gecko") !== -1;
  4013. })();
  4014. /**
  4015. * @memberOf SuperMap
  4016. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  4017. * * "opera" -- Opera
  4018. * * "msie" -- Internet Explorer
  4019. * * "safari" -- Safari
  4020. * * "firefox" -- Firefox
  4021. * * "mozilla" -- Mozilla
  4022. * @constant
  4023. */
  4024. SuperMap.Browser = (function () {
  4025. var name = '', version = '', device = 'pc', uaMatch;
  4026. //以下进行测试
  4027. var ua = navigator.userAgent.toLowerCase();
  4028. if (ua.indexOf("msie") > -1 || (ua.indexOf("trident") > -1 && ua.indexOf("rv") > -1)) {
  4029. name = 'msie';
  4030. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  4031. } else if (ua.indexOf("chrome") > -1) {
  4032. name = 'chrome';
  4033. uaMatch = ua.match(/chrome\/([\d.]+)/);
  4034. } else if (ua.indexOf("firefox") > -1) {
  4035. name = 'firefox';
  4036. uaMatch = ua.match(/firefox\/([\d.]+)/);
  4037. } else if (ua.indexOf("opera") > -1) {
  4038. name = 'opera';
  4039. uaMatch = ua.match(/version\/([\d.]+)/);
  4040. } else if (ua.indexOf("safari") > -1) {
  4041. name = 'safari';
  4042. uaMatch = ua.match(/version\/([\d.]+)/);
  4043. }
  4044. version = uaMatch ? uaMatch[1] : '';
  4045. if (ua.indexOf("ipad") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("iphone") > -1) {
  4046. device = 'apple';
  4047. } else if (ua.indexOf("android") > -1) {
  4048. uaMatch = ua.match(/version\/([\d.]+)/);
  4049. version = uaMatch ? uaMatch[1] : '';
  4050. device = 'android';
  4051. }
  4052. return {name: name, version: version, device: device};
  4053. })();
  4054. /**
  4055. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  4056. * @returns {Object} 获取浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  4057. */
  4058. SuperMap.Util.getBrowser = function () {
  4059. return SuperMap.Browser;
  4060. };
  4061. /**
  4062. * @description 浏览器是否支持 Canvas。
  4063. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas。
  4064. */
  4065. SuperMap.Util.isSupportCanvas = (function () {
  4066. var checkRes = true, broz = SuperMap.Util.getBrowser();
  4067. if (document.createElement("canvas").getContext) {
  4068. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  4069. checkRes = false;
  4070. }
  4071. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  4072. checkRes = false;
  4073. }
  4074. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  4075. checkRes = false;
  4076. }
  4077. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  4078. checkRes = false;
  4079. }
  4080. } else {
  4081. checkRes = false;
  4082. }
  4083. return checkRes;
  4084. })();
  4085. /**
  4086. * @description 判断;浏览器是否支持 Canvas。
  4087. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas 。
  4088. */
  4089. SuperMap.Util.supportCanvas = function () {
  4090. return SuperMap.Util.isSupportCanvas;
  4091. };
  4092. //将服务端的地图单位转成SuperMap的地图单位
  4093. SuperMap.INCHES_PER_UNIT.degree = SuperMap.INCHES_PER_UNIT.dd;
  4094. SuperMap.INCHES_PER_UNIT.meter = SuperMap.INCHES_PER_UNIT.m;
  4095. SuperMap.INCHES_PER_UNIT.foot = SuperMap.INCHES_PER_UNIT.ft;
  4096. SuperMap.INCHES_PER_UNIT.inch = SuperMap.INCHES_PER_UNIT.inches;
  4097. SuperMap.INCHES_PER_UNIT.mile = SuperMap.INCHES_PER_UNIT.mi;
  4098. SuperMap.INCHES_PER_UNIT.kilometer = SuperMap.INCHES_PER_UNIT.km;
  4099. SuperMap.INCHES_PER_UNIT.yard = SuperMap.INCHES_PER_UNIT.yd;
  4100. /**
  4101. * @description 判断一个 URL 请求是否在当前域中。
  4102. * @param {string} url - URL 请求字符串。
  4103. * @returns {boolean} URL 请求是否在当前域中。
  4104. */
  4105. SuperMap.Util.isInTheSameDomain = function (url) {
  4106. if (!url) {
  4107. return true;
  4108. }
  4109. var index = url.indexOf("//");
  4110. var documentUrl = document.location.toString();
  4111. var documentIndex = documentUrl.indexOf("//");
  4112. if (index === -1) {
  4113. return true;
  4114. } else {
  4115. var protocol;
  4116. var substring = protocol = url.substring(0, index);
  4117. var documentSubString = documentUrl.substring(documentIndex + 2);
  4118. documentIndex = documentSubString.indexOf("/");
  4119. var documentPortIndex = documentSubString.indexOf(":");
  4120. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  4121. //var documentPort;
  4122. var documentprotocol = document.location.protocol;
  4123. if (documentPortIndex !== -1) {
  4124. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  4125. } else {
  4126. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  4127. }
  4128. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  4129. return false;
  4130. }
  4131. substring = url.substring(index + 2);
  4132. var portIndex = substring.indexOf(":");
  4133. index = substring.indexOf("/");
  4134. var domainWithPort = substring.substring(0, index);
  4135. var domain;
  4136. if (portIndex !== -1) {
  4137. domain = substring.substring(0, portIndex);
  4138. } else {
  4139. domain = substring.substring(0, index);
  4140. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  4141. }
  4142. var documentDomain = document.domain;
  4143. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  4144. return true;
  4145. }
  4146. }
  4147. return false;
  4148. };
  4149. /**
  4150. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  4151. * @param {SuperMap.Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  4152. * @param {SuperMap.Size} viewer - 地图初始化时默认的地图图片的尺寸。
  4153. * @param {number} scale - 地图初始化时默认的显示比例尺。
  4154. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  4155. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  4156. * @returns {number} 返回图层显示分辨率。
  4157. */
  4158. SuperMap.Util.calculateDpi = function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  4159. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  4160. if (!viewBounds || !viewer || !scale) {
  4161. return;
  4162. }
  4163. var ratio = 10000,
  4164. rvbWidth = viewBounds.getWidth(),
  4165. rvbHeight = viewBounds.getHeight(),
  4166. rvWidth = viewer.w,
  4167. rvHeight = viewer.h;
  4168. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  4169. datumAxis = datumAxis || 6378137;
  4170. coordUnit = coordUnit || "degrees";
  4171. var dpi;
  4172. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  4173. let num1 = rvbWidth / rvWidth,
  4174. num2 = rvbHeight / rvHeight,
  4175. resolution = num1 > num2 ? num1 : num2;
  4176. dpi = 0.0254 * ratio / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  4177. } else {
  4178. let resolution = rvbWidth / rvWidth;
  4179. dpi = 0.0254 * ratio / resolution / scale / ratio;
  4180. }
  4181. return dpi;
  4182. };
  4183. /**
  4184. * @description 将对象转换成 JSON 字符串。
  4185. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  4186. * @returns {string} 返回转换后的 JSON 对象。
  4187. */
  4188. SuperMap.Util.toJSON = function (obj) {
  4189. var objInn = obj;
  4190. if (objInn == null) {
  4191. return null;
  4192. }
  4193. switch (objInn.constructor) {
  4194. case String:
  4195. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  4196. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  4197. objInn = objInn.replace(/\n/g, "\\n");
  4198. objInn = objInn.replace(/\r/g, "\\r");
  4199. objInn = objInn.replace("<", "&lt;");
  4200. objInn = objInn.replace(">", "&gt;");
  4201. objInn = objInn.replace(/%/g, "%25");
  4202. objInn = objInn.replace(/&/g, "%26");
  4203. return objInn;
  4204. case Array:
  4205. var arr = [];
  4206. for (var i = 0, len = objInn.length; i < len; i++) {
  4207. arr.push(SuperMap.Util.toJSON(objInn[i]));
  4208. }
  4209. return "[" + arr.join(",") + "]";
  4210. case Number:
  4211. return isFinite(objInn) ? String(objInn) : null;
  4212. case Boolean:
  4213. return String(objInn);
  4214. case Date:
  4215. var dateStr = "{" + "'__type':\"System.DateTime\"," +
  4216. "'Year':" + objInn.getFullYear() + "," +
  4217. "'Month':" + (objInn.getMonth() + 1) + "," +
  4218. "'Day':" + objInn.getDate() + "," +
  4219. "'Hour':" + objInn.getHours() + "," +
  4220. "'Minute':" + objInn.getMinutes() + "," +
  4221. "'Second':" + objInn.getSeconds() + "," +
  4222. "'Millisecond':" + objInn.getMilliseconds() + "," +
  4223. "'TimezoneOffset':" + objInn.getTimezoneOffset() + "}";
  4224. return dateStr;
  4225. default:
  4226. if (objInn["toJSON"] != null && typeof objInn["toJSON"] === "function") {
  4227. return objInn.toJSON();
  4228. }
  4229. if (typeof objInn === "object") {
  4230. if (objInn.length) {
  4231. let arr = [];
  4232. for (let i = 0, len = objInn.length; i < len; i++) {
  4233. arr.push(SuperMap.Util.toJSON(objInn[i]));
  4234. }
  4235. return "[" + arr.join(",") + "]";
  4236. }
  4237. let arr = [];
  4238. for (let attr in objInn) {
  4239. //为解决SuperMap.Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  4240. if (typeof objInn[attr] !== "function" && attr !== "CLASS_NAME" && attr !== "parent") {
  4241. arr.push("'" + attr + "':" + SuperMap.Util.toJSON(objInn[attr]));
  4242. }
  4243. }
  4244. if (arr.length > 0) {
  4245. return "{" + arr.join(",") + "}";
  4246. } else {
  4247. return "{}";
  4248. }
  4249. }
  4250. return objInn.toString();
  4251. }
  4252. };
  4253. /**
  4254. * @description 根据比例尺和 dpi 计算屏幕分辨率。
  4255. * @param {number} scale - 比例尺。
  4256. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  4257. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  4258. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  4259. * @returns {number} 返回当前比例尺下的屏幕分辨率。
  4260. */
  4261. SuperMap.Util.getResolutionFromScaleDpi = function (scale, dpi, coordUnit, datumAxis) {
  4262. var resolution = null,
  4263. ratio = 10000;
  4264. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  4265. datumAxis = datumAxis || 6378137;
  4266. coordUnit = coordUnit || "";
  4267. if (scale > 0 && dpi > 0) {
  4268. scale = SuperMap.Util.normalizeScale(scale);
  4269. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  4270. //scale = SuperMap.Util.normalizeScale(scale);
  4271. resolution = 0.0254 * ratio / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  4272. return resolution;
  4273. } else {
  4274. resolution = 0.0254 * ratio / dpi / scale / ratio;
  4275. return resolution;
  4276. }
  4277. }
  4278. return -1;
  4279. };
  4280. /**
  4281. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  4282. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  4283. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  4284. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  4285. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  4286. * @returns {number} 返回当前屏幕分辨率下的比例尺。
  4287. */
  4288. SuperMap.Util.getScaleFromResolutionDpi = function (resolution, dpi, coordUnit, datumAxis) {
  4289. var scale = null,
  4290. ratio = 10000;
  4291. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  4292. datumAxis = datumAxis || 6378137;
  4293. coordUnit = coordUnit || "";
  4294. if (resolution > 0 && dpi > 0) {
  4295. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  4296. scale = 0.0254 * ratio / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  4297. return scale;
  4298. } else {
  4299. scale = 0.0254 * ratio / dpi / resolution / ratio;
  4300. return scale;
  4301. }
  4302. }
  4303. return -1;
  4304. };
  4305. /**
  4306. * @description 转换查询结果。
  4307. * @param {Object} result - 查询结果。
  4308. * @returns {Object} 转换后的查询结果。
  4309. */
  4310. SuperMap.Util.transformResult = function (result) {
  4311. if (result.responseText && typeof result.responseText === "string") {
  4312. result = JSON.parse(result.responseText);
  4313. }
  4314. return result;
  4315. };
  4316. /**
  4317. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  4318. * @param {Object} [destination] - 拷贝目标。
  4319. * @param {Object} source - 源对象。
  4320. *
  4321. */
  4322. SuperMap.Util.copyAttributes = function (destination, source) {
  4323. destination = destination || {};
  4324. if (source) {
  4325. for (var property in source) {
  4326. var value = source[property];
  4327. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  4328. destination[property] = value;
  4329. }
  4330. }
  4331. }
  4332. return destination;
  4333. };
  4334. /**
  4335. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  4336. * @param {Object} [destination] - 目标对象。
  4337. * @param {Object} source - 源对象。
  4338. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  4339. *
  4340. */
  4341. SuperMap.Util.copyAttributesWithClip = function (destination, source, clip) {
  4342. destination = destination || {};
  4343. if (source) {
  4344. for (var property in source) {
  4345. //去掉禁止拷贝的属性
  4346. var isInClip = false;
  4347. if (clip && clip.length) {
  4348. for (var i = 0, len = clip.length; i < len; i++) {
  4349. if (property === clip[i]) {
  4350. isInClip = true;
  4351. break;
  4352. }
  4353. }
  4354. }
  4355. if (isInClip === true) {
  4356. continue;
  4357. }
  4358. var value = source[property];
  4359. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  4360. destination[property] = value;
  4361. }
  4362. }
  4363. }
  4364. return destination;
  4365. };
  4366. /**
  4367. * @description 克隆一个 Object 对象
  4368. * @param {Object} obj - 需要克隆的对象。
  4369. * @returns {Object} 返回对象的拷贝对象,注意是新的对象,不是指向。
  4370. */
  4371. SuperMap.Util.cloneObject = function (obj) {
  4372. // Handle the 3 simple types, and null or undefined
  4373. if (null === obj || "object" !== typeof obj) {
  4374. return obj;
  4375. }
  4376. // Handle Date
  4377. if (obj instanceof Date) {
  4378. let copy = new Date();
  4379. copy.setTime(obj.getTime());
  4380. return copy;
  4381. }
  4382. // Handle Array
  4383. if (obj instanceof Array) {
  4384. let copy = obj.slice(0);
  4385. return copy;
  4386. }
  4387. // Handle Object
  4388. if (obj instanceof Object) {
  4389. let copy = {};
  4390. for (var attr in obj) {
  4391. if (obj.hasOwnProperty(attr)) {
  4392. copy[attr] = SuperMap.Util.cloneObject(obj[attr]);
  4393. }
  4394. }
  4395. return copy;
  4396. }
  4397. throw new Error("Unable to copy obj! Its type isn't supported.");
  4398. };
  4399. /**
  4400. * @description 判断两条线段是不是有交点。
  4401. * @param {SuperMap.Geometry.Point} a1 - 第一条线段的起始节点。
  4402. * @param {SuperMap.Geometry.Point} a2 - 第一条线段的结束节点。
  4403. * @param {SuperMap.Geometry.Point} b1 - 第二条线段的起始节点。
  4404. * @param {SuperMap.Geometry.Point} b2 - 第二条线段的结束节点。
  4405. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  4406. */
  4407. SuperMap.Util.lineIntersection = function (a1, a2, b1, b2) {
  4408. var intersectValue = null;
  4409. var k1;
  4410. var k2;
  4411. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  4412. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  4413. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  4414. //ab==0代表两条线断的斜率一样
  4415. if (ab != 0) {
  4416. k1 = b / ab;
  4417. k2 = a / ab;
  4418. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  4419. intersectValue = new SuperMap.Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  4420. } else {
  4421. intersectValue = "No Intersection";
  4422. }
  4423. } else {
  4424. if (b == 0 && a == 0) {
  4425. var maxy = Math.max(a1.y, a2.y);
  4426. var miny = Math.min(a1.y, a2.y);
  4427. var maxx = Math.max(a1.x, a2.x);
  4428. var minx = Math.min(a1.x, a2.x);
  4429. if (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) &&
  4430. (b1.x >= minx && b1.x <= maxx) || (b2.x >= minx && b2.x <= maxx)) {
  4431. intersectValue = "Coincident";//重合
  4432. } else {
  4433. intersectValue = "Parallel";//平行
  4434. }
  4435. } else {
  4436. intersectValue = "Parallel";//平行
  4437. }
  4438. }
  4439. return intersectValue;
  4440. };
  4441. /**
  4442. * @description 获取文本外接矩形宽度与高度。
  4443. * @param {SuperMap.ThemeStyle} style - 文本样式。
  4444. * @param {string} text - 文本内容。
  4445. * @param {Object} element - DOM 元素。
  4446. * @returns {Object} 返回裁剪后的宽度,高度信息。
  4447. */
  4448. SuperMap.Util.getTextBounds = function (style, text, element) {
  4449. document.body.appendChild(element);
  4450. element.style.width = 'auto';
  4451. element.style.height = 'auto';
  4452. if (style.fontSize) {
  4453. element.style.fontSize = style.fontSize;
  4454. }
  4455. if (style.fontFamily) {
  4456. element.style.fontFamily = style.fontFamily;
  4457. }
  4458. if (style.fontWeight) {
  4459. element.style.fontWeight = style.fontWeight;
  4460. }
  4461. element.style.position = 'relative';
  4462. element.style.visibility = 'hidden';
  4463. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  4464. element.style.display = 'inline-block';
  4465. element.innerHTML = text;
  4466. var textWidth = element.clientWidth;
  4467. var textHeight = element.clientHeight;
  4468. document.body.removeChild(element);
  4469. return {
  4470. textWidth: textWidth,
  4471. textHeight: textHeight
  4472. };
  4473. };
  4474. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  4475. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4476. * This program are made available under the terms of the Apache License, Version 2.0
  4477. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4478. /**
  4479. * @class SuperMap.LonLat
  4480. * @category BaseTypes Geometry
  4481. * @classdesc 这个类用来表示经度和纬度对。
  4482. * @param {number} [lon=0.0] - 地图单位上的 X 轴坐标,如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  4483. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  4484. * @param {Array.<float>} [location] - 如果要同时设置,则使用传入横纵坐标组成的数组。
  4485. * @example
  4486. * var lonLat = new SuperMap.LonLat(30,45);
  4487. */
  4488. class LonLat {
  4489. constructor(lon, lat) {
  4490. if (Util.isArray(lon)) {
  4491. lat = lon[1];
  4492. lon = lon[0];
  4493. }
  4494. /**
  4495. * @member {float} [SuperMap.LonLat.prototype.lon=0.0]
  4496. * @description 地图的单位的 X 轴(横轴)坐标。
  4497. */
  4498. this.lon = lon ? Util.toFloat(lon) : 0.0;
  4499. /**
  4500. * @member {float} [SuperMap.LonLat.prototype.lat=0.0]
  4501. * @description 地图的单位的 Y 轴(纵轴)坐标。
  4502. */
  4503. this.lat = lat ? Util.toFloat(lat) : 0.0;
  4504. this.CLASS_NAME = "SuperMap.LonLat";
  4505. }
  4506. /**
  4507. * @function SuperMap.LonLat.prototype.toString
  4508. * @description 返回此对象的字符串形式
  4509. * @example
  4510. * var lonLat = new SuperMap.LonLat(100,50);
  4511. * var str = lonLat.toString();
  4512. * @returns {string} 例如: "lon=100,lat=50"
  4513. */
  4514. toString() {
  4515. return ("lon=" + this.lon + ",lat=" + this.lat);
  4516. }
  4517. /**
  4518. * @function SuperMap.LonLat.prototype.toShortString
  4519. * @description 将经度纬度转换成简单字符串。
  4520. * @example
  4521. * var lonLat = new SuperMap.LonLat(100,50);
  4522. * var str = lonLat.toShortString();
  4523. * @returns {string} 返回处理后的经纬度字符串。例如:"100,50"
  4524. */
  4525. toShortString() {
  4526. return (this.lon + "," + this.lat);
  4527. }
  4528. /**
  4529. * @function SuperMap.LonLat.prototype.clone
  4530. * @description 复制坐标对象,并返回复制后的新对象。
  4531. * @example
  4532. * var lonLat1 = new SuperMap.LonLat(100,50);
  4533. * var lonLat2 = lonLat1.clone();
  4534. * @returns {SuperMap.LonLat} 返回相同坐标值的新的坐标对象。
  4535. */
  4536. clone() {
  4537. return new LonLat(this.lon, this.lat);
  4538. }
  4539. /**
  4540. * @function SuperMap.LonLat.prototype.add
  4541. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  4542. * @example
  4543. * var lonLat1 = new SuperMap.LonLat(100,50);
  4544. * //lonLat2 是新的对象
  4545. * var lonLat2 = lonLat1.add(100,50);
  4546. * @param {float} lon - 传入的经度参数。
  4547. * @param {float} lat - 传入的纬度参数。
  4548. * @returns {SuperMap.LonLat} 返回一个新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  4549. */
  4550. add(lon, lat) {
  4551. if ((lon == null) || (lat == null)) {
  4552. throw new TypeError('LonLat.add cannot receive null values');
  4553. }
  4554. return new LonLat(this.lon + Util.toFloat(lon),
  4555. this.lat + Util.toFloat(lat));
  4556. }
  4557. /**
  4558. * @function SuperMap.LonLat.prototype.equals
  4559. * @description 判断两个坐标对象是否相等。
  4560. * @example
  4561. * var lonLat1 = new SuperMap.LonLat(100,50);
  4562. * var lonLat2 = new SuperMap.LonLat(100,50);
  4563. * var isEquals = lonLat1.equals(lonLat2);
  4564. * @param {SuperMap.LonLat} ll - 需要进行比较的坐标对象。
  4565. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  4566. * 致或传入的ll参数为NULL则返回false。
  4567. */
  4568. equals(ll) {
  4569. var equals = false;
  4570. if (ll != null) {
  4571. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  4572. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  4573. }
  4574. return equals;
  4575. }
  4576. /**
  4577. * @function SuperMap.LonLat.prototype.wrapDateLine
  4578. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  4579. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  4580. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  4581. * @example
  4582. * var lonLat1 = new SuperMap.LonLat(420,50);
  4583. * var lonLat2 = lonLat1.wrapDateLine(
  4584. * new SuperMap.Bounds(-180,-90,180,90)
  4585. * );
  4586. * @param {SuperMap.Bounds} maxExtent - 最大边界的范围。
  4587. * @returns {SuperMap.LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  4588. */
  4589. wrapDateLine(maxExtent) {
  4590. var newLonLat = this.clone();
  4591. if (maxExtent) {
  4592. //shift right?
  4593. while (newLonLat.lon < maxExtent.left) {
  4594. newLonLat.lon += maxExtent.getWidth();
  4595. }
  4596. //shift left?
  4597. while (newLonLat.lon > maxExtent.right) {
  4598. newLonLat.lon -= maxExtent.getWidth();
  4599. }
  4600. }
  4601. return newLonLat;
  4602. }
  4603. /**
  4604. *
  4605. * @function SuperMap.LonLat.prototype.destroy
  4606. * @description 销毁此对象。
  4607. * 销毁后此对象的所有属性为 null,而不是初始值。
  4608. * @example
  4609. * var lonLat = new SuperMap.LonLat(100,50);
  4610. * lonLat.destroy();
  4611. */
  4612. destroy() {
  4613. this.lon = null;
  4614. this.lat = null;
  4615. }
  4616. /**
  4617. * @function SuperMap.LonLat.fromString
  4618. * @description 通过字符串生成一个 {@link SuperMap.LonLat} 对象。
  4619. * @example
  4620. * var str = "100,50";
  4621. * var lonLat = SuperMap.LonLat.fromString(str);
  4622. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  4623. * @returns {SuperMap.LonLat} 返回一个 {@link SuperMap.LonLat} 对象。
  4624. */
  4625. static fromString(str) {
  4626. var pair = str.split(",");
  4627. return new LonLat(pair[0], pair[1]);
  4628. }
  4629. /**
  4630. * @function SuperMap.LonLat.fromArray
  4631. * @description 通过数组生成一个 <SuperMap.LonLat> 对象。
  4632. * @param {Array.<float>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  4633. * @returns {SuperMap.LonLat} 返回一个 <SuperMap.LonLat> 对象。
  4634. */
  4635. static fromArray(arr) {
  4636. var gotArr = Util.isArray(arr),
  4637. lon = gotArr && arr[0],
  4638. lat = gotArr && arr[1];
  4639. return new LonLat(lon, lat);
  4640. }
  4641. }
  4642. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  4643. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4644. * This program are made available under the terms of the Apache License, Version 2.0
  4645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4646. /**
  4647. * @class SuperMap.Bounds
  4648. * @category BaseTypes Geometry
  4649. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  4650. * @param {number} [left] - 左边界,注意考虑宽度,理论上小于 right 值。
  4651. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  4652. * @param {number} [right] - 右边界。
  4653. * @param {number} [top] - 上边界。
  4654. * @param {Array.<number>} [array] - [left, bottom, right, top],如果同时传多个参数,则使用左下右上组成的数组。
  4655. * @example
  4656. * var bounds = new SuperMap.Bounds();
  4657. * bounds.extend(new SuperMap.LonLat(4,5));
  4658. * bounds.extend(new SuperMap.LonLat(5,6));
  4659. * bounds.toBBOX(); // returns 4,5,5,6
  4660. */
  4661. class Bounds {
  4662. constructor(left, bottom, right, top) {
  4663. if (Util.isArray(left)) {
  4664. top = left[3];
  4665. right = left[2];
  4666. bottom = left[1];
  4667. left = left[0];
  4668. }
  4669. /**
  4670. * @member {number} SuperMap.Bounds.prototype.left
  4671. * @description 最小的水平坐标系。
  4672. */
  4673. this.left = left != null ? Util.toFloat(left) : this.left;
  4674. /**
  4675. * @member {number} SuperMap.Bounds.prototype.bottom
  4676. * @description 最小的垂直坐标系。
  4677. */
  4678. this.bottom = bottom != null ? Util.toFloat(bottom) : this.bottom;
  4679. /**
  4680. * @member {number} SuperMap.Bounds.prototype.right
  4681. * @description 最大的水平坐标系。
  4682. */
  4683. this.right = right != null ? Util.toFloat(right) : this.right;
  4684. /**
  4685. * @member {number} SuperMap.Bounds.prototype.top
  4686. * @description 最大的垂直坐标系。
  4687. */
  4688. this.top = top != null ? Util.toFloat(top) : this.top;
  4689. /**
  4690. * @member {SuperMap.LonLat} SuperMap.Bounds.prototype.centerLonLat
  4691. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  4692. */
  4693. this.centerLonLat = null;
  4694. this.CLASS_NAME = "SuperMap.Bounds";
  4695. }
  4696. /**
  4697. * @function SuperMap.Bounds.prototype.clone
  4698. * @description 复制当前 bounds 对象。
  4699. * @example
  4700. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  4701. * var bounds2 = bounds1.clone();
  4702. * @returns {SuperMap.Bounds} 返回一个克隆的 bounds。
  4703. */
  4704. clone() {
  4705. return new Bounds(this.left, this.bottom,
  4706. this.right, this.top);
  4707. }
  4708. /**
  4709. * @function SuperMap.Bounds.prototype.equals
  4710. * @description 判断两个 bounds 对象是否相等。
  4711. * @example
  4712. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  4713. * var bounds2 = new SuperMap.Bounds(-180,-90,180,90);
  4714. * var isEquals = bounds1.equals(bounds2);
  4715. * @param {SuperMap.Bounds} bounds - 需要进行计较的 bounds。
  4716. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  4717. */
  4718. equals(bounds) {
  4719. var equals = false;
  4720. if (bounds != null) {
  4721. equals = ((this.left === bounds.left) &&
  4722. (this.right === bounds.right) &&
  4723. (this.top === bounds.top) &&
  4724. (this.bottom === bounds.bottom));
  4725. }
  4726. return equals;
  4727. }
  4728. /**
  4729. * @function SuperMap.Bounds.prototype.toString
  4730. * @description 返回此对象的字符串形式。
  4731. * @example
  4732. * var bounds = new SuperMap.Bounds(-180,-90,180,90);
  4733. * var str = bounds.toString();
  4734. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  4735. */
  4736. toString() {
  4737. return [this.left, this.bottom, this.right, this.top].join(",");
  4738. }
  4739. /**
  4740. * @function SuperMap.Bounds.prototype.toArray
  4741. * @description 边界对象的数组表示形式。
  4742. * @example
  4743. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4744. * //array1 = [-180,-90,100,80];
  4745. * var array1 = bounds.toArray();
  4746. * //array1 = [-90,-180,80,100];
  4747. * var array2 = bounds.toArray(true);
  4748. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  4749. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  4750. * @returns {Array.<number>} left, bottom, right, top 数组。
  4751. */
  4752. toArray(reverseAxisOrder) {
  4753. if (reverseAxisOrder === true) {
  4754. return [this.bottom, this.left, this.top, this.right];
  4755. } else {
  4756. return [this.left, this.bottom, this.right, this.top];
  4757. }
  4758. }
  4759. /**
  4760. * @function SuperMap.Bounds.prototype.toBBOX
  4761. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  4762. * @example
  4763. * var bounds = new SuperMap.Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  4764. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  4765. * var str1 = bounds.toBBOX();
  4766. * //str2 = "-1.1,-1.8,1.4,1.6";
  4767. * var str2 = bounds.toBBOX(1);
  4768. * //str2 = "-1.8,-1.1,1.6,1.4";
  4769. * var str2 = bounds.toBBOX(1,true);
  4770. * @param {integer} [decimal=6] - 边界方位坐标的有效数字个数。
  4771. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  4772. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  4773. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  4774. */
  4775. toBBOX(decimal, reverseAxisOrder) {
  4776. if (decimal == null) {
  4777. decimal = 6;
  4778. }
  4779. var mult = Math.pow(10, decimal);
  4780. var xmin = Math.round(this.left * mult) / mult;
  4781. var ymin = Math.round(this.bottom * mult) / mult;
  4782. var xmax = Math.round(this.right * mult) / mult;
  4783. var ymax = Math.round(this.top * mult) / mult;
  4784. if (reverseAxisOrder === true) {
  4785. return ymin + "," + xmin + "," + ymax + "," + xmax;
  4786. } else {
  4787. return xmin + "," + ymin + "," + xmax + "," + ymax;
  4788. }
  4789. }
  4790. /**
  4791. * @function SuperMap.Bounds.prototype.toGeometry
  4792. * @description 基于当前边界范围创建一个新的多边形对象。
  4793. * @example
  4794. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4795. * //SuperMap.Geometry.Polygon对象
  4796. * var geo = bounds.toGeometry();
  4797. * @returns {SuperMap.Geometry.Polygon} 基于当前 bounds 坐标创建的新的多边形。
  4798. */
  4799. // toGeometry() {
  4800. // return new Polygon([
  4801. // new LinearRing([
  4802. // new Point(this.left, this.bottom),
  4803. // new Point(this.right, this.bottom),
  4804. // new Point(this.right, this.top),
  4805. // new Point(this.left, this.top)
  4806. // ])
  4807. // ]);
  4808. // }
  4809. /**
  4810. * @function SuperMap.Bounds.prototype.getWidth
  4811. * @description 获取 bounds 的宽度。
  4812. * @example
  4813. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4814. * //width = 280;
  4815. * var width = bounds.getWidth();
  4816. * @returns {float} 获取当前 bounds 的宽度(right 减去 left)。
  4817. */
  4818. getWidth() {
  4819. return (this.right - this.left);
  4820. }
  4821. /**
  4822. * @function SuperMap.Bounds.prototype.getHeight
  4823. * @description 获取 bounds 的高度。
  4824. * @example
  4825. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4826. * //height = 170;
  4827. * var height = bounds.getHeight();
  4828. * @returns {float} 返回边界高度(top 减去 bottom)。
  4829. */
  4830. getHeight() {
  4831. return (this.top - this.bottom);
  4832. }
  4833. /**
  4834. * @function SuperMap.Bounds.prototype.getSize
  4835. * @description 获取边框大小。
  4836. * @example
  4837. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4838. * var size = bounds.getSize();
  4839. * @returns {SuperMap.Size} 返回边框大小。
  4840. */
  4841. getSize() {
  4842. return new Size(this.getWidth(), this.getHeight());
  4843. }
  4844. /**
  4845. * @function SuperMap.Bounds.prototype.getCenterPixel
  4846. * @description 获取像素格式的范围中心点。
  4847. * @example
  4848. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4849. * var pixel = bounds.getCenterPixel();
  4850. * @returns {SuperMap.Pixel} 返回像素格式的当前范围的中心点。
  4851. */
  4852. getCenterPixel() {
  4853. return new Pixel((this.left + this.right) / 2,
  4854. (this.bottom + this.top) / 2);
  4855. }
  4856. /**
  4857. * @function SuperMap.Bounds.prototype.getCenterLonLat
  4858. * @description 获取地理格式的范围中心点。
  4859. * @example
  4860. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  4861. * var lonlat = bounds.getCenterLonLat();
  4862. * @returns {SuperMap.LonLat} 返回当前地理范围的中心点。
  4863. */
  4864. getCenterLonLat() {
  4865. if (!this.centerLonLat) {
  4866. this.centerLonLat = new LonLat(
  4867. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  4868. );
  4869. }
  4870. return this.centerLonLat;
  4871. }
  4872. /**
  4873. * @function SuperMap.Bounds.prototype.scale
  4874. * @description 按照比例扩大/缩小出一个新的 bounds。
  4875. * @example
  4876. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  4877. * var bounds2 = bounds.scale(2);
  4878. * @param {float} [ratio=1] - 需要扩大的比例。
  4879. * @param {(SuperMap.Pixel|SuperMap.LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  4880. * @returns {SuperMap.Bounds} 返回通过 ratio、origin 计算得到的新的边界范围。
  4881. */
  4882. scale(ratio, origin) {
  4883. ratio = ratio ? ratio : 1;
  4884. if (origin == null) {
  4885. origin = this.getCenterLonLat();
  4886. }
  4887. var origx, origy;
  4888. // get origin coordinates
  4889. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  4890. origx = origin.lon;
  4891. origy = origin.lat;
  4892. } else {
  4893. origx = origin.x;
  4894. origy = origin.y;
  4895. }
  4896. var left = (this.left - origx) * ratio + origx;
  4897. var bottom = (this.bottom - origy) * ratio + origy;
  4898. var right = (this.right - origx) * ratio + origx;
  4899. var top = (this.top - origy) * ratio + origy;
  4900. return new Bounds(left, bottom, right, top);
  4901. }
  4902. /**
  4903. * @function SuperMap.Bounds.prototype.add
  4904. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  4905. * @example
  4906. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  4907. * //bounds2 是新的 bounds
  4908. * var bounds2 = bounds.add(20,10);
  4909. * @param {float} x - 传入坐标点的 x 坐标。
  4910. * @param {float} y - 传入坐标点的 y 坐标。
  4911. * @returns {SuperMap.Bounds} 返回一个新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  4912. */
  4913. add(x, y) {
  4914. if ((x == null) || (y == null)) {
  4915. throw new TypeError('Bounds.add cannot receive null values');
  4916. }
  4917. return new Bounds(this.left + x, this.bottom + y,
  4918. this.right + x, this.top + y);
  4919. }
  4920. /**
  4921. * @function SuperMap.Bounds.prototype.extend
  4922. * @description 在当前 bounds 上扩展 bounds,支持 point,lanlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  4923. * @example
  4924. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  4925. * //bounds 改变
  4926. * bounds.extend(new SuperMap.LonLat(50,60));
  4927. * @param {(SuperMap.Geometry.Point|SuperMap.LonLat|SuperMap.Bounds)} object - 可以是 point、lonlat 和 bounds。
  4928. */
  4929. extend(object) {
  4930. var bounds = null;
  4931. if (object) {
  4932. // clear cached center location
  4933. switch (object.CLASS_NAME) {
  4934. case "SuperMap.LonLat":
  4935. bounds = new Bounds(object.lon, object.lat,
  4936. object.lon, object.lat);
  4937. break;
  4938. case "SuperMap.Geometry.Point":
  4939. bounds = new Bounds(object.x, object.y,
  4940. object.x, object.y);
  4941. break;
  4942. case "SuperMap.Bounds":
  4943. bounds = object;
  4944. break;
  4945. }
  4946. if (bounds) {
  4947. this.centerLonLat = null;
  4948. if ((this.left == null) || (bounds.left < this.left)) {
  4949. this.left = bounds.left;
  4950. }
  4951. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  4952. this.bottom = bounds.bottom;
  4953. }
  4954. if ((this.right == null) || (bounds.right > this.right)) {
  4955. this.right = bounds.right;
  4956. }
  4957. if ((this.top == null) || (bounds.top > this.top)) {
  4958. this.top = bounds.top;
  4959. }
  4960. }
  4961. }
  4962. }
  4963. /**
  4964. * @function SuperMap.Bounds.prototype.containsLonLat
  4965. * @description 判断传入的坐标是否在范围内。
  4966. * @example
  4967. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  4968. * //isContains1 = true
  4969. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  4970. * var isContains1 = bounds.containsLonLat(new SuperMap.LonLat(40,40),true);
  4971. *
  4972. * //(40,40)在范围内,同样(40+360,40)也在范围内
  4973. * var bounds2 = new SuperMap.Bounds(-50,-50,40,40);
  4974. * //isContains2 = true;
  4975. * var isContains2 = bounds2.containsLonLat(
  4976. * new SuperMap.LonLat(400,40),
  4977. * {
  4978. * inclusive:true,
  4979. * //全球的范围
  4980. * worldBounds: new SuperMap.Bounds(-180,-90,180,90)
  4981. * }
  4982. * );
  4983. * @param {(SuperMap.LonLat|Object)} ll - <SuperMap.LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  4984. * @param {Object} options - 可选参数。
  4985. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  4986. * @param {SuperMap.Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  4987. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  4988. * @returns {boolean} 传入坐标是否包含在范围内。
  4989. */
  4990. containsLonLat(ll, options) {
  4991. if (typeof options === "boolean") {
  4992. options = {inclusive: options};
  4993. }
  4994. options = options || {};
  4995. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  4996. worldBounds = options.worldBounds;
  4997. //日界线以外的也有可能算包含,
  4998. if (worldBounds && !contains) {
  4999. var worldWidth = worldBounds.getWidth();
  5000. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  5001. //这一步很关键
  5002. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  5003. contains = this.containsLonLat({
  5004. lon: ll.lon - worldsAway * worldWidth,
  5005. lat: ll.lat
  5006. }, {inclusive: options.inclusive});
  5007. }
  5008. return contains;
  5009. }
  5010. /**
  5011. * @function SuperMap.Bounds.prototype.containsPixel
  5012. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  5013. * @example
  5014. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  5015. * //isContains = true
  5016. * var isContains = bounds.containsPixel(new SuperMap.Pixel(40,40),true);
  5017. * @param {SuperMap.Pixel} px - 提供的像素参数。
  5018. * @param {boolean} [inclusive=true] - 是否包含边界。
  5019. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  5020. */
  5021. containsPixel(px, inclusive) {
  5022. return this.contains(px.x, px.y, inclusive);
  5023. }
  5024. /**
  5025. * @function SuperMap.Bounds.prototype.contains
  5026. * @description 判断传入的 x,y 坐标值是否在范围内。
  5027. * @example
  5028. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  5029. * //isContains = true
  5030. * var isContains = bounds.contains(40,40,true);
  5031. * @param {float} x - 传入的 x 坐标值。
  5032. * @param {float} y - 传入的 y 坐标值。
  5033. * @param {boolean} [inclusive=true] - 是否包含边界。
  5034. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  5035. */
  5036. contains(x, y, inclusive) {
  5037. //set default
  5038. if (inclusive == null) {
  5039. inclusive = true;
  5040. }
  5041. if (x == null || y == null) {
  5042. return false;
  5043. }
  5044. //x = Util.toFloat(x);
  5045. //y = Util.toFloat(y);
  5046. var contains = false;
  5047. if (inclusive) {
  5048. contains = ((x >= this.left) && (x <= this.right) &&
  5049. (y >= this.bottom) && (y <= this.top));
  5050. } else {
  5051. contains = ((x > this.left) && (x < this.right) &&
  5052. (y > this.bottom) && (y < this.top));
  5053. }
  5054. return contains;
  5055. }
  5056. /**
  5057. * @function SuperMap.Bounds.prototype.intersectsBounds
  5058. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意
  5059. * 边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  5060. * @example
  5061. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5062. * var isIntersects = bounds.intersectsBounds(
  5063. * new SuperMap.Bounds(-170,-90,120,80)
  5064. * );
  5065. * @param {SuperMap.Bounds} bounds - 目标边界。
  5066. * @param {Object} options - 参数。
  5067. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,
  5068. * 两个边界范围没有重叠部分仅仅是在边缘相接(重合),
  5069. * 这种情况被认为没有相交。
  5070. * @param {SuperMap.Bounds} [options.worldBounds] - 提供了 worldBounds 参数, 如果他们相交时
  5071. * 是在全球范围内, 两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  5072. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  5073. */
  5074. intersectsBounds(bounds, options) {
  5075. if (typeof options === "boolean") {
  5076. options = {inclusive: options};
  5077. }
  5078. options = options || {};
  5079. if (options.worldBounds) {
  5080. var self = this.wrapDateLine(options.worldBounds);
  5081. bounds = bounds.wrapDateLine(options.worldBounds);
  5082. } else {
  5083. self = this;
  5084. }
  5085. if (options.inclusive == null) {
  5086. options.inclusive = true;
  5087. }
  5088. var intersects = false;
  5089. var mightTouch = (
  5090. self.left === bounds.right ||
  5091. self.right === bounds.left ||
  5092. self.top === bounds.bottom ||
  5093. self.bottom === bounds.top
  5094. );
  5095. // if the two bounds only touch at an edge, and inclusive is false,
  5096. // then the bounds don't *really* intersect.
  5097. if (options.inclusive || !mightTouch) {
  5098. // otherwise, if one of the boundaries even partially contains another,
  5099. // inclusive of the edges, then they do intersect.
  5100. var inBottom = (
  5101. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  5102. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  5103. );
  5104. var inTop = (
  5105. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  5106. ((self.top > bounds.bottom) && (self.top < bounds.top))
  5107. );
  5108. var inLeft = (
  5109. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  5110. ((self.left >= bounds.left) && (self.left <= bounds.right))
  5111. );
  5112. var inRight = (
  5113. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  5114. ((self.right >= bounds.left) && (self.right <= bounds.right))
  5115. );
  5116. intersects = ((inBottom || inTop) && (inLeft || inRight));
  5117. }
  5118. // document me
  5119. if (options.worldBounds && !intersects) {
  5120. var world = options.worldBounds;
  5121. var width = world.getWidth();
  5122. var selfCrosses = !world.containsBounds(self);
  5123. var boundsCrosses = !world.containsBounds(bounds);
  5124. if (selfCrosses && !boundsCrosses) {
  5125. bounds = bounds.add(-width, 0);
  5126. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  5127. } else if (boundsCrosses && !selfCrosses) {
  5128. self = self.add(-width, 0);
  5129. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  5130. }
  5131. }
  5132. return intersects;
  5133. }
  5134. /**
  5135. * @function SuperMap.Bounds.prototype.containsBounds
  5136. * @description 判断目标边界是否被当前边界包含在内。
  5137. * @example
  5138. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5139. * var isContains = bounds.containsBounds(
  5140. * new SuperMap.Bounds(-170,-90,100,80),true,true
  5141. * );
  5142. * @param {SuperMap.Bounds} bounds - 目标边界。
  5143. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  5144. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  5145. * @param {boolean} [inclusive=true] - 边缘共享被视为包含。
  5146. * @returns {boolean} 传入的边界被当前边界包含。
  5147. */
  5148. containsBounds(bounds, partial, inclusive) {
  5149. if (partial == null) {
  5150. partial = false;
  5151. }
  5152. if (inclusive == null) {
  5153. inclusive = true;
  5154. }
  5155. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  5156. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  5157. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  5158. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  5159. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  5160. : (bottomLeft && bottomRight && topLeft && topRight);
  5161. }
  5162. /**
  5163. * @function SuperMap.Bounds.prototype.determineQuadrant
  5164. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  5165. * @example
  5166. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5167. * //str = "tr";
  5168. * var str = bounds.determineQuadrant(
  5169. * new SuperMap.LonLat(20,20)
  5170. * );
  5171. * @param {SuperMap.LonLat} lonlat - 传入的坐标对象。
  5172. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  5173. */
  5174. determineQuadrant(lonlat) {
  5175. var quadrant = "";
  5176. var center = this.getCenterLonLat();
  5177. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  5178. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  5179. return quadrant;
  5180. }
  5181. /**
  5182. * @function SuperMap.Bounds.prototype.wrapDateLine
  5183. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  5184. * @example
  5185. * var bounds = new SuperMap.Bounds(380,-40,400,-20);
  5186. * var maxExtent = new SuperMap.Bounds(-180,-90,100,80);
  5187. * //新的bounds
  5188. * var newBounds = bounds.wrapDateLine(maxExtent);
  5189. * @param {SuperMap.Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  5190. * @param {Object} options - 可选选项参数。
  5191. * @param {float} [options.leftTolerance=0] - left 允许的误差。
  5192. * @param {float} [options.rightTolerance=0] - right 允许的误差。
  5193. * @returns {SuperMap.Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  5194. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  5195. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  5196. */
  5197. wrapDateLine(maxExtent, options) {
  5198. options = options || {};
  5199. var leftTolerance = options.leftTolerance || 0;
  5200. var rightTolerance = options.rightTolerance || 0;
  5201. var newBounds = this.clone();
  5202. if (maxExtent) {
  5203. var width = maxExtent.getWidth();
  5204. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  5205. //shift right?
  5206. while (newBounds.left < maxExtent.left &&
  5207. newBounds.right - rightTolerance <= maxExtent.left) {
  5208. newBounds = newBounds.add(width, 0);
  5209. }
  5210. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  5211. //shift left?
  5212. while (newBounds.left + leftTolerance >= maxExtent.right &&
  5213. newBounds.right > maxExtent.right) {
  5214. newBounds = newBounds.add(-width, 0);
  5215. }
  5216. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  5217. // crosses right only? force left
  5218. var newLeft = newBounds.left + leftTolerance;
  5219. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  5220. newBounds.right - rightTolerance > maxExtent.right) {
  5221. newBounds = newBounds.add(-width, 0);
  5222. }
  5223. }
  5224. return newBounds;
  5225. }
  5226. /**
  5227. * @function SuperMap.Bounds.prototype.toServerJSONObject
  5228. * @description 转换成对应的 JSON 格式对象。
  5229. * @example
  5230. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5231. * var obj = bounds.toServerJSONObject();
  5232. * @returns {Object} 返回 JSON 格式的 Object 对象。
  5233. */
  5234. toServerJSONObject() {
  5235. var jsonObject = {
  5236. rightTop: {x: this.right, y: this.top},
  5237. leftBottom: {x: this.left, y: this.bottom},
  5238. left: this.left,
  5239. right: this.right,
  5240. top: this.top,
  5241. bottom: this.bottom
  5242. }
  5243. return jsonObject;
  5244. }
  5245. /**
  5246. *
  5247. * @function SuperMap.Bounds.prototype.destroy
  5248. * @description 销毁此对象。
  5249. * 销毁后此对象的所有属性为 null,而不是初始值。
  5250. * @example
  5251. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  5252. * bounds.destroy();
  5253. */
  5254. destroy() {
  5255. this.left = null;
  5256. this.right = null;
  5257. this.top = null;
  5258. this.bottom = null;
  5259. this.centerLonLat = null;
  5260. }
  5261. /**
  5262. * @function SuperMap.Bounds.fromString
  5263. * @description 通过字符串参数创建新的 bounds 的构造函数。
  5264. * @example
  5265. * var bounds = SuperMap.Bounds.fromString("-180,-90,100,80");
  5266. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  5267. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  5268. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  5269. * @returns {SuperMap.Bounds} 返回给定的字符串创建的新的边界对象。
  5270. */
  5271. static fromString(str, reverseAxisOrder) {
  5272. var bounds = str.split(",");
  5273. return Bounds.fromArray(bounds, reverseAxisOrder);
  5274. }
  5275. /**
  5276. * @function SuperMap.Bounds.fromArray
  5277. * @description 通过边界框数组创建 Bounds。
  5278. * @example
  5279. * var bounds = SuperMap.Bounds.fromArray([-180,-90,100,80]);
  5280. * @param {Array.<float>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  5281. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  5282. * @returns {SuperMap.Bounds} 返回根据传入的数组创建的新的边界对象。
  5283. */
  5284. static fromArray(bbox, reverseAxisOrder) {
  5285. return reverseAxisOrder === true ?
  5286. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  5287. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  5288. }
  5289. /**
  5290. * @function SuperMap.Bounds.fromSize
  5291. * @description 通过传入的边界大小来创建新的边界。
  5292. * @example
  5293. * var bounds = SuperMap.Bounds.fromSize(new SuperMap.Size(20,10));
  5294. * @param {SuperMap.Size} size - 传入的边界大小。
  5295. * @returns {SuperMap.Bounds} 返回根据传入的边界大小的创建新的边界。
  5296. */
  5297. static fromSize(size) {
  5298. return new Bounds(0,
  5299. size.h,
  5300. size.w,
  5301. 0);
  5302. }
  5303. /**
  5304. * @function SuperMap.Bounds.oppositeQuadrant
  5305. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  5306. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  5307. * @returns {string} 反转后的象限。
  5308. */
  5309. static oppositeQuadrant(quadrant) {
  5310. var opp = "";
  5311. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  5312. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  5313. return opp;
  5314. }
  5315. }
  5316. SuperMap.Bounds = Bounds;
  5317. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  5318. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5319. * This program are made available under the terms of the Apache License, Version 2.0
  5320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5321. // import {WKT} from '../format/WKT';
  5322. // import {Vector} from './Vector';
  5323. /**
  5324. * @class SuperMap.Geometry
  5325. * @category BaseTypes Geometry
  5326. * @classdesc 几何对象类,描述地理对象的几何图形。
  5327. */
  5328. class Geometry {
  5329. constructor() {
  5330. this.CLASS_NAME = "SuperMap.Geometry";
  5331. /**
  5332. * @member {string} SuperMap.Geometry.prototype.id
  5333. * @description 此几何对象的唯一标示符。
  5334. *
  5335. */
  5336. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  5337. /**
  5338. * @member {SuperMap.Geometry} SuperMap.Geometry.prototype.parent
  5339. * @description This is set when a Geometry is added as component
  5340. * of another geometry
  5341. */
  5342. this.parent = null;
  5343. /**
  5344. * @member {SuperMap.Bounds} SuperMap.Geometry.prototype.bounds
  5345. * @description 几何对象的范围。
  5346. *
  5347. */
  5348. this.bounds = null;
  5349. /**
  5350. * @member {interger} SuperMap.Geometry.prototype.SRID
  5351. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  5352. * @example
  5353. * var geometry= new SuperMap.Geometry();
  5354. * geometry. SRID=4326;
  5355. *
  5356. */
  5357. this.SRID = null;
  5358. }
  5359. /**
  5360. * @function SuperMap.Geometry.prototype.destroy
  5361. * @description 解构 Geometry 类,释放资源。
  5362. */
  5363. destroy() {
  5364. this.id = null;
  5365. this.bounds = null;
  5366. this.SRID = null;
  5367. }
  5368. /**
  5369. * @function SuperMap.Geometry.prototype.clone
  5370. * @description 创建克隆的几何图形。克隆的几何图形不设置非标准的属性。
  5371. * @returns {SuperMap.Geometry} 克隆的几何图形。
  5372. */
  5373. clone() {
  5374. return new Geometry();
  5375. }
  5376. /**
  5377. * @function SuperMap.Geometry.prototype.setBounds
  5378. * @description 设置此几何对象的 bounds。
  5379. * @param {SuperMap.Bounds} bounds - 范围。
  5380. */
  5381. setBounds(bounds) {
  5382. if (bounds) {
  5383. this.bounds = bounds.clone();
  5384. }
  5385. }
  5386. /**
  5387. * @function SuperMap.Geometry.prototype.clearBounds
  5388. * @description 清除几何对象的 bounds。
  5389. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  5390. */
  5391. clearBounds() {
  5392. this.bounds = null;
  5393. if (this.parent) {
  5394. this.parent.clearBounds();
  5395. }
  5396. }
  5397. /**
  5398. * @function SuperMap.Geometry.prototype.extendBounds
  5399. * @description Extend the existing bounds to include the new bounds.
  5400. * If geometry's bounds is not yet set, then set a new Bounds.
  5401. *
  5402. * @param {SuperMap.Bounds} newBounds - 范围。
  5403. */
  5404. extendBounds(newBounds) {
  5405. var bounds = this.getBounds();
  5406. if (!bounds) {
  5407. this.setBounds(newBounds);
  5408. } else {
  5409. this.bounds.extend(newBounds);
  5410. }
  5411. }
  5412. /**
  5413. * @function SuperMap.Geometry.prototype.getBounds
  5414. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  5415. * @returns {SuperMap.Bounds} 返回的几何对象的边界。
  5416. */
  5417. getBounds() {
  5418. if (this.bounds == null) {
  5419. this.calculateBounds();
  5420. }
  5421. return this.bounds;
  5422. }
  5423. /**
  5424. * @function SuperMap.Geometry.prototype.calculateBounds
  5425. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  5426. */
  5427. calculateBounds() {
  5428. //
  5429. // This should be overridden by subclasses.
  5430. //
  5431. }
  5432. /**
  5433. * @function SuperMap.Geometry.prototype.getVertices
  5434. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  5435. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  5436. * @returns {Array} 几何图形的顶点列表。
  5437. */
  5438. getVertices(nodes) { // eslint-disable-line no-unused-vars
  5439. }
  5440. /**
  5441. * @function SuperMap.Geometry.prototype.getArea
  5442. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  5443. * @returns {float} The area of the collection by summing its parts
  5444. */
  5445. getArea() {
  5446. //to be overridden by geometries that actually have an area
  5447. //
  5448. return 0.0;
  5449. }
  5450. // /**
  5451. // * @function SuperMap.Geometry.prototype.toString
  5452. // * @description 返回geometry对象的字符串表述,需要引入{@link SuperMap.Format.WKT}。此方法只能在子类实现,在父类使用会报错。
  5453. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  5454. // */
  5455. // toString() {
  5456. // var string;
  5457. // if (WKT) {
  5458. // var wkt = new WKT();
  5459. // string = wkt.write(new Vector(this));
  5460. // } else {
  5461. // string = Object.prototype.toString.call(this);
  5462. // }
  5463. // return string;
  5464. // }
  5465. }
  5466. SuperMap.Geometry = Geometry;
  5467. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  5468. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5469. * This program are made available under the terms of the Apache License, Version 2.0
  5470. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5471. /**
  5472. * @class SuperMap.Geometry.Collection
  5473. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  5474. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  5475. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  5476. * @category BaseTypes Geometry
  5477. * @extends {SuperMap.Geometry}
  5478. * @param {Array.<SuperMap.Geometry>} components - 几何对象数组。
  5479. * @example
  5480. * var point1 = new SuperMap.Geometry.Point(10,20);
  5481. * var point2 = new SuperMap.Geometry.Point(30,40);
  5482. * var col = new SuperMap.Geometry.Collection([point1,point2]);
  5483. */
  5484. class Collection extends Geometry {
  5485. constructor(components) {
  5486. super();
  5487. /**
  5488. * @description 存储几何对象的数组。
  5489. * @member {Array.<SuperMap.Geometry>} SuperMap.Geometry.Collection.prototype.components
  5490. */
  5491. this.components = [];
  5492. /**
  5493. * @member {Array.<string>} SuperMap.Geometry.Collection.prototype.componentTypes
  5494. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  5495. */
  5496. this.componentTypes = null;
  5497. if (components != null) {
  5498. this.addComponents(components);
  5499. }
  5500. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  5501. this.geometryType = "Collection";
  5502. }
  5503. /**
  5504. * @function SuperMap.Geometry.Collection.prototype.destroy
  5505. * @description 销毁几何图形。
  5506. */
  5507. destroy() {
  5508. this.components.length = 0;
  5509. this.components = null;
  5510. super.destroy();
  5511. }
  5512. /**
  5513. * @function SuperMap.Geometry.Collection.prototype.clone
  5514. * @description 克隆当前几何对象。
  5515. * @returns {SuperMap.Geometry.Collection} 克隆的几何对象集合。
  5516. */
  5517. clone() {
  5518. var geometry = new Collection();
  5519. for (var i = 0, len = this.components.length; i < len; i++) {
  5520. geometry.addComponent(this.components[i].clone());
  5521. }
  5522. // catch any randomly tagged-on properties
  5523. Util.applyDefaults(geometry, this);
  5524. return geometry;
  5525. }
  5526. /**
  5527. * @function SuperMap.Geometry.Collection.prototype.getComponentsString
  5528. * @description 获取 components 字符串。
  5529. * @returns {string} components 字符串。
  5530. */
  5531. getComponentsString() {
  5532. var strings = [];
  5533. for (var i = 0, len = this.components.length; i < len; i++) {
  5534. strings.push(this.components[i].toShortString());
  5535. }
  5536. return strings.join(",");
  5537. }
  5538. /**
  5539. * @function SuperMap.Geometry.Collection.prototype.calculateBounds
  5540. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  5541. */
  5542. calculateBounds() {
  5543. this.bounds = null;
  5544. var bounds = new Bounds();
  5545. var components = this.components;
  5546. if (components) {
  5547. for (var i = 0, len = components.length; i < len; i++) {
  5548. bounds.extend(components[i].getBounds());
  5549. }
  5550. }
  5551. // to preserve old behavior, we only set bounds if non-null
  5552. // in the future, we could add bounds.isEmpty()
  5553. if (bounds.left != null && bounds.bottom != null &&
  5554. bounds.right != null && bounds.top != null) {
  5555. this.setBounds(bounds);
  5556. }
  5557. }
  5558. /**
  5559. * @function SuperMap.Geometry.Collection.prototype.addComponents
  5560. * @description 给几何图形对象添加元素。
  5561. * @param {Array.<SuperMap.Geometry>} components - 几何对象组件。
  5562. * @example
  5563. * var collection = new SuperMap.Geometry.Collection();
  5564. * collection.addComponents(new SuerpMap.Geometry.Point(10,10));
  5565. */
  5566. addComponents(components) {
  5567. if (!(Util.isArray(components))) {
  5568. components = [components];
  5569. }
  5570. for (var i = 0, len = components.length; i < len; i++) {
  5571. this.addComponent(components[i]);
  5572. }
  5573. }
  5574. /**
  5575. * @function SuperMap.Geometry.Collection.prototype.addComponent
  5576. * @description 添加一个几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  5577. * @param {SuperMap.Geometry} component - 待添加的几何对象。
  5578. * @param {int} [index] - 几何对象插入的位置。
  5579. * @returns {boolean} 是否添加成功。
  5580. */
  5581. addComponent(component, index) {
  5582. var added = false;
  5583. if (component) {
  5584. if (this.componentTypes == null ||
  5585. (Util.indexOf(this.componentTypes,
  5586. component.CLASS_NAME) > -1)) {
  5587. if (index != null && (index < this.components.length)) {
  5588. var components1 = this.components.slice(0, index);
  5589. var components2 = this.components.slice(index,
  5590. this.components.length);
  5591. components1.push(component);
  5592. this.components = components1.concat(components2);
  5593. } else {
  5594. this.components.push(component);
  5595. }
  5596. component.parent = this;
  5597. this.clearBounds();
  5598. added = true;
  5599. }
  5600. }
  5601. return added;
  5602. }
  5603. /**
  5604. * @function SuperMap.Geometry.Collection.prototype.removeComponents
  5605. * @description 清除几何对象。
  5606. * @param {Array.<SuperMap.Geometry>} components - 需要清除的几何对象。
  5607. * @returns {boolean} 元素是否被删除。
  5608. */
  5609. removeComponents(components) {
  5610. var removed = false;
  5611. if (!(Util.isArray(components))) {
  5612. components = [components];
  5613. }
  5614. for (var i = components.length - 1; i >= 0; --i) {
  5615. removed = this.removeComponent(components[i]) || removed;
  5616. }
  5617. return removed;
  5618. }
  5619. /**
  5620. * @function SuperMap.Geometry.Collection.prototype.removeComponent
  5621. * @description 从集合中移除一个几何对象。
  5622. * @param {SuperMap.Geometry} component - 要移除的几何对象。
  5623. * @returns {boolean} 几何对象是否移除成功。
  5624. */
  5625. removeComponent(component) {
  5626. Util.removeItem(this.components, component);
  5627. // clearBounds() so that it gets recalculated on the next call
  5628. // to this.getBounds();
  5629. this.clearBounds();
  5630. return true;
  5631. }
  5632. /**
  5633. * @function SuperMap.Geometry.Collection.prototype.getArea
  5634. * @description 计算几何对象的面积。注意,这个方法在 {@link SuperMap.Geometry.Polygon} 类中需要重写。
  5635. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  5636. */
  5637. getArea() {
  5638. var area = 0.0;
  5639. for (var i = 0, len = this.components.length; i < len; i++) {
  5640. area += this.components[i].getArea();
  5641. }
  5642. return area;
  5643. }
  5644. /**
  5645. * @function SuperMap.Geometry.Collection.prototype.equals
  5646. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  5647. * @param {SuperMap.Geometry} geometry - 需要判断的几何图形。
  5648. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  5649. */
  5650. equals(geometry) {
  5651. var equivalent = true;
  5652. if (!geometry || !geometry.CLASS_NAME ||
  5653. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  5654. equivalent = false;
  5655. } else if (!(Util.isArray(geometry.components)) ||
  5656. (geometry.components.length !== this.components.length)) {
  5657. equivalent = false;
  5658. } else {
  5659. for (var i = 0, len = this.components.length; i < len; ++i) {
  5660. if (!this.components[i].equals(geometry.components[i])) {
  5661. equivalent = false;
  5662. break;
  5663. }
  5664. }
  5665. }
  5666. return equivalent;
  5667. }
  5668. /**
  5669. * @function SuperMap.Geometry.Collection.prototype.getVertices
  5670. * @description 返回几何对象的所有结点的列表。
  5671. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点如果没有设置此参数,则返回所有顶点。
  5672. * @returns {Array} 几何对象的顶点列表。
  5673. */
  5674. getVertices(nodes) {
  5675. var vertices = [];
  5676. for (var i = 0, len = this.components.length; i < len; ++i) {
  5677. Array.prototype.push.apply(
  5678. vertices, this.components[i].getVertices(nodes)
  5679. );
  5680. }
  5681. return vertices;
  5682. }
  5683. }
  5684. SuperMap.Geometry.Collection = Collection;
  5685. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  5686. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5687. * This program are made available under the terms of the Apache License, Version 2.0
  5688. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5689. /**
  5690. * @class SuperMap.Geometry.MultiPoint
  5691. * @classdesc 几何对象多点类。
  5692. * @category BaseTypes Geometry
  5693. * @extends {SuperMap.Geometry.Collection}
  5694. * @param {Array.<SuperMap.Geometry.Point>} components - 点对象数组。
  5695. * @example
  5696. * var point1 = new SuperMap.Geometry.Point(5,6);
  5697. * var poine2 = new SuperMap.Geometry.Point(7,8);
  5698. * var multiPoint = new SuperMap.Geometry.MultiPoint([point1,point2]);
  5699. */
  5700. class MultiPoint extends Collection {
  5701. constructor(components) {
  5702. super(components);
  5703. /**
  5704. * @member {Array.<string>} [SuperMap.Geometry.MultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  5705. * @description components 存储的的几何对象所支持的几何类型数组。
  5706. * @readonly
  5707. */
  5708. this.componentTypes = ["SuperMap.Geometry.Point"];
  5709. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  5710. this.geometryType = "MultiPoint";
  5711. }
  5712. /**
  5713. * @function SuperMap.Geometry.MultiPoint.prototype.addPoint
  5714. * @description 添加点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.addComponent} 方法。
  5715. * @param {SuperMap.Geometry.Point} point - 添加的点。
  5716. * @param {integer} [index] - 下标。
  5717. */
  5718. addPoint(point, index) {
  5719. this.addComponent(point, index);
  5720. }
  5721. /**
  5722. * @function SuperMap.Geometry.MultiPoint.prototype.removePoint
  5723. * @description 移除点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.removeComponent} 方法。
  5724. * @param {SuperMap.Geometry.Point} point - 移除的点对象。
  5725. */
  5726. removePoint(point) {
  5727. this.removeComponent(point);
  5728. }
  5729. }
  5730. SuperMap.Geometry.MultiPoint = MultiPoint;
  5731. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  5732. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5733. * This program are made available under the terms of the Apache License, Version 2.0
  5734. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5735. /**
  5736. * @class SuperMap.Geometry.Curve
  5737. * @classdesc 几何对象曲线类。
  5738. * @category BaseTypes Geometry
  5739. * @extends {SuperMap.Geometry.MultiPoint}
  5740. * @param {Array.<SuperMap.Geometry.Point>} components - 几何对象数组。
  5741. * @example
  5742. * var point1 = new SuperMap.Geometry.Point(10,20);
  5743. * var point2 = new SuperMap.Geometry.Point(30,40);
  5744. * var curve = new SuperMap.Geometry.Curve([point1,point2]);
  5745. */
  5746. class Curve extends MultiPoint {
  5747. constructor(components) {
  5748. super(components);
  5749. /**
  5750. * @member {Array.<string>} [SuperMap.Geometry.Curve.prototype.componentType=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  5751. * @description components 存储的的几何对象所支持的几何类型数组。
  5752. * @readonly
  5753. */
  5754. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  5755. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  5756. this.geometryType = "Curve";
  5757. }
  5758. }
  5759. SuperMap.Geometry.Curve = Curve;
  5760. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  5761. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5762. * This program are made available under the terms of the Apache License, Version 2.0
  5763. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5764. /**
  5765. * @class SuperMap.Geometry.Point
  5766. * @classdesc 点几何对象类。
  5767. * @category BaseTypes Geometry
  5768. * @extends {SuperMap.Geometry}
  5769. * @param {float} x - x 坐标。
  5770. * @param {float} y - y 坐标。
  5771. * @param {string} [type = 'Point'] - 用来存储点的类型。
  5772. * @param {float} [tag] - 用来存储额外的属性,比如差值分析中的 Z 值。
  5773. * @example
  5774. * var point = new SuperMap.Geometry.Point(-111.04, 45.68);
  5775. */
  5776. class Point extends Geometry {
  5777. constructor(x, y, type, tag) {
  5778. super(x, y, type, tag);
  5779. /**
  5780. * @member {float} SuperMap.Geometry.Point.prototype.x
  5781. * @description 横坐标。
  5782. */
  5783. this.x = parseFloat(x);
  5784. /**
  5785. * @member {float} SuperMap.Geometry.Point.prototype.y
  5786. * @description 纵坐标。
  5787. */
  5788. this.y = parseFloat(y);
  5789. /**
  5790. * @member {string} SuperMap.Geometry.Point.prototype.tag
  5791. * @description 用来存储额外的属性,比如差值分析中的 Z 值。
  5792. */
  5793. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  5794. /**
  5795. * @member {string} SuperMap.Geometry.Point.prototype.tag
  5796. * @description 用来存储点的类型
  5797. */
  5798. this.type = type || "Point";
  5799. this.CLASS_NAME = "SuperMap.Geometry.Point";
  5800. this.geometryType = "Point";
  5801. }
  5802. /**
  5803. * @function SuperMap.Geometry.Point.prototype.clone
  5804. * @description 克隆点对象。
  5805. * @returns {SuperMap.Geometry.Point} 克隆后的点对象。
  5806. */
  5807. clone(obj) {
  5808. if (obj == null) {
  5809. obj = new Point(this.x, this.y);
  5810. }
  5811. // catch any randomly tagged-on properties
  5812. Util.applyDefaults(obj, this);
  5813. return obj;
  5814. }
  5815. /**
  5816. * @function SuperMap.Geometry.Point.prototype.calculateBounds
  5817. * @description 计算点对象的范围。
  5818. */
  5819. calculateBounds() {
  5820. this.bounds = new Bounds(this.x, this.y,
  5821. this.x, this.y);
  5822. }
  5823. /**
  5824. * @function SuperMap.Geometry.Point.prototype.equals
  5825. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  5826. * @example
  5827. * var point= new SuperMap.Geometry.Point(0,0);
  5828. * var point1={x:0,y:0};
  5829. * var result= point.equals(point1);
  5830. * @param {SuperMap.Geometry.Point} geom - 需要判断的点对象。
  5831. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  5832. */
  5833. equals(geom) {
  5834. var equals = false;
  5835. if (geom != null) {
  5836. equals = ((this.x === geom.x && this.y === geom.y) ||
  5837. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  5838. }
  5839. return equals;
  5840. }
  5841. /**
  5842. * @function SuperMap.Geometry.Point.prototype.move
  5843. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  5844. * @param {float} x - x 轴正方向上的偏移量。
  5845. * @param {float} y - y 轴正方向上偏移量。
  5846. */
  5847. move(x, y) {
  5848. this.x = this.x + x;
  5849. this.y = this.y + y;
  5850. this.clearBounds();
  5851. }
  5852. /**
  5853. * @function SuperMap.Geometry.Point.prototype.toShortString
  5854. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  5855. */
  5856. toShortString() {
  5857. return (this.x + ", " + this.y);
  5858. }
  5859. /**
  5860. * @function SuperMap.Geometry.Point.prototype.destroy
  5861. * @description 释放点对象的资源。
  5862. */
  5863. destroy() {
  5864. this.x = null;
  5865. this.y = null;
  5866. this.tag = null;
  5867. super.destroy();
  5868. }
  5869. /**
  5870. * @function SuperMap.Geometry.Point.prototype.getVertices
  5871. * @description 返回点对象的所有顶点的列表。
  5872. * @param {boolean} [nodes] - 对于点对象此参数不起作用,直接返回点。
  5873. * @returns {Array} 几何图形的顶点列表。
  5874. */
  5875. getVertices(nodes) { // eslint-disable-line no-unused-vars
  5876. return [this];
  5877. }
  5878. }
  5879. SuperMap.Geometry.Point = Point;
  5880. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  5881. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5882. * This program are made available under the terms of the Apache License, Version 2.0
  5883. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5884. /**
  5885. * @class SuperMap.Geometry.LineString
  5886. * @classdesc 几何对象线串类。
  5887. * @category BaseTypes Geometry
  5888. * @param {Array.<SuperMap.Geometry.Point>} points - 用来生成线串的点数组。
  5889. * @extends {SuperMap.Geometry.Curve}
  5890. * @example
  5891. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  5892. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  5893. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  5894. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  5895. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  5896. * var roadLine = new SuperMap.Geometry.LineString(points);
  5897. */
  5898. class LineString extends Curve {
  5899. constructor(points) {
  5900. super(points);
  5901. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  5902. this.geometryType = "LineString";
  5903. }
  5904. /**
  5905. * @function SuperMap.Geometry.LineString.prototype.removeComponent
  5906. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  5907. * @param {SuperMap.Geometry.Point} point - 将被删除的点。
  5908. * @returns {boolean} 删除的点。
  5909. */
  5910. removeComponent(point) { // eslint-disable-line no-unused-vars
  5911. var removed = this.components && (this.components.length > 2);
  5912. if (removed) {
  5913. super.removeComponent.apply(this, arguments);
  5914. }
  5915. return removed;
  5916. }
  5917. /**
  5918. * @function SuperMap.Geometry.LineString.prototype.getSortedSegments
  5919. * @returns {Array} An array of segment objects. Segment objects have properties
  5920. * x1, y1, x2, and y2. The start point is represented by x1 and y1.
  5921. * The end point is represented by x2 and y2. Start and end are
  5922. * ordered so that x1 < x2.
  5923. */
  5924. getSortedSegments() {
  5925. var numSeg = this.components.length - 1;
  5926. var segments = new Array(numSeg), point1, point2;
  5927. for (var i = 0; i < numSeg; ++i) {
  5928. point1 = this.components[i];
  5929. point2 = this.components[i + 1];
  5930. if (point1.x < point2.x) {
  5931. segments[i] = {
  5932. x1: point1.x,
  5933. y1: point1.y,
  5934. x2: point2.x,
  5935. y2: point2.y
  5936. };
  5937. } else {
  5938. segments[i] = {
  5939. x1: point2.x,
  5940. y1: point2.y,
  5941. x2: point1.x,
  5942. y2: point1.y
  5943. };
  5944. }
  5945. }
  5946. // more efficient to define this somewhere static
  5947. function byX1(seg1, seg2) {
  5948. return seg1.x1 - seg2.x1;
  5949. }
  5950. return segments.sort(byX1);
  5951. }
  5952. /**
  5953. * @function SuperMap.Geometry.LineString.prototype.getVertices
  5954. * @description 返回几何图形的所有顶点的列表。
  5955. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点。如果没有设置此参数,则返回所有顶点。
  5956. * @returns {Array} 几何图形的顶点列表。
  5957. */
  5958. getVertices(nodes) {
  5959. var vertices;
  5960. if (nodes === true) {
  5961. vertices = [
  5962. this.components[0],
  5963. this.components[this.components.length - 1]
  5964. ];
  5965. } else if (nodes === false) {
  5966. vertices = this.components.slice(1, this.components.length - 1);
  5967. } else {
  5968. vertices = this.components.slice();
  5969. }
  5970. return vertices;
  5971. }
  5972. /**
  5973. * @function SuperMap.Geometry.LineString.calculateCircle
  5974. * @description 三点画圆弧。
  5975. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  5976. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的圆弧控制点。
  5977. * @example
  5978. * var points = [];
  5979. * points.push(new SuperMap.Geometry.Point(-50,30));
  5980. * points.push(new SuperMap.Geometry.Point(-30,50));
  5981. * points.push(new SuperMap.Geometry.Point(2,60));
  5982. * var circle = SuperMap.Geometry.LineString.calculateCircle(points);
  5983. */
  5984. static calculateCircle(points) {
  5985. if (points.length < 3) {
  5986. return points
  5987. }
  5988. var centerPoint = {},
  5989. p1 = points[0],
  5990. p2 = points[1],
  5991. p3 = points[2];
  5992. var R = 0,
  5993. dStep = 0,
  5994. direc = true,
  5995. dRotation = 0,
  5996. dRotationBegin = 0,
  5997. dRotationAngle = 0,
  5998. nSegmentCount = 72,
  5999. circlePoints = [];
  6000. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  6001. var B13 = p3.y - KTan13 * p3.x;
  6002. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  6003. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  6004. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  6005. circlePoints.push(p1);
  6006. circlePoints.push(p2);
  6007. circlePoints.push(p3);
  6008. } else {
  6009. 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) -
  6010. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  6011. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  6012. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  6013. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  6014. centerPoint.x = D / F;
  6015. centerPoint.y = E / F;
  6016. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  6017. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  6018. var cons = (2 * R * R - dis) / (2 * R * R);
  6019. cons = cons >= 1 ? 1 : cons;
  6020. cons = cons <= -1 ? -1 : cons;
  6021. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  6022. if (p3.x == p1.x) {
  6023. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  6024. } else {
  6025. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  6026. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  6027. }
  6028. dStep = dRotationAngle / 72;
  6029. if (p3.y != p1.y) {
  6030. if (p3.x == p1.x) {
  6031. if (p3.y > p1.y) {
  6032. if (p2.x < p1.x) {
  6033. direc = false;
  6034. }
  6035. } else {
  6036. if (p2.x > p1.x) {
  6037. direc = false;
  6038. }
  6039. }
  6040. } else if (p3.x < p1.x) {
  6041. if (p2.y < KTan13 * p2.x + B13) {
  6042. direc = false;
  6043. }
  6044. } else {
  6045. if (p2.y > KTan13 * p2.x + B13) {
  6046. direc = false;
  6047. }
  6048. }
  6049. } else {
  6050. if (p3.x > p1.x) {
  6051. if (p2.y > p1.y) {
  6052. direc = false;
  6053. }
  6054. } else {
  6055. if (p2.y < p1.y) {
  6056. direc = false;
  6057. }
  6058. }
  6059. }
  6060. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  6061. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  6062. var CY = Math.abs(centerPoint.y);
  6063. if ((p1.y == CY) && (CY == p3.y)) {
  6064. if (p1.x < p3.x) {
  6065. atan10 = atan10 + 180;
  6066. }
  6067. }
  6068. var newPY = p1.y - centerPoint.y;
  6069. circlePoints.push(p1);
  6070. for (var i = 1; i < nSegmentCount; i++) {
  6071. dRotation = dStep * i;
  6072. dRotationBegin = atan10;
  6073. if (direc) {
  6074. if (newPY >= 0) {
  6075. if (K10 >= 0) {
  6076. dRotationBegin = dRotationBegin + dRotation;
  6077. } else {
  6078. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  6079. }
  6080. } else {
  6081. if (K10 > 0) {
  6082. dRotationBegin = (dRotationBegin - 180) + dRotation;
  6083. } else {
  6084. dRotationBegin = (90 - dRotationBegin) + dRotation;
  6085. }
  6086. }
  6087. } else {
  6088. if (newPY >= 0) {
  6089. if (K10 >= 0) {
  6090. dRotationBegin = dRotationBegin - dRotation;
  6091. } else {
  6092. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  6093. }
  6094. } else {
  6095. if (K10 >= 0) {
  6096. dRotationBegin = (dRotationBegin - 180) - dRotation;
  6097. } else {
  6098. dRotationBegin = (90 - dRotationBegin) - dRotation;
  6099. }
  6100. }
  6101. }
  6102. dRotationBegin = dRotationBegin * Math.PI / 180;
  6103. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  6104. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  6105. circlePoints.push(new Point(x, y));
  6106. }
  6107. circlePoints.push(p3);
  6108. }
  6109. return circlePoints;
  6110. }
  6111. /**
  6112. * @function SuperMap.Geometry.LineString.createLineEPS
  6113. * @description 根据点的类型画出不同类型的曲线。
  6114. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  6115. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  6116. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的 lineEPS 控制点。
  6117. * @example
  6118. * var points = [];
  6119. * points.push(new SuperMap.Geometry.Point(-50,30));
  6120. * points.push(new SuperMap.Geometry.Point(-30,50,"LTypeArc"));
  6121. * points.push(new SuperMap.Geometry.Point(2,60));
  6122. * points.push(new SuperMap.Geometry.Point(8,20));
  6123. * var lineEPS = SuperMap.Geometry.LineString.createLineEPS(points);
  6124. */
  6125. static createLineEPS(points) {
  6126. var list = [],
  6127. len = points.length;
  6128. if (len < 2) {
  6129. return points;
  6130. }
  6131. for (var i = 0; i < len;) {
  6132. var type = points[i].type;
  6133. if (type == 'LTypeArc') {
  6134. var listObj = LineString.createLineArc(list, i, len, points);
  6135. list = listObj[0];
  6136. i = listObj[1];
  6137. } else {
  6138. list.push(points[i]);
  6139. i++;
  6140. }
  6141. }
  6142. return list;
  6143. }
  6144. static createLineArc(list, i, len, points) {
  6145. if (i == 0) {
  6146. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  6147. Array.prototype.push.apply(list, bezierPtsObj[0]);
  6148. i = bezierPtsObj[1] + 1;
  6149. } else if (i == len - 1) {
  6150. var bezierP = [points[i - 1], points[i]],
  6151. bezierPts = LineString.calculateCircle(bezierP);
  6152. Array.prototype.push.apply(list, bezierPts);
  6153. i++;
  6154. } else {
  6155. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  6156. list.pop();
  6157. Array.prototype.push.apply(list, bezierPtsObj[0]);
  6158. i = bezierPtsObj[1] + 1;
  6159. }
  6160. return [list, i];
  6161. }
  6162. static addPointEPS(points, i, len, type) {
  6163. var bezierP = [], j = i + 1;
  6164. if (i == 0) {
  6165. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  6166. } else if (i == len - 1) {
  6167. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  6168. } else {
  6169. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  6170. }
  6171. var bezierPts;
  6172. if (type == 'LTypeCurve') {
  6173. bezierPts = LineString.calculatePointsFBZN(bezierP);
  6174. } else if (type == 'LTypeArc') {
  6175. bezierPts = LineString.calculateCircle(bezierP);
  6176. }
  6177. return [bezierPts, j];
  6178. }
  6179. }
  6180. SuperMap.Geometry.LineString = LineString;
  6181. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  6182. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6183. * This program are made available under the terms of the Apache License, Version 2.0
  6184. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6185. /**
  6186. * @class SuperMap.Geometry.GeoText
  6187. * @classdesc 文本标签类。
  6188. * @category BaseTypes Geometry
  6189. * @extends {SuperMap.Geometry}
  6190. * @param {float} x - x 坐标。
  6191. * @param {float} y - y 坐标。
  6192. * @param {string} text - 标签中的文本内容。
  6193. */
  6194. class GeoText extends Geometry {
  6195. constructor(x, y, text) {
  6196. super(x, y, text);
  6197. /**
  6198. * @member {float} SuperMap.Geometry.GeoText.prototype.x
  6199. * @description 横坐标。
  6200. */
  6201. this.x = parseFloat(x);
  6202. /**
  6203. * @member {float} SuperMap.Geometry.GeoText.prototype.y
  6204. * @description 纵坐标。
  6205. */
  6206. this.y = parseFloat(y);
  6207. /**
  6208. * @member {string} SuperMap.Geometry.GeoText.prototype.text
  6209. * @description 标签中的文本内容。
  6210. */
  6211. this.text = text.toString();
  6212. /**
  6213. * @member {Object} SuperMap.Geometry.GeoText.prototype.bsInfo
  6214. * @description 标签范围的基础信息。
  6215. * @property {number} w - bounds 的宽。
  6216. * @property {number} h - bounds 的高度。
  6217. */
  6218. this.bsInfo = {
  6219. "h": null,
  6220. "w": null
  6221. };
  6222. this.element = document.createElement('span');
  6223. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  6224. this.geometryType = "GeoText";
  6225. }
  6226. /**
  6227. * @function SuperMap.Geometry.GeoText.prototype.destroy
  6228. * @description 销毁文本标签类。
  6229. */
  6230. destroy() {
  6231. super.destroy();
  6232. this.x = null;
  6233. this.y = null;
  6234. this.text = null;
  6235. }
  6236. /**
  6237. * @function SuperMap.Geometry.GeoText.prototype.getCentroid
  6238. * @description 获取标签对象的质心。
  6239. * @returns {SuperMap.Geometry.Point} 标签对象的质心。
  6240. */
  6241. getCentroid() {
  6242. return new Point(this.x, this.y);
  6243. }
  6244. /**
  6245. * @function SuperMap.Geometry.GeoText.prototype.clone
  6246. * @description 克隆标签对象。
  6247. * @returns {SuperMap.Geometry.GeoText} 克隆后的标签对象。
  6248. */
  6249. clone(obj) {
  6250. if (obj == null) {
  6251. obj = new GeoText(this.x, this.y, this.text);
  6252. }
  6253. Util.applyDefaults(obj, this);
  6254. return obj;
  6255. }
  6256. /**
  6257. * @function SuperMap.Geometry.GeoText.prototype.calculateBounds
  6258. * @description 计算标签对象的范围。
  6259. */
  6260. calculateBounds() {
  6261. this.bounds = new Bounds(this.x, this.y,
  6262. this.x, this.y);
  6263. }
  6264. /**
  6265. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByLabel
  6266. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  6267. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  6268. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  6269. * @param {string} labelHeight - 标签的高度。
  6270. * @param {Object} style - 标签的 style。
  6271. * @returns {SuperMap.Bounds} 标签的像素范围。
  6272. */
  6273. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  6274. var labelPxBounds, left, bottom, top, right;
  6275. var locationPx = Util.cloneObject(locationPixel);
  6276. //计算文本行数
  6277. var theText = style.label || this.text;
  6278. var textRows = theText.split('\n');
  6279. var laberRows = textRows.length;
  6280. //处理文字对齐
  6281. labelWidth = parseFloat(labelWidth);
  6282. labelHeight = parseFloat(labelHeight);
  6283. if (laberRows > 1) {
  6284. labelHeight = parseFloat(labelHeight) * laberRows;
  6285. }
  6286. if (style.labelAlign && style.labelAlign !== "cm") {
  6287. switch (style.labelAlign) {
  6288. case "lt":
  6289. locationPx.x += labelWidth / 2;
  6290. locationPx.y += labelHeight / 2;
  6291. break;
  6292. case "lm":
  6293. locationPx.x += labelWidth / 2;
  6294. break;
  6295. case "lb":
  6296. locationPx.x += labelWidth / 2;
  6297. locationPx.y -= labelHeight / 2;
  6298. break;
  6299. case "ct":
  6300. locationPx.y += labelHeight / 2;
  6301. break;
  6302. case "cb":
  6303. locationPx.y -= labelHeight / 2;
  6304. break;
  6305. case "rt":
  6306. locationPx.x -= labelWidth / 2;
  6307. locationPx.y += labelHeight / 2;
  6308. break;
  6309. case "rm":
  6310. locationPx.x -= labelWidth / 2;
  6311. break;
  6312. case "rb":
  6313. locationPx.x -= labelWidth / 2;
  6314. locationPx.y -= labelHeight / 2;
  6315. break;
  6316. default:
  6317. break;
  6318. }
  6319. }
  6320. this.bsInfo.h = labelHeight;
  6321. this.bsInfo.w = labelWidth;
  6322. //bounds的四边
  6323. left = locationPx.x - parseFloat(labelWidth) / 2;
  6324. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  6325. right = locationPx.x + parseFloat(labelWidth) / 2;
  6326. top = locationPx.y - parseFloat(labelHeight) / 2;
  6327. labelPxBounds = new Bounds(left, bottom, right, top);
  6328. return labelPxBounds;
  6329. }
  6330. /**
  6331. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByText
  6332. * @description 根据文本内容获取文字标签的像素范围。
  6333. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  6334. * @param {Object} style - 标签的样式。
  6335. * @returns {SuperMap.Bounds} 标签的像素范围。
  6336. */
  6337. getLabelPxBoundsByText(locationPixel, style) {
  6338. var labelPxBounds, left, bottom, top, right;
  6339. var labelSize = this.getLabelPxSize(style);
  6340. var locationPx = Util.cloneObject(locationPixel);
  6341. //处理文字对齐
  6342. if (style.labelAlign && style.labelAlign !== "cm") {
  6343. switch (style.labelAlign) {
  6344. case "lt":
  6345. locationPx.x += labelSize.w / 2;
  6346. locationPx.y += labelSize.h / 2;
  6347. break;
  6348. case "lm":
  6349. locationPx.x += labelSize.w / 2;
  6350. break;
  6351. case "lb":
  6352. locationPx.x += labelSize.w / 2;
  6353. locationPx.y -= labelSize.h / 2;
  6354. break;
  6355. case "ct":
  6356. locationPx.y += labelSize.h / 2;
  6357. break;
  6358. case "cb":
  6359. locationPx.y -= labelSize.h / 2;
  6360. break;
  6361. case "rt":
  6362. locationPx.x -= labelSize.w / 2;
  6363. locationPx.y += labelSize.h / 2;
  6364. break;
  6365. case "rm":
  6366. locationPx.x -= labelSize.w / 2;
  6367. break;
  6368. case "rb":
  6369. locationPx.x -= labelSize.w / 2;
  6370. locationPx.y -= labelSize.h / 2;
  6371. break;
  6372. default:
  6373. break;
  6374. }
  6375. }
  6376. this.bsInfo.h = labelSize.h;
  6377. this.bsInfo.w = labelSize.w;
  6378. left = locationPx.x - labelSize.w / 2;
  6379. bottom = locationPx.y + labelSize.h / 2;
  6380. //处理斜体字
  6381. if (style.fontStyle && style.fontStyle === "italic") {
  6382. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  6383. } else {
  6384. right = locationPx.x + labelSize.w / 2;
  6385. }
  6386. top = locationPx.y - labelSize.h / 2;
  6387. labelPxBounds = new Bounds(left, bottom, right, top);
  6388. return labelPxBounds;
  6389. }
  6390. /**
  6391. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxSize
  6392. * @description 获取 label 的像素大小。
  6393. * @param {Object} style - 标签样式。
  6394. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  6395. */
  6396. getLabelPxSize(style) {
  6397. var text,//文本内容
  6398. fontSize,//字体大小
  6399. spacing = 1,//两个字符间的间距(单位:px)
  6400. lineSpacing = 0.2,
  6401. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  6402. text = style.label || this.text;
  6403. if (style.fontSize) {
  6404. fontSize = parseFloat(style.fontSize);
  6405. } else {
  6406. fontSize = parseFloat("12px");
  6407. }
  6408. //标签宽高
  6409. var labelW, labelH;
  6410. var textRows = text.split('\n');
  6411. var numRows = textRows.length;
  6412. if (numRows > 1) {
  6413. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  6414. } else {
  6415. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  6416. }
  6417. //取最大宽度
  6418. labelW = 0;
  6419. if (this.labelWTmp && labelW < this.labelWTmp) {
  6420. labelW = this.labelWTmp;
  6421. }
  6422. for (var i = 0; i < numRows; i++) {
  6423. var textCharC = this.getTextCount(textRows[i]);
  6424. var labelWTmp = this.labelWTmp = Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  6425. if (labelW < labelWTmp) {
  6426. labelW = labelWTmp;
  6427. }
  6428. }
  6429. var labelSize = new Object(); //标签大小
  6430. labelSize.h = labelH;
  6431. labelSize.w = labelW;
  6432. return labelSize;
  6433. }
  6434. /**
  6435. * @function SuperMap.Geometry.GeoText.prototype.getTextCount
  6436. * @description 获取 text 中的字符个数。
  6437. * @param {string} text - 字符串。
  6438. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  6439. */
  6440. getTextCount(text) {
  6441. var textCharCount = {};
  6442. var cnCount = 0;
  6443. var enCount = 0;
  6444. for (var i = 0; i < text.length; i++) {
  6445. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  6446. cnCount++;
  6447. } else {
  6448. enCount++;
  6449. }
  6450. }
  6451. //中午字符个数
  6452. textCharCount.cnC = cnCount;
  6453. //英文字符个数
  6454. textCharCount.enC = enCount;
  6455. //字符总个数
  6456. textCharCount.textC = text.length;
  6457. return textCharCount;
  6458. }
  6459. }
  6460. SuperMap.Geometry.GeoText = GeoText;
  6461. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  6462. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6463. * This program are made available under the terms of the Apache License, Version 2.0
  6464. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6465. /**
  6466. * @class SuperMap.Geometry.LinearRing
  6467. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  6468. * 作为最后的一个点来自动关闭线环。
  6469. * @category BaseTypes Geometry
  6470. * @extends {SuperMap.Geometry.LineString}
  6471. * @param {Array.<SuperMap.Geometry.Point>} points - 组成线性环的点。
  6472. * @example
  6473. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  6474. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  6475. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  6476. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  6477. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  6478. * var linearRing = new SuperMap.Geometry.LinearRing(points);
  6479. */
  6480. class LinearRing extends LineString {
  6481. constructor(points) {
  6482. super(points);
  6483. /**
  6484. * @member {Array.<string>} [SuperMap.Geometry.LinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  6485. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  6486. * @readonly
  6487. */
  6488. this.componentTypes = ["SuperMap.Geometry.Point"];
  6489. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  6490. this.geometryType = "LinearRing";
  6491. }
  6492. /**
  6493. * @function SuperMap.Geometry.LinearRing.prototype.addComponent
  6494. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  6495. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  6496. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  6497. * @param {SuperMap.Geometry.Point} point - 点对象。
  6498. * @param {integer} [index] - 插入组件数组的下标。
  6499. * @returns {boolean} 点对象是否添加成功。
  6500. */
  6501. addComponent(point, index) {
  6502. var added = false;
  6503. //remove last point
  6504. var lastPoint = this.components.pop();
  6505. // given an index, add the point
  6506. // without an index only add non-duplicate points
  6507. if (index != null || !point.equals(lastPoint)) {
  6508. added = super.addComponent.apply(this, arguments);
  6509. }
  6510. //append copy of first point
  6511. var firstPoint = this.components[0];
  6512. super.addComponent.apply(this, [firstPoint]);
  6513. return added;
  6514. }
  6515. /**
  6516. * @function SuperMap.Geometry.LinearRing.prototype.removeComponent
  6517. * @description 从几何组件中删除一个点。
  6518. * @param {SuperMap.Geometry.Point} point - 点对象。
  6519. * @returns {boolean} 点对象是否删除。
  6520. */
  6521. removeComponent(point) { // eslint-disable-line no-unused-vars
  6522. var removed = this.components && (this.components.length > 3);
  6523. if (removed) {
  6524. //remove last point
  6525. this.components.pop();
  6526. //remove our point
  6527. super.removeComponent.apply(this, arguments);
  6528. //append copy of first point
  6529. var firstPoint = this.components[0];
  6530. super.addComponent.apply(this, [firstPoint]);
  6531. }
  6532. return removed;
  6533. }
  6534. /**
  6535. * @function SuperMap.Geometry.LinearRing.prototype.getArea
  6536. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  6537. * @returns {float} 环的面积。
  6538. */
  6539. getArea() {
  6540. var area = 0.0;
  6541. if (this.components && (this.components.length > 2)) {
  6542. var sum = 0.0;
  6543. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  6544. var b = this.components[i];
  6545. var c = this.components[i + 1];
  6546. sum += (b.x + c.x) * (c.y - b.y);
  6547. }
  6548. area = -sum / 2.0;
  6549. }
  6550. return area;
  6551. }
  6552. /**
  6553. * @function SuperMap.Geometry.LinearRing.prototype.getVertices
  6554. * @description 返回几何图形的所有点的列表。
  6555. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  6556. * @returns {Array} 几何对象所有点的列表。
  6557. */
  6558. getVertices(nodes) {
  6559. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  6560. }
  6561. }
  6562. SuperMap.Geometry.LinearRing = LinearRing;
  6563. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  6564. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6565. * This program are made available under the terms of the Apache License, Version 2.0
  6566. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6567. /**
  6568. * @class SuperMap.Geometry.MultiLineString
  6569. * @classdesc 几何对象多线类。
  6570. * @category BaseTypes Geometry
  6571. * @extends {SuperMap.Geometry.Collection}
  6572. * @param {Array.<SuperMap.Geometry.LineString>} components - LineString 数组。
  6573. * @example
  6574. * var multi = new SuperMap.Geometry.MultiLineString([
  6575. * new SuperMap.Geometry.LineString([
  6576. * new SuperMap.Geometry.Point(1, 0),
  6577. * new SuperMap.Geometry.Point(0, 1)
  6578. * ])
  6579. * ]);
  6580. */
  6581. class MultiLineString extends Collection {
  6582. constructor(components) {
  6583. super(components);
  6584. /**
  6585. * @member {Array.<string>} [SuperMap.Geometry.MultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  6586. * @description components 存储的的几何对象所支持的几何类型数组。
  6587. * @readonly
  6588. */
  6589. this.componentTypes = ["SuperMap.Geometry.LineString"];
  6590. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  6591. this.geometryType = "MultiLineString";
  6592. }
  6593. }
  6594. SuperMap.Geometry.MultiLineString = MultiLineString;
  6595. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  6596. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6597. * This program are made available under the terms of the Apache License, Version 2.0
  6598. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6599. /**
  6600. * @class SuperMap.Geometry.MultiPolygon
  6601. * @classdesc 几何对象多多边形类。
  6602. * @category BaseTypes Geometry
  6603. * @extends {SuperMap.Geometry.Collection}
  6604. * @param {Array.<SuperMap.Geometry.Polygon>} components - 形成 MultiPolygon 的多边形数组。
  6605. * @example
  6606. * var points1 = [new SuperMap.Geometry.Point(10,10),new SuperMap.Geometry.Point(0,0)];
  6607. * 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)];
  6608. *
  6609. * var linearRing1 = new SuperMap.Geometry.LinearRing(points1);
  6610. * var linearRing2 = new SuperMap.Geometry.LinearRing(points2);
  6611. *
  6612. * var polygon1 = new SuperMap.Geometry.Polygon([linearRing1]);
  6613. * var polygon2 = new SuperMap.Geometry.Polygon([linearRing2]);
  6614. *
  6615. * var multiPolygon1 = new SuperMap.Geometry.MultiPolygon([polygon1,polygon2]);
  6616. */
  6617. class MultiPolygon extends Collection {
  6618. constructor(components) {
  6619. super(components);
  6620. /**
  6621. * @member {Array.<string>} [SuperMap.Geometry.MultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  6622. * @description components 存储的的几何对象所支持的几何类型数组。
  6623. * @readonly
  6624. */
  6625. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  6626. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  6627. this.geometryType = "MultiPolygon";
  6628. }
  6629. }
  6630. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  6631. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  6632. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6633. * This program are made available under the terms of the Apache License, Version 2.0
  6634. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6635. /**
  6636. * @class SuperMap.Geometry.Polygon
  6637. * @classdesc 多边形几何对象类。
  6638. * @category BaseTypes Geometry
  6639. * @extends {SuperMap.Geometry.Collection}
  6640. * @param {Array.<SuperMap.Geometry.LinearRing>} components - 用来生成多边形的线环数组。
  6641. * @example
  6642. * var points =[new SuperMap.Geometry.Point(0,4010338),
  6643. * new SuperMap.Geometry.Point(1063524,4010338),
  6644. * new SuperMap.Geometry.Point(1063524,3150322),
  6645. * new SuperMap.Geometry.Point(0,3150322)
  6646. * ],
  6647. * var linearRings = new SuperMap.Geometry.LinearRing(points),
  6648. * var region = new SuperMap.Geometry.Polygon([linearRings]);
  6649. */
  6650. class Polygon extends Collection {
  6651. constructor(components) {
  6652. super(components);
  6653. /**
  6654. * @member {Array.<string>} [SuperMap.Geometry.Polygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  6655. * @description components 存储的的几何对象所支持的几何类型数组。
  6656. * @readonly
  6657. */
  6658. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  6659. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  6660. this.geometryType = "Polygon";
  6661. }
  6662. /**
  6663. * @function SuperMap.Geometry.Polygon.prototype.getArea
  6664. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  6665. * @returns {float} 几何对象的面积。
  6666. */
  6667. getArea() {
  6668. var area = 0.0;
  6669. if (this.components && (this.components.length > 0)) {
  6670. area += Math.abs(this.components[0].getArea());
  6671. for (var i = 1, len = this.components.length; i < len; i++) {
  6672. area -= Math.abs(this.components[i].getArea());
  6673. }
  6674. }
  6675. return area;
  6676. }
  6677. }
  6678. SuperMap.Geometry.Polygon = Polygon;
  6679. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  6680. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6681. * This program are made available under the terms of the Apache License, Version 2.0
  6682. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6683. /**
  6684. * @class SuperMap.Geometry.Rectangle
  6685. * @classdesc 矩形几何对象类。
  6686. * @category BaseTypes Geometry
  6687. * @param {float} x - 矩形左下角点的横坐标。
  6688. * @param {float} y - 矩形左下角点的纵坐标。
  6689. * @param {float} width - 矩形的宽度。
  6690. * @param {float} height - 矩形的高度。
  6691. * @extends {SuperMap.Geometry}
  6692. * @example
  6693. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  6694. * var x = 1;
  6695. * var y = 2;
  6696. * var w = 10;
  6697. * var h = 20;
  6698. * var recttangle = new SuperMap.Geometry.Rectangle(x, y, w, h);
  6699. */
  6700. class Rectangle extends Geometry {
  6701. constructor(x, y, width, height) {
  6702. super(x, y, width, height);
  6703. /**
  6704. * @member {float} SuperMap.Geometry.Rectangle.prototype.x
  6705. * @description 矩形左下角点的横坐标。
  6706. */
  6707. this.x = x;
  6708. /**
  6709. * @member {float} SuperMap.Geometry.Rectangle.prototype.y
  6710. * @description 矩形左下角点的纵坐标。
  6711. */
  6712. this.y = y;
  6713. /**
  6714. * @member {float} SuperMap.Geometry.Rectangle.prototype.width
  6715. * @description 矩形的宽度。
  6716. */
  6717. this.width = width;
  6718. /**
  6719. * @member {float} SuperMap.Geometry.Rectangle.prototype.height
  6720. * @description 矩形的高度。
  6721. */
  6722. this.height = height;
  6723. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  6724. this.geometryType = "Rectangle";
  6725. }
  6726. /**
  6727. * @function SuperMap.Geometry.Rectangle.prototype.calculateBounds
  6728. * @description 计算出此矩形对象的 bounds。
  6729. */
  6730. calculateBounds() {
  6731. this.bounds = new Bounds(this.x, this.y,
  6732. this.x + this.width,
  6733. this.y + this.height);
  6734. }
  6735. /**
  6736. * @function SuperMap.Geometry.Rectangle.prototype.getArea
  6737. * @description 获取矩形对象的面积。
  6738. * @returns {float} 矩形对象面积。
  6739. */
  6740. getArea() {
  6741. var area = this.width * this.height;
  6742. return area;
  6743. }
  6744. }
  6745. SuperMap.Geometry.Rectangle = Rectangle;
  6746. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  6747. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6748. * This program are made available under the terms of the Apache License, Version 2.0
  6749. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6750. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  6751. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6752. * This program are made available under the terms of the Apache License, Version 2.0
  6753. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6754. /**
  6755. * @class SuperMap.Credential
  6756. * @category Security
  6757. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  6758. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  6759. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  6760. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  6761. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  6762. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  6763. * @example
  6764. * var pixcel = new SuperMap.Credential("valueString","token");
  6765. * pixcel.destroy();
  6766. */
  6767. class Credential {
  6768. constructor(value, name) {
  6769. /**
  6770. * @member {string} SuperMap.Bounds.prototype.value
  6771. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  6772. */
  6773. this.value = value ? value : "";
  6774. /**
  6775. * @member {string} [SuperMap.Bounds.prototype.name='token']
  6776. * @description 验证信息前缀,name=value 部分的 name 部分。
  6777. */
  6778. this.name = name ? name : "token";
  6779. this.CLASS_NAME = "SuperMap.Credential";
  6780. }
  6781. /**
  6782. * @function SuperMap.Credential.prototype.getUrlParameters
  6783. * @example
  6784. * var credential = new SuperMap.Credential("valueString","token");
  6785. * //这里 str = "token=valueString";
  6786. * var str = credential.getUrlParameters();
  6787. * @returns {string} 返回安全信息组成的 url 片段。
  6788. */
  6789. getUrlParameters() {
  6790. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  6791. return this.name + "=" + this.value;
  6792. }
  6793. /**
  6794. * @function SuperMap.Bounds.prototype.getValue
  6795. * @description 获取 value。
  6796. * @example
  6797. * var credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  6798. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  6799. * var str = credential.getValue();
  6800. * @returns {string} 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。
  6801. */
  6802. getValue() {
  6803. return this.value;
  6804. }
  6805. /**
  6806. *
  6807. * @function SuperMap.Credential.prototype.destroy
  6808. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  6809. * @example
  6810. * var credential = new SuperMap.Credential("valueString","token");
  6811. * credential.destroy();
  6812. */
  6813. destroy() {
  6814. this.value = null;
  6815. this.name = null;
  6816. }
  6817. }
  6818. /**
  6819. * @member {SuperMap.Credential} SuperMap.Credential.CREDENTIAL
  6820. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  6821. * @constant
  6822. * @example
  6823. * 代码实例:
  6824. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  6825. * var value = "(以iServer为例,这里是申请的token值)";
  6826. * var name = "token";
  6827. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  6828. * SuperMap.Credential.CREDENTIAL = new SuperMap.Credential(value, name);
  6829. *
  6830. */
  6831. Credential.CREDENTIAL = null;
  6832. SuperMap.Credential = Credential;
  6833. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  6834. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6835. * This program are made available under the terms of the Apache License, Version 2.0
  6836. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6837. /**
  6838. * @name Date
  6839. * @memberOf SuperMap
  6840. * @namespace
  6841. * @category BaseTypes Util
  6842. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  6843. */
  6844. var DateExt = SuperMap.Date = {
  6845. /**
  6846. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  6847. * @example
  6848. * var dateString = SuperMap.Date.toISOString(new Date());
  6849. * @param {Date} date - 日期对象。
  6850. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  6851. */
  6852. toISOString: (function () {
  6853. //标准的Date会存在toISOString方法,可以直接调用
  6854. if ("toISOString" in Date.prototype) {
  6855. return function (date) {
  6856. return date.toISOString();
  6857. };
  6858. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  6859. function pad(num, len) {
  6860. var str = num + "";
  6861. while (str.length < len) {
  6862. str = "0" + str;
  6863. }
  6864. return str;
  6865. }
  6866. return function (date) {
  6867. var str;
  6868. if (isNaN(date.getTime())) {
  6869. // ECMA-262 says throw RangeError, Firefox returns
  6870. // "Invalid Date"
  6871. str = "Invalid Date";
  6872. } else {
  6873. str =
  6874. date.getUTCFullYear() + "-" +
  6875. pad(date.getUTCMonth() + 1, 2) + "-" +
  6876. pad(date.getUTCDate(), 2) + "T" +
  6877. pad(date.getUTCHours(), 2) + ":" +
  6878. pad(date.getUTCMinutes(), 2) + ":" +
  6879. pad(date.getUTCSeconds(), 2) + "." +
  6880. pad(date.getUTCMilliseconds(), 3) + "Z";
  6881. }
  6882. return str;
  6883. };
  6884. }
  6885. })(),
  6886. /**
  6887. * @description 从一个字符串生成一个日期对象。
  6888. * @example
  6889. * var date = SuperMap.Date.parse("2010-08-07");
  6890. * @param {string} str - 代表日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  6891. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  6892. */
  6893. parse: function (str) {
  6894. var date;
  6895. 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)?$/);
  6896. if (match && (match[1] || match[7])) { // must have at least year or time
  6897. var year = parseInt(match[1], 10) || 0;
  6898. var month = (parseInt(match[2], 10) - 1) || 0;
  6899. var day = parseInt(match[3], 10) || 1;
  6900. date = new Date(Date.UTC(year, month, day));
  6901. // optional time
  6902. var type = match[7];
  6903. if (type) {
  6904. var hours = parseInt(match[4], 10);
  6905. var minutes = parseInt(match[5], 10);
  6906. var secFrac = parseFloat(match[6]);
  6907. var seconds = secFrac | 0;
  6908. var milliseconds = Math.round(1000 * (secFrac - seconds));
  6909. date.setUTCHours(hours, minutes, seconds, milliseconds);
  6910. // check offset
  6911. if (type !== "Z") {
  6912. var hoursOffset = parseInt(type, 10);
  6913. var minutesOffset = parseInt(match[8], 10) || 0;
  6914. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  6915. date = new Date(date.getTime() + offset);
  6916. }
  6917. }
  6918. } else {
  6919. date = new Date("invalid");
  6920. }
  6921. return date;
  6922. }
  6923. };
  6924. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  6925. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6926. * This program are made available under the terms of the Apache License, Version 2.0
  6927. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6928. /**
  6929. * @name Event
  6930. * @memberOf SuperMap
  6931. * @namespace
  6932. * @description 事件处理函数.
  6933. */
  6934. var Event = SuperMap.Event = {
  6935. /**
  6936. * @description A hash table cache of the event observers. Keyed by element._eventCacheID
  6937. * @type {boolean}
  6938. * @default false
  6939. */
  6940. observers: false,
  6941. /**
  6942. * @description KEY_SPACE
  6943. * @type {number}
  6944. * @default 32
  6945. */
  6946. KEY_SPACE: 32,
  6947. /**
  6948. * @description KEY_BACKSPACE
  6949. * @type {number}
  6950. * @default 8
  6951. */
  6952. KEY_BACKSPACE: 8,
  6953. /**
  6954. * @description KEY_TAB
  6955. * @type {number}
  6956. * @default 9
  6957. */
  6958. KEY_TAB: 9,
  6959. /**
  6960. * @description KEY_RETURN
  6961. * @type {number}
  6962. * @default 13
  6963. */
  6964. KEY_RETURN: 13,
  6965. /**
  6966. * @description KEY_ESC
  6967. * @type {number}
  6968. * @default 27
  6969. */
  6970. KEY_ESC: 27,
  6971. /**
  6972. * @description KEY_LEFT
  6973. * @type {number}
  6974. * @default 37
  6975. */
  6976. KEY_LEFT: 37,
  6977. /**
  6978. * @description KEY_UP
  6979. * @type {number}
  6980. * @default 38
  6981. */
  6982. KEY_UP: 38,
  6983. /**
  6984. * @description KEY_RIGHT
  6985. * @type {number}
  6986. * @default 39
  6987. */
  6988. KEY_RIGHT: 39,
  6989. /**
  6990. * @description KEY_DOWN
  6991. * @type {number}
  6992. * @default 40
  6993. */
  6994. KEY_DOWN: 40,
  6995. /**
  6996. * @description KEY_DELETE
  6997. * @type {number}
  6998. * @default 46
  6999. */
  7000. KEY_DELETE: 46,
  7001. /**
  7002. * @description Cross browser event element detection.
  7003. * @param {Event} event - The event
  7004. * @returns {HTMLElement} The element that caused the event
  7005. */
  7006. element: function (event) {
  7007. return event.target || event.srcElement;
  7008. },
  7009. /**
  7010. * @description Determine whether event was caused by a single touch
  7011. * @param {Event} event - The event
  7012. * @returns {boolean}
  7013. */
  7014. isSingleTouch: function (event) {
  7015. return event.touches && event.touches.length === 1;
  7016. },
  7017. /**
  7018. * @description Determine whether event was caused by a multi touch
  7019. * @param {Event} event - The event
  7020. * @returns {boolean}
  7021. */
  7022. isMultiTouch: function (event) {
  7023. return event.touches && event.touches.length > 1;
  7024. },
  7025. /**
  7026. * @description Determine whether event was caused by a left click.
  7027. * @param {Event} event - The event
  7028. * @returns {boolean}
  7029. */
  7030. isLeftClick: function (event) {
  7031. return (((event.which) && (event.which === 1)) ||
  7032. ((event.button) && (event.button === 1)));
  7033. },
  7034. /**
  7035. * @description Determine whether event was caused by a right mouse click.
  7036. * @param {Event} event - The event
  7037. * @returns {boolean}
  7038. */
  7039. isRightClick: function (event) {
  7040. return (((event.which) && (event.which === 3)) ||
  7041. ((event.button) && (event.button === 2)));
  7042. },
  7043. /**
  7044. * @description Stops an event from propagating.
  7045. * @param {Event} event - The event
  7046. * @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
  7047. */
  7048. stop: function (event, allowDefault) {
  7049. if (!allowDefault) {
  7050. if (event.preventDefault) {
  7051. event.preventDefault();
  7052. } else {
  7053. event.returnValue = false;
  7054. }
  7055. }
  7056. if (event.stopPropagation) {
  7057. event.stopPropagation();
  7058. } else {
  7059. event.cancelBubble = true;
  7060. }
  7061. },
  7062. /**
  7063. * @param {Event} event - The event。
  7064. * @param {string} tagName - html 标签名。
  7065. * @returns {HTMLElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
  7066. */
  7067. findElement: function (event, tagName) {
  7068. var element = SuperMap.Event.element(event);
  7069. while (element.parentNode && (!element.tagName ||
  7070. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  7071. element = element.parentNode;
  7072. }
  7073. return element;
  7074. },
  7075. /**
  7076. * @description 监听事件,注册事件处理方法。
  7077. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  7078. * @param {string} name - 监听事件的类别名称。
  7079. * @param {function} observer - 注册的事件处理方法。
  7080. * @param {boolean} [useCapture=false] - 是否捕获。
  7081. */
  7082. observe: function (elementParam, name, observer, useCapture) {
  7083. var element = Util.getElement(elementParam);
  7084. useCapture = useCapture || false;
  7085. if (name === 'keypress' &&
  7086. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  7087. || element.attachEvent)) {
  7088. name = 'keydown';
  7089. }
  7090. //if observers cache has not yet been created, create it
  7091. if (!this.observers) {
  7092. this.observers = {};
  7093. }
  7094. //if not already assigned, make a new unique cache ID
  7095. if (!element._eventCacheID) {
  7096. var idPrefix = "eventCacheID_";
  7097. if (element.id) {
  7098. idPrefix = element.id + "_" + idPrefix;
  7099. }
  7100. element._eventCacheID = Util.createUniqueID(idPrefix);
  7101. }
  7102. var cacheID = element._eventCacheID;
  7103. //if there is not yet a hash entry for this element, add one
  7104. if (!this.observers[cacheID]) {
  7105. this.observers[cacheID] = [];
  7106. }
  7107. //add a new observer to this element's list
  7108. this.observers[cacheID].push({
  7109. 'element': element,
  7110. 'name': name,
  7111. 'observer': observer,
  7112. 'useCapture': useCapture
  7113. });
  7114. //add the actual browser event listener
  7115. if (element.addEventListener) {
  7116. if(name === 'mousewheel'){
  7117. // https://www.chromestatus.com/features/6662647093133312
  7118. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  7119. } else {
  7120. element.addEventListener(name, observer, useCapture);
  7121. }
  7122. } else if (element.attachEvent) {
  7123. element.attachEvent('on' + name, observer);
  7124. }
  7125. },
  7126. /**
  7127. * @description Given the id of an element to stop observing, cycle through the
  7128. * element's cached observers, calling stopObserving on each one,
  7129. * skipping those entries which can no longer be removed.
  7130. *
  7131. * @param {(HTMLElement|string)} elementParam -
  7132. */
  7133. stopObservingElement: function (elementParam) {
  7134. var element = Util.getElement(elementParam);
  7135. var cacheID = element._eventCacheID;
  7136. this._removeElementObservers(SuperMap.Event.observers[cacheID]);
  7137. },
  7138. /**
  7139. * @param {Array.<Object>} elementObservers - Array of (element, name,
  7140. * observer, usecapture) objects,
  7141. * taken directly from hashtable
  7142. */
  7143. _removeElementObservers: function (elementObservers) {
  7144. if (elementObservers) {
  7145. for (var i = elementObservers.length - 1; i >= 0; i--) {
  7146. var entry = elementObservers[i];
  7147. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  7148. SuperMap.Event.stopObserving.apply(this, args);
  7149. }
  7150. }
  7151. },
  7152. /**
  7153. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
  7154. * 保持一致才能确保事件移除成功。
  7155. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  7156. * @param {string} name - 需要移除的被监听事件名称。
  7157. * @param {function} observer - 需要移除的事件处理方法。
  7158. * @param {boolean} [useCapture=false] - 是否捕获。
  7159. * @returns {boolean} Whether or not the event observer was removed
  7160. */
  7161. stopObserving: function (elementParam, name, observer, useCapture) {
  7162. useCapture = useCapture || false;
  7163. var element = Util.getElement(elementParam);
  7164. var cacheID = element._eventCacheID;
  7165. if (name === 'keypress') {
  7166. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  7167. element.detachEvent) {
  7168. name = 'keydown';
  7169. }
  7170. }
  7171. // find element's entry in this.observers cache and remove it
  7172. var foundEntry = false;
  7173. var elementObservers = SuperMap.Event.observers[cacheID];
  7174. if (elementObservers) {
  7175. // find the specific event type in the element's list
  7176. var i = 0;
  7177. while (!foundEntry && i < elementObservers.length) {
  7178. var cacheEntry = elementObservers[i];
  7179. if ((cacheEntry.name === name) &&
  7180. (cacheEntry.observer === observer) &&
  7181. (cacheEntry.useCapture === useCapture)) {
  7182. elementObservers.splice(i, 1);
  7183. if (elementObservers.length == 0) {
  7184. delete SuperMap.Event.observers[cacheID];
  7185. }
  7186. foundEntry = true;
  7187. break;
  7188. }
  7189. i++;
  7190. }
  7191. }
  7192. //actually remove the event listener from browser
  7193. if (foundEntry) {
  7194. if (element.removeEventListener) {
  7195. element.removeEventListener(name, observer, useCapture);
  7196. } else if (element && element.detachEvent) {
  7197. element.detachEvent('on' + name, observer);
  7198. }
  7199. }
  7200. return foundEntry;
  7201. },
  7202. /**
  7203. * @description Cycle through all the element entries in the events cache and call
  7204. * stopObservingElement on each.
  7205. */
  7206. unloadCache: function () {
  7207. // check for SuperMap.Event before checking for observers, because
  7208. // SuperMap.Event may be undefined in IE if no map instance was
  7209. // created
  7210. if (SuperMap.Event && SuperMap.Event.observers) {
  7211. for (var cacheID in SuperMap.Event.observers) {
  7212. var elementObservers = SuperMap.Event.observers[cacheID];
  7213. SuperMap.Event._removeElementObservers.apply(this,
  7214. [elementObservers]);
  7215. }
  7216. SuperMap.Event.observers = false;
  7217. }
  7218. },
  7219. CLASS_NAME: "SuperMap.Event"
  7220. };
  7221. SuperMap.Event = Event;
  7222. /* prevent memory leaks in IE */
  7223. SuperMap.Event.observe(window, 'unload', SuperMap.Event.unloadCache, false);
  7224. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  7225. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7226. * This program are made available under the terms of the Apache License, Version 2.0
  7227. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7228. /**
  7229. * @class SuperMap.Events
  7230. * @classdesc 事件类。
  7231. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  7232. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  7233. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  7234. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  7235. * @param {Object} options - 事件对象选项。
  7236. */
  7237. class Events {
  7238. constructor(object, element, eventTypes, fallThrough, options) {
  7239. /**
  7240. * @member {Array.<string>} SuperMap.Events.prototype.BROWSER_EVENTS
  7241. * @description 支持的事件。
  7242. * @constant
  7243. * @default [
  7244. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  7245. "click", "dblclick", "rightclick", "dblrightclick","resize",
  7246. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  7247. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  7248. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  7249. ]
  7250. */
  7251. this.BROWSER_EVENTS = [
  7252. "mouseover", "mouseout",
  7253. "mousedown", "mouseup", "mousemove",
  7254. "click", "dblclick", "rightclick", "dblrightclick",
  7255. "resize", "focus", "blur",
  7256. "touchstart", "touchmove", "touchend",
  7257. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  7258. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  7259. "contextmenu"
  7260. ];
  7261. /**
  7262. * @member {Object} SuperMap.Events.prototype.listeners
  7263. * @description Hashtable of Array(function): events listener functions
  7264. */
  7265. this.listeners = {};
  7266. /**
  7267. * @member {Object} SuperMap.Events.prototype.object
  7268. * @description 发布应用程序事件的对象。
  7269. */
  7270. this.object = object;
  7271. /**
  7272. * @member {HTMLElement} SuperMap.Events.prototype.element
  7273. * @description 接受浏览器事件的 DOM 节点。
  7274. */
  7275. this.element = null;
  7276. /**
  7277. * @member {Array.<string>} SuperMap.Events.prototype.eventTypes
  7278. * @description 支持的事件类型列表。
  7279. */
  7280. this.eventTypes = [];
  7281. /**
  7282. * @member {function} SuperMap.Events.prototype.eventHandler
  7283. * @description 绑定在元素上的事件处理器对象。
  7284. */
  7285. this.eventHandler = null;
  7286. /**
  7287. * @member {boolean} [SuperMap.Events.prototype.fallThrough=false]
  7288. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  7289. */
  7290. this.fallThrough = fallThrough;
  7291. /**
  7292. * @member {boolean} [SuperMap.Events.prototype.includeXY=false]
  7293. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
  7294. * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
  7295. * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
  7296. * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  7297. * @example
  7298. * function named(evt) {
  7299. * this.xy = this.object.events.getMousePosition(evt);
  7300. * }
  7301. */
  7302. this.includeXY = false;
  7303. /**
  7304. * @member {Object} SuperMap.Events.prototype.extensions
  7305. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  7306. * @example
  7307. * 以扩展 "foostart" 和 "fooend" 事件为例。展示替换 css 属性为 foo 的元素的 click 事件。
  7308. *
  7309. * SuperMap.Events.foostart = SuperMap.Class({
  7310. * initialize: function(target) {
  7311. * this.target = target;
  7312. * this.target.register("click", this, this.doStuff, {extension: true});
  7313. * // only required if extension provides more than one event type
  7314. * this.target.extensions["foostart"] = true;
  7315. * this.target.extensions["fooend"] = true;
  7316. * },
  7317. * destroy: function() {
  7318. * var target = this.target;
  7319. * target.unregister("click", this, this.doStuff);
  7320. * delete this.target;
  7321. * // only required if extension provides more than one event type
  7322. * delete target.extensions["foostart"];
  7323. * delete target.extensions["fooend"];
  7324. * },
  7325. * doStuff: function(evt) {
  7326. * var propagate = true;
  7327. * if (SuperMap.Event.element(evt).className === "foo") {
  7328. * propagate = false;
  7329. * var target = this.target;
  7330. * target.triggerEvent("foostart");
  7331. * window.setTimeout(function() {
  7332. * target.triggerEvent("fooend");
  7333. * }, 1000);
  7334. * }
  7335. * return propagate;
  7336. * }
  7337. * });
  7338. * // only required if extension provides more than one event type
  7339. * SuperMap.Events.fooend = SuperMap.Events.foostart;
  7340. */
  7341. this.extensions = {};
  7342. /**
  7343. * @member {Object} SuperMap.Events.prototype.extensionCount
  7344. */
  7345. this.extensionCount = {};
  7346. /**
  7347. * @member {Object} SuperMap.Events.prototype.clearMouseListener
  7348. */
  7349. this.clearMouseListener = null;
  7350. Util.extend(this, options);
  7351. if (eventTypes != null) {
  7352. for (var i = 0, len = eventTypes.length; i < len; i++) {
  7353. this.addEventType(eventTypes[i]);
  7354. }
  7355. }
  7356. if (element != null) {
  7357. this.attachToElement(element);
  7358. }
  7359. this.CLASS_NAME = "SuperMap.Events";
  7360. }
  7361. /**
  7362. * @function SuperMap.Events.prototype.destroy
  7363. * @description 移除当前要素 element 上的所有事件监听和处理。
  7364. */
  7365. destroy() {
  7366. for (var e in this.extensions) {
  7367. if (typeof this.extensions[e] !== "boolean") {
  7368. this.extensions[e].destroy();
  7369. }
  7370. }
  7371. this.extensions = null;
  7372. if (this.element) {
  7373. Event.stopObservingElement(this.element);
  7374. if (this.element.hasScrollEvent) {
  7375. Event.stopObserving(
  7376. window, "scroll", this.clearMouseListener
  7377. );
  7378. }
  7379. }
  7380. this.element = null;
  7381. this.listeners = null;
  7382. this.object = null;
  7383. this.eventTypes = null;
  7384. this.fallThrough = null;
  7385. this.eventHandler = null;
  7386. }
  7387. /**
  7388. * @function SuperMap.Events.prototype.addEventType
  7389. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  7390. * @param {string} eventName - 事件名。
  7391. */
  7392. addEventType(eventName) {
  7393. if (!this.listeners[eventName]) {
  7394. this.eventTypes.push(eventName);
  7395. this.listeners[eventName] = [];
  7396. }
  7397. }
  7398. /**
  7399. * @function SuperMap.Events.prototype.attachToElement
  7400. * @description 给 DOM 元素绑定浏览器事件。
  7401. * @param {HTMLDOMElement} element - 绑定浏览器事件的 DOM 元素。
  7402. */
  7403. attachToElement(element) {
  7404. if (this.element) {
  7405. Event.stopObservingElement(this.element);
  7406. } else {
  7407. // keep a bound copy of handleBrowserEvent() so that we can
  7408. // pass the same function to both Event.observe() and .stopObserving()
  7409. this.eventHandler = FunctionExt.bindAsEventListener(
  7410. this.handleBrowserEvent, this
  7411. );
  7412. // to be used with observe and stopObserving
  7413. this.clearMouseListener = FunctionExt.bind(
  7414. this.clearMouseCache, this
  7415. );
  7416. }
  7417. this.element = element;
  7418. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  7419. var eventType = this.BROWSER_EVENTS[i];
  7420. // every browser event has a corresponding application event
  7421. // (whether it's listened for or not).
  7422. this.addEventType(eventType);
  7423. // use Prototype to register the event cross-browser
  7424. Event.observe(element, eventType, this.eventHandler);
  7425. }
  7426. // disable dragstart in IE so that mousedown/move/up works normally
  7427. Event.observe(element, "dragstart", Event.stop);
  7428. }
  7429. /**
  7430. * @function SuperMap.Events.prototype.on
  7431. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  7432. * @example
  7433. * // 注册一个 "loadstart" 监听事件
  7434. * events.on({"loadstart": loadStartListener});
  7435. *
  7436. * // 同样注册一个 "loadstart" 监听事件
  7437. * events.register("loadstart", undefined, loadStartListener);
  7438. *
  7439. * // 同时为对象注册多个监听事件
  7440. * events.on({
  7441. * "loadstart": loadStartListener,
  7442. * "loadend": loadEndListener,
  7443. * scope: object
  7444. * });
  7445. *
  7446. * // 同时为对象注册多个监听事件,多次调用 register 方法
  7447. * events.register("loadstart", object, loadStartListener);
  7448. * events.register("loadend", object, loadEndListener);
  7449. *
  7450. *
  7451. * @param {Object} object - 添加监听的对象。
  7452. */
  7453. on(object) {
  7454. for (var type in object) {
  7455. if (type !== "scope" && object.hasOwnProperty(type)) {
  7456. this.register(type, object.scope, object[type]);
  7457. }
  7458. }
  7459. }
  7460. /**
  7461. * @function SuperMap.Events.prototype.register
  7462. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  7463. * 指定 SuperMap.Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  7464. * @param {string} type - 事件注册者的名字。
  7465. * @param {Object} [obj=this.object] - 对象绑定的回调。
  7466. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  7467. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  7468. */
  7469. register(type, obj, func, priority) {
  7470. if (type in Events && !this.extensions[type]) {
  7471. this.extensions[type] = new Events[type](this);
  7472. }
  7473. if ((func != null) &&
  7474. (Util.indexOf(this.eventTypes, type) !== -1)) {
  7475. if (obj == null) {
  7476. obj = this.object;
  7477. }
  7478. var listeners = this.listeners[type];
  7479. if (!listeners) {
  7480. listeners = [];
  7481. this.listeners[type] = listeners;
  7482. this.extensionCount[type] = 0;
  7483. }
  7484. var listener = {obj: obj, func: func};
  7485. if (priority) {
  7486. listeners.splice(this.extensionCount[type], 0, listener);
  7487. if (typeof priority === "object" && priority.extension) {
  7488. this.extensionCount[type]++;
  7489. }
  7490. } else {
  7491. listeners.push(listener);
  7492. }
  7493. }
  7494. }
  7495. /**
  7496. * @function SuperMap.Events.prototype.registerPriority
  7497. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  7498. * @param {string} type - 事件注册者的名字。
  7499. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  7500. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  7501. */
  7502. registerPriority(type, obj, func) {
  7503. this.register(type, obj, func, true);
  7504. }
  7505. /**
  7506. * @function SuperMap.Events.prototype.un
  7507. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  7508. * @example
  7509. * // 移除 "loadstart" 事件监听
  7510. * events.un({"loadstart": loadStartListener});
  7511. *
  7512. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  7513. * events.unregister("loadstart", undefined, loadStartListener);
  7514. *
  7515. * // 取消对象多个事件监听
  7516. * events.un({
  7517. * "loadstart": loadStartListener,
  7518. * "loadend": loadEndListener,
  7519. * scope: object
  7520. * });
  7521. *
  7522. * // 取消对象多个事件监听,多次调用unregister方法。
  7523. * events.unregister("loadstart", object, loadStartListener);
  7524. * events.unregister("loadend", object, loadEndListener);
  7525. *
  7526. * @param {Object} object - 移除监听的对象。
  7527. */
  7528. un(object) {
  7529. for (var type in object) {
  7530. if (type !== "scope" && object.hasOwnProperty(type)) {
  7531. this.unregister(type, object.scope, object[type]);
  7532. }
  7533. }
  7534. }
  7535. /**
  7536. * @function SuperMap.Events.prototype.unregister
  7537. * @description 取消注册。
  7538. * @param {string} type - 事件类型。
  7539. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  7540. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  7541. */
  7542. unregister(type, obj, func) {
  7543. if (obj == null) {
  7544. obj = this.object;
  7545. }
  7546. var listeners = this.listeners[type];
  7547. if (listeners != null) {
  7548. for (var i = 0, len = listeners.length; i < len; i++) {
  7549. if (listeners[i].obj === obj && listeners[i].func === func) {
  7550. listeners.splice(i, 1);
  7551. break;
  7552. }
  7553. }
  7554. }
  7555. }
  7556. /**
  7557. * @function SuperMap.Events.prototype.remove
  7558. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  7559. * @param {string} type - 事件类型。
  7560. */
  7561. remove(type) {
  7562. if (this.listeners[type] != null) {
  7563. this.listeners[type] = [];
  7564. }
  7565. }
  7566. /**
  7567. * @function SuperMap.Events.prototype.triggerEvent
  7568. * @description 触发一个特定的注册事件。
  7569. * @param {string} type - 触发事件类型。
  7570. * @param {Event} evt - 事件对象。
  7571. * @returns {boolean} 返回监听对象,如果返回是 false,则停止监听。
  7572. */
  7573. triggerEvent(type, evt) {
  7574. var listeners = this.listeners[type];
  7575. // fast path
  7576. if (!listeners || listeners.length == 0) {
  7577. return undefined;
  7578. }
  7579. // prep evt object with object & div references
  7580. if (evt == null) {
  7581. evt = {};
  7582. }
  7583. evt.object = this.object;
  7584. evt.element = this.element;
  7585. if (!evt.type) {
  7586. evt.type = type;
  7587. }
  7588. // execute all callbacks registered for specified type
  7589. // get a clone of the listeners array to
  7590. // allow for splicing during callbacks
  7591. listeners = listeners.slice();
  7592. var continueChain;
  7593. for (var i = 0, len = listeners.length; i < len; i++) {
  7594. var callback = listeners[i];
  7595. // bind the context to callback.obj
  7596. continueChain = callback.func.apply(callback.obj, [evt]);
  7597. if ((continueChain != undefined) && (continueChain === false)) {
  7598. // if callback returns false, execute no more callbacks.
  7599. break;
  7600. }
  7601. }
  7602. // don't fall through to other DOM elements
  7603. if (!this.fallThrough) {
  7604. Event.stop(evt, true);
  7605. }
  7606. return continueChain;
  7607. }
  7608. /**
  7609. * @function SuperMap.Events.prototype.handleBrowserEvent
  7610. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  7611. * @param {Event} evt - 事件对象。
  7612. */
  7613. handleBrowserEvent(evt) {
  7614. var type = evt.type, listeners = this.listeners[type];
  7615. if (!listeners || listeners.length == 0) {
  7616. // noone's listening, bail out
  7617. return;
  7618. }
  7619. // add clientX & clientY to all events - corresponds to average x, y
  7620. var touches = evt.touches;
  7621. if (touches && touches[0]) {
  7622. var x = 0;
  7623. var y = 0;
  7624. var num = touches.length;
  7625. var touch;
  7626. for (var i = 0; i < num; ++i) {
  7627. touch = touches[i];
  7628. x += touch.clientX;
  7629. y += touch.clientY;
  7630. }
  7631. evt.clientX = x / num;
  7632. evt.clientY = y / num;
  7633. }
  7634. if (this.includeXY) {
  7635. evt.xy = this.getMousePosition(evt);
  7636. }
  7637. this.triggerEvent(type, evt);
  7638. }
  7639. /**
  7640. * @function SuperMap.Events.prototype.clearMouseCache
  7641. * @description 清除鼠标缓存。
  7642. */
  7643. clearMouseCache() {
  7644. this.element.scrolls = null;
  7645. this.element.lefttop = null;
  7646. var body = document.body;
  7647. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  7648. navigator.userAgent.match(/iPhone/i))) {
  7649. this.element.offsets = null;
  7650. }
  7651. }
  7652. /**
  7653. * @function SuperMap.Events.prototype.getMousePosition
  7654. * @param {Event} evt - 事件对象。
  7655. * @returns {SuperMap.Pixel} 当前的鼠标的 xy 坐标点。
  7656. */
  7657. getMousePosition(evt) {
  7658. if (!this.includeXY) {
  7659. this.clearMouseCache();
  7660. } else if (!this.element.hasScrollEvent) {
  7661. Event.observe(window, "scroll", this.clearMouseListener);
  7662. this.element.hasScrollEvent = true;
  7663. }
  7664. if (!this.element.scrolls) {
  7665. var viewportElement = Util.getViewportElement();
  7666. this.element.scrolls = [
  7667. viewportElement.scrollLeft,
  7668. viewportElement.scrollTop
  7669. ];
  7670. }
  7671. if (!this.element.lefttop) {
  7672. this.element.lefttop = [
  7673. (document.documentElement.clientLeft || 0),
  7674. (document.documentElement.clientTop || 0)
  7675. ];
  7676. }
  7677. if (!this.element.offsets) {
  7678. this.element.offsets = Util.pagePosition(this.element);
  7679. }
  7680. return new Pixel(
  7681. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  7682. - this.element.lefttop[0],
  7683. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  7684. - this.element.lefttop[1]
  7685. );
  7686. }
  7687. }
  7688. SuperMap.Events = Events;
  7689. SuperMap.Events.prototype.BROWSER_EVENTS = [
  7690. "mouseover", "mouseout",
  7691. "mousedown", "mouseup", "mousemove",
  7692. "click", "dblclick", "rightclick", "dblrightclick",
  7693. "resize", "focus", "blur",
  7694. "touchstart", "touchmove", "touchend",
  7695. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  7696. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  7697. "contextmenu"
  7698. ];
  7699. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  7700. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7701. * This program are made available under the terms of the Apache License, Version 2.0
  7702. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7703. /**
  7704. * @class SuperMap.Feature
  7705. * @category BaseTypes Geometry
  7706. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  7707. * @param {SuperMap.Layer} layer - 图层。
  7708. * @param {SuperMap.LonLat} lonlat - 经纬度。
  7709. * @param {Object} data - 数据对象。
  7710. */
  7711. class Feature {
  7712. constructor(layer, lonlat, data) {
  7713. this.CLASS_NAME = "SuperMap.Feature";
  7714. /**
  7715. * @deprecated
  7716. * @member {SuperMap.Layer} SuperMap.Feature.prototype.layer
  7717. * @description 图层。
  7718. */
  7719. this.layer = layer;
  7720. /**
  7721. * @member {string} SuperMap.Feature.prototype.id
  7722. * @description 要素 ID。
  7723. */
  7724. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  7725. /**
  7726. * @member {SuperMap.LonLat} SuperMap.Feature.prototype.lonlat
  7727. * @description 经纬度。
  7728. *
  7729. */
  7730. this.lonlat = lonlat;
  7731. /**
  7732. * @member {Object} SuperMap.Feature.prototype.data
  7733. * @description 数据对象。
  7734. */
  7735. this.data = (data != null) ? data : {};
  7736. }
  7737. /**
  7738. * @function SuperMap.Feature.prototype.destroy
  7739. * @description 释放相关资源。
  7740. */
  7741. destroy() {
  7742. this.id = null;
  7743. this.lonlat = null;
  7744. this.data = null;
  7745. }
  7746. }
  7747. SuperMap.Feature = Feature;
  7748. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  7749. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7750. * This program are made available under the terms of the Apache License, Version 2.0
  7751. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7752. /**
  7753. * @class SuperMap.Feature.Vector
  7754. * @category BaseTypes Geometry
  7755. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  7756. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  7757. * 其中,默认的样式在 {@link SuperMap.Feature.Vector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  7758. * @extends {SuperMap.Feature}
  7759. * @param {SuperMap.Geometry} geometry - 代表要素的几何形状。
  7760. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  7761. * @param {Object} [style] - 样式对象。
  7762. * @example
  7763. * var geometry = new SuperMap.Geometry.Point(-115,10);
  7764. * var style = {
  7765. * strokeColor:"#339933",
  7766. * strokeOpacity:1,
  7767. * strokeWidth:3,
  7768. * pointRadius:6
  7769. * }
  7770. * var pointFeature = new SuperMap.Feature.Vector(geometry,null,style);
  7771. * vectorLayer.addFeatures(pointFeature);
  7772. */
  7773. class Vector extends Feature {
  7774. constructor(geometry, attributes, style) {
  7775. super(null, null, attributes);
  7776. /**
  7777. * @member {string} SuperMap.Feature.Vector.prototype.fid
  7778. * @description fid
  7779. */
  7780. this.fid = null;
  7781. /**
  7782. * @member {SuperMap.Geometry} SuperMap.Feature.Vector.prototype.geometry
  7783. * @description 该属性用于存放几何信息。
  7784. */
  7785. this.geometry = geometry ? geometry : null;
  7786. /**
  7787. * @member {Object} SuperMap.Feature.Vector.prototype.attributes
  7788. * @description 描述要素的任意的可序列化属性。
  7789. */
  7790. this.attributes = {};
  7791. if (attributes) {
  7792. this.attributes = Util.extend(this.attributes, attributes);
  7793. }
  7794. /**
  7795. * @member {SuperMap.Bounds} SuperMap.Feature.Vector.prototype.bounds
  7796. * @description The box bounding that feature's geometry, that
  7797. * property can be set by an <SuperMap.Format> object when
  7798. * deserializing the feature, so in most cases it represents an
  7799. * information set by the server.
  7800. */
  7801. this.bounds = null;
  7802. /**
  7803. * @member {string} SuperMap.Feature.Vector.prototype.state
  7804. * @description state
  7805. */
  7806. this.state = null;
  7807. /**
  7808. * @member {Object} SuperMap.Feature.Vector.prototype.style
  7809. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  7810. */
  7811. this.style = style ? style : null;
  7812. /**
  7813. * @member {string} SuperMap.Feature.Vector.prototype.url
  7814. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link SuperMap.HTTP} 。
  7815. */
  7816. this.url = null;
  7817. this.lonlat = null;
  7818. this.CLASS_NAME = "SuperMap.Feature.Vector";
  7819. // TRASH THIS
  7820. SuperMap.State = {
  7821. /** states */
  7822. UNKNOWN: 'Unknown',
  7823. INSERT: 'Insert',
  7824. UPDATE: 'Update',
  7825. DELETE: 'Delete'
  7826. };
  7827. Vector.style = {
  7828. 'default': {
  7829. fillColor: "#ee9900",
  7830. fillOpacity: 0.4,
  7831. hoverFillColor: "white",
  7832. hoverFillOpacity: 0.8,
  7833. strokeColor: "#ee9900",
  7834. strokeOpacity: 1,
  7835. strokeWidth: 1,
  7836. strokeLinecap: "round",
  7837. strokeDashstyle: "solid",
  7838. hoverStrokeColor: "red",
  7839. hoverStrokeOpacity: 1,
  7840. hoverStrokeWidth: 0.2,
  7841. pointRadius: 6,
  7842. hoverPointRadius: 1,
  7843. hoverPointUnit: "%",
  7844. pointerEvents: "visiblePainted",
  7845. cursor: "inherit",
  7846. fontColor: "#000000",
  7847. labelAlign: "cm",
  7848. labelOutlineColor: "white",
  7849. labelOutlineWidth: 3
  7850. },
  7851. 'select': {
  7852. fillColor: "blue",
  7853. fillOpacity: 0.4,
  7854. hoverFillColor: "white",
  7855. hoverFillOpacity: 0.8,
  7856. strokeColor: "blue",
  7857. strokeOpacity: 1,
  7858. strokeWidth: 2,
  7859. strokeLinecap: "round",
  7860. strokeDashstyle: "solid",
  7861. hoverStrokeColor: "red",
  7862. hoverStrokeOpacity: 1,
  7863. hoverStrokeWidth: 0.2,
  7864. pointRadius: 6,
  7865. hoverPointRadius: 1,
  7866. hoverPointUnit: "%",
  7867. pointerEvents: "visiblePainted",
  7868. cursor: "pointer",
  7869. fontColor: "#000000",
  7870. labelAlign: "cm",
  7871. labelOutlineColor: "white",
  7872. labelOutlineWidth: 3
  7873. },
  7874. 'temporary': {
  7875. fillColor: "#66cccc",
  7876. fillOpacity: 0.2,
  7877. hoverFillColor: "white",
  7878. hoverFillOpacity: 0.8,
  7879. strokeColor: "#66cccc",
  7880. strokeOpacity: 1,
  7881. strokeLinecap: "round",
  7882. strokeWidth: 2,
  7883. strokeDashstyle: "solid",
  7884. hoverStrokeColor: "red",
  7885. hoverStrokeOpacity: 1,
  7886. hoverStrokeWidth: 0.2,
  7887. pointRadius: 6,
  7888. hoverPointRadius: 1,
  7889. hoverPointUnit: "%",
  7890. pointerEvents: "visiblePainted",
  7891. //cursor:"inherit",
  7892. cursor: "default",
  7893. fontColor: "#000000",
  7894. labelAlign: "cm",
  7895. labelOutlineColor: "white",
  7896. labelOutlineWidth: 3
  7897. },
  7898. 'delete': {
  7899. display: "none"
  7900. }
  7901. };
  7902. }
  7903. /**
  7904. * @function SuperMap.Feature.Vector.prototype.destroy
  7905. * @description nullify references to prevent circular references and memory leaks
  7906. */
  7907. destroy() {
  7908. if (this.layer) {
  7909. this.layer.removeFeatures(this);
  7910. this.layer = null;
  7911. }
  7912. this.geometry = null;
  7913. super.destroy();
  7914. }
  7915. /**
  7916. * @function SuperMap.Feature.Vector.prototype.clone
  7917. * @description Create a clone of this vector feature. Does not set any non-standard
  7918. * properties.
  7919. * @returns {SuperMap.Feature.Vector} An exact clone of this vector feature.
  7920. */
  7921. clone() {
  7922. return new Vector(
  7923. this.geometry ? this.geometry.clone() : null,
  7924. this.attributes,
  7925. this.style);
  7926. }
  7927. /**
  7928. * @function SuperMap.Feature.Vector.prototype.toState
  7929. * @description 设置新状态。
  7930. * @param {string} state - 状态。
  7931. */
  7932. toState(state) {
  7933. if (state === SuperMap.State.UPDATE) {
  7934. switch (this.state) {
  7935. case SuperMap.State.UNKNOWN:
  7936. case SuperMap.State.DELETE:
  7937. this.state = state;
  7938. break;
  7939. case SuperMap.State.UPDATE:
  7940. case SuperMap.State.INSERT:
  7941. break;
  7942. }
  7943. } else if (state === SuperMap.State.INSERT) {
  7944. switch (this.state) {
  7945. case SuperMap.State.UNKNOWN:
  7946. break;
  7947. default:
  7948. this.state = state;
  7949. break;
  7950. }
  7951. } else if (state === SuperMap.State.DELETE) {
  7952. switch (this.state) {
  7953. case SuperMap.State.INSERT:
  7954. // the feature should be destroyed
  7955. break;
  7956. case SuperMap.State.DELETE:
  7957. break;
  7958. case SuperMap.State.UNKNOWN:
  7959. case SuperMap.State.UPDATE:
  7960. this.state = state;
  7961. break;
  7962. }
  7963. } else if (state === SuperMap.State.UNKNOWN) {
  7964. this.state = state;
  7965. }
  7966. }
  7967. }
  7968. /**
  7969. *
  7970. * @typedef {Object} SuperMap.Feature.Vector.style
  7971. * @description SuperMap.features 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  7972. * 大部分样式通过 SVG 标准定义属性。
  7973. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  7974. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  7975. * @property {boolean} [fill] - 不需要填充则设置为 false。
  7976. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  7977. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  7978. * @property {boolean} [stroke] - 不需要描边则设为 false。
  7979. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  7980. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  7981. * @property {number} [strokeWidth=1] - 像素描边宽度。
  7982. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  7983. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  7984. * @property {boolean} [graphic] - 不需要则设置为 false。
  7985. * @property {number} [pointRadius=6] - 像素点半径。
  7986. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  7987. * @property {string} [cursor] - cursor。
  7988. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  7989. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  7990. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  7991. * @property {number} [graphicHeight] - 外部图表的高宽度。
  7992. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  7993. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  7994. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量 Pixel。
  7995. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  7996. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  7997. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  7998. * @property {string} [graphicTitle] - 外部图表的提示框。
  7999. * @property {string} [backgroundGraphic] - 外部图表的背景。
  8000. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  8001. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  8002. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  8003. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  8004. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  8005. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  8006. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  8007. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  8008. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  8009. * @property {string} [label] - 可选的标签文本。
  8010. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  8011. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  8012. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  8013. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  8014. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  8015. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  8016. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  8017. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  8018. * @property {string} [fontFamily] - 标签的字体类型。
  8019. * @property {string} [fontSize] - 标签的字体大小。
  8020. * @property {string} [fontStyle] - 标签的字体样式。
  8021. * @property {string} [fontWeight] - 标签的字体粗细。
  8022. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  8023. * @example
  8024. * // label的用法如下:
  8025. * function addGeoTest(){
  8026. * var geometry = new SuperMap.Geometry.Point(105, 35);
  8027. * var pointFeature = new SuperMap.Feature.Vector(geometry);
  8028. * var styleTest = {
  8029. * label:"supermap",
  8030. * fontColor:"#0000ff",
  8031. * fontOpacity:"0.5",
  8032. * fontFamily:"隶书",
  8033. * fontSize:"8em",
  8034. * fontWeight:"bold",
  8035. * fontStyle:"italic",
  8036. * labelSelect:"true",
  8037. * }
  8038. * pointFeature.style = styleTest;
  8039. * vectorLayer.addFeatures([pointFeature]);
  8040. * }
  8041. */
  8042. SuperMap.Feature.Vector = Vector;
  8043. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  8044. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8045. * This program are made available under the terms of the Apache License, Version 2.0
  8046. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8047. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  8048. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8049. * This program are made available under the terms of the Apache License, Version 2.0
  8050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8051. /**
  8052. * @class SuperMap.Format
  8053. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  8054. * @category BaseTypes Format
  8055. * @param {Object} options - 可选参数。
  8056. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  8057. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  8058. */
  8059. class Format {
  8060. constructor(options) {
  8061. /**
  8062. * @member {Object} SuperMap.Format.prototype.data
  8063. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  8064. */
  8065. this.data = null;
  8066. /**
  8067. * APIProperty: keepData
  8068. * @member {Object} [SuperMap.Format.prototype.keepData=false]
  8069. * @description 保持最近读到的数据的引用(通过 <data> 属性)。
  8070. */
  8071. this.keepData = false;
  8072. Util.extend(this, options);
  8073. this.options = options;
  8074. this.CLASS_NAME = "SuperMap.Format";
  8075. }
  8076. /**
  8077. * @function SuperMap.Format.prototype.destroy
  8078. * @description 销毁该格式类,释放相关资源。
  8079. */
  8080. destroy() {
  8081. //用来销毁该格式类,释放相关资源
  8082. }
  8083. /**
  8084. * @function SuperMap.Format.prototype.read
  8085. * @description 来从字符串中读取数据。
  8086. * @param {string} data - 读取的数据。
  8087. */
  8088. read(data) { // eslint-disable-line no-unused-vars
  8089. //用来从字符串中读取数据
  8090. }
  8091. /**
  8092. * @function SuperMap.Format.prototype.write
  8093. * @description 将对象写成字符串。
  8094. * @param {Object} object - 可序列化的对象。
  8095. * @returns {string} 对象被写成字符串。
  8096. */
  8097. write(object) { // eslint-disable-line no-unused-vars
  8098. //用来写字符串
  8099. }
  8100. }
  8101. SuperMap.Format = SuperMap.Format || Format;
  8102. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  8103. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8104. * This program are made available under the terms of the Apache License, Version 2.0
  8105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8106. /**
  8107. * @class SuperMap.Format.JSON
  8108. * @classdesc 安全的读写 JSON 的解析类。使用 {@link SuperMap.Format.JSON} 构造函数创建新实例。
  8109. * @category BaseTypes Format
  8110. * @param {Object} [options] - 参数。
  8111. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  8112. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  8113. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  8114. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  8115. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8116. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  8117. * @extends {SuperMap.Format}
  8118. */
  8119. class JSONFormat extends Format {
  8120. constructor(options) {
  8121. super(options);
  8122. /**
  8123. * @member {string} [SuperMap.Format.JSON.prototype.indent=" "]
  8124. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  8125. */
  8126. this.indent = " ";
  8127. /**
  8128. * @member {string} [SuperMap.Format.JSON.prototype.space=" "]
  8129. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  8130. */
  8131. this.space = " ";
  8132. /**
  8133. * @member {string} [SuperMap.Format.JSON.prototype.newline="\n"]
  8134. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  8135. */
  8136. this.newline = "\n";
  8137. /**
  8138. * @member {integer} [SuperMap.Format.JSON.prototype.level=0]
  8139. * @description 用于格式化输出, 表示的是缩进级别。
  8140. */
  8141. this.level = 0;
  8142. /**
  8143. * @member {boolean} [SuperMap.Format.JSON.prototype.pretty=false]
  8144. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8145. */
  8146. this.pretty = false;
  8147. /**
  8148. * @member {boolean} SuperMap.Format.JSON.prototype.nativeJSON
  8149. * @description 判断浏览器是否原生支持 JSON 格式数据。
  8150. */
  8151. this.nativeJSON = (function () {
  8152. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  8153. })();
  8154. this.CLASS_NAME = "SuperMap.Format.JSON";
  8155. /**
  8156. * @member SuperMap.Format.JSON.prototype.serialize
  8157. * @description 提供一些类型对象转 JSON 字符串的方法。
  8158. */
  8159. this.serialize = {
  8160. /**
  8161. * @function SuperMap.Format.JSON.serialize.object
  8162. * @description 把对象转换为 JSON 字符串。
  8163. * @param {Object} object - 可序列化的对象。
  8164. * @returns {string} JSON 字符串。
  8165. */
  8166. 'object': function (object) {
  8167. // three special objects that we want to treat differently
  8168. if (object == null) {
  8169. return "null";
  8170. }
  8171. if (object.constructor === Date) {
  8172. return this.serialize.date.apply(this, [object]);
  8173. }
  8174. if (object.constructor === Array) {
  8175. return this.serialize.array.apply(this, [object]);
  8176. }
  8177. var pieces = ['{'];
  8178. this.level += 1;
  8179. var key, keyJSON, valueJSON;
  8180. var addComma = false;
  8181. for (key in object) {
  8182. if (object.hasOwnProperty(key)) {
  8183. // recursive calls need to allow for sub-classing
  8184. keyJSON = this.write.apply(this,
  8185. [key, this.pretty]);
  8186. valueJSON = this.write.apply(this,
  8187. [object[key], this.pretty]);
  8188. if (keyJSON != null && valueJSON != null) {
  8189. if (addComma) {
  8190. pieces.push(',');
  8191. }
  8192. pieces.push(this.writeNewline(), this.writeIndent(),
  8193. keyJSON, ':', this.writeSpace(), valueJSON);
  8194. addComma = true;
  8195. }
  8196. }
  8197. }
  8198. this.level -= 1;
  8199. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  8200. return pieces.join('');
  8201. },
  8202. /**
  8203. * @function SuperMap.Format.JSON.serialize.array
  8204. * @description 把数组转换成 JSON 字符串。
  8205. * @param {Array} array - 可序列化的数组。
  8206. * @returns {string} JSON 字符串。
  8207. */
  8208. 'array': function (array) {
  8209. var json;
  8210. var pieces = ['['];
  8211. this.level += 1;
  8212. for (var i = 0, len = array.length; i < len; ++i) {
  8213. // recursive calls need to allow for sub-classing
  8214. json = this.write.apply(this,
  8215. [array[i], this.pretty]);
  8216. if (json != null) {
  8217. if (i > 0) {
  8218. pieces.push(',');
  8219. }
  8220. pieces.push(this.writeNewline(), this.writeIndent(), json);
  8221. }
  8222. }
  8223. this.level -= 1;
  8224. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  8225. return pieces.join('');
  8226. },
  8227. /**
  8228. * @function SuperMap.Format.JSON.serialize.string
  8229. * @description 把字符串转换成 JSON 字符串。
  8230. * @param {string} string - 可序列化的字符串。
  8231. * @returns {string} JSON 字符串。
  8232. */
  8233. 'string': function (string) {
  8234. // If the string contains no control characters, no quote characters, and no
  8235. // backslash characters, then we can simply slap some quotes around it.
  8236. // Otherwise we must also replace the offending characters with safe
  8237. // sequences.
  8238. var m = {
  8239. '\b': '\\b',
  8240. '\t': '\\t',
  8241. '\n': '\\n',
  8242. '\f': '\\f',
  8243. '\r': '\\r',
  8244. '"': '\\"',
  8245. '\\': '\\\\'
  8246. };
  8247. /*eslint-disable no-control-regex*/
  8248. if (/["\\\x00-\x1f]/.test(string)) {
  8249. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  8250. var c = m[b];
  8251. if (c) {
  8252. return c;
  8253. }
  8254. c = b.charCodeAt();
  8255. return '\\u00' +
  8256. Math.floor(c / 16).toString(16) +
  8257. (c % 16).toString(16);
  8258. }) + '"';
  8259. }
  8260. return '"' + string + '"';
  8261. },
  8262. /**
  8263. * @function SuperMap.Format.JSON.serialize.number
  8264. * @description 把数字转换成 JSON 字符串。
  8265. * @param {number} number - 可序列化的数字。
  8266. * @returns {string} JSON 字符串。
  8267. */
  8268. 'number': function (number) {
  8269. return isFinite(number) ? String(number) : "null";
  8270. },
  8271. /**
  8272. * @function SuperMap.Format.JSON.serialize.boolean
  8273. * @description Transform a boolean into a JSON string.
  8274. * @param {boolean} bool - The boolean to be serialized.
  8275. * @returns {string} A JSON string representing the boolean.
  8276. */
  8277. 'boolean': function (bool) {
  8278. return String(bool);
  8279. },
  8280. /**
  8281. * @function SuperMap.Format.JSON.serialize.object
  8282. * @description 将日期对象转换成 JSON 字符串。
  8283. * @param {Date} date - 可序列化的日期对象。
  8284. * @returns {string} JSON 字符串。
  8285. */
  8286. 'date': function (date) {
  8287. function format(number) {
  8288. // Format integers to have at least two digits.
  8289. return (number < 10) ? '0' + number : number;
  8290. }
  8291. return '"' + date.getFullYear() + '-' +
  8292. format(date.getMonth() + 1) + '-' +
  8293. format(date.getDate()) + 'T' +
  8294. format(date.getHours()) + ':' +
  8295. format(date.getMinutes()) + ':' +
  8296. format(date.getSeconds()) + '"';
  8297. }
  8298. };
  8299. }
  8300. /**
  8301. * @function SuperMap.Format.JSON.prototype.read
  8302. * @description 将一个符合 JSON 结构的字符串进行解析。
  8303. * @param {string} json - 符合 JSON 结构的字符串。
  8304. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  8305. * @returns {Object} 对象,数组,字符串或数字。
  8306. */
  8307. read(json, filter) {
  8308. var object;
  8309. if (this.nativeJSON) {
  8310. try {
  8311. object = JSON.parse(json, filter);
  8312. } catch (e) {
  8313. // Fall through if the regexp test fails.
  8314. }
  8315. }
  8316. if (this.keepData) {
  8317. this.data = object;
  8318. }
  8319. return object;
  8320. }
  8321. /**
  8322. * @function SuperMap.Format.JSON.prototype.write
  8323. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  8324. * @param {(object|string|Array|number|boolean)} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  8325. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8326. * @returns {string} 符合 JSON 格式的字符串。
  8327. *
  8328. */
  8329. write(value, pretty) {
  8330. this.pretty = !!pretty;
  8331. var json = null;
  8332. var type = typeof value;
  8333. if (this.serialize[type]) {
  8334. try {
  8335. json = (!this.pretty && this.nativeJSON) ?
  8336. JSON.stringify(value) :
  8337. this.serialize[type].apply(this, [value]);
  8338. } catch (err) {
  8339. //SuperMap.Console.error("Trouble serializing: " + err);
  8340. }
  8341. }
  8342. return json;
  8343. }
  8344. /**
  8345. * @function SuperMap.Format.JSON.prototype.writeIndent
  8346. * @description 根据缩进级别输出一个缩进字符串。
  8347. * @private
  8348. * @returns {string} 一个适当的缩进字符串。
  8349. */
  8350. writeIndent() {
  8351. var pieces = [];
  8352. if (this.pretty) {
  8353. for (var i = 0; i < this.level; ++i) {
  8354. pieces.push(this.indent);
  8355. }
  8356. }
  8357. return pieces.join('');
  8358. }
  8359. /**
  8360. * @function SuperMap.Format.JSON.prototype.writeNewline
  8361. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  8362. * @private
  8363. * @returns {string} 代表新的一行的字符串。
  8364. */
  8365. writeNewline() {
  8366. return (this.pretty) ? this.newline : '';
  8367. }
  8368. /**
  8369. * @function SuperMap.Format.JSON.prototype.writeSpace
  8370. * @private
  8371. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  8372. * @returns {string} 一个空格。
  8373. */
  8374. writeSpace() {
  8375. return (this.pretty) ? this.space : '';
  8376. }
  8377. }
  8378. SuperMap.Format.JSON = JSONFormat;
  8379. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  8380. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8381. * This program are made available under the terms of the Apache License, Version 2.0
  8382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8383. /**
  8384. * @class SuperMap.ServerColor
  8385. * @category iServer Map Theme
  8386. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  8387. * @param {Object} options - 参数。
  8388. * @param {number} [options.red=255] - 获取或设置红色值。
  8389. * @param {number} [options.green=0] - 获取或设置绿色值。
  8390. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  8391. */
  8392. class ServerColor {
  8393. constructor(red, green, blue) {
  8394. /**
  8395. * @member {number} [SuperMap.ServerColor.prototype.red=255]
  8396. * @description 获取或设置红色值。
  8397. */
  8398. this.red = (!red && red != 0)?255:red;
  8399. /**
  8400. * @member {number} [SuperMap.ServerColor.prototype.green=0]
  8401. * @description 获取或设置绿色值。
  8402. */
  8403. this.green = green||0;
  8404. /**
  8405. * @member {number} [SuperMap.ServerColor.prototype.blue=0]
  8406. * @description 获取或设置蓝色值。
  8407. */
  8408. this.blue = blue||0;
  8409. this.CLASS_NAME = "SuperMap.ServerColor";
  8410. }
  8411. /**
  8412. * @function SuperMap.ServerColor.prototype.destroy
  8413. * @description 释放资源,将引用资源的属性置空。
  8414. */
  8415. destroy() {
  8416. var me = this;
  8417. me.red = null;
  8418. me.green = null;
  8419. me.blue = null;
  8420. }
  8421. /**
  8422. * @function SuperMap.ServerColor.formJson
  8423. * @description 将 JSON 对象转化为 ServerColor 对象。
  8424. * @param {Object} jsonObject - 要转换的 JSON 对象。
  8425. * @returns {SuperMap.ServerColor} 转化后的 ServerColor 对象。
  8426. */
  8427. static fromJson(jsonObject) {
  8428. if (!jsonObject) {
  8429. return;
  8430. }
  8431. var color = new ServerColor();
  8432. var red = 255;
  8433. if (jsonObject.red !== null) {
  8434. red = Number(jsonObject.red);
  8435. }
  8436. color.red = red;
  8437. var green = 0;
  8438. if (jsonObject.green !== null) {
  8439. green = Number(jsonObject.green);
  8440. }
  8441. color.green = green;
  8442. var blue = 0;
  8443. if (jsonObject.blue !== null) {
  8444. blue = Number(jsonObject.blue);
  8445. }
  8446. color.blue = blue;
  8447. return color;
  8448. }
  8449. }
  8450. SuperMap.ServerColor = ServerColor;
  8451. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  8452. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8453. * This program are made available under the terms of the Apache License, Version 2.0
  8454. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8455. /**
  8456. * @class SuperMap.ServerStyle
  8457. * @category iServer Map Theme
  8458. * @classdesc 服务端矢量要素风格类。
  8459. * @description 该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  8460. * @param {Object} options - 参数。
  8461. * @param {SuperMap.FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  8462. * @param {SuperMap.ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  8463. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  8464. * @param {SuperMap.ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  8465. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  8466. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  8467. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  8468. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  8469. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  8470. * @param {SuperMap.ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  8471. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  8472. * @param {number} [options.lineWidth=1] - 边线的宽度。
  8473. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  8474. * @param {number} [options.markerSize=1] - 点状符号的大小。
  8475. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  8476. */
  8477. class ServerStyle {
  8478. constructor(options) {
  8479. /**
  8480. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillBackColor
  8481. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  8482. */
  8483. this.fillBackColor = new ServerColor(255, 255, 255);
  8484. /**
  8485. * @member {boolean} [SuperMap.ServerStyle.prototype.fillBackOpaque=false]
  8486. * @description 背景是否不透明。false 表示透明。
  8487. */
  8488. this.fillBackOpaque = false;
  8489. /**
  8490. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillForeColor
  8491. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  8492. */
  8493. this.fillForeColor = new ServerColor(255, 0, 0);
  8494. /**
  8495. * @member {SuperMap.FillGradientMode} SuperMap.ServerStyle.prototype.fillGradientMode
  8496. * @description 渐变填充风格的渐变类型。
  8497. */
  8498. this.fillGradientMode = null;
  8499. /**
  8500. * @member {number} SuperMap.ServerStyle.prototype.fillGradientAngle -
  8501. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  8502. */
  8503. this.fillGradientAngle = 0;
  8504. /**
  8505. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioX
  8506. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  8507. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  8508. */
  8509. this.fillGradientOffsetRatioX = 0;
  8510. /**
  8511. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioY
  8512. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  8513. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  8514. */
  8515. this.fillGradientOffsetRatioY = 0;
  8516. /**
  8517. * @member {number} [SuperMap.ServerStyle.prototype.fillOpaqueRate=100]
  8518. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  8519. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  8520. */
  8521. this.fillOpaqueRate = 100;
  8522. /**
  8523. * @member {number} SuperMap.ServerStyle.prototype.fillSymbolID
  8524. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  8525. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  8526. */
  8527. this.fillSymbolID = 0;
  8528. /**
  8529. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.lineColor
  8530. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  8531. */
  8532. this.lineColor = new ServerColor(0, 0, 0);
  8533. /**
  8534. * @member {number} [SuperMap.ServerStyle.prototype.lineSymbolID=0]
  8535. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  8536. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  8537. */
  8538. this.lineSymbolID = 0;
  8539. /**
  8540. * @member {number} [SuperMap.ServerStyle.prototype.lineWidth=1.0]
  8541. * @description 边线的宽度。单位为毫米,精度到 0.1。
  8542. */
  8543. this.lineWidth = 1;
  8544. /**
  8545. * @member {number} [SuperMap.ServerStyle.prototype.markerAngle=0]
  8546. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  8547. */
  8548. this.markerAngle = 0;
  8549. /**
  8550. * @member {number} [SuperMap.ServerStyle.prototype.markerSize=1.0]
  8551. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  8552. * 当该属性设置为非法值时,交由服务器默认处理。
  8553. */
  8554. this.markerSize = 1;
  8555. /**
  8556. * @member {number} [SuperMap.ServerStyle.prototype.markerSymbolID=-1]
  8557. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  8558. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  8559. */
  8560. this.markerSymbolID = -1;
  8561. if (options) {
  8562. Util.extend(this, options);
  8563. }
  8564. this.CLASS_NAME = "SuperMap.ServerStyle";
  8565. }
  8566. /**
  8567. * @function SuperMap.ServerStyle.prototype.destroy
  8568. * @description 释放资源,将引用资源的属性置空。
  8569. */
  8570. destroy() {
  8571. var me = this;
  8572. if (me.fillBackColor) {
  8573. me.fillBackColor.destroy();
  8574. me.fillBackColor = null;
  8575. }
  8576. me.fillBackOpaque = null;
  8577. if (me.fillForeColor) {
  8578. me.fillForeColor.destroy();
  8579. me.fillForeColor = null;
  8580. }
  8581. me.fillGradientMode = null;
  8582. me.fillGradientAngle = null;
  8583. me.fillGradientOffsetRatioX = null;
  8584. me.fillGradientOffsetRatioY = null;
  8585. me.fillOpaqueRate = null;
  8586. me.fillSymbolID = null;
  8587. if (me.lineColor) {
  8588. me.lineColor.destroy();
  8589. me.lineColor = null;
  8590. }
  8591. me.lineSymbolID = null;
  8592. me.lineWidth = null;
  8593. me.markerAngle = null;
  8594. me.markerSize = null;
  8595. me.markerSymbolID = null;
  8596. }
  8597. /**
  8598. * @function SuperMap.ServerStyle.prototype.toServerJSONObject
  8599. * @description 转换成对应的 JSON 格式对象。
  8600. * @returns {Object} 对应的 JSON 格式对象.
  8601. */
  8602. toServerJSONObject() {
  8603. var styleObj = {};
  8604. styleObj = Util.copyAttributes(styleObj, this);
  8605. //暂时先忽略serverColor往Json的转换
  8606. return styleObj;
  8607. }
  8608. /**
  8609. * @function SuperMap.ServerStyle.fromJson
  8610. * @description 将JSON对象转换为 SuperMap.ServerStyle 对象。
  8611. * @param jsonObject - {Object} 要转换的 JSON 对象。
  8612. * @returns {SuperMap.ServerStyle} 转化后的 SuperMap.ServerStyle 对象。
  8613. */
  8614. static fromJson(jsonObject) {
  8615. if (!jsonObject) {
  8616. return;
  8617. }
  8618. return new ServerStyle({
  8619. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  8620. fillBackOpaque: jsonObject.fillBackOpaque,
  8621. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  8622. fillGradientMode: jsonObject.fillGradientMode,
  8623. fillGradientAngle: jsonObject.fillGradientAngle,
  8624. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  8625. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  8626. fillOpaqueRate: jsonObject.fillOpaqueRate,
  8627. fillSymbolID: jsonObject.fillSymbolID,
  8628. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  8629. lineSymbolID: jsonObject.lineSymbolID,
  8630. lineWidth: jsonObject.lineWidth,
  8631. markerAngle: jsonObject.markerAngle,
  8632. markerSize: jsonObject.markerSize,
  8633. markerSymbolID: jsonObject.markerSymbolID
  8634. });
  8635. }
  8636. }
  8637. SuperMap.ServerStyle = ServerStyle;
  8638. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  8639. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8640. * This program are made available under the terms of the Apache License, Version 2.0
  8641. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8642. /**
  8643. * @class SuperMap.PointWithMeasure
  8644. * @category iServer SpatialAnalyst
  8645. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  8646. * @param {Object} options - 参数。
  8647. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  8648. * @param {number} options.x - 获取当前点对象在地理坐标系下的 X 坐标值。
  8649. * @param {number} options.y - 获取当前点对象在地理坐标系下的 Y 坐标值。
  8650. * @extends {SuperMap.Geometry.Point}
  8651. */
  8652. class PointWithMeasure extends Point {
  8653. constructor(options) {
  8654. super(options);
  8655. /**
  8656. * @member {number} SuperMap.PointWithMeasure.prototype.measure
  8657. * @description 度量值,即路由对象属性值 M。
  8658. */
  8659. this.measure = null;
  8660. if (options) {
  8661. Util.extend(this, options);
  8662. }
  8663. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  8664. }
  8665. /**
  8666. * @function SuperMap.PointWithMeasure.prototype.equals
  8667. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  8668. * @param {SuperMap.PointWithMeasure} geom - 需要判断的路由点对象。
  8669. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  8670. */
  8671. equals(geom) {
  8672. var equals = false;
  8673. if (geom != null) {
  8674. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  8675. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  8676. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  8677. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  8678. }
  8679. return equals;
  8680. }
  8681. /**
  8682. * @function SuperMap.PointWithMeasure.prototype.toJson
  8683. * @description 转换为 JSON 对象。
  8684. * */
  8685. toJson() {
  8686. var result = "{";
  8687. if (this.measure != null && this.measure != undefined) {
  8688. result += "\"measure\":" + this.measure + ",";
  8689. }
  8690. result += "\"x\":" + this.x + ",";
  8691. result += "\"y\":" + this.y;
  8692. result += "}";
  8693. return result;
  8694. }
  8695. /**
  8696. * @function SuperMap.PointWithMeasure.prototype.destroy
  8697. * @description 释放资源,将引用资源的属性置空。
  8698. */
  8699. destroy() {
  8700. var me = this;
  8701. me.measure = null;
  8702. me.x = null;
  8703. me.y = null;
  8704. }
  8705. /**
  8706. * @function SuperMap.PointWithMeasure.fromJson
  8707. * @description 将 JSON 对象转换为{@link SuperMap.PointWithMeasure} 对象。
  8708. * @param {Object} jsonObject - JSON 对象表示的路由点。
  8709. * @returns {SuperMap.PointWithMeasure} 转化后的 PointWithMeasure 对象。
  8710. */
  8711. static fromJson(jsonObject) {
  8712. if (!jsonObject) {
  8713. return;
  8714. }
  8715. return new PointWithMeasure({
  8716. x: jsonObject.x,
  8717. y: jsonObject.y,
  8718. measure: jsonObject.measure
  8719. });
  8720. }
  8721. }
  8722. SuperMap.PointWithMeasure = PointWithMeasure;
  8723. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  8724. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8725. * This program are made available under the terms of the Apache License, Version 2.0
  8726. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8727. /**
  8728. * @class SuperMap.Route
  8729. * @category iServer SpatialAnalyst
  8730. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  8731. * @param {Array.<SuperMap.Geometry>} points - 形成路由对象的线数组。
  8732. * @param {Object} options - 参数。
  8733. * @param {number} options.id - 路由对象在数据库中的 id。
  8734. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  8735. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  8736. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  8737. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  8738. * @extends {SuperMap.Geometry.Collection}
  8739. */
  8740. class Route extends Collection {
  8741. constructor(points, options) {
  8742. super(points, options);
  8743. /**
  8744. * @member {number} SuperMap.Route.prototype.id
  8745. * @description 路由对象在数据库中的 ID。
  8746. */
  8747. this.id = null;
  8748. /**
  8749. * @member {number} SuperMap.Route.prototype.center
  8750. * @description 路由对象的中心点。
  8751. */
  8752. this.center = null;
  8753. /**
  8754. * @member {string} SuperMap.Route.prototype.style
  8755. * @description 路由对象的样式。
  8756. */
  8757. this.style = null;
  8758. /**
  8759. * @member {number} SuperMap.Route.prototype.length
  8760. * @description 路由对象的长度。单位与数据集的单位相同。
  8761. */
  8762. this.length = null;
  8763. /**
  8764. * @member {number} SuperMap.Route.prototype.maxM
  8765. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  8766. */
  8767. this.maxM = null;
  8768. /**
  8769. * @member {number} SuperMap.Route.prototype.minM
  8770. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  8771. */
  8772. this.minM = null;
  8773. /**
  8774. * @member {Array.<number>} SuperMap.Route.prototype.parts
  8775. * @description 服务端几何对象中各个子对象所包含的节点个数。
  8776. */
  8777. this.parts = null;
  8778. /**
  8779. * @member {Array.<Object>} SuperMap.Route.prototype.points
  8780. * @description 路由对象的所有路由点。
  8781. * @example
  8782. * (start code)
  8783. * [
  8784. * {
  8785. * "measure": 0,
  8786. * "y": -4377.027184298267,
  8787. * "x": 4020.0045221720466
  8788. * },
  8789. * {
  8790. * "measure": 37.33288381391519,
  8791. * "y": -4381.569363260499,
  8792. * "x": 4057.0600591960642
  8793. * }
  8794. * ]
  8795. * (end)
  8796. */
  8797. this.points = null;
  8798. /**
  8799. * @member {string} SuperMap.Route.prototype.type
  8800. * @description 服务端几何对象类型。
  8801. */
  8802. this.type = null;
  8803. /**
  8804. * @member {Array.<string>} [SuperMap.Route.prototype.componentTypes=SuperMap.Geometry.LineString]
  8805. * @description components 存储的的几何对象所支持的几何类型数组。
  8806. */
  8807. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  8808. if (options) {
  8809. Util.extend(this, options);
  8810. }
  8811. this.CLASS_NAME = "SuperMap.Route";
  8812. this.geometryType = "LINEM";
  8813. }
  8814. /**
  8815. *
  8816. * @function SuperMap.Route.prototype.toJson
  8817. * @description 转换为 JSON 对象。
  8818. * @returns {Object} JSON 对象。
  8819. */
  8820. toJson() {
  8821. var result = "{";
  8822. if (this.id != null && this.id != undefined) {
  8823. result += "\"id\":" + this.id + ",";
  8824. }
  8825. if (this.center != null && this.center != undefined) {
  8826. result += "\"center\":" + this.center + ",";
  8827. }
  8828. if (this.style != null && this.style != undefined) {
  8829. result += "\"style\":" + this.style + ",";
  8830. }
  8831. if (this.length != null && this.length != undefined) {
  8832. result += "\"length\":" + this.length + ",";
  8833. }
  8834. if (this.maxM != null && this.maxM != undefined) {
  8835. result += "\"maxM\":" + this.maxM + ",";
  8836. }
  8837. if (this.minM != null && this.minM != undefined) {
  8838. result += "\"minM\":" + this.minM + ",";
  8839. }
  8840. if (this.type != null && this.type != undefined) {
  8841. result += "\"type\":\"" + this.type + "\",";
  8842. }
  8843. if (this.parts != null && this.parts != undefined) {
  8844. result += "\"parts\":[" + this.parts[0];
  8845. for (var i = 1; i < this.parts.length; i++) {
  8846. result += "," + this.parts[i];
  8847. }
  8848. result += "],";
  8849. }
  8850. if (this.components != null && this.components.length > 0) {
  8851. result += "\"points\":[";
  8852. for (var j = 0, len = this.components.length; j < len; j++) {
  8853. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  8854. result += this.components[j].components[k].toJson() + ",";
  8855. }
  8856. }
  8857. result = result.replace(/,$/g, '');
  8858. result += "]";
  8859. }
  8860. result = result.replace(/,$/g, '');
  8861. result += "}";
  8862. return result;
  8863. }
  8864. /**
  8865. * @function SuperMap.Route.prototype.destroy
  8866. * @override
  8867. */
  8868. destroy() {
  8869. var me = this;
  8870. me.id = null;
  8871. me.center = null;
  8872. me.style = null;
  8873. me.length = null;
  8874. me.maxM = null;
  8875. me.minM = null;
  8876. me.type = null;
  8877. me.parts = null;
  8878. me.components.length = 0;
  8879. me.components = null;
  8880. me.componentTypes = null;
  8881. }
  8882. /**
  8883. * @function SuperMap.Route.fromJson
  8884. * @description 将 JSON 对象转换为 SuperMap.Route 对象。
  8885. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  8886. * @returns {SuperMap.Route} 转化后的 Route 对象。
  8887. */
  8888. static fromJson(jsonObject) {
  8889. if (!jsonObject) {
  8890. return;
  8891. }
  8892. var geoParts = jsonObject.parts || [],
  8893. geoPoints = jsonObject.points || [],
  8894. len = geoParts.length,
  8895. lineList = [];
  8896. if (len > 0) {
  8897. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  8898. for (var j = 0; j < geoParts[i]; j++) {
  8899. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  8900. }
  8901. pointIndex += geoParts[i];
  8902. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  8903. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  8904. lineList.push(new LinearRing(pointList));
  8905. } else {
  8906. lineList.push(new LineString(pointList));
  8907. }
  8908. pointList = [];
  8909. }
  8910. } else {
  8911. return null;
  8912. }
  8913. return new Route(lineList, {
  8914. id: jsonObject.id,
  8915. center: jsonObject.center,
  8916. style: jsonObject.style,
  8917. length: jsonObject.length,
  8918. maxM: jsonObject.maxM,
  8919. minM: jsonObject.minM,
  8920. type: jsonObject.type,
  8921. parts: jsonObject.parts
  8922. });
  8923. }
  8924. }
  8925. SuperMap.Route = Route;
  8926. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  8927. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8928. * This program are made available under the terms of the Apache License, Version 2.0
  8929. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8930. /**
  8931. * @class SuperMap.ServerGeometry
  8932. * @category iServer
  8933. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  8934. * @param {Object} options - 参数。
  8935. * @param {string} options.id - 服务端几何对象唯一标识符。
  8936. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  8937. * @param {Array.<SuperMap.Geometry.Point>} options.points - 组成几何对象的节点的坐标对数组。
  8938. * @param {SuperMap.GeometryType} options.type - 几何对象的类型。
  8939. * @param {SuperMap.ServerStyle} [options.style] - 服务端几何对象的风格。
  8940. */
  8941. class ServerGeometry {
  8942. constructor(options) {
  8943. /**
  8944. * @member {string} SuperMap.ServerGeometry.prototype.id
  8945. * @description 服务端几何对象唯一标识符。
  8946. */
  8947. this.id = 0;
  8948. /**
  8949. * @member {SuperMap.ServerStyle} [SuperMap.ServerGeometry.prototype.style]
  8950. * @description 服务端几何对象的风格(ServerStyle)。
  8951. */
  8952. this.style = null;
  8953. /**
  8954. * @member {Array.<number>} SuperMap.ServerGeometry.prototype.parts
  8955. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  8956. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  8957. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  8958. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  8959. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  8960. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  8961. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  8962. * 该字段的值就是这个简单对象节点的个数。
  8963. * 如果一个几何对象是由几个简单对象组合而成的,
  8964. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  8965. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  8966. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  8967. */
  8968. this.parts = null;
  8969. /**
  8970. * @member {Array.<SuperMap.Geometry.Point>} SuperMap.ServerGeometry.prototype.points
  8971. * @description 组成几何对象的节点的坐标对数组。<br>
  8972. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  8973. * 该字段存放了组成几何对象的点坐标的数组。
  8974. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  8975. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  8976. * 从而确定 Points 字段中坐标对的分配归属问题。
  8977. */
  8978. this.points = null;
  8979. /**
  8980. * @member {SuperMap.GeometryType} SuperMap.ServerGeometry.prototype.type
  8981. * @description 几何对象的类型(GeometryType)。
  8982. */
  8983. this.type = null;
  8984. /**
  8985. * @member {Object} SuperMap.ServerGeometry.prototype.prjCoordSys
  8986. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  8987. */
  8988. this.prjCoordSys = null;
  8989. if (options) {
  8990. Util.extend(this, options);
  8991. }
  8992. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  8993. }
  8994. /**
  8995. * @function SuperMap.ServerGeometry.prototype.destroy
  8996. * @description 释放资源,将引用资源的属性置空。
  8997. */
  8998. destroy() {
  8999. var me = this;
  9000. me.id = null;
  9001. me.style = null;
  9002. me.parts = null;
  9003. me.partTopo = null;
  9004. me.points = null;
  9005. me.type = null;
  9006. me.prjCoordSys = null;
  9007. }
  9008. /**
  9009. * @function SuperMap.ServerGeometry.prototype.toGeometry
  9010. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  9011. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9012. */
  9013. toGeometry() {
  9014. var me = this,
  9015. geoType = me.type;
  9016. switch (geoType.toUpperCase()) {
  9017. case GeometryType.POINT:
  9018. return me.toGeoPoint();
  9019. case GeometryType.LINE:
  9020. return me.toGeoLine();
  9021. case GeometryType.LINEM:
  9022. return me.toGeoLinem();
  9023. case GeometryType.REGION:
  9024. return me.toGeoRegion();
  9025. case GeometryType.POINTEPS:
  9026. return me.toGeoPoint();
  9027. case GeometryType.LINEEPS:
  9028. return me.toGeoLineEPS();
  9029. case GeometryType.REGIONEPS:
  9030. return me.toGeoRegionEPS();
  9031. case GeometryType.GEOCOMPOUND:
  9032. return me.transformGeoCompound();
  9033. }
  9034. }
  9035. /**
  9036. * @function SuperMap.ServerGeometry.prototype.toGeoPoint
  9037. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  9038. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9039. */
  9040. toGeoPoint() {
  9041. var me = this,
  9042. geoParts = me.parts || [],
  9043. geoPoints = me.points || [],
  9044. len = geoParts.length;
  9045. if (len > 0) {
  9046. if (len === 1) {
  9047. return new Point(geoPoints[0].x, geoPoints[0].y);
  9048. } else {
  9049. var pointList = [];
  9050. for (let i = 0; i < len; i++) {
  9051. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  9052. }
  9053. return new MultiPoint(pointList);
  9054. }
  9055. } else {
  9056. return null;
  9057. }
  9058. }
  9059. /**
  9060. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  9061. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  9062. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9063. */
  9064. toGeoLine() {
  9065. var me = this,
  9066. geoParts = me.parts || [],
  9067. geoPoints = me.points || [],
  9068. len = geoParts.length;
  9069. if (len > 0) {
  9070. if (len === 1) {
  9071. let pointList = [];
  9072. for (let i = 0; i < geoParts[0]; i++) {
  9073. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  9074. }
  9075. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  9076. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  9077. return new LinearRing(pointList);
  9078. } else {
  9079. return new LineString(pointList);
  9080. }
  9081. } else {
  9082. let lineList = [];
  9083. for (let i = 0; i < len; i++) {
  9084. let pointList = [];
  9085. for (let j = 0; j < geoParts[i]; j++) {
  9086. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  9087. }
  9088. lineList.push(new LineString(pointList));
  9089. geoPoints.splice(0, geoParts[i]);
  9090. }
  9091. return new MultiLineString(lineList);
  9092. }
  9093. } else {
  9094. return null;
  9095. }
  9096. }
  9097. /**
  9098. * @function SuperMap.ServerGeometry.prototype.toGeoLineEPS
  9099. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  9100. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9101. */
  9102. toGeoLineEPS() {
  9103. var me = this,
  9104. geoParts = me.parts || [],
  9105. geoPoints = me.points || [],
  9106. i,
  9107. j,
  9108. pointList,
  9109. lineList,
  9110. lineEPS,
  9111. len = geoParts.length;
  9112. if (len > 0) {
  9113. if (len === 1) {
  9114. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  9115. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  9116. }
  9117. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  9118. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  9119. lineEPS = LineString.createLineEPS(pointList);
  9120. return new LinearRing(lineEPS);
  9121. } else {
  9122. lineEPS = LineString.createLineEPS(pointList);
  9123. return new LineString(lineEPS);
  9124. }
  9125. } else {
  9126. for (i = 0, lineList = []; i < len; i++) {
  9127. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  9128. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  9129. }
  9130. lineEPS = LineString.createLineEPS(pointList);
  9131. lineList.push(new LineString(lineEPS));
  9132. geoPoints.splice(0, geoParts[i]);
  9133. }
  9134. return new MultiLineString(lineList);
  9135. }
  9136. } else {
  9137. return null;
  9138. }
  9139. }
  9140. /**
  9141. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  9142. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  9143. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9144. */
  9145. toGeoLinem() {
  9146. var me = this;
  9147. return Route.fromJson(me);
  9148. }
  9149. /**
  9150. * @function SuperMap.ServerGeometry.prototype.toGeoRegion
  9151. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  9152. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9153. */
  9154. toGeoRegion() {
  9155. var me = this,
  9156. geoParts = me.parts || [],
  9157. geoTopo = me.partTopo || [],
  9158. geoPoints = me.points || [],
  9159. len = geoParts.length;
  9160. if (len <= 0) {
  9161. return null;
  9162. }
  9163. var polygonArray = [];
  9164. var pointList = [];
  9165. if (len == 1) {
  9166. for (let i = 0; i < geoPoints.length; i++) {
  9167. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  9168. }
  9169. polygonArray.push(new Polygon([new LinearRing(pointList)]));
  9170. return new MultiPolygon(polygonArray);
  9171. }
  9172. //处理复杂面
  9173. var CCWArray = [];
  9174. var areaArray = [];
  9175. var polygonArrayTemp = [];
  9176. var polygonBounds = [];
  9177. //polyon岛洞标识数组,初始都是岛。
  9178. var CCWIdent = [];
  9179. for (let i = 0, pointIndex = 0; i < len; i++) {
  9180. for (let j = 0; j < geoParts[i]; j++) {
  9181. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  9182. }
  9183. pointIndex += geoParts[i];
  9184. var polygon = new Polygon([new LinearRing(pointList)]);
  9185. pointList = [];
  9186. polygonArrayTemp.push(polygon);
  9187. if (geoTopo.length === 0) {
  9188. polygonBounds.push(polygon.getBounds());
  9189. }
  9190. CCWIdent.push(1);
  9191. areaArray.push(polygon.getArea());
  9192. }
  9193. //根据面积排序
  9194. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  9195. //iServer 9D新增字段
  9196. if (geoTopo.length === 0) {
  9197. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  9198. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  9199. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  9200. //目标polygon索引列表 -1标示没有被任何polygon包含,
  9201. var targetArray = [];
  9202. for (let i = 1; i < polygonArrayTemp.length; i++) {
  9203. for (let j = i - 1; j >= 0; j--) {
  9204. targetArray[i] = -1;
  9205. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  9206. CCWIdent[i] = CCWIdent[j] * -1;
  9207. if (CCWIdent[i] < 0) {
  9208. targetArray[i] = j;
  9209. }
  9210. break;
  9211. }
  9212. }
  9213. }
  9214. for (let i = 0; i < polygonArrayTemp.length; i++) {
  9215. if (CCWIdent[i] > 0) {
  9216. polygonArray.push(polygonArrayTemp[i]);
  9217. } else {
  9218. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  9219. polygonArrayTemp[i].components
  9220. );
  9221. //占位
  9222. polygonArray.push('');
  9223. }
  9224. }
  9225. } else {
  9226. //根据面积排序
  9227. //ServerGeometry.bubbleSort(areaArray, polygonArrayTemp,geoTopo);
  9228. polygonArray = new Array();
  9229. for (let i = 0; i < polygonArrayTemp.length; i++) {
  9230. if (geoTopo[i] && geoTopo[i] == -1) {
  9231. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  9232. } else {
  9233. if (CCWArray.length > 0 && polygonArray.length > 0) {
  9234. polygonArray[polygonArray.length - 1].components = polygonArray[
  9235. polygonArray.length - 1
  9236. ].components.concat(CCWArray);
  9237. CCWArray = [];
  9238. }
  9239. polygonArray.push(polygonArrayTemp[i]);
  9240. }
  9241. if (i == len - 1) {
  9242. var polyLength = polygonArray.length;
  9243. if (polyLength) {
  9244. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  9245. CCWArray
  9246. );
  9247. } else {
  9248. for (let k = 0, length = CCWArray.length; k < length; k++) {
  9249. polygonArray.push(new Polygon(CCWArray));
  9250. }
  9251. }
  9252. }
  9253. }
  9254. }
  9255. return new MultiPolygon(polygonArray);
  9256. }
  9257. /**
  9258. * @function SuperMap.ServerGeometry.prototype.toGeoRegionEPS
  9259. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  9260. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  9261. */
  9262. toGeoRegionEPS() {
  9263. var me = this,
  9264. geoParts = me.parts || [],
  9265. geoTopo = me.partTopo || [],
  9266. geoPoints = me.points || [],
  9267. len = geoParts.length;
  9268. if (len <= 0) {
  9269. return null;
  9270. }
  9271. var polygonArray = [];
  9272. var pointList = [];
  9273. var lineEPS;
  9274. if (len == 1) {
  9275. for (var i = 0; i < geoPoints.length; i++) {
  9276. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  9277. }
  9278. lineEPS = LineString.createLineEPS(pointList);
  9279. polygonArray.push(new Polygon([new LinearRing(lineEPS)]));
  9280. return new MultiPolygon(polygonArray);
  9281. }
  9282. //处理复杂面
  9283. var CCWArray = [];
  9284. var areaArray = [];
  9285. var polygonArrayTemp = [];
  9286. var polygonBounds = [];
  9287. //polyon岛洞标识数组,初始都是岛。
  9288. var CCWIdent = [];
  9289. for (let i = 0, pointIndex = 0; i < len; i++) {
  9290. for (let j = 0; j < geoParts[i]; j++) {
  9291. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  9292. }
  9293. pointIndex += geoParts[i];
  9294. lineEPS = LineString.createLineEPS(pointList);
  9295. var polygon = new Polygon([new LinearRing(lineEPS)]);
  9296. pointList = [];
  9297. polygonArrayTemp.push(polygon);
  9298. if (geoTopo.length === 0) {
  9299. polygonBounds.push(polygon.getBounds());
  9300. }
  9301. CCWIdent.push(1);
  9302. areaArray.push(polygon.getArea());
  9303. }
  9304. //根据面积排序
  9305. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  9306. //iServer 9D新增字段
  9307. if (geoTopo.length === 0) {
  9308. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  9309. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  9310. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  9311. //目标polygon索引列表 -1标示没有被任何polygon包含,
  9312. var targetArray = [];
  9313. for (let i = 1; i < polygonArrayTemp.length; i++) {
  9314. for (let j = i - 1; j >= 0; j--) {
  9315. targetArray[i] = -1;
  9316. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  9317. CCWIdent[i] = CCWIdent[j] * -1;
  9318. if (CCWIdent[i] < 0) {
  9319. targetArray[i] = j;
  9320. }
  9321. break;
  9322. }
  9323. }
  9324. }
  9325. for (let i = 0; i < polygonArrayTemp.length; i++) {
  9326. if (CCWIdent[i] > 0) {
  9327. polygonArray.push(polygonArrayTemp[i]);
  9328. } else {
  9329. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  9330. polygonArrayTemp[i].components
  9331. );
  9332. //占位
  9333. polygonArray.push('');
  9334. }
  9335. }
  9336. } else {
  9337. //根据面积排序
  9338. polygonArray = new Array();
  9339. for (let i = 0; i < polygonArrayTemp.length; i++) {
  9340. if (geoTopo[i] && geoTopo[i] == -1) {
  9341. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  9342. } else {
  9343. if (CCWArray.length > 0 && polygonArray.length > 0) {
  9344. polygonArray[polygonArray.length - 1].components = polygonArray[
  9345. polygonArray.length - 1
  9346. ].components.concat(CCWArray);
  9347. CCWArray = [];
  9348. }
  9349. polygonArray.push(polygonArrayTemp[i]);
  9350. }
  9351. if (i == len - 1) {
  9352. var polyLength = polygonArray.length;
  9353. if (polyLength) {
  9354. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  9355. CCWArray
  9356. );
  9357. } else {
  9358. for (let k = 0, length = CCWArray.length; k < length; k++) {
  9359. polygonArray.push(new Polygon(CCWArray));
  9360. }
  9361. }
  9362. }
  9363. }
  9364. }
  9365. return new MultiPolygon(polygonArray);
  9366. }
  9367. transformGeoCompound() {
  9368. const me = this,
  9369. geoParts = me.geoParts || [],
  9370. len = geoParts.length;
  9371. if (len <= 0) {
  9372. return null;
  9373. }
  9374. const geometryList = [];
  9375. for (let index = 0; index < len; index++) {
  9376. const geometry = geoParts[index];
  9377. geometryList.push(new ServerGeometry(geometry).toGeometry());
  9378. }
  9379. return new Collection(geometryList);
  9380. }
  9381. /**
  9382. * @function SuperMap.ServerGeometry.prototype.fromJson
  9383. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  9384. * @param {Object} jsonObject - 要转换的 JSON 对象。
  9385. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  9386. */
  9387. static fromJson(jsonObject) {
  9388. if (!jsonObject) {
  9389. return;
  9390. }
  9391. return new ServerGeometry({
  9392. id: jsonObject.id,
  9393. style: ServerStyle.fromJson(jsonObject.style),
  9394. parts: jsonObject.parts,
  9395. partTopo: jsonObject.partTopo,
  9396. points: jsonObject.points,
  9397. center: jsonObject.center,
  9398. length: jsonObject.length,
  9399. maxM: jsonObject.maxM,
  9400. minM: jsonObject.minM,
  9401. type: jsonObject.type
  9402. });
  9403. }
  9404. /**
  9405. * @function SuperMap.ServerGeometry.prototype.fromGeometry
  9406. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  9407. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  9408. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  9409. */
  9410. static fromGeometry(geometry) {
  9411. if (!geometry) {
  9412. return;
  9413. }
  9414. var id = 0,
  9415. parts = [],
  9416. points = [],
  9417. type = null,
  9418. icomponents = geometry.components,
  9419. className = geometry.CLASS_NAME,
  9420. prjCoordSys = { epsgCode: geometry.SRID };
  9421. if (!isNaN(geometry.id)) {
  9422. id = geometry.id;
  9423. }
  9424. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  9425. if (
  9426. className != 'SuperMap.Geometry.LinearRing' &&
  9427. className != 'SuperMap.Geometry.LineString' &&
  9428. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  9429. ) {
  9430. let ilen = icomponents.length;
  9431. for (let i = 0; i < ilen; i++) {
  9432. let partPointsCount = icomponents[i].getVertices().length;
  9433. parts.push(partPointsCount);
  9434. for (let j = 0; j < partPointsCount; j++) {
  9435. points.push(new Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  9436. }
  9437. }
  9438. //这里className不是多点就全部是算线
  9439. type = className == 'SuperMap.Geometry.MultiPoint' ? GeometryType.POINT : GeometryType.LINE;
  9440. } else if (geometry instanceof MultiPolygon) {
  9441. let ilen = icomponents.length;
  9442. for (let i = 0; i < ilen; i++) {
  9443. let polygon = icomponents[i],
  9444. linearRingOfPolygon = polygon.components,
  9445. linearRingOfPolygonLen = linearRingOfPolygon.length;
  9446. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  9447. let partPointsCount = linearRingOfPolygon[j].getVertices().length + 1;
  9448. parts.push(partPointsCount);
  9449. for (let k = 0; k < partPointsCount - 1; k++) {
  9450. points.push(
  9451. new Point(
  9452. linearRingOfPolygon[j].getVertices()[k].x,
  9453. linearRingOfPolygon[j].getVertices()[k].y
  9454. )
  9455. );
  9456. }
  9457. points.push(
  9458. new Point(linearRingOfPolygon[j].getVertices()[0].x, linearRingOfPolygon[j].getVertices()[0].y)
  9459. );
  9460. }
  9461. }
  9462. type = GeometryType.REGION;
  9463. } else if (geometry instanceof Polygon) {
  9464. let ilen = icomponents.length;
  9465. for (let i = 0; i < ilen; i++) {
  9466. let partPointsCount = icomponents[i].getVertices().length + 1;
  9467. parts.push(partPointsCount);
  9468. for (let j = 0; j < partPointsCount - 1; j++) {
  9469. points.push(new Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  9470. }
  9471. points.push(new Point(icomponents[i].getVertices()[0].x, icomponents[i].getVertices()[0].y));
  9472. }
  9473. type = GeometryType.REGION;
  9474. } else {
  9475. let geometryVerticesCount = geometry.getVertices().length;
  9476. for (let j = 0; j < geometryVerticesCount; j++) {
  9477. points.push(new Point(geometry.getVertices()[j].x, geometry.getVertices()[j].y));
  9478. }
  9479. if (geometry instanceof LinearRing) {
  9480. points.push(new Point(geometry.getVertices()[0].x, geometry.getVertices()[0].y));
  9481. geometryVerticesCount++;
  9482. }
  9483. parts.push(geometryVerticesCount);
  9484. type = geometry instanceof Point ? GeometryType.POINT : GeometryType.LINE;
  9485. }
  9486. return new ServerGeometry({
  9487. id: id,
  9488. style: null,
  9489. parts: parts,
  9490. points: points,
  9491. type: type,
  9492. prjCoordSys: prjCoordSys
  9493. });
  9494. }
  9495. /**
  9496. * @function SuperMap.ServerGeometry.prototype.IsClockWise
  9497. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  9498. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  9499. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  9500. */
  9501. static IsClockWise(points) {
  9502. var length = points.length;
  9503. if (length < 3) {
  9504. return 0.0;
  9505. }
  9506. var s = points[0].y * (points[length - 1].x - points[1].x);
  9507. points.push(points[0]);
  9508. for (var i = 1; i < length; i++) {
  9509. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  9510. }
  9511. return s * 0.5;
  9512. }
  9513. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  9514. for (var i = 0; i < areaArray.length; i++) {
  9515. for (var j = 0; j < areaArray.length; j++) {
  9516. if (areaArray[i] > areaArray[j]) {
  9517. var d = areaArray[j];
  9518. areaArray[j] = areaArray[i];
  9519. areaArray[i] = d;
  9520. var b = pointList[j];
  9521. pointList[j] = pointList[i];
  9522. pointList[i] = b;
  9523. if (geoTopo && geoTopo.length > 0) {
  9524. var c = geoTopo[j];
  9525. geoTopo[j] = geoTopo[i];
  9526. geoTopo[i] = c;
  9527. }
  9528. if (polygonBounds && polygonBounds.length > 0) {
  9529. var f = polygonBounds[j];
  9530. polygonBounds[j] = polygonBounds[i];
  9531. polygonBounds[i] = f;
  9532. }
  9533. }
  9534. }
  9535. }
  9536. }
  9537. }
  9538. SuperMap.ServerGeometry = ServerGeometry;
  9539. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  9540. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9541. * This program are made available under the terms of the Apache License, Version 2.0
  9542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9543. /**
  9544. * @class SuperMap.Format.GeoJSON
  9545. * @classdesc GeoJSON 的读和写。使用 {@link SuperMap.Format.GeoJSON} 构造器创建一个 GeoJSON 解析器。
  9546. * @category BaseTypes Format
  9547. * @param {Object} [options] - 参数。
  9548. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  9549. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  9550. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  9551. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  9552. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  9553. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  9554. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  9555. * @extends {SuperMap.Format.JSON}
  9556. */
  9557. class GeoJSON extends JSONFormat {
  9558. constructor(options) {
  9559. super(options);
  9560. /**
  9561. * @member {boolean} [SuperMap.Format.GeoJSON.prototype.ignoreExtraDims=true]
  9562. * @description 忽略维度超过 2 的几何要素。
  9563. */
  9564. this.ignoreExtraDims = true;
  9565. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  9566. /**
  9567. * @member {Object} SuperMap.Format.GeoJSON.prototype.parseCoords
  9568. * @private
  9569. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  9570. */
  9571. this.parseCoords = {
  9572. /**
  9573. * @function SuperMap.Format.GeoJSON.parseCoords.point
  9574. * @description 将一组坐标转成一个 {@link SuperMap.Geometry} 对象。
  9575. * @param {Object} array - GeoJSON 片段中的一组坐标。
  9576. * @returns {SuperMap.Geometry} 一个几何对象。
  9577. */
  9578. "point": function (array) {
  9579. if (this.ignoreExtraDims === false &&
  9580. array.length != 2) {
  9581. throw "Only 2D points are supported: " + array;
  9582. }
  9583. return new Point(array[0], array[1]);
  9584. },
  9585. /**
  9586. * @function SuperMap.Format.GeoJSON.parseCoords.multipoint
  9587. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  9588. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  9589. * @returns {SuperMap.Geometry} 一个几何对象。
  9590. */
  9591. "multipoint": function (array) {
  9592. var points = [];
  9593. var p = null;
  9594. for (var i = 0, len = array.length; i < len; ++i) {
  9595. try {
  9596. p = this.parseCoords["point"].apply(this, [array[i]]);
  9597. } catch (err) {
  9598. throw err;
  9599. }
  9600. points.push(p);
  9601. }
  9602. return new MultiPoint(points);
  9603. },
  9604. /**
  9605. * @function SuperMap.Format.GeoJSON.parseCoords.linestring
  9606. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  9607. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  9608. * @returns {SuperMap.Geometry} 一个几何对象。
  9609. */
  9610. "linestring": function (array) {
  9611. var points = [];
  9612. var p = null;
  9613. for (var i = 0, len = array.length; i < len; ++i) {
  9614. try {
  9615. p = this.parseCoords["point"].apply(this, [array[i]]);
  9616. } catch (err) {
  9617. throw err;
  9618. }
  9619. points.push(p);
  9620. }
  9621. return new LineString(points);
  9622. },
  9623. /**
  9624. * @function SuperMap.Format.GeoJSON.parseCoords.multilinestring
  9625. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  9626. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  9627. * @returns {SuperMap.Geometry} 一个几何对象。
  9628. */
  9629. "multilinestring": function (array) {
  9630. var lines = [];
  9631. var l = null;
  9632. for (var i = 0, len = array.length; i < len; ++i) {
  9633. try {
  9634. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  9635. } catch (err) {
  9636. throw err;
  9637. }
  9638. lines.push(l);
  9639. }
  9640. return new MultiLineString(lines);
  9641. },
  9642. /**
  9643. * @function SuperMap.Format.GeoJSON.parseCoords.polygon
  9644. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  9645. * @returns {SuperMap.Geometry} 一个几何对象。
  9646. */
  9647. "polygon": function (array) {
  9648. var rings = [];
  9649. var r, l;
  9650. for (var i = 0, len = array.length; i < len; ++i) {
  9651. try {
  9652. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  9653. } catch (err) {
  9654. throw err;
  9655. }
  9656. r = new LinearRing(l.components);
  9657. rings.push(r);
  9658. }
  9659. return new Polygon(rings);
  9660. },
  9661. /**
  9662. * @function SuperMap.Format.GeoJSON.parseCoords.multipolygon
  9663. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  9664. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  9665. * @returns {SuperMap.Geometry} 一个几何对象。
  9666. */
  9667. "multipolygon": function (array) {
  9668. var polys = [];
  9669. var p = null;
  9670. for (var i = 0, len = array.length; i < len; ++i) {
  9671. try {
  9672. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  9673. } catch (err) {
  9674. throw err;
  9675. }
  9676. polys.push(p);
  9677. }
  9678. return new MultiPolygon(polys);
  9679. },
  9680. /**
  9681. * @function SuperMap.Format.GeoJSON.parseCoords.box
  9682. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  9683. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  9684. * @returns {SuperMap.Geometry} 一个几何对象。
  9685. */
  9686. "box": function (array) {
  9687. if (array.length != 2) {
  9688. throw "GeoJSON box coordinates must have 2 elements";
  9689. }
  9690. return new Polygon([
  9691. new LinearRing([
  9692. new Point(array[0][0], array[0][1]),
  9693. new Point(array[1][0], array[0][1]),
  9694. new Point(array[1][0], array[1][1]),
  9695. new Point(array[0][0], array[1][1]),
  9696. new Point(array[0][0], array[0][1])
  9697. ])
  9698. ]);
  9699. }
  9700. };
  9701. /**
  9702. * @member {Object} SuperMap.Format.GeoJSON.prototype.extract
  9703. * @private
  9704. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  9705. */
  9706. this.extract = {
  9707. /**
  9708. * @function SuperMap.Format.GeoJSON.extract.feature
  9709. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  9710. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  9711. * @returns {Object} 一个表示点的对象。
  9712. */
  9713. 'feature': function (feature) {
  9714. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  9715. var json = {
  9716. "type": "Feature",
  9717. "properties": this.createAttributes(feature),
  9718. "geometry": geom
  9719. };
  9720. if (feature.geometry && feature.geometry.type === 'TEXT') {
  9721. json.properties.texts = feature.geometry.texts;
  9722. json.properties.textStyle = feature.geometry.textStyle;
  9723. }
  9724. if (feature.fid) {
  9725. json.id = feature.fid;
  9726. }
  9727. if (feature.ID) {
  9728. json.id = feature.ID;
  9729. }
  9730. return json;
  9731. },
  9732. /**
  9733. * @function SuperMap.Format.GeoJSON.extract.geometry
  9734. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  9735. * @param {Object} geometry - iServer 几何对象。
  9736. * @returns {Object} 一个表示几何体的对象。
  9737. */
  9738. 'geometry': function (geometry) {
  9739. if (geometry == null) {
  9740. return null;
  9741. }
  9742. if (!geometry.parts && geometry.points) {
  9743. geometry.parts = [geometry.points.length];
  9744. }
  9745. var geo = geometry.hasOwnProperty('geometryType')
  9746. ? geometry
  9747. : new ServerGeometry(geometry).toGeometry() || geometry;
  9748. var geometryType = geo.geometryType || geo.type;
  9749. var data;
  9750. if (geometryType === "LinearRing") {
  9751. geometryType = "LineString";
  9752. }
  9753. if (geometryType === "LINEM") {
  9754. geometryType = "MultiLineString";
  9755. }
  9756. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  9757. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  9758. var json;
  9759. if (geometryType === "Collection") {
  9760. json = {
  9761. "type": "GeometryCollection",
  9762. "geometries": data
  9763. };
  9764. } else {
  9765. json = {
  9766. "type": geometryType,
  9767. "coordinates": data
  9768. };
  9769. }
  9770. return json;
  9771. },
  9772. /**
  9773. * @function SuperMap.Format.GeoJSON.extract.point
  9774. * @description 从一个点对象中返回一个坐标组。
  9775. * @param {SuperMap.Geometry.Point} point - 一个点对象。
  9776. * @returns {Array} 一个表示一个点的坐标组。
  9777. */
  9778. 'point': function (point) {
  9779. var p = [point.x, point.y];
  9780. for (var name in point) {
  9781. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  9782. p.push(point[name]);
  9783. }
  9784. }
  9785. return p;
  9786. },
  9787. /**
  9788. * @function SuperMap.Format.GeoJSON.extract.point
  9789. * @description 从一个文本对象中返回一个坐标组。
  9790. * @param {Object} geo - 一个文本对象。
  9791. * @returns {Array} 一个表示一个点的坐标组。
  9792. */
  9793. 'text': function (geo) {
  9794. return [geo.points[0].x, geo.points[0].y];
  9795. },
  9796. /**
  9797. * @function SuperMap.Format.GeoJSON.extract.multipoint
  9798. * @description 从一个多点对象中返一个坐标组数组。
  9799. * @param {SuperMap.Geometry.MultiPoint} multipoint - 多点对象。
  9800. * @returns {Array} 一个表示多点的坐标组数组。
  9801. */
  9802. 'multipoint': function (multipoint) {
  9803. var array = [];
  9804. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  9805. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  9806. }
  9807. return array;
  9808. },
  9809. /**
  9810. * @function SuperMap.Format.GeoJSON.extract.linestring
  9811. * @description 从一个线对象中返回一个坐标组数组。
  9812. * @param {SuperMap.Geometry.Linestring} linestring - 线对象。
  9813. * @returns {Array} 一个表示线对象的坐标组数组。
  9814. */
  9815. 'linestring': function (linestring) {
  9816. var array = [];
  9817. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  9818. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  9819. }
  9820. return array;
  9821. },
  9822. /**
  9823. * @function SuperMap.Format.GeoJSON.extract.multilinestring
  9824. * @description 从一个多线对象中返回一个线数组。
  9825. * @param {SuperMap.Geometry.MultiLinestring} multilinestring - 多线对象。
  9826. *
  9827. * @returns {Array} 一个表示多线的线数组。
  9828. */
  9829. 'multilinestring': function (multilinestring) {
  9830. var array = [];
  9831. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  9832. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  9833. }
  9834. return array;
  9835. },
  9836. /**
  9837. * @function SuperMap.Format.GeoJSON.extract.polygon
  9838. * @description 从一个面对象中返回一组线环。
  9839. * @param {SuperMap.Geometry.Polygon} polygon - 面对象。
  9840. * @returns {Array} 一组表示面的线环。
  9841. */
  9842. 'polygon': function (polygon) {
  9843. var array = [];
  9844. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  9845. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  9846. }
  9847. return array;
  9848. },
  9849. /**
  9850. * @function SuperMap.Format.GeoJSON.extract.multipolygon
  9851. * @description 从一个多面对象中返回一组面。
  9852. * @param {SuperMap.Geometry.MultiPolygon} multipolygon - 多面对象。
  9853. * @returns {Array} 一组表示多面的面。
  9854. */
  9855. 'multipolygon': function (multipolygon) {
  9856. var array = [];
  9857. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  9858. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  9859. }
  9860. return array;
  9861. },
  9862. /**
  9863. * @function SuperMap.Format.GeoJSON.extract.collection
  9864. * @description 从一个几何要素集合中一组几何要素数组。
  9865. * @param {SuperMap.Geometry.Collection} collection - 几何要素集合。
  9866. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  9867. */
  9868. 'collection': function (collection) {
  9869. var len = collection.components.length;
  9870. var array = new Array(len);
  9871. for (var i = 0; i < len; ++i) {
  9872. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  9873. }
  9874. return array;
  9875. }
  9876. };
  9877. }
  9878. /**
  9879. * @function SuperMap.Format.GeoJSON.prototype.read
  9880. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  9881. * @param {GeoJSONObject} json - GeoJSON 对象。
  9882. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  9883. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  9884. * @returns {Object} 返回值依赖于 type 参数的值。
  9885. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link SuperMap.Feature.Vector} 数组。
  9886. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link SuperMap.Feature.Geometry}。
  9887. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link SuperMap.Feature.Vector}。
  9888. */
  9889. read(json, type, filter) {
  9890. type = (type) ? type : "FeatureCollection";
  9891. var results = null;
  9892. var obj = null;
  9893. if (typeof json == "string") {
  9894. obj = super.read(json, filter);
  9895. } else {
  9896. obj = json;
  9897. }
  9898. if (!obj) {
  9899. //SuperMap.Console.error("Bad JSON: " + json);
  9900. } else if (typeof (obj.type) != "string") {
  9901. //SuperMap.Console.error("Bad GeoJSON - no type: " + json);
  9902. } else if (this.isValidType(obj, type)) {
  9903. switch (type) {
  9904. case "Geometry":
  9905. try {
  9906. results = this.parseGeometry(obj);
  9907. } catch (err) {
  9908. //SuperMap.Console.error(err);
  9909. }
  9910. break;
  9911. case "Feature":
  9912. try {
  9913. results = this.parseFeature(obj);
  9914. results.type = "Feature";
  9915. } catch (err) {
  9916. //SuperMap.Console.error(err);
  9917. }
  9918. break;
  9919. case "FeatureCollection":
  9920. // for type FeatureCollection, we allow input to be any type
  9921. results = [];
  9922. switch (obj.type) {
  9923. case "Feature":
  9924. try {
  9925. results.push(this.parseFeature(obj));
  9926. } catch (err) {
  9927. results = null;
  9928. //SuperMap.Console.error(err);
  9929. }
  9930. break;
  9931. case "FeatureCollection":
  9932. for (var i = 0, len = obj.features.length; i < len; ++i) {
  9933. try {
  9934. results.push(this.parseFeature(obj.features[i]));
  9935. } catch (err) {
  9936. results = null;
  9937. // SuperMap.Console.error(err);
  9938. }
  9939. }
  9940. break;
  9941. default:
  9942. try {
  9943. var geom = this.parseGeometry(obj);
  9944. results.push(new Vector(geom));
  9945. } catch (err) {
  9946. results = null;
  9947. //SuperMap.Console.error(err);
  9948. }
  9949. }
  9950. break;
  9951. default:
  9952. break;
  9953. }
  9954. }
  9955. return results;
  9956. }
  9957. /**
  9958. * @function SuperMap.Format.GeoJSON.prototype.write
  9959. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  9960. * @param {Object} obj - iServer Geometry JSON 对象。
  9961. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  9962. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  9963. */
  9964. write(obj, pretty) {
  9965. return super.write(this.toGeoJSON(obj), pretty);
  9966. }
  9967. /**
  9968. * @function SuperMap.Format.GeoJSON.prototype.fromGeoJSON
  9969. * @version 9.1.1
  9970. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  9971. * @param {GeoJSONObject} json - GeoJSON 对象。
  9972. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  9973. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  9974. * @returns {Object} iServer Feature JSON。
  9975. */
  9976. fromGeoJSON(json, type, filter) {
  9977. let feature = this.read(json, type, filter);
  9978. if (!Util.isArray(feature)) {
  9979. return this._toiSevrerFeature(feature);
  9980. }
  9981. return feature.map((element) => {
  9982. return this._toiSevrerFeature(element);
  9983. })
  9984. }
  9985. /**
  9986. * @function SuperMap.Format.GeoJSON.prototype.toGeoJSON
  9987. * @version 9.1.1
  9988. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  9989. * @param {Object} obj - iServer Feature JSON。
  9990. * @returns {GeoJSONObject} GeoJSON 对象。
  9991. */
  9992. toGeoJSON(obj) {
  9993. var geojson = {
  9994. "type": null
  9995. };
  9996. if (Util.isArray(obj)) {
  9997. geojson.type = "FeatureCollection";
  9998. var numFeatures = obj.length;
  9999. geojson.features = new Array(numFeatures);
  10000. for (var i = 0; i < numFeatures; ++i) {
  10001. var element = obj[i];
  10002. if (isGeometry(element)) {
  10003. let feature = {};
  10004. feature.geometry = element;
  10005. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  10006. } else {
  10007. geojson.features[i] = this.extract.feature.apply(this, [element]);
  10008. }
  10009. }
  10010. } else if (isGeometry(obj)) {
  10011. let feature = {};
  10012. feature.geometry = obj;
  10013. geojson = this.extract.feature.apply(this, [feature]);
  10014. } else {
  10015. geojson = this.extract.feature.apply(this, [obj]);
  10016. }
  10017. function isGeometry(input) {
  10018. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  10019. }
  10020. return geojson;
  10021. }
  10022. /**
  10023. * @function SuperMap.Format.GeoJSON.prototype.isValidType
  10024. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  10025. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  10026. * @private
  10027. */
  10028. isValidType(obj, type) {
  10029. var valid = false;
  10030. switch (type) {
  10031. case "Geometry":
  10032. if (Util.indexOf(
  10033. ["Point", "MultiPoint", "LineString", "MultiLineString",
  10034. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  10035. ],
  10036. obj.type) == -1) {
  10037. // unsupported geometry type
  10038. //SuperMap.Console.error("Unsupported geometry type: " +
  10039. // obj.type);
  10040. } else {
  10041. valid = true;
  10042. }
  10043. break;
  10044. case "FeatureCollection":
  10045. // allow for any type to be converted to a feature collection
  10046. valid = true;
  10047. break;
  10048. default:
  10049. // for Feature types must match
  10050. if (obj.type == type) {
  10051. valid = true;
  10052. } else {
  10053. //SuperMap.Console.error("Cannot convert types from " +
  10054. //obj.type + " to " + type);
  10055. }
  10056. }
  10057. return valid;
  10058. }
  10059. /**
  10060. * @function SuperMap.Format.GeoJSON.prototype.parseFeature
  10061. * @description 将一个 GeoJSON 中的 feature 转化成 {@link SuperMap.Feature.Vector}> 对象。
  10062. * @private
  10063. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  10064. * @returns {SuperMap.Feature.Vector} 一个要素。
  10065. */
  10066. parseFeature(obj) {
  10067. var feature, geometry, attributes, bbox;
  10068. attributes = (obj.properties) ? obj.properties : {};
  10069. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  10070. try {
  10071. geometry = this.parseGeometry(obj.geometry);
  10072. } catch (err) {
  10073. // deal with bad geometries
  10074. throw err;
  10075. }
  10076. feature = new Vector(geometry, attributes);
  10077. if (bbox) {
  10078. feature.bounds = Bounds.fromArray(bbox);
  10079. }
  10080. if (obj.id) {
  10081. feature.fid = obj.id;
  10082. }
  10083. return feature;
  10084. }
  10085. /**
  10086. * @function SuperMap.Format.GeoJSON.prototype.parseGeometry
  10087. * @description 将一个 GeoJSON 中的几何要素转化成 {@link SuperMap.Geometry} 对象。
  10088. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  10089. * @returns {SuperMap.Geometry} 一个几何要素。
  10090. * @private
  10091. */
  10092. parseGeometry(obj) {
  10093. if (obj == null) {
  10094. return null;
  10095. }
  10096. var geometry;
  10097. if (obj.type == "GeometryCollection") {
  10098. if (!(Util.isArray(obj.geometries))) {
  10099. throw "GeometryCollection must have geometries array: " + obj;
  10100. }
  10101. var numGeom = obj.geometries.length;
  10102. var components = new Array(numGeom);
  10103. for (var i = 0; i < numGeom; ++i) {
  10104. components[i] = this.parseGeometry.apply(
  10105. this, [obj.geometries[i]]
  10106. );
  10107. }
  10108. geometry = new Collection(components);
  10109. } else {
  10110. if (!(Util.isArray(obj.coordinates))) {
  10111. throw "Geometry must have coordinates array: " + obj;
  10112. }
  10113. if (!this.parseCoords[obj.type.toLowerCase()]) {
  10114. throw "Unsupported geometry type: " + obj.type;
  10115. }
  10116. try {
  10117. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  10118. this, [obj.coordinates]
  10119. );
  10120. } catch (err) {
  10121. // deal with bad coordinates
  10122. throw err;
  10123. }
  10124. }
  10125. return geometry;
  10126. }
  10127. /**
  10128. * @function SuperMap.Format.GeoJSON.prototype.createCRSObject
  10129. * @description 从一个要素对象中创建一个坐标参考系对象。
  10130. * @param {SuperMap.Feature.Vector} object - 要素对象。
  10131. * @private
  10132. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  10133. */
  10134. createCRSObject(object) {
  10135. var proj = object.layer.projection.toString();
  10136. var crs = {};
  10137. if (proj.match(/epsg:/i)) {
  10138. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  10139. if (code == 4326) {
  10140. crs = {
  10141. "type": "name",
  10142. "properties": {
  10143. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  10144. }
  10145. };
  10146. } else {
  10147. crs = {
  10148. "type": "name",
  10149. "properties": {
  10150. "name": "EPSG:" + code
  10151. }
  10152. };
  10153. }
  10154. }
  10155. return crs;
  10156. }
  10157. _toiSevrerFeature(feature) {
  10158. const attributes = feature.attributes;
  10159. const attrNames = [];
  10160. const attrValues = [];
  10161. for (var attr in attributes) {
  10162. attrNames.push(attr);
  10163. attrValues.push(attributes[attr]);
  10164. }
  10165. const newFeature = {
  10166. fieldNames: attrNames,
  10167. fieldValues: attrValues,
  10168. geometry: ServerGeometry.fromGeometry(feature.geometry)
  10169. };
  10170. newFeature.geometry.id = feature.fid;
  10171. return newFeature;
  10172. }
  10173. createAttributes(feature) {
  10174. if (!feature) {
  10175. return null;
  10176. }
  10177. var attr = {};
  10178. processFieldsAttributes(feature, attr);
  10179. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  10180. for (var key in feature) {
  10181. if (exceptKeys.indexOf(key) > -1) {
  10182. continue;
  10183. }
  10184. attr[key] = feature[key];
  10185. }
  10186. function processFieldsAttributes(feature, attributes) {
  10187. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  10188. return;
  10189. }
  10190. var names = feature.fieldNames,
  10191. values = feature.fieldValues;
  10192. for (var i in names) {
  10193. attributes[names[i]] = values[i];
  10194. }
  10195. }
  10196. return attr;
  10197. }
  10198. }
  10199. SuperMap.Format.GeoJSON = GeoJSON;
  10200. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  10201. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10202. * This program are made available under the terms of the Apache License, Version 2.0
  10203. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10204. /**
  10205. * @class SuperMap.Format.WKT
  10206. * @classdesc 用于读写常见文本的类。通过 {@link SuperMap.Format.WKT} 构造器来创建一个新的实例。
  10207. * @category BaseTypes Format
  10208. * @extends {SuperMap.Format}
  10209. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link SuperMap.Format}。
  10210. */
  10211. class WKT extends Format {
  10212. constructor(options) {
  10213. super(options);
  10214. this.regExes = {
  10215. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  10216. 'spaces': /\s+/,
  10217. 'parenComma': /\)\s*,\s*\(/,
  10218. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  10219. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  10220. };
  10221. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  10222. * @private
  10223. * @description Object with properties corresponding to the geometry types.
  10224. * Property values are functions that do the actual data extraction.
  10225. */
  10226. this.extract = {
  10227. /**
  10228. * @description Return a space delimited string of point coordinates.
  10229. * @param {SuperMap.Geometry.Point} point
  10230. * @returns {string} A string of coordinates representing the point
  10231. */
  10232. 'point': function (point) {
  10233. return point.x + ' ' + point.y;
  10234. },
  10235. /**
  10236. * @description Return a comma delimited string of point coordinates from a multipoint.
  10237. * @param {SuperMap.Geometry.MultiPoint} multipoint
  10238. * @returns {string} A string of point coordinate strings representing
  10239. * the multipoint
  10240. */
  10241. 'multipoint'(multipoint) {
  10242. var array = [];
  10243. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  10244. array.push('(' +
  10245. this.extract.point.apply(this, [multipoint.components[i]]) +
  10246. ')');
  10247. }
  10248. return array.join(',');
  10249. },
  10250. /**
  10251. * @description Return a comma delimited string of point coordinates from a line.
  10252. * @param {SuperMap.Geometry.LineString} linestring
  10253. * @returns {string} A string of point coordinate strings representing
  10254. * the linestring
  10255. */
  10256. 'linestring'(linestring) {
  10257. var array = [];
  10258. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  10259. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  10260. }
  10261. return array.join(',');
  10262. },
  10263. /**
  10264. * @description Return a comma delimited string of linestring strings from a multilinestring.
  10265. * @param {SuperMap.Geometry.MultiLineString} multilinestring
  10266. * @returns {string} A string of of linestring strings representing
  10267. * the multilinestring
  10268. */
  10269. 'multilinestring'(multilinestring) {
  10270. var array = [];
  10271. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  10272. array.push('(' +
  10273. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  10274. ')');
  10275. }
  10276. return array.join(',');
  10277. },
  10278. /**
  10279. * @description Return a comma delimited string of linear ring arrays from a polygon.
  10280. * @param {SuperMap.Geometry.Polygon} polygon
  10281. * @returns {string} An array of linear ring arrays representing the polygon
  10282. */
  10283. 'polygon'(polygon) {
  10284. var array = [];
  10285. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  10286. array.push('(' +
  10287. this.extract.linestring.apply(this, [polygon.components[i]]) +
  10288. ')');
  10289. }
  10290. return array.join(',');
  10291. },
  10292. /**
  10293. * @description Return an array of polygon arrays from a multipolygon.
  10294. * @param {SuperMap.Geometry.MultiPolygon} multipolygon
  10295. * @returns {string} An array of polygon arrays representing
  10296. * the multipolygon
  10297. */
  10298. 'multipolygon'(multipolygon) {
  10299. var array = [];
  10300. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  10301. array.push('(' +
  10302. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  10303. ')');
  10304. }
  10305. return array.join(',');
  10306. },
  10307. /**
  10308. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <SuperMap.Geometry.Collection>
  10309. * @param {SuperMap.Geometry.Collection} collection
  10310. * @returns {string} internal WKT representation of the collection
  10311. */
  10312. 'collection'(collection) {
  10313. var array = [];
  10314. for (var i = 0, len = collection.components.length; i < len; ++i) {
  10315. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  10316. }
  10317. return array.join(',');
  10318. }
  10319. };
  10320. /**
  10321. * @private
  10322. * @description Object with properties corresponding to the geometry types.
  10323. * Property values are functions that do the actual parsing.
  10324. */
  10325. this.parse = {
  10326. /**
  10327. * @private
  10328. * @description Return point feature given a point WKT fragment.
  10329. * @param {string} str A WKT fragment representing the point
  10330. * @returns {SuperMap.Feature.Vector} A point feature
  10331. *
  10332. */
  10333. 'point': function (str) {
  10334. var coords = StringExt.trim(str).split(this.regExes.spaces);
  10335. return new Vector(new Point(coords[0], coords[1])
  10336. );
  10337. },
  10338. /**
  10339. * @description Return a multipoint feature given a multipoint WKT fragment.
  10340. * @param {string} A WKT fragment representing the multipoint
  10341. * @returns {SuperMap.Feature.Vector} A multipoint feature
  10342. * @private
  10343. */
  10344. 'multipoint': function (str) {
  10345. var point;
  10346. var points = StringExt.trim(str).split(',');
  10347. var components = [];
  10348. for (var i = 0, len = points.length; i < len; ++i) {
  10349. point = points[i].replace(this.regExes.trimParens, '$1');
  10350. components.push(this.parse.point.apply(this, [point]).geometry);
  10351. }
  10352. return new Vector(
  10353. new MultiPoint(components)
  10354. );
  10355. },
  10356. /**
  10357. * @description Return a linestring feature given a linestring WKT fragment.
  10358. * @param {string} A WKT fragment representing the linestring
  10359. * @returns {SuperMap.Feature.Vector} A linestring feature
  10360. * @private
  10361. */
  10362. 'linestring': function (str) {
  10363. var points = StringExt.trim(str).split(',');
  10364. var components = [];
  10365. for (var i = 0, len = points.length; i < len; ++i) {
  10366. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  10367. }
  10368. return new Vector(
  10369. new LineString(components)
  10370. );
  10371. },
  10372. /**
  10373. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  10374. * @param {string} A WKT fragment representing the multilinestring
  10375. * @returns {SuperMap.Feature.Vector} A multilinestring feature
  10376. * @private
  10377. */
  10378. 'multilinestring': function (str) {
  10379. var line;
  10380. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  10381. var components = [];
  10382. for (var i = 0, len = lines.length; i < len; ++i) {
  10383. line = lines[i].replace(this.regExes.trimParens, '$1');
  10384. components.push(this.parse.linestring.apply(this, [line]).geometry);
  10385. }
  10386. return new Vector(
  10387. new MultiLineString(components)
  10388. );
  10389. },
  10390. /**
  10391. * @description Return a polygon feature given a polygon WKT fragment.
  10392. * @param {string} A WKT fragment representing the polygon
  10393. * @returns {SuperMap.Feature.Vector} A polygon feature
  10394. * @private
  10395. */
  10396. 'polygon': function (str) {
  10397. var ring, linestring, linearring;
  10398. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  10399. var components = [];
  10400. for (var i = 0, len = rings.length; i < len; ++i) {
  10401. ring = rings[i].replace(this.regExes.trimParens, '$1');
  10402. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  10403. linearring = new LinearRing(linestring.components);
  10404. components.push(linearring);
  10405. }
  10406. return new Vector(
  10407. new Polygon(components)
  10408. );
  10409. },
  10410. /**
  10411. * @private
  10412. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  10413. * @param {string} A WKT fragment representing the multipolygon
  10414. * @returns {SuperMap.Feature.Vector} A multipolygon feature
  10415. *
  10416. */
  10417. 'multipolygon': function (str) {
  10418. var polygon;
  10419. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  10420. var components = [];
  10421. for (var i = 0, len = polygons.length; i < len; ++i) {
  10422. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  10423. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  10424. }
  10425. return new Vector(
  10426. new MultiPolygon(components)
  10427. );
  10428. },
  10429. /**
  10430. * @description Return an array of features given a geometrycollection WKT fragment.
  10431. * @param {string} A WKT fragment representing the geometrycollection
  10432. * @returns {Array} An array of SuperMap.Feature.Vector
  10433. * @private
  10434. */
  10435. 'geometrycollection': function (str) {
  10436. // separate components of the collection with |
  10437. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  10438. var wktArray = StringExt.trim(str).split('|');
  10439. var components = [];
  10440. for (var i = 0, len = wktArray.length; i < len; ++i) {
  10441. components.push(this.read(wktArray[i]));
  10442. }
  10443. return components;
  10444. }
  10445. };
  10446. }
  10447. /**
  10448. * @function SuperMap.Format.WKT.prototype.read
  10449. * @description Deserialize a WKT string and return a vector feature or an
  10450. * array of vector features. Supports WKT for POINT, MULTIPOINT,
  10451. * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
  10452. * GEOMETRYCOLLECTION.
  10453. * @param {string} wkt - A WKT string
  10454. * @returns {SuperMap.Feature.Vector|Array} A feature or array of features for
  10455. * GEOMETRYCOLLECTION WKT.
  10456. */
  10457. read(wkt) {
  10458. var features, type, str;
  10459. wkt = wkt.replace(/[\n\r]/g, " ");
  10460. var matches = this.regExes.typeStr.exec(wkt);
  10461. if (matches) {
  10462. type = matches[1].toLowerCase();
  10463. str = matches[2];
  10464. if (this.parse[type]) {
  10465. features = this.parse[type].apply(this, [str]);
  10466. }
  10467. }
  10468. return features;
  10469. }
  10470. /**
  10471. * @function SuperMap.Format.WKT.prototype.write
  10472. * @description Serialize a feature or array of features into a WKT string.
  10473. * @param {(SuperMap.Feature.Vector|Array)} features - A feature or array of features
  10474. * @returns {string} The WKT string representation of the input geometries
  10475. */
  10476. write(features) {
  10477. var collection, geometry, isCollection;
  10478. if (features.constructor === Array) {
  10479. collection = features;
  10480. isCollection = true;
  10481. } else {
  10482. collection = [features];
  10483. isCollection = false;
  10484. }
  10485. var pieces = [];
  10486. if (isCollection) {
  10487. pieces.push('GEOMETRYCOLLECTION(');
  10488. }
  10489. for (var i = 0, len = collection.length; i < len; ++i) {
  10490. if (isCollection && i > 0) {
  10491. pieces.push(',');
  10492. }
  10493. geometry = collection[i].geometry;
  10494. pieces.push(this.extractGeometry(geometry));
  10495. }
  10496. if (isCollection) {
  10497. pieces.push(')');
  10498. }
  10499. return pieces.join('');
  10500. }
  10501. /**
  10502. * @function SuperMap.Format.WKT.prototype.extractGeometry
  10503. * @description Entry point to construct the WKT for a single Geometry object.
  10504. * @param {SuperMap.Geometry} geometry
  10505. * @returns {string} A WKT string of representing the geometry
  10506. */
  10507. extractGeometry(geometry) {
  10508. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  10509. if (!this.extract[type]) {
  10510. return null;
  10511. }
  10512. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  10513. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  10514. return data;
  10515. }
  10516. }
  10517. SuperMap.Format.WKT = WKT;
  10518. ;// CONCATENATED MODULE: ./src/common/format/index.js
  10519. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10520. * This program are made available under the terms of the Apache License, Version 2.0
  10521. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10522. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  10523. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10524. * This program are made available under the terms of the Apache License, Version 2.0
  10525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10526. /**
  10527. * @class SuperMap.TimeControlBase
  10528. * @classdesc 时间控制基类类。
  10529. * @category Control
  10530. * @param {Object} options - 该类开放的可选属性。
  10531. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  10532. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  10533. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  10534. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  10535. * @param {boolean} [options.repeat=true] - 是否重复循环。
  10536. * @param {boolean} [options.reverse=false] - 是否反向。
  10537. */
  10538. class TimeControlBase {
  10539. constructor(options) {
  10540. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  10541. var me = this;
  10542. options = options || {};
  10543. /**
  10544. * @member {number} [SuperMap.TimeControlBase.prototype.speed=1]
  10545. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)
  10546. */
  10547. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  10548. /**
  10549. * @member {number} [SuperMap.TimeControlBase.prototype.frequency=1000]
  10550. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  10551. */
  10552. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  10553. /**
  10554. * @member {number} [SuperMap.TimeControlBase.prototype.startTime=0]
  10555. * @description 记录的起始时间,必须为数字,
  10556. * 如果不设置,初始化时为0,建议设置
  10557. */
  10558. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  10559. /**
  10560. * @member {number} SuperMap.TimeControlBase.prototype.endTime
  10561. * @description 记录的结束时间,必须为数字,
  10562. * 如果不设置,初始化时以当前时间进行设置,建议设置
  10563. */
  10564. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  10565. /**
  10566. * @member {boolean} [SuperMap.TimeControlBase.prototype.repeat=true]
  10567. * @description 是否重复循环。
  10568. */
  10569. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  10570. /**
  10571. * @member {boolean} [SuperMap.TimeControlBase.prototype.reverse=false]
  10572. * @description 是否反向。
  10573. */
  10574. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  10575. /**
  10576. * @member {number} SuperMap.TimeControlBase.prototype.currentTime
  10577. * @description 记录近期的时间,也就是当前帧运行到的时间。
  10578. */
  10579. this.currentTime = null;
  10580. /**
  10581. * @member {number} SuperMap.TimeControlBase.prototype.oldTime
  10582. * @description 记录上一帧的时间,也就是之前运行到的时间。
  10583. */
  10584. this.oldTime = null;
  10585. /**
  10586. * @member {boolean} [SuperMap.TimeControlBase.prototype.running=false]
  10587. * @description 记录当前是否处于运行中。
  10588. */
  10589. this.running = false;
  10590. /**
  10591. * @private
  10592. * @member {Array.<string>} SuperMap.TimeControlBase.prototype.EVENT_TYPES
  10593. * @description 此类支持的事件类型。
  10594. *
  10595. */
  10596. this.EVENT_TYPES = ["start", "pause", "stop"];
  10597. /**
  10598. * @private
  10599. * @member {SuperMap.Events} SuperMap.TimeControlBase.prototype.events
  10600. * @description 事件
  10601. */
  10602. me.events = new Events(this, null, this.EVENT_TYPES);
  10603. me.speed = Number(me.speed);
  10604. me.frequency = Number(me.frequency);
  10605. me.startTime = Number(me.startTime);
  10606. me.endTime = Number(me.endTime);
  10607. me.startTime = Date.parse(new Date(me.startTime));
  10608. me.endTime = Date.parse(new Date(me.endTime));
  10609. //初始化当前时间
  10610. me.currentTime = me.startTime;
  10611. this.CLASS_NAME = "SuperMap.TimeControlBase";
  10612. }
  10613. /**
  10614. * @function SuperMap.TimeControlBase.prototype.updateOptions
  10615. * @param {Object} options - 设置参数得可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  10616. */
  10617. updateOptions(options) {
  10618. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  10619. var me = this;
  10620. options = options || {};
  10621. if (options.speed && options.speed >= 0) {
  10622. me.speed = options.speed;
  10623. me.speed = Number(me.speed);
  10624. }
  10625. if (options.speed && options.frequency >= 0) {
  10626. me.frequency = options.frequency;
  10627. me.frequency = Number(me.frequency);
  10628. }
  10629. if (options.startTime && options.startTime != null) {
  10630. me.startTime = options.startTime;
  10631. me.startTime = Date.parse(new Date(me.startTime));
  10632. }
  10633. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  10634. me.endTime = options.endTime;
  10635. me.endTime = Date.parse(new Date(me.endTime));
  10636. }
  10637. if (options.repeat != null) {
  10638. me.repeat = options.repeat;
  10639. }
  10640. if (options.reverse != null) {
  10641. me.reverse = options.reverse;
  10642. }
  10643. }
  10644. /**
  10645. * @function SuperMap.TimeControlBase.prototype.start
  10646. * @description 开始。
  10647. */
  10648. start() {
  10649. var me = this;
  10650. if (!me.running) {
  10651. me.running = true;
  10652. me.tick();
  10653. me.events.triggerEvent('start', me.currentTime);
  10654. }
  10655. }
  10656. /**
  10657. * @function SuperMap.TimeControlBase.prototype.pause
  10658. * @description 暂停。
  10659. */
  10660. pause() {
  10661. var me = this;
  10662. me.running = false;
  10663. me.events.triggerEvent('pause', me.currentTime);
  10664. }
  10665. /**
  10666. * @function SuperMap.TimeControlBase.prototype.stop
  10667. * @description 停止,停止后返回起始状态。
  10668. */
  10669. stop() {
  10670. var me = this;
  10671. //停止时 时间设置为开始时间
  10672. me.currentTime = me.startTime;
  10673. //如果正在运行,修改为初始时间即可绘制一帧
  10674. if (me.running) {
  10675. me.running = false;
  10676. }
  10677. me.events.triggerEvent('stop', me.currentTime);
  10678. }
  10679. /**
  10680. * @function SuperMap.TimeControlBase.prototype.toggle
  10681. * @description 开关切换,切换的是开始和暂停。
  10682. */
  10683. toggle() {
  10684. var me = this;
  10685. if (me.running) {
  10686. me.pause();
  10687. } else {
  10688. me.start();
  10689. }
  10690. }
  10691. /**
  10692. * @function SuperMap.TimeControlBase.prototype.setSpeed
  10693. * @description 设置步长。
  10694. * @param {number} [speed=1] - 步长,必须为非负数。
  10695. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  10696. */
  10697. setSpeed(speed) {
  10698. var me = this;
  10699. if (speed >= 0) {
  10700. me.speed = speed;
  10701. return true;
  10702. }
  10703. return false;
  10704. }
  10705. /**
  10706. * @function SuperMap.TimeControlBase.prototype.getSpeed
  10707. * @description 获取步长。
  10708. * @returns {number} 返回当前的步长
  10709. */
  10710. getSpeed() {
  10711. return this.speed;
  10712. }
  10713. /**
  10714. * @function SuperMap.TimeControlBase.prototype.setFrequency
  10715. * @description 设置刷新频率。
  10716. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  10717. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  10718. */
  10719. setFrequency(frequency) {
  10720. var me = this;
  10721. if (frequency >= 0) {
  10722. me.frequency = frequency;
  10723. return true;
  10724. }
  10725. return false;
  10726. }
  10727. /**
  10728. * @function SuperMap.TimeControlBase.prototype.getFrequency
  10729. * @description 获取刷新频率。
  10730. * @returns {number} 返回当前的刷新频率。
  10731. */
  10732. getFrequency() {
  10733. return this.frequency;
  10734. }
  10735. /**
  10736. * @function SuperMap.TimeControlBase.prototype.setStartTime
  10737. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  10738. * @param {number} startTime - 需要设置的起始时间。
  10739. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  10740. */
  10741. setStartTime(startTime) {
  10742. var me = this;
  10743. startTime = Date.parse(new Date(startTime));
  10744. //起始时间不得大于结束时间
  10745. if (startTime > me.endTime) {
  10746. return false;
  10747. }
  10748. me.startTime = startTime;
  10749. //如果当前时间小于了起始时间,则从当前起始时间开始
  10750. if (me.currentTime < me.startTime) {
  10751. me.currentTime = me.startTime;
  10752. me.tick();
  10753. }
  10754. return true;
  10755. }
  10756. /**
  10757. * @function SuperMap.TimeControlBase.prototype.getStartTime
  10758. * @description 获取起始时间。
  10759. * @returns {number} 返回当前的起始时间。
  10760. */
  10761. getStartTime() {
  10762. return this.startTime;
  10763. }
  10764. /**
  10765. * @function SuperMap.TimeControlBase.prototype.setEndTime
  10766. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  10767. * @param {number} endTime - 需要设置的结束时间。
  10768. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  10769. */
  10770. setEndTime(endTime) {
  10771. var me = this;
  10772. me.endTime = Date.parse(new Date(me.endTime));
  10773. //结束时间不得小于开始时间
  10774. if (endTime < me.startTime) {
  10775. return false;
  10776. }
  10777. me.endTime = endTime;
  10778. //如果当前时间大于了结束时间,则从起始时间开始
  10779. if (me.currentTime >= me.endTime) {
  10780. me.currentTime = me.startTime;
  10781. me.tick();
  10782. }
  10783. return true;
  10784. }
  10785. /**
  10786. * @function SuperMap.TimeControlBase.prototype.getEndTime
  10787. * @description 获取结束时间。
  10788. * @returns {number} 返回当前的结束时间。
  10789. */
  10790. getEndTime() {
  10791. return this.endTime;
  10792. }
  10793. /**
  10794. * @function SuperMap.TimeControlBase.prototype.setCurrentTime
  10795. * @description 设置当前时间。
  10796. * @param {number} currentTime - 需要设置的当前时间。
  10797. * @returns {boolean} true 代表设置成功,false 设置失败。
  10798. */
  10799. setCurrentTime(currentTime) {
  10800. var me = this;
  10801. me.currentTime = Date.parse(new Date(me.currentTime));
  10802. //结束时间不得小于开始时间
  10803. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  10804. me.currentTime = currentTime;
  10805. me.startTime = me.currentTime;
  10806. me.tick();
  10807. return true;
  10808. }
  10809. return false;
  10810. }
  10811. /**
  10812. * @function SuperMap.TimeControlBase.prototype.getCurrentTime
  10813. * @description 获取当前时间。
  10814. * @returns {number} 返回当前时间。
  10815. */
  10816. getCurrentTime() {
  10817. return this.currentTime;
  10818. }
  10819. /**
  10820. * @function SuperMap.TimeControlBase.prototype.setRepeat
  10821. * @description 设置是否重复循环。
  10822. * @param {boolean} [repeat=true] - 是否重复循环。
  10823. */
  10824. setRepeat(repeat) {
  10825. this.repeat = repeat;
  10826. }
  10827. /**
  10828. * @function SuperMap.TimeControlBase.prototype.getRepeat
  10829. * @description 获取是否重复循环,默认是 true。
  10830. * @returns {boolean} 返回是否重复循环。
  10831. */
  10832. getRepeat() {
  10833. return this.repeat;
  10834. }
  10835. /**
  10836. * @function SuperMap.TimeControlBase.prototype.setReverse
  10837. * @description 设置是否反向。
  10838. * @param {boolean} [reverse=false] - 是否反向。
  10839. */
  10840. setReverse(reverse) {
  10841. this.reverse = reverse;
  10842. }
  10843. /**
  10844. * @function SuperMap.TimeControlBase.prototype.getReverse
  10845. * @description 获取是否反向,默认是false。
  10846. * @returns {boolean} 返回是否反向。
  10847. */
  10848. getReverse() {
  10849. return this.reverse;
  10850. }
  10851. /**
  10852. * @function SuperMap.TimeControlBase.prototype.getRunning
  10853. * @description 获取运行状态。
  10854. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  10855. */
  10856. getRunning() {
  10857. return this.running;
  10858. }
  10859. /**
  10860. * @function SuperMap.TimeControlBase.prototype.destroy
  10861. * @description 销毁 Animator 对象,释放资源。
  10862. */
  10863. destroy() {
  10864. var me = this;
  10865. me.speed = null;
  10866. me.frequency = null;
  10867. me.startTime = null;
  10868. me.endTime = null;
  10869. me.currentTime = null;
  10870. me.repeat = null;
  10871. me.running = false;
  10872. me.reverse = null;
  10873. }
  10874. tick() {
  10875. //TODO 每次刷新执行的操作。子类实现
  10876. }
  10877. }
  10878. SuperMap.TimeControlBase = TimeControlBase;
  10879. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  10880. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10881. * This program are made available under the terms of the Apache License, Version 2.0
  10882. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10883. /**
  10884. * @class SuperMap.TimeFlowControl
  10885. * @classdesc 时间管理类。
  10886. * @category Control
  10887. * @description 此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  10888. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  10889. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会 1 次(通过 setFrequency 修改)
  10890. * @extends {SuperMap.TimeControlBase}
  10891. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  10892. * @param {Object} options - 该类开放的可选属性。
  10893. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  10894. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  10895. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  10896. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  10897. * @param {boolean} [options.repeat=true] - 是否重复循环。
  10898. * @param {boolean} [options.reverse=false] - 是否反向。
  10899. */
  10900. class TimeFlowControl extends TimeControlBase {
  10901. constructor(callback, options) {
  10902. super(options);
  10903. var me = this;
  10904. /**
  10905. * @member SuperMap.TimeFlowControl.prototype.callback -{function}
  10906. * @description 每次刷新执行的回调函数。
  10907. */
  10908. me.callback = callback;
  10909. //先让IE下支持bind方法
  10910. if (!Function.prototype.bind) {
  10911. Function.prototype.bind = function (oThis) {
  10912. if (typeof this !== "function") {
  10913. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  10914. }
  10915. var aArgs = Array.prototype.slice.call(arguments, 1),
  10916. fToBind = this,
  10917. fNOP = function () {
  10918. //empty Function
  10919. },
  10920. fBound = function () {
  10921. return fToBind.apply(this instanceof fNOP && oThis
  10922. ? this
  10923. : oThis,
  10924. aArgs.concat(Array.prototype.slice.call(arguments)));
  10925. };
  10926. fNOP.prototype = this.prototype;
  10927. fBound.prototype = new fNOP();
  10928. return fBound;
  10929. };
  10930. }
  10931. //保证 this.tick 的上下文还是 TimeControl 这个对象
  10932. me.update = me.update.bind(me);
  10933. me.oldTime = me.currentTime;
  10934. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  10935. }
  10936. /**
  10937. * @function SuperMap.TimeFlowControl.prototype.updateOptions
  10938. * @override
  10939. */
  10940. updateOptions(options) {
  10941. options = options || {};
  10942. super.updateOptions(options);
  10943. }
  10944. /**
  10945. * @function SuperMap.TimeFlowControl.prototype.start
  10946. * @override
  10947. */
  10948. start() {
  10949. var me = this;
  10950. if (me.running) {
  10951. return;
  10952. }
  10953. me.running = true;
  10954. if (me.reverse) {
  10955. if (me.currentTime === me.startTime) {
  10956. me.oldTime = me.endTime;
  10957. me.currentTime = me.oldTime;
  10958. }
  10959. } else {
  10960. if (me.oldTime === me.endTime) {
  10961. me.currentTime = me.startTime;
  10962. me.oldTime = me.currentTime;
  10963. }
  10964. }
  10965. me.tick();
  10966. }
  10967. /**
  10968. * @function SuperMap.TimeFlowControl.prototype.stop
  10969. * @override
  10970. */
  10971. stop() {
  10972. super.stop();
  10973. var me = this;
  10974. me.oldTime = me.currentTime;
  10975. if (me.running) {
  10976. me.running = false;
  10977. }
  10978. //清除定时tick
  10979. me.intervalId && window.clearTimeout(me.intervalId);
  10980. }
  10981. /**
  10982. * @function SuperMap.TimeFlowControl.prototype.destroy
  10983. * @override
  10984. */
  10985. destroy() {
  10986. super.destroy();
  10987. var me = this;
  10988. me.oldTime = null;
  10989. me.callback = null;
  10990. }
  10991. /**
  10992. * @function SuperMap.TimeFlowControl.prototype.tick
  10993. * @description 定时刷新。
  10994. */
  10995. tick() {
  10996. var me = this;
  10997. me.intervalId && window.clearInterval(me.intervalId);
  10998. me.intervalId = null;
  10999. me.update();
  11000. me.intervalId = window.setInterval(me.update, me.frequency);
  11001. }
  11002. /**
  11003. * @function SuperMap.TimeFlowControl.prototype.update
  11004. * @override
  11005. */
  11006. update() {
  11007. var me = this;
  11008. //判定是否还需要继续
  11009. if (!me.running) {
  11010. return;
  11011. }
  11012. //调用回调函数
  11013. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  11014. if (!me.reverse) {
  11015. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  11016. if (me.currentTime === me.endTime) {
  11017. //不循环时
  11018. if (!me.repeat) {
  11019. me.running = false;
  11020. me.stop();
  11021. return null;
  11022. }
  11023. me.stop();
  11024. me.currentTime = me.startTime;
  11025. me.oldTime = me.currentTime;
  11026. me.start();
  11027. } else {//否则时间递增
  11028. me.oldTime = me.currentTime;
  11029. me.currentTime += me.speed;
  11030. }
  11031. if (me.currentTime >= me.endTime) {
  11032. me.currentTime = me.endTime;
  11033. }
  11034. } else {
  11035. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  11036. if (me.currentTime === me.startTime) {
  11037. //不循环时
  11038. if (!me.repeat) {
  11039. me.running = false;
  11040. return null;
  11041. }
  11042. me.oldTime = me.endTime;
  11043. me.currentTime = me.oldTime;
  11044. } else {//否则时间递减
  11045. me.currentTime = me.oldTime;
  11046. me.oldTime -= me.speed;
  11047. }
  11048. if (me.oldTime <= me.startTime) {
  11049. me.oldTime = me.startTime;
  11050. }
  11051. }
  11052. }
  11053. }
  11054. SuperMap.TimeFlowControl = TimeFlowControl;
  11055. ;// CONCATENATED MODULE: ./src/common/control/index.js
  11056. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11057. * This program are made available under the terms of the Apache License, Version 2.0
  11058. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11059. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  11060. var polyfill = __webpack_require__(107);
  11061. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  11062. var fetch = __webpack_require__(693);
  11063. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  11064. var fetch_jsonp = __webpack_require__(144);
  11065. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  11066. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  11067. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11068. * This program are made available under the terms of the Apache License, Version 2.0
  11069. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11070. let FetchRequest_fetch = window.fetch;
  11071. var setFetch = function (newFetch) {
  11072. FetchRequest_fetch = newFetch;
  11073. }
  11074. /**
  11075. * @function SuperMap.setCORS
  11076. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  11077. * @param {boolean} cors - 是否允许跨域请求。
  11078. */
  11079. var setCORS = SuperMap.setCORS = function (cors) {
  11080. SuperMap.CORS = cors;
  11081. }
  11082. /**
  11083. * @function SuperMap.isCORS
  11084. * @description 是是否允许跨域请求。
  11085. * @returns {boolean} 是否允许跨域请求。
  11086. */
  11087. var isCORS = SuperMap.isCORS = function () {
  11088. if (SuperMap.CORS != undefined) {
  11089. return SuperMap.CORS;
  11090. }
  11091. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  11092. }
  11093. /**
  11094. * @function SuperMap.setRequestTimeout
  11095. * @description 设置请求超时时间。
  11096. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  11097. */
  11098. var setRequestTimeout = SuperMap.setRequestTimeout = function (timeout) {
  11099. return SuperMap.RequestTimeout = timeout;
  11100. }
  11101. /**
  11102. * @function SuperMap.getRequestTimeout
  11103. * @description 获取请求超时时间。
  11104. * @returns {number} 请求超时时间。
  11105. */
  11106. var getRequestTimeout = SuperMap.getRequestTimeout = function () {
  11107. return SuperMap.RequestTimeout || 45000;
  11108. }
  11109. var FetchRequest = SuperMap.FetchRequest = {
  11110. commit: function (method, url, params, options) {
  11111. method = method ? method.toUpperCase() : method;
  11112. switch (method) {
  11113. case 'GET':
  11114. return this.get(url, params, options);
  11115. case 'POST':
  11116. return this.post(url, params, options);
  11117. case 'PUT':
  11118. return this.put(url, params, options);
  11119. case 'DELETE':
  11120. return this.delete(url, params, options);
  11121. default:
  11122. return this.get(url, params, options);
  11123. }
  11124. },
  11125. supportDirectRequest: function (url, options) {
  11126. if (Util.isInTheSameDomain(url)) {
  11127. return true;
  11128. }
  11129. if (options.crossOrigin != undefined) {
  11130. return options.crossOrigin;
  11131. } else {
  11132. return isCORS() || options.proxy;
  11133. }
  11134. },
  11135. get: function (url, params, options) {
  11136. options = options || {};
  11137. var type = 'GET';
  11138. url = Util.urlAppend(url, this._getParameterString(params || {}));
  11139. url = this._processUrl(url, options);
  11140. if (!this.supportDirectRequest(url, options)) {
  11141. url = url.replace('.json', '.jsonp');
  11142. var config = {
  11143. url: url,
  11144. data: params
  11145. };
  11146. return SuperMap.Util.RequestJSONPPromise.GET(config);
  11147. }
  11148. if (!this.urlIsLong(url)) {
  11149. return this._fetch(url, params, options, type);
  11150. } else {
  11151. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  11152. }
  11153. },
  11154. delete: function (url, params, options) {
  11155. options = options || {};
  11156. var type = 'DELETE';
  11157. url = Util.urlAppend(url, this._getParameterString(params || {}));
  11158. url = this._processUrl(url, options);
  11159. if (!this.supportDirectRequest(url, options)) {
  11160. url = url.replace('.json', '.jsonp');
  11161. var config = {
  11162. url: url += "&_method=DELETE",
  11163. data: params
  11164. };
  11165. return SuperMap.Util.RequestJSONPPromise.DELETE(config);
  11166. }
  11167. if (this.urlIsLong(url)) {
  11168. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  11169. }
  11170. return this._fetch(url, params, options, type);
  11171. },
  11172. post: function (url, params, options) {
  11173. options = options || {};
  11174. if (!this.supportDirectRequest(url, options)) {
  11175. url = url.replace('.json', '.jsonp');
  11176. var config = {
  11177. url: url += "&_method=POST",
  11178. data: params
  11179. };
  11180. return SuperMap.Util.RequestJSONPPromise.POST(config);
  11181. }
  11182. return this._fetch(this._processUrl(url, options), params, options, 'POST');
  11183. },
  11184. put: function (url, params, options) {
  11185. options = options || {};
  11186. url = this._processUrl(url, options);
  11187. if (!this.supportDirectRequest(url, options)) {
  11188. url = url.replace('.json', '.jsonp');
  11189. var config = {
  11190. url: url += "&_method=PUT",
  11191. data: params
  11192. };
  11193. return SuperMap.Util.RequestJSONPPromise.PUT(config);
  11194. }
  11195. return this._fetch(url, params, options, 'PUT');
  11196. },
  11197. urlIsLong: function (url) {
  11198. //当前url的字节长度。
  11199. var totalLength = 0,
  11200. charCode = null;
  11201. for (var i = 0, len = url.length; i < len; i++) {
  11202. //转化为Unicode编码
  11203. charCode = url.charCodeAt(i);
  11204. if (charCode < 0x007f) {
  11205. totalLength++;
  11206. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  11207. totalLength += 2;
  11208. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  11209. totalLength += 3;
  11210. }
  11211. }
  11212. return totalLength < 2000 ? false : true;
  11213. },
  11214. _postSimulatie: function (type, url, params, options) {
  11215. var separator = url.indexOf('?') > -1 ? '&' : '?';
  11216. url += separator + '_method=' + type;
  11217. if (typeof params !== 'string') {
  11218. params = JSON.stringify(params);
  11219. }
  11220. return this.post(url, params, options);
  11221. },
  11222. _processUrl: function (url, options) {
  11223. if (this._isMVTRequest(url)) {
  11224. return url;
  11225. }
  11226. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  11227. if (url.indexOf('?') < 0) {
  11228. url += '.json';
  11229. } else {
  11230. var urlArrays = url.split('?');
  11231. if (urlArrays.length === 2) {
  11232. url = urlArrays[0] + '.json?' + urlArrays[1];
  11233. }
  11234. }
  11235. }
  11236. if (options && options.proxy) {
  11237. if (typeof options.proxy === 'function') {
  11238. url = options.proxy(url);
  11239. } else {
  11240. url = decodeURIComponent(url);
  11241. url = options.proxy + encodeURIComponent(url);
  11242. }
  11243. }
  11244. return url;
  11245. },
  11246. _fetch: function (url, params, options, type) {
  11247. options = options || {};
  11248. options.headers = options.headers || {};
  11249. if (!options.headers['Content-Type']) {
  11250. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  11251. }
  11252. if (options.timeout) {
  11253. return this._timeout(
  11254. options.timeout,
  11255. FetchRequest_fetch(url, {
  11256. method: type,
  11257. headers: options.headers,
  11258. body: type === 'PUT' || type === 'POST' ? params : undefined,
  11259. credentials: this._getWithCredentials(options),
  11260. mode: 'cors',
  11261. timeout: getRequestTimeout()
  11262. }).then(function (response) {
  11263. return response;
  11264. })
  11265. );
  11266. }
  11267. return FetchRequest_fetch(url, {
  11268. method: type,
  11269. body: type === 'PUT' || type === 'POST' ? params : undefined,
  11270. headers: options.headers,
  11271. credentials: this._getWithCredentials(options),
  11272. mode: 'cors',
  11273. timeout: getRequestTimeout()
  11274. }).then(function (response) {
  11275. return response;
  11276. });
  11277. },
  11278. _getWithCredentials: function (options) {
  11279. if (options.withCredentials === true) {
  11280. return 'include';
  11281. }
  11282. if (options.withCredentials === false) {
  11283. return 'omit';
  11284. }
  11285. return 'same-origin';
  11286. },
  11287. _fetchJsonp: function (url, options) {
  11288. options = options || {};
  11289. return fetch_jsonp_default()(url, {
  11290. method: 'GET',
  11291. timeout: options.timeout
  11292. }).then(function (response) {
  11293. return response;
  11294. });
  11295. },
  11296. _timeout: function (seconds, promise) {
  11297. return new Promise(function (resolve, reject) {
  11298. setTimeout(function () {
  11299. reject(new Error('timeout'));
  11300. }, seconds);
  11301. promise.then(resolve, reject);
  11302. });
  11303. },
  11304. _getParameterString: function (params) {
  11305. var paramsArray = [];
  11306. for (var key in params) {
  11307. var value = params[key];
  11308. if (value != null && typeof value !== 'function') {
  11309. var encodedValue;
  11310. if (Array.isArray(value) || value.toString() === '[object Object]') {
  11311. encodedValue = encodeURIComponent(JSON.stringify(value));
  11312. } else {
  11313. encodedValue = encodeURIComponent(value);
  11314. }
  11315. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  11316. }
  11317. }
  11318. return paramsArray.join('&');
  11319. },
  11320. _isMVTRequest: function (url) {
  11321. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  11322. }
  11323. }
  11324. SuperMap.Util.RequestJSONPPromise = {
  11325. limitLength: 1500,
  11326. queryKeys: [],
  11327. queryValues: [],
  11328. supermap_callbacks: {},
  11329. addQueryStrings: function (values) {
  11330. var me = this;
  11331. for (var key in values) {
  11332. me.queryKeys.push(key);
  11333. if (typeof values[key] !== 'string') {
  11334. values[key] = SuperMap.Util.toJSON(values[key]);
  11335. }
  11336. var tempValue = encodeURIComponent(values[key]);
  11337. me.queryValues.push(tempValue);
  11338. }
  11339. },
  11340. issue: function (config) {
  11341. var me = this,
  11342. uid = me.getUid(),
  11343. url = config.url,
  11344. splitQuestUrl = [];
  11345. var p = new Promise(function (resolve) {
  11346. me.supermap_callbacks[uid] = function (response) {
  11347. delete me.supermap_callbacks[uid];
  11348. resolve(response);
  11349. };
  11350. });
  11351. // me.addQueryStrings({
  11352. // callback: "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  11353. // });
  11354. var sectionURL = url,
  11355. keysCount = 0; //此次sectionURL中有多少个key
  11356. var length = me.queryKeys ? me.queryKeys.length : 0;
  11357. for (var i = 0; i < length; i++) {
  11358. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  11359. //+2 for ("&"or"?")and"="
  11360. if (keysCount == 0) {
  11361. return false;
  11362. }
  11363. splitQuestUrl.push(sectionURL);
  11364. sectionURL = url;
  11365. keysCount = 0;
  11366. i--;
  11367. } else {
  11368. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  11369. var leftValue = me.queryValues[i];
  11370. while (leftValue.length > 0) {
  11371. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  11372. if (sectionURL.indexOf('?') > -1) {
  11373. sectionURL += '&';
  11374. } else {
  11375. sectionURL += '?';
  11376. }
  11377. var tempLeftValue = leftValue.substring(0, leftLength);
  11378. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  11379. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  11380. leftLength -= 1;
  11381. tempLeftValue = leftValue.substring(0, leftLength);
  11382. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  11383. leftLength -= 2;
  11384. tempLeftValue = leftValue.substring(0, leftLength);
  11385. }
  11386. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  11387. leftValue = leftValue.substring(leftLength);
  11388. if (tempLeftValue.length > 0) {
  11389. splitQuestUrl.push(sectionURL);
  11390. sectionURL = url;
  11391. keysCount = 0;
  11392. }
  11393. }
  11394. } else {
  11395. keysCount++;
  11396. if (sectionURL.indexOf('?') > -1) {
  11397. sectionURL += '&';
  11398. } else {
  11399. sectionURL += '?';
  11400. }
  11401. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  11402. }
  11403. }
  11404. }
  11405. splitQuestUrl.push(sectionURL);
  11406. me.send(
  11407. splitQuestUrl,
  11408. 'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
  11409. config && config.proxy
  11410. );
  11411. return p;
  11412. },
  11413. getUid: function () {
  11414. var uid = new Date().getTime(),
  11415. random = Math.floor(Math.random() * 1e17);
  11416. return uid * 1000 + random;
  11417. },
  11418. send: function (splitQuestUrl, callback, proxy) {
  11419. var len = splitQuestUrl.length;
  11420. if (len > 0) {
  11421. var jsonpUserID = new Date().getTime();
  11422. for (var i = 0; i < len; i++) {
  11423. var url = splitQuestUrl[i];
  11424. if (url.indexOf('?') > -1) {
  11425. url += '&';
  11426. } else {
  11427. url += '?';
  11428. }
  11429. url += 'sectionCount=' + len;
  11430. url += '&sectionIndex=' + i;
  11431. url += '&jsonpUserID=' + jsonpUserID;
  11432. if (proxy) {
  11433. url = decodeURIComponent(url);
  11434. url = proxy + encodeURIComponent(url);
  11435. }
  11436. fetch_jsonp_default()(url, {
  11437. jsonpCallbackFunction: callback,
  11438. timeout: 30000
  11439. });
  11440. }
  11441. }
  11442. },
  11443. GET: function (config) {
  11444. var me = this;
  11445. me.queryKeys.length = 0;
  11446. me.queryValues.length = 0;
  11447. me.addQueryStrings(config.params);
  11448. return me.issue(config);
  11449. },
  11450. POST: function (config) {
  11451. var me = this;
  11452. me.queryKeys.length = 0;
  11453. me.queryValues.length = 0;
  11454. me.addQueryStrings({
  11455. requestEntity: config.data
  11456. });
  11457. return me.issue(config);
  11458. },
  11459. PUT: function (config) {
  11460. var me = this;
  11461. me.queryKeys.length = 0;
  11462. me.queryValues.length = 0;
  11463. me.addQueryStrings({
  11464. requestEntity: config.data
  11465. });
  11466. return me.issue(config);
  11467. },
  11468. DELETE: function (config) {
  11469. var me = this;
  11470. me.queryKeys.length = 0;
  11471. me.queryValues.length = 0;
  11472. me.addQueryStrings({
  11473. requestEntity: config.data
  11474. });
  11475. return me.issue(config);
  11476. }
  11477. };
  11478. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  11479. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11480. * This program are made available under the terms of the Apache License, Version 2.0
  11481. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11482. /**
  11483. * @name SecurityManager
  11484. * @memberOf SuperMap
  11485. * @namespace
  11486. * @category Security
  11487. * @description 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  11488. * > 使用说明:
  11489. * > 创建任何一个服务之前调用 {@link SuperMap.SecurityManager.registerToken}或
  11490. * > {@link SuperMap.SecurityManager.registerKey}注册凭据。
  11491. * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
  11492. */
  11493. class SecurityManager {
  11494. /**
  11495. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  11496. * @function SuperMap.SecurityManager.generateToken
  11497. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  11498. * @param {SuperMap.TokenServiceParameter} tokenParam - token 申请参数。
  11499. * @returns {Promise} 返回包含 token 信息的 Promise 对象。
  11500. */
  11501. static generateToken(url, tokenParam) {
  11502. var serverInfo = this.servers[url];
  11503. if (!serverInfo) {
  11504. return;
  11505. }
  11506. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function (response) {
  11507. return response.text();
  11508. });
  11509. }
  11510. /**
  11511. * @description 注册安全服务器相关信息。
  11512. * @function SuperMap.SecurityManager.registerServers
  11513. * @param {SuperMap.ServerInfo} serverInfos - 服务器信息。
  11514. */
  11515. static registerServers(serverInfos) {
  11516. this.servers = this.servers || {};
  11517. if (!Util.isArray(serverInfos)) {
  11518. serverInfos = [serverInfos];
  11519. }
  11520. for (var i = 0; i < serverInfos.length; i++) {
  11521. var serverInfo = serverInfos[i];
  11522. this.servers[serverInfo.server] = serverInfo;
  11523. }
  11524. }
  11525. /**
  11526. * @description 服务请求都会自动带上这个 token。
  11527. * @function SuperMap.SecurityManager.registerToken
  11528. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  11529. * @param {string} token - token
  11530. */
  11531. static registerToken(url, token) {
  11532. this.tokens = this.tokens || {};
  11533. if (!url || !token) {
  11534. return;
  11535. }
  11536. var domain = this._getTokenStorageKey(url);
  11537. this.tokens[domain] = token;
  11538. }
  11539. /**
  11540. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  11541. * @function SuperMap.SecurityManager.registerKey
  11542. * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
  11543. * @param {string} key - key
  11544. */
  11545. static registerKey(ids, key) {
  11546. this.keys = this.keys || {};
  11547. if (!ids || ids.length < 1 || !key) {
  11548. return;
  11549. }
  11550. ids = (Util.isArray(ids)) ? ids : [ids];
  11551. for (var i = 0; i < ids.length; i++) {
  11552. var id = this._getUrlRestString(ids[0]) || ids[0];
  11553. this.keys[id] = key;
  11554. }
  11555. }
  11556. /**
  11557. * @description 获取服务器信息。
  11558. * @function SuperMap.SecurityManager.getServerInfo
  11559. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  11560. * @returns {SuperMap.ServerInfo} 服务器信息。
  11561. */
  11562. static getServerInfo(url) {
  11563. this.servers = this.servers || {};
  11564. return this.servers[url];
  11565. }
  11566. /**
  11567. * @description 根据 Url 获取token。
  11568. * @function SuperMap.SecurityManager.getToken
  11569. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  11570. * @returns {string} token
  11571. */
  11572. static getToken(url) {
  11573. if (!url) {
  11574. return;
  11575. }
  11576. this.tokens = this.tokens || {};
  11577. var domain = this._getTokenStorageKey(url);
  11578. return this.tokens[domain];
  11579. }
  11580. /**
  11581. * @description 根据 Url 获取 key。
  11582. * @function SuperMap.SecurityManager.getKey
  11583. * @param {string} id - id
  11584. * @returns {string} key
  11585. */
  11586. static getKey(id) {
  11587. this.keys = this.keys || {};
  11588. var key = this._getUrlRestString(id) || id;
  11589. return this.keys[key];
  11590. }
  11591. /**
  11592. * @description iServer 登录验证。
  11593. * @function SuperMap.SecurityManager.loginiServer
  11594. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  11595. * @param {string} username - 用户名。
  11596. * @param {string} password - 密码。
  11597. * @param {boolean} [rememberme=false] - 是否记住。
  11598. * @returns {Promise} 返回包含 iServer 登录请求结果的 Promise 对象。
  11599. */
  11600. static loginiServer(url, username, password, rememberme) {
  11601. url = Util.urlPathAppend(url, 'services/security/login');
  11602. var loginInfo = {
  11603. username: username && username.toString(),
  11604. password: password && password.toString(),
  11605. rememberme: rememberme
  11606. };
  11607. loginInfo = JSON.stringify(loginInfo);
  11608. var requestOptions = {
  11609. headers: {
  11610. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  11611. }
  11612. };
  11613. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  11614. return response.json();
  11615. });
  11616. }
  11617. /**
  11618. * @description iServer登出。
  11619. * @function SuperMap.SecurityManager.logoutiServer
  11620. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  11621. * @returns {Promise} 是否登出成功。
  11622. */
  11623. static logoutiServer(url) {
  11624. url = Util.urlPathAppend(url, 'services/security/logout');
  11625. var requestOptions = {
  11626. headers: {
  11627. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  11628. },
  11629. withoutFormatSuffix: true
  11630. };
  11631. return FetchRequest.get(url, "", requestOptions).then(function () {
  11632. return true;
  11633. }).catch(function () {
  11634. return false;
  11635. });
  11636. }
  11637. /**
  11638. * @description Online 登录验证。
  11639. * @function SuperMap.SecurityManager.loginOnline
  11640. * @param {string} callbackLocation - 跳转位置。
  11641. * @param {boolean} [newTab=true] - 是否新窗口打开。
  11642. */
  11643. static loginOnline(callbackLocation, newTab) {
  11644. var loginUrl = SecurityManager.SSO + "/login?service=" + callbackLocation;
  11645. this._open(loginUrl, newTab);
  11646. }
  11647. /**
  11648. * @description iPortal登录验证。
  11649. * @function SuperMap.SecurityManager.loginiPortal
  11650. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  11651. * @param {string} username - 用户名。
  11652. * @param {string} password - 密码。
  11653. * @returns {Promise} 返回包含 iPortal 登录请求结果的 Promise 对象。
  11654. */
  11655. static loginiPortal(url, username, password) {
  11656. url = Util.urlPathAppend(url, 'web/login');
  11657. var loginInfo = {
  11658. username: username && username.toString(),
  11659. password: password && password.toString()
  11660. };
  11661. loginInfo = JSON.stringify(loginInfo);
  11662. var requestOptions = {
  11663. headers: {
  11664. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  11665. },
  11666. withCredentials: true
  11667. };
  11668. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  11669. return response.json();
  11670. });
  11671. }
  11672. /**
  11673. * @description iPortal 登出。
  11674. * @function SuperMap.SecurityManager.logoutiPortal
  11675. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  11676. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  11677. */
  11678. static logoutiPortal(url) {
  11679. url = Util.urlPathAppend(url, 'services/security/logout');
  11680. var requestOptions = {
  11681. headers: {
  11682. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  11683. },
  11684. withCredentials: true,
  11685. withoutFormatSuffix: true
  11686. };
  11687. return FetchRequest.get(url, "", requestOptions).then(function () {
  11688. return true;
  11689. }).catch(function () {
  11690. return false;
  11691. });
  11692. }
  11693. /**
  11694. * @description iManager 登录验证。
  11695. * @function SuperMap.SecurityManager.loginManager
  11696. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  11697. * @param {Object} [loginInfoParams] - iManager 登录参数。
  11698. * @param {string} loginInfoParams.userName - 用户名。
  11699. * @param {string} loginInfoParams.password - 密码。
  11700. * @param {Object} options
  11701. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  11702. * @returns {Promise} 返回包含 iManager 登录请求结果的 Promise 对象。
  11703. */
  11704. static loginManager(url, loginInfoParams, options) {
  11705. if (!Util.isInTheSameDomain(url)) {
  11706. var isNewTab = options ? options.isNewTab : true;
  11707. this._open(url, isNewTab);
  11708. return;
  11709. }
  11710. var requestUrl = Util.urlPathAppend(url, 'icloud/security/tokens');
  11711. var params = loginInfoParams || {};
  11712. var loginInfo = {
  11713. username: params.userName && params.userName.toString(),
  11714. password: params.password && params.password.toString()
  11715. };
  11716. loginInfo = JSON.stringify(loginInfo);
  11717. var requestOptions = {
  11718. headers: {
  11719. 'Accept': '*/*',
  11720. 'Content-Type': 'application/json'
  11721. }
  11722. };
  11723. var me = this;
  11724. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function (response) {
  11725. response.text().then(function (result) {
  11726. me.imanagerToken = result;
  11727. return result;
  11728. });
  11729. });
  11730. }
  11731. /**
  11732. * @description 清空全部验证信息。
  11733. * @function SuperMap.SecurityManager.destroyAllCredentials
  11734. */
  11735. static destroyAllCredentials() {
  11736. this.keys = null;
  11737. this.tokens = null;
  11738. this.servers = null;
  11739. }
  11740. /**
  11741. * @description 清空令牌信息。
  11742. * @function SuperMap.SecurityManager.destroyToken
  11743. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  11744. */
  11745. static destroyToken(url) {
  11746. if (!url) {
  11747. return;
  11748. }
  11749. var domain = this._getTokenStorageKey(url);
  11750. this.tokens = this.tokens || {};
  11751. if (this.tokens[domain]) {
  11752. delete this.tokens[domain];
  11753. }
  11754. }
  11755. /**
  11756. * @description 清空服务授权码。
  11757. * @function SuperMap.SecurityManager.destroyKey
  11758. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  11759. */
  11760. static destroyKey(url) {
  11761. if (!url) {
  11762. return;
  11763. }
  11764. this.keys = this.keys || {};
  11765. var key = this._getUrlRestString(url) || url;
  11766. if (this.keys[key]) {
  11767. delete this.keys[key];
  11768. }
  11769. }
  11770. static _open(url, newTab) {
  11771. newTab = (newTab != null) ? newTab : true;
  11772. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  11773. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  11774. var options =
  11775. "height=" + this.INNER_WINDOW_HEIGHT + ", width=" + this.INNER_WINDOW_WIDTH +
  11776. ",top=" + offsetY + ", left=" + offsetX +
  11777. ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  11778. if (newTab) {
  11779. window.open(url, 'login');
  11780. } else {
  11781. window.open(url, 'login', options);
  11782. }
  11783. }
  11784. static _getTokenStorageKey(url) {
  11785. var patten = /(.*?):\/\/([^\/]+)/i;
  11786. var result = url.match(patten);
  11787. if (!result) {
  11788. return url;
  11789. }
  11790. return result[0];
  11791. }
  11792. static _getUrlRestString(url) {
  11793. if (!url) {
  11794. return url;
  11795. }
  11796. // var patten = /http:\/\/(.*\/rest)/i;
  11797. var patten = /(http|https):\/\/(.*\/rest)/i;
  11798. var result = url.match(patten);
  11799. if (!result) {
  11800. return url;
  11801. }
  11802. return result[0];
  11803. }
  11804. }
  11805. SecurityManager.INNER_WINDOW_WIDTH = 600;
  11806. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  11807. SecurityManager.SSO = "https://sso.supermap.com";
  11808. SecurityManager.ONLINE = "https://www.supermapol.com";
  11809. SuperMap.SecurityManager = SecurityManager;
  11810. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  11811. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11812. * This program are made available under the terms of the Apache License, Version 2.0
  11813. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11814. /**
  11815. * @class SuperMap.iManagerServiceBase
  11816. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  11817. * @category iManager
  11818. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  11819. * @param {Object} options - 服务参数。
  11820. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  11821. * @param {Object} [options.headers] - 请求头。
  11822. */
  11823. class IManagerServiceBase {
  11824. constructor(url,options) {
  11825. if (url) {
  11826. var end = url.substr(url.length - 1, 1);
  11827. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  11828. }
  11829. this.options = options || {};
  11830. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  11831. }
  11832. /**
  11833. * @function SuperMap.iManagerServiceBase.prototype.request
  11834. * @description 子类统一通过该方法发送请求。
  11835. * @param {string} url - 请求 URL。
  11836. * @param {string} [method='GET'] - 请求类型。
  11837. * @param {Object} [requestOptions] - 请求选项。
  11838. * @param {Object} param - 请求参数。
  11839. * @description 发送请求。
  11840. * @returns {Promise} Promise 对象。
  11841. */
  11842. request(method, url, param, requestOptions) {
  11843. requestOptions = requestOptions || {
  11844. headers: {
  11845. 'Accept': '*/*',
  11846. 'Content-Type': 'application/json'
  11847. }
  11848. };
  11849. if (!requestOptions.hasOwnProperty("withCredentials")) {
  11850. requestOptions['withCredentials'] = true;
  11851. }
  11852. requestOptions['crossOrigin'] = this.options.crossOrigin;
  11853. requestOptions['headers'] = this.options.headers;
  11854. var token = SecurityManager.imanagerToken;
  11855. if (token) {
  11856. if (!requestOptions.headers) {
  11857. requestOptions.headers = [];
  11858. }
  11859. requestOptions.headers['X-Auth-Token'] = token;
  11860. }
  11861. if (param) {
  11862. param = JSON.stringify(param);
  11863. }
  11864. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  11865. return response.json();
  11866. });
  11867. }
  11868. }
  11869. SuperMap.iManagerServiceBase = IManagerServiceBase;
  11870. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  11871. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11872. * This program are made available under the terms of the Apache License, Version 2.0
  11873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11874. /**
  11875. * @class SuperMap.iManagerCreateNodeParam
  11876. * @classdesc iManager 创建节点参数。
  11877. * @category iManager
  11878. * @param {Object} [params] - iManager 创建节点参数。
  11879. *
  11880. */
  11881. class IManagerCreateNodeParam {
  11882. constructor(params) {
  11883. params = params || {};
  11884. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  11885. this.nodeCount = 1; //要创建vm的个数
  11886. this.nodeName = ''; //vm名称
  11887. this.password = ''; //vm的密码,空表示随机分配
  11888. this.description = ''; //描述信息
  11889. this.physicalMachineName = ''; //vm所属的物理机名称.
  11890. this.ips = []; //vm的ip,空数组表示随机分配
  11891. this.userName = ''; //vm所属用户
  11892. Util.extend(this, params);
  11893. }
  11894. }
  11895. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  11896. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  11897. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11898. * This program are made available under the terms of the Apache License, Version 2.0
  11899. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11900. /**
  11901. * @class SuperMap.iManager
  11902. * @classdesc iManager 服务类。
  11903. * @category iManager
  11904. * @param {string} serviceUrl - iManager 首页地址。
  11905. *
  11906. */
  11907. class IManager extends IManagerServiceBase {
  11908. constructor(iManagerUrl) {
  11909. super(iManagerUrl);
  11910. }
  11911. /**
  11912. * @function SuperMap.iManager.prototype.load
  11913. * @description 获取所有服务接口,验证是否已登录授权。
  11914. * @returns {Promise} Promise 对象。
  11915. */
  11916. load() {
  11917. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  11918. }
  11919. /**
  11920. * @function SuperMap.iManager.prototype.createIServer
  11921. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  11922. * @description 创建 iServer。
  11923. * @returns {Promise} Promise 对象。
  11924. */
  11925. createIServer(createParam) {
  11926. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  11927. }
  11928. /**
  11929. * @function SuperMap.iManager.prototype.createIPortal
  11930. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  11931. * @description 创建 iPortal。
  11932. * @returns {Promise} Promise 对象。
  11933. */
  11934. createIPortal(createParam) {
  11935. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  11936. }
  11937. /**
  11938. * @function SuperMap.iManager.prototype.iServerList
  11939. * @description 获取所有创建的 iServer。
  11940. * @returns {Promise} Promise 对象。
  11941. */
  11942. iServerList() {
  11943. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  11944. }
  11945. /**
  11946. * @function SuperMap.iManager.prototype.iPortalList
  11947. * @description 获取所有创建的 iPortal。
  11948. * @returns {Promise} Promise 对象。
  11949. */
  11950. iPortalList() {
  11951. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  11952. }
  11953. /**
  11954. * @function SuperMap.iManager.prototype.startNodes
  11955. * @param {Array} ids - 需要启动节点的 ID 数组。e.g:['1']。
  11956. * @description 启动节点。
  11957. * @returns {Promise} Promise 对象。
  11958. */
  11959. startNodes(ids) {
  11960. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  11961. }
  11962. /**
  11963. * @function SuperMap.iManager.prototype.stopNodes
  11964. * @param {Array} ids - 需要停止节点的 ID 数组。e.g:['1']。
  11965. * @description 停止节点。
  11966. * @returns {Promise} Promise 对象。
  11967. */
  11968. stopNodes(ids) {
  11969. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  11970. }
  11971. }
  11972. SuperMap.iManager = IManager;
  11973. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  11974. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11975. * This program are made available under the terms of the Apache License, Version 2.0
  11976. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11977. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  11978. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11979. * This program are made available under the terms of the Apache License, Version 2.0
  11980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11981. /**
  11982. * @class SuperMap.iPortalServiceBase
  11983. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  11984. * @category iPortal/Online
  11985. * @param {string} url - iPortal 服务地址。
  11986. * @param {Object} options - 可选参数。
  11987. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  11988. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  11989. * @param {Object} [options.headers] - 请求头。
  11990. */
  11991. class IPortalServiceBase {
  11992. constructor(url, options) {
  11993. options = options || {};
  11994. this.serviceUrl = url;
  11995. this.serverType = ServerType.iPortal;
  11996. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  11997. this.withCredentials = options.withCredentials || false;
  11998. this.crossOrigin = options.crossOrigin
  11999. this.headers = options.headers
  12000. }
  12001. /**
  12002. * @function SuperMap.iPortalServiceBase.prototype.request
  12003. * @description 子类统一通过该方法发送请求。
  12004. * @param {string} [method='GET'] - 请求类型。
  12005. * @param {string} url - 服务地址。
  12006. * @param {Object} param - 请求参数。
  12007. * @param {Object} [requestOptions] - fetch 请求配置项。
  12008. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  12009. */
  12010. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  12011. url = this.createCredentialUrl(url);
  12012. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  12013. return response.json();
  12014. });
  12015. }
  12016. /**
  12017. * @function SuperMap.iPortalServiceBase.prototype.createCredentialUrl
  12018. * @description 追加授权信息。
  12019. * @param {string} url - 创建证书 URL 地址。
  12020. * @returns {string} 携带 token 或 key 的新地址。
  12021. */
  12022. createCredentialUrl(url) {
  12023. var newUrl = url,
  12024. credential = this.getCredential();
  12025. if (credential) {
  12026. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  12027. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  12028. newUrl += credential.getUrlParameters();
  12029. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  12030. newUrl += "&" + credential.getUrlParameters();
  12031. } else {
  12032. newUrl += "?" + credential.getUrlParameters();
  12033. }
  12034. }
  12035. return newUrl;
  12036. }
  12037. /**
  12038. * @function SuperMap.iPortalServiceBase.prototype.getCredential
  12039. * @description 获取 token。
  12040. * @returns {string} 返回获取的 token。
  12041. *
  12042. */
  12043. getCredential() {
  12044. var credential,
  12045. value = SecurityManager.getToken(this.serviceUrl);
  12046. credential = value ? new Credential(value, "token") : null;
  12047. if (!credential) {
  12048. value = this.getKey();
  12049. credential = value ? new Credential(value, "key") : null;
  12050. }
  12051. return credential;
  12052. }
  12053. /**
  12054. * @function SuperMap.iPortalServiceBase.prototype.getKey
  12055. * @description 其子类需要重写该方法,修改其中获取 key 的字段,存储 key 可能是服务 ID 字段,可能是 URL。
  12056. */
  12057. getKey() {
  12058. //return SuperMap.SecurityManager.getKey(this.id);
  12059. //或
  12060. //return SuperMap.SecurityManager.getKey(this.serviceUrl);
  12061. }
  12062. }
  12063. SuperMap.iPortalServiceBase = IPortalServiceBase;
  12064. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  12065. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12066. * This program are made available under the terms of the Apache License, Version 2.0
  12067. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12068. /**
  12069. * @class SuperMap.iPortalQueryParam
  12070. * @classdesc iPortal 资源查询参数。
  12071. * @version 10.0.1
  12072. * @category iPortal/Online
  12073. * @param {Object} params - iPortal 资源查询具体参数。
  12074. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型
  12075. * @param {number} [params.pageSize] - 分页中每页大小。
  12076. * @param {number} [params.currentPage] - 分页页码。
  12077. * @param {SuperMap.OrderBy} [params.orderBy] - 排序字段。
  12078. * @param {SuperMap.OrderType} [params.orderType] - 根据升序还是降序过滤。
  12079. * @param {SuperMap.SearchType} [params.searchType] - 根据查询的范围进行过滤。
  12080. * @param {Array} [params.tags] - 标签。
  12081. * @param {Array} [params.dirIds] - 目录 id
  12082. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  12083. * @param {SuperMap.AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  12084. * @param {string} [params.text] - 搜索的关键词。
  12085. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  12086. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  12087. */
  12088. class IPortalQueryParam {
  12089. constructor(params) {
  12090. params = params || {};
  12091. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  12092. this.pageSize = 12; // 每页多少条
  12093. this.currentPage = 1; // 第几页
  12094. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  12095. this.orderType = "DESC"; // DESC ASC
  12096. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  12097. this.tags = []; // 标签
  12098. this.dirIds = []; // 类别
  12099. this.resourceSubTypes = []; // 类型
  12100. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  12101. this.text = ""; // 搜索字段
  12102. this.groupIds = []; // 群组Id过滤
  12103. this.departmentIds = []; // 部门Id过滤
  12104. Util.extend(this, params);
  12105. }
  12106. }
  12107. SuperMap.iPortalQueryParam = IPortalQueryParam;
  12108. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  12109. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12110. * This program are made available under the terms of the Apache License, Version 2.0
  12111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12112. /**
  12113. * @class SuperMap.iPortalQueryResult
  12114. * @classdesc iPortal 资源结果集封装类。
  12115. * @version 10.0.1
  12116. * @category iPortal/Online
  12117. * @param {Object} queryResult - 资源参数。
  12118. * @param {Array} [queryResult.content] - 页面内容。
  12119. * @param {number} [queryResult.total] - 总记录数。
  12120. * @param {number} [queryResult.currentPage] - 当前第几页。
  12121. * @param {number} [queryResult.pageSize] - 每页大小。
  12122. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  12123. */
  12124. class IPortalQueryResult {
  12125. constructor(queryResult) {
  12126. queryResult = queryResult || {};
  12127. this.content = [];
  12128. this.total = 0;
  12129. this.currentPage = 1;
  12130. this.pageSize = 12;
  12131. this.aggregations = null;
  12132. Util.extend(this, queryResult);
  12133. }
  12134. }
  12135. SuperMap.iPortalQueryResult = IPortalQueryResult;
  12136. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  12137. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12138. * This program are made available under the terms of the Apache License, Version 2.0
  12139. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12140. /**
  12141. * @class SuperMap.iPortalResource
  12142. * @classdesc iPortal 资源详情类。
  12143. * @version 10.0.1
  12144. * @category iPortal/Online
  12145. * @param {string} portalUrl - 资源地址。
  12146. * @param {Object} resourceInfo - 资源详情参数。
  12147. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息
  12148. * @param {string} [resourceInfo.bounds] - 资源的坐标范围
  12149. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  12150. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED
  12151. * @param {Date} [resourceInfo.createTime] - 资源的创建时间
  12152. * @param {string} [resourceInfo.description] - 资源描述
  12153. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的id
  12154. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  12155. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  12156. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档id
  12157. * @param {string} [resourceInfo.name] - 资源名称
  12158. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的id
  12159. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的id
  12160. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  12161. * @param {SuperMap.ResourceType} [resourceInfo.resourceType] - 资源类型
  12162. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID
  12163. * @param {Array} [resourceInfo.tags] - 资源的标签
  12164. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图
  12165. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间
  12166. * @param {string} [resourceInfo.userName] - 搜索的关键词
  12167. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  12168. * @extends {SuperMap.iPortalServiceBase}
  12169. */
  12170. class IPortalResource extends IPortalServiceBase {
  12171. constructor(portalUrl, resourceInfo) {
  12172. super(portalUrl);
  12173. resourceInfo = resourceInfo || {};
  12174. this.authorizeSetting = [];
  12175. this.bounds = "";
  12176. this.bounds4326 = "";
  12177. this.checkStatus = "";
  12178. this.createTime = 0;
  12179. this.description = null;
  12180. this.dirId = null;
  12181. this.epsgCode = 0;
  12182. this.heatLevel = 0;
  12183. this.id = 0;
  12184. this.name = "";
  12185. this.personalDirId = null;
  12186. this.resourceId = 0;
  12187. this.resourceSubType = null;
  12188. this.resourceType = null;
  12189. this.serviceRootUrlId = null;
  12190. this.tags = null;
  12191. this.thumbnail = null;
  12192. this.updateTime = 0;
  12193. this.userName = "";
  12194. this.sourceJSON = {};//返回门户资源详细信息
  12195. Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  12196. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  12197. if (this.withCredentials) {
  12198. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  12199. }
  12200. // if (this.id) {
  12201. // this.mapUrl = mapUrl + "/" + this.id;
  12202. // }
  12203. }
  12204. /**
  12205. * @function SuperMap.iPortalResource.prototype.load
  12206. * @description 加载资源信息。
  12207. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  12208. */
  12209. load() {
  12210. var me = this;
  12211. return me.request("GET", me.resourceUrl + ".json")
  12212. .then(function (resourceInfo) {
  12213. if (resourceInfo.error) {
  12214. return resourceInfo;
  12215. }
  12216. me.sourceJSON = resourceInfo;
  12217. });
  12218. }
  12219. /**
  12220. * @function SuperMap.iPortalResource.prototype.update
  12221. * @description 更新资源属性信息。
  12222. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  12223. */
  12224. update() {
  12225. var resourceName = this.resourceType.replace("_","").toLowerCase();
  12226. var options = {
  12227. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  12228. };
  12229. if( resourceName === 'data') {
  12230. this.resourceUrl = this.resourceUrl + "/attributes.json";
  12231. }
  12232. var entity = JSON.stringify(this.sourceJSON);
  12233. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  12234. if( resourceName === 'service') {
  12235. var serviceInfo = {
  12236. authorizeSetting:this.sourceJSON.authorizeSetting,
  12237. metadata:this.sourceJSON.metadata,
  12238. tags:this.sourceJSON.tags,
  12239. thumbnail:this.sourceJSON.thumbnail,
  12240. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  12241. };
  12242. entity = JSON.stringify(serviceInfo);
  12243. }
  12244. return this.request("PUT", this.resourceUrl, entity, options);
  12245. }
  12246. }
  12247. SuperMap.iPortalResource = IPortalResource;
  12248. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  12249. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12250. * This program are made available under the terms of the Apache License, Version 2.0
  12251. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12252. /**
  12253. * @class SuperMap.iPortalShareParam
  12254. * @classdesc iPortal 资源共享参数。
  12255. * @version 10.0.1
  12256. * @category iPortal/Online
  12257. * @param {Object} params - iPortal 资源共享具体参数。
  12258. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型。
  12259. * @param {Array} [params.ids] - 资源的id数组。
  12260. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  12261. */
  12262. class IPortalShareParam {
  12263. constructor(params) {
  12264. params = params || {};
  12265. this.ids = [];
  12266. this.entities = [];
  12267. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  12268. Util.extend(this, params);
  12269. }
  12270. }
  12271. SuperMap.iPortalShareParam = IPortalShareParam;
  12272. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  12273. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12274. * This program are made available under the terms of the Apache License, Version 2.0
  12275. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12276. /**
  12277. * @class SuperMap.iPortal
  12278. * @classdesc 对接 SuperMap iPortal 基础服务。
  12279. * @category iPortal/Online
  12280. * @extends {SuperMap.iPortalServiceBase}
  12281. * @param {string} iportalUrl - 地址。
  12282. * @param {Object} options - 参数。
  12283. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  12284. */
  12285. class IPortal extends IPortalServiceBase {
  12286. constructor(iportalUrl, options) {
  12287. super(iportalUrl, options);
  12288. this.iportalUrl = iportalUrl;
  12289. options = options || {};
  12290. this.withCredentials = options.withCredentials || false;
  12291. }
  12292. /**
  12293. * @function SuperMap.iPortal.prototype.load
  12294. * @description 加载页面。
  12295. * @returns {Promise} 返回包含 iportal web 资源信息的 Promise 对象。
  12296. */
  12297. load() {
  12298. return FetchRequest.get(this.iportalUrl + "/web");
  12299. }
  12300. /**
  12301. * @function SuperMap.iPortal.prototype.queryResources
  12302. * @description 查询资源。
  12303. * @version 10.0.1
  12304. * @param {SuperMap.iPortalQueryParam} queryParams - 查询参数。
  12305. * @returns {Promise} 返回包含所有资源结果的 Promise 对象。
  12306. */
  12307. queryResources(queryParams) {
  12308. if (!(queryParams instanceof IPortalQueryParam)) {
  12309. return new Promise( function(resolve){
  12310. resolve(
  12311. "queryParams is not instanceof iPortalQueryParam !"
  12312. );
  12313. });
  12314. }
  12315. var me = this;
  12316. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  12317. queryParams.t = new Date().getTime();
  12318. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  12319. var content = [];
  12320. result.content.forEach(function(item) {
  12321. content.push(new IPortalResource(me.iportalUrl, item));
  12322. });
  12323. let queryResult = new IPortalQueryResult();
  12324. queryResult.content = content;
  12325. queryResult.total = result.total;
  12326. queryResult.currentPage = result.currentPage;
  12327. queryResult.pageSize = result.pageSize;
  12328. queryResult.aggregations = result.aggregations;
  12329. return queryResult;
  12330. });
  12331. }
  12332. /**
  12333. * @function SuperMap.iPortal.prototype.updateResourcesShareSetting
  12334. * @description 更新共享设置。
  12335. * @version 10.0.1
  12336. * @param {SuperMap.iPortalShareParam} shareParams - 共享的参数。
  12337. * @returns {Promise} 返回包含共享资源结果的 Promise 对象。
  12338. */
  12339. updateResourcesShareSetting(shareParams) {
  12340. if (!(shareParams instanceof IPortalShareParam)) {
  12341. return new Promise( function(resolve){
  12342. resolve(
  12343. "shareParams is not instanceof iPortalShareParam !"
  12344. );
  12345. });
  12346. }
  12347. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  12348. if(resourceUrlName === "datas"){
  12349. resourceUrlName = "mycontent/"+resourceUrlName;
  12350. }
  12351. var cloneShareParams = {
  12352. ids: shareParams.ids,
  12353. entities: shareParams.entities
  12354. }
  12355. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  12356. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  12357. return result;
  12358. });
  12359. }
  12360. }
  12361. SuperMap.iPortal = IPortal;
  12362. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  12363. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12364. * This program are made available under the terms of the Apache License, Version 2.0
  12365. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12366. /**
  12367. * @class SuperMap.iPortalShareEntity
  12368. * @classdesc iPortal 资源共享实体参数。
  12369. * @version 10.0.1
  12370. * @category iPortal/Online
  12371. * @param {Object} shareEntity - iPortal 资源共享实体具体参数。
  12372. * @param {SuperMap.PermissionType} [shareEntity.permissionType] - 权限类型。
  12373. * @param {SuperMap.EntityType} [shareEntity.entityType] - 实体类型
  12374. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、 ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  12375. * @param {number} [shareEntity.entityId] - 实体的 id。用于群组的授权。
  12376. */
  12377. class IPortalShareEntity {
  12378. constructor(shareEntity) {
  12379. shareEntity = shareEntity || {};
  12380. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  12381. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  12382. this.entityName = "GUEST"; // GUEST or 具体用户 name
  12383. this.entityId = null;
  12384. Util.extend(this, shareEntity);
  12385. }
  12386. }
  12387. SuperMap.iPortalShareEntity = IPortalShareEntity;
  12388. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  12389. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12390. * This program are made available under the terms of the Apache License, Version 2.0
  12391. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12392. /**
  12393. * @class SuperMap.iPortalAddResourceParam
  12394. * @classdesc iPortal 添加资源参数。
  12395. * @version 10.0.1
  12396. * @category iPortal/Online
  12397. * @param {Object} params - iPortal 添加资源具体参数。
  12398. * @param {String} [params.rootUrl] - 服务地址。
  12399. * @param {Array} [params.tags] - 标签。
  12400. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  12401. */
  12402. class IPortalAddResourceParam {
  12403. constructor(params) {
  12404. params = params || {};
  12405. this.rootUrl = "";
  12406. this.tags = [];
  12407. this.entities = [];
  12408. Util.extend(this, params);
  12409. }
  12410. }
  12411. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  12412. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  12413. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12414. * This program are made available under the terms of the Apache License, Version 2.0
  12415. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12416. /**
  12417. * @class SuperMap.iPortalRegisterServiceParam
  12418. * @classdesc iPortal 注册服务参数。
  12419. * @version 10.0.1
  12420. * @category iPortal/Online
  12421. * @param {Object} params - iPortal 注册服务具体参数。
  12422. * @param {String} [params.type] - 服务类型。
  12423. * @param {Array} [params.tags] - 服务标签。
  12424. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  12425. * @param {Object} [params.metadata] - 服务元信息。
  12426. * @param {Array} [params.addedMapNames] - 地图服务列表。
  12427. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  12428. */
  12429. class IPortalRegisterServiceParam {
  12430. constructor(params) {
  12431. params = params || {};
  12432. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  12433. this.tags = [];
  12434. this.entities = [];
  12435. this.metadata = {};
  12436. this.addedMapNames = [];
  12437. this.addedSceneNames = [];
  12438. Util.extend(this, params);
  12439. }
  12440. }
  12441. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  12442. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  12443. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12444. * This program are made available under the terms of the Apache License, Version 2.0
  12445. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12446. /**
  12447. * @class SuperMap.iPortalAddDataParam
  12448. * @classdesc iPortal 上传/注册数据所需的参数。
  12449. * @version 10.0.1
  12450. * @category iPortal/Online
  12451. * @param {Object} params - iPortal 上传/注册数据所需的具体参数。
  12452. * @param {string} params.fileName - 文件名称
  12453. * @param {SuperMap.DataItemType} params.type - 数据类型。
  12454. * @param {Array} [params.tags] - 数据的标签
  12455. * @param {SuperMap.iPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息
  12456. */
  12457. class IPortalAddDataParam {
  12458. constructor(params) {
  12459. params = params || {};
  12460. this.fileName = "";
  12461. this.type = "";
  12462. this.tags = [];
  12463. this.dataMetaInfo = {};
  12464. Util.extend(this, params);
  12465. }
  12466. }
  12467. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  12468. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  12469. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12470. * This program are made available under the terms of the Apache License, Version 2.0
  12471. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12472. /**
  12473. * @class SuperMap.iPortalDataMetaInfoParam
  12474. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  12475. * @version 10.0.1
  12476. * @category iPortal/Online
  12477. * @param {Object} params - iPortal 获取数据项id excel csv类型的数据所需数据元信息具体参数。
  12478. * @param {string} params.xField - X 坐标字段
  12479. * @param {string} params.yField - Y 坐标字段
  12480. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)
  12481. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)
  12482. * @param {array} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为[a,b,,c]。
  12483. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)
  12484. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)
  12485. * @param {boolean} params.url - HDFS注册目录地址
  12486. * @param {SuperMap.iPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息
  12487. */
  12488. class IPortalDataMetaInfoParam {
  12489. constructor(params) {
  12490. params = params || {};
  12491. this.xField = "";
  12492. this.yField = "";
  12493. this.fileEncoding = "UTF-8";
  12494. this.xIndex = 1;
  12495. this.yIndex = 1;
  12496. this.fieldTypes = [];
  12497. this.separator = "";
  12498. this.firstRowIsHead = true;
  12499. this.url = "";
  12500. this.dataStoreInfo = {};
  12501. Util.extend(this, params);
  12502. }
  12503. }
  12504. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  12505. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  12506. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12507. * This program are made available under the terms of the Apache License, Version 2.0
  12508. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12509. /**
  12510. * @class SuperMap.iPortalDataStoreInfoParam
  12511. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  12512. * @version 10.0.1
  12513. * @category iPortal/Online
  12514. * @param {Object} params - iPortal 注册一个HBASE HDFS数据存储类具体参数。
  12515. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE
  12516. * @param {string} params.url - HDFS数据存储目录地址
  12517. * @param {SuperMap.iPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息
  12518. */
  12519. class IPortalDataStoreInfoParam {
  12520. constructor(params) {
  12521. params = params || {};
  12522. this.type = "";
  12523. this.url = "";
  12524. this.connectionInfo = {};
  12525. Util.extend(this, params);
  12526. }
  12527. }
  12528. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  12529. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  12530. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12531. * This program are made available under the terms of the Apache License, Version 2.0
  12532. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12533. /**
  12534. * @class SuperMap.iPortalDataConnectionInfoParam
  12535. * @classdesc iPortal HBASE数据源连接信息类。
  12536. * @version 10.0.1
  12537. * @category iPortal/Online
  12538. * @param {Object} params - iPortal HBASE数据源连接信息类具体参数。
  12539. * @param {string} params.dataBase - 数据源连接的数据库名。
  12540. * @param {string} params.server - 服务地址。
  12541. */
  12542. class IPortalDataConnectionInfoParam {
  12543. constructor(params) {
  12544. params = params || {};
  12545. this.dataBase = "";
  12546. this.server = "";
  12547. Util.extend(this, params);
  12548. }
  12549. }
  12550. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  12551. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  12552. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12553. * This program are made available under the terms of the Apache License, Version 2.0
  12554. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12555. /**
  12556. * @class SuperMap.iPortalUser
  12557. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  12558. * @version 10.0.1
  12559. * @category iPortal/Online
  12560. * @param {string} iportalUrl - iportal根地址。
  12561. * @extends {SuperMap.iPortalServiceBase}
  12562. *
  12563. */
  12564. class IPortalUser extends IPortalServiceBase {
  12565. constructor(iportalUrl) {
  12566. super(iportalUrl);
  12567. this.iportalUrl = iportalUrl;
  12568. }
  12569. /**
  12570. * @function SuperMap.iPortalUser.prototype.deleteResources
  12571. * @description 删除资源。
  12572. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  12573. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  12574. */
  12575. deleteResources(params) {
  12576. var resourceName = params.resourceType.replace("_","").toLowerCase();
  12577. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  12578. if( resourceName === 'data') {
  12579. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  12580. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  12581. }
  12582. return this.request("DELETE", deleteResourceUrl);
  12583. }
  12584. /**
  12585. * @function SuperMap.iPortalUser.prototype.addMap
  12586. * @description 添加地图。
  12587. * @version 10.1.0
  12588. * @param {SuperMap.iPortalAddResourceParam} addMapParams - 添加地图的参数。
  12589. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  12590. */
  12591. addMap(addMapParams) {
  12592. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  12593. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  12594. }
  12595. let cloneAddMapParams = {
  12596. rootUrl: addMapParams.rootUrl,
  12597. tags: addMapParams.tags,
  12598. authorizeSetting: addMapParams.entities
  12599. }
  12600. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  12601. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  12602. return result;
  12603. });
  12604. }
  12605. /**
  12606. * @function SuperMap.iPortalUser.prototype.addScene
  12607. * @description 添加场景。
  12608. * @version 10.1.0
  12609. * @param {SuperMap.iPortalAddResourceParam} addSceneParams - 添加场景的参数。
  12610. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  12611. */
  12612. addScene(addSceneParams) {
  12613. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  12614. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  12615. }
  12616. let cloneAddSceneParams = {
  12617. rootUrl: addSceneParams.rootUrl,
  12618. tags: addSceneParams.tags,
  12619. authorizeSetting: addSceneParams.entities
  12620. }
  12621. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  12622. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  12623. return result;
  12624. });
  12625. }
  12626. /**
  12627. * @function SuperMap.iPortalUser.prototype.registerService
  12628. * @description 注册服务。
  12629. * @version 10.1.0
  12630. * @param {SuperMap.iPortalRegisterServiceParam} registerParams - 注册服务的参数。
  12631. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  12632. */
  12633. registerService(registerParams) {
  12634. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  12635. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  12636. }
  12637. let cloneRegisterParams = {
  12638. type: registerParams.type,
  12639. tags: registerParams.tags,
  12640. authorizeSetting: registerParams.entities,
  12641. metadata: registerParams.metadata,
  12642. addedMapNames: registerParams.addedMapNames,
  12643. addedSceneNames: registerParams.addedSceneNames
  12644. }
  12645. let registerUrl = this.iportalUrl + "/web/services.json";
  12646. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  12647. return result;
  12648. });
  12649. }
  12650. /**
  12651. * @function SuperMap.iPortalUser.prototype.getErrMsgPromise
  12652. * @description 获取包含错误信息的Promise对象。
  12653. * @version 10.1.0
  12654. * @param {String} errMsg - 传入的错误信息。
  12655. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  12656. */
  12657. getErrMsgPromise(errMsg) {
  12658. return new Promise(resolve => {
  12659. resolve(errMsg);
  12660. })
  12661. }
  12662. /**
  12663. * @function SuperMap.iPortalUser.prototype.uploadDataRequest
  12664. * @description 上传数据。
  12665. * @version 10.1.0
  12666. * @param {number} id - 上传数据的资源id。
  12667. * @param {Object} formData - 请求体为文本数据流。
  12668. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  12669. */
  12670. uploadDataRequest(id,formData) {
  12671. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  12672. return this.request("POST",uploadDataUrl,formData);
  12673. }
  12674. /**
  12675. * @function SuperMap.iPortalUser.prototype.addData
  12676. * @description 上传/注册数据。
  12677. * @version 10.1.0
  12678. * @param {SuperMap.iPortalAddDataParam} params - 上传/注册数据所需的参数。
  12679. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  12680. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  12681. */
  12682. addData(params,formData) {
  12683. if(!(params instanceof IPortalAddDataParam)){
  12684. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  12685. }
  12686. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  12687. var entity = {
  12688. fileName:params.fileName,
  12689. tags:params.tags,
  12690. type:params.type
  12691. };
  12692. var type = params.type.toLowerCase();
  12693. var dataMetaInfo;
  12694. if(type === "excel" || type === "csv"){
  12695. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  12696. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  12697. }
  12698. dataMetaInfo = {
  12699. xField:params.dataMetaInfo.xField,
  12700. yField:params.dataMetaInfo.yField
  12701. }
  12702. if(type === 'csv') {
  12703. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  12704. }
  12705. entity.coordType = "WGS84";
  12706. entity.dataMetaInfo = dataMetaInfo;
  12707. }else if(type === "hdfs" || type === "hbase") {
  12708. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  12709. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  12710. }
  12711. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  12712. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  12713. }
  12714. var dataStoreInfo = {
  12715. type:params.dataMetaInfo.dataStoreInfo.type
  12716. }
  12717. switch (type) {
  12718. case "hdfs":
  12719. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  12720. dataMetaInfo = {
  12721. url: params.dataMetaInfo.url,
  12722. dataStoreInfo:dataStoreInfo
  12723. }
  12724. break;
  12725. case "hbase":
  12726. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  12727. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  12728. }
  12729. dataStoreInfo.connectionInfo = {
  12730. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  12731. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  12732. engineType:'HBASE'
  12733. }
  12734. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  12735. dataMetaInfo = {
  12736. dataStoreInfo:dataStoreInfo
  12737. }
  12738. break;
  12739. }
  12740. entity.dataMetaInfo = dataMetaInfo;
  12741. }
  12742. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  12743. if(type === "hdfs" || type === "hbase"){
  12744. return res;
  12745. }else {
  12746. if(res.childID) {
  12747. return this.uploadDataRequest(res.childID,formData);
  12748. }else {
  12749. return res.customResult;
  12750. }
  12751. }
  12752. })
  12753. }
  12754. /**
  12755. * @function SuperMap.iPortalUser.prototype.publishOrUnpublish
  12756. * @description 发布/取消发布。
  12757. * @version 10.1.0
  12758. * @param {object} options - 发布/取消发布数据服务所需的参数。
  12759. * @param {object} options.dataId - 数据项id。
  12760. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  12761. * @param {object} [options.dataServiceId] - 发布的服务 id。
  12762. * @param {boolean} forPublish - 是否取消发布。
  12763. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  12764. */
  12765. publishOrUnpublish(option,forPublish){
  12766. if(!option.dataId || !option.serviceType) {
  12767. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  12768. }
  12769. var dataId = option.dataId;
  12770. var dataServiceId = option.dataServiceId;
  12771. var serviceType = option.serviceType;
  12772. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  12773. if (dataServiceId) {
  12774. publishUrl += "&dataServiceId=" + dataServiceId;
  12775. }
  12776. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  12777. // 发起服务状态查询
  12778. if(forPublish) {
  12779. // 发布服务的结果异步处理
  12780. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  12781. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  12782. dataServiceId = res.customResult;
  12783. }
  12784. return dataServiceId;
  12785. }else {
  12786. // 取消发布的结果同步处理
  12787. return res;
  12788. }
  12789. });
  12790. }
  12791. /**
  12792. * @function SuperMap.iPortalUser.prototype.getDataPublishedStatus
  12793. * @description 查询服务状态,发起服务状态查询。
  12794. * @version 10.1.0
  12795. * @param {number} dataId - 查询服务状态的数据项id。
  12796. * @param {string} dataServiceId - 发布的服务id。
  12797. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  12798. */
  12799. getDataPublishedStatus(dataId,dataServiceId){
  12800. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  12801. return this.request("GET",publishStateUrl);
  12802. }
  12803. /**
  12804. * @function SuperMap.iPortalUser.prototype.unPublishedDataService
  12805. * @description 取消发布。
  12806. * @version 10.1.0
  12807. * @param {object} options - 取消发布服务具体参数。
  12808. * @param {object} options.dataId - 数据项id。
  12809. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  12810. * @param {object} [options.dataServiceId] - 发布的服务 id。
  12811. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  12812. */
  12813. unPublishDataService(option){
  12814. return this.publishOrUnpublish(option,false);
  12815. }
  12816. /**
  12817. * @function SuperMap.iPortalUser.prototype.publishedDataService
  12818. * @description 发布数据服务。
  12819. * @version 10.1.0
  12820. * @param {object} options - 发布数据服务具体参数。
  12821. * @param {object} options.dataId - 数据项id。
  12822. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  12823. * @param {object} [options.dataServiceId] - 发布的服务 id。
  12824. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  12825. */
  12826. publishDataService(option){
  12827. return this.publishOrUnpublish(option,true);
  12828. }
  12829. }
  12830. SuperMap.iPortalUser = IPortalUser;
  12831. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  12832. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12833. * This program are made available under the terms of the Apache License, Version 2.0
  12834. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12835. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  12836. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12837. * This program are made available under the terms of the Apache License, Version 2.0
  12838. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12839. /**
  12840. * @class SuperMap.CommonServiceBase
  12841. * @category iServer
  12842. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  12843. * @param {string} url - 服务地址。
  12844. * @param {Object} options - 参数。
  12845. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  12846. * @param {string} [options.proxy] - 服务代理地址。
  12847. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  12848. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  12849. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  12850. * @param {Object} [options.headers] - 请求头。
  12851. */
  12852. class CommonServiceBase {
  12853. constructor(url, options) {
  12854. let me = this;
  12855. this.EVENT_TYPES = ["processCompleted", "processFailed"];
  12856. this.events = null;
  12857. this.eventListeners = null;
  12858. this.url = null;
  12859. this.urls = null;
  12860. this.proxy = null;
  12861. this.serverType = null;
  12862. this.index = null;
  12863. this.length = null;
  12864. this.options = null;
  12865. this.totalTimes = null;
  12866. this.POLLING_TIMES = 3;
  12867. this._processSuccess = null;
  12868. this._processFailed = null;
  12869. this.isInTheSameDomain = null;
  12870. this.withCredentials = false;
  12871. if (Util.isArray(url)) {
  12872. me.urls = url;
  12873. me.length = url.length;
  12874. me.totalTimes = me.length;
  12875. if (me.length === 1) {
  12876. me.url = url[0];
  12877. } else {
  12878. me.index = parseInt(Math.random() * me.length);
  12879. me.url = url[me.index];
  12880. }
  12881. } else {
  12882. me.totalTimes = 1;
  12883. me.url = url;
  12884. }
  12885. if (Util.isArray(url) && !me.isServiceSupportPolling()) {
  12886. me.url = url[0];
  12887. me.totalTimes = 1;
  12888. }
  12889. me.serverType = me.serverType || ServerType.ISERVER;
  12890. options = options || {};
  12891. this.crossOrigin = options.crossOrigin;
  12892. this.headers = options.headers;
  12893. Util.extend(this, options);
  12894. me.isInTheSameDomain = Util.isInTheSameDomain(me.url);
  12895. me.events = new Events(me, null, me.EVENT_TYPES, true);
  12896. if (me.eventListeners instanceof Object) {
  12897. me.events.on(me.eventListeners);
  12898. }
  12899. this.CLASS_NAME = "SuperMap.CommonServiceBase";
  12900. }
  12901. /**
  12902. * @function SuperMap.CommonServiceBase.prototype.destroy
  12903. * @description 释放资源,将引用的资源属性置空。
  12904. */
  12905. destroy() {
  12906. let me = this;
  12907. if (Util.isArray(me.urls)) {
  12908. me.urls = null;
  12909. me.index = null;
  12910. me.length = null;
  12911. me.totalTimes = null;
  12912. }
  12913. me.url = null;
  12914. me.options = null;
  12915. me._processSuccess = null;
  12916. me._processFailed = null;
  12917. me.isInTheSameDomain = null;
  12918. me.EVENT_TYPES = null;
  12919. if (me.events) {
  12920. me.events.destroy();
  12921. me.events = null;
  12922. }
  12923. if (me.eventListeners) {
  12924. me.eventListeners = null;
  12925. }
  12926. }
  12927. /**
  12928. * @function SuperMap.CommonServiceBase.prototype.request
  12929. * @description: 该方法用于向服务发送请求。
  12930. * @param {Object} options - 参数。
  12931. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  12932. * @param {string} [options.url] - 发送请求的地址。
  12933. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  12934. * @param {string} [options.data] - 发送到服务器的数据。
  12935. * @param {function} options.success - 请求成功后的回调函数。
  12936. * @param {function} options.failure - 请求失败后的回调函数。
  12937. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  12938. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  12939. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  12940. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  12941. * @param {Object} [options.headers] - 请求头。
  12942. */
  12943. request(options) {
  12944. let me = this;
  12945. options.url = options.url || me.url;
  12946. options.proxy = options.proxy || me.proxy;
  12947. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  12948. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  12949. options.headers = options.headers || me.headers;
  12950. options.isInTheSameDomain = me.isInTheSameDomain;
  12951. //为url添加安全认证信息片段
  12952. let credential = this.getCredential(options.url);
  12953. if (credential) {
  12954. options.url = Util.urlAppend(options.url, credential.getUrlParameters());
  12955. }
  12956. me.calculatePollingTimes();
  12957. me._processSuccess = options.success;
  12958. me._processFailed = options.failure;
  12959. options.scope = me;
  12960. options.success = me.getUrlCompleted;
  12961. options.failure = me.getUrlFailed;
  12962. me.options = options;
  12963. me._commit(me.options);
  12964. }
  12965. /**
  12966. * @function SuperMap.CommonServiceBase.prototype.getCredential
  12967. * @description 获取凭据信息
  12968. * @param {string} url - 服务地址。
  12969. * @returns {SuperMap.Credential} 凭据信息对象。
  12970. */
  12971. getCredential(url) {
  12972. let keyUrl = url,
  12973. credential, value;
  12974. switch (this.serverType) {
  12975. case ServerType.IPORTAL:
  12976. value = SecurityManager.getToken(keyUrl);
  12977. credential = value ? new Credential(value, "token") : null;
  12978. if (!credential) {
  12979. value = SecurityManager.getKey(keyUrl);
  12980. credential = value ? new Credential(value, "key") : null;
  12981. }
  12982. break;
  12983. case ServerType.ONLINE:
  12984. value = SecurityManager.getKey(keyUrl);
  12985. credential = value ? new Credential(value, "key") : null;
  12986. break;
  12987. default:
  12988. //iServer or others
  12989. value = SecurityManager.getToken(keyUrl);
  12990. credential = value ? new Credential(value, "token") : null;
  12991. break;
  12992. }
  12993. return credential;
  12994. }
  12995. /**
  12996. * @function SuperMap.CommonServiceBase.prototype.getUrlCompleted
  12997. * @description 请求成功后执行此方法。
  12998. * @param {Object} result - 服务器返回的结果对象。
  12999. */
  13000. getUrlCompleted(result) {
  13001. let me = this;
  13002. me._processSuccess(result);
  13003. }
  13004. /**
  13005. * @function SuperMap.CommonServiceBase.prototype.getUrlFailed
  13006. * @description 请求失败后执行此方法。
  13007. * @param {Object} result - 服务器返回的结果对象。
  13008. */
  13009. getUrlFailed(result) {
  13010. let me = this;
  13011. if (me.totalTimes > 0) {
  13012. me.totalTimes--;
  13013. me.ajaxPolling();
  13014. } else {
  13015. me._processFailed(result);
  13016. }
  13017. }
  13018. /**
  13019. *
  13020. * @function SuperMap.CommonServiceBase.prototype.ajaxPolling
  13021. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
  13022. */
  13023. ajaxPolling() {
  13024. let me = this,
  13025. url = me.options.url,
  13026. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  13027. me.index = parseInt(Math.random() * me.length);
  13028. me.url = me.urls[me.index];
  13029. url = url.replace(re, re.exec(me.url)[0]);
  13030. me.options.url = url;
  13031. me.options.isInTheSameDomain = Util.isInTheSameDomain(url);
  13032. me._commit(me.options);
  13033. }
  13034. /**
  13035. * @function SuperMap.CommonServiceBase.prototype.calculatePollingTimes
  13036. * @description 计算剩余请求失败执行次数。
  13037. */
  13038. calculatePollingTimes() {
  13039. let me = this;
  13040. if (me.times) {
  13041. if (me.totalTimes > me.POLLING_TIMES) {
  13042. if (me.times > me.POLLING_TIMES) {
  13043. me.totalTimes = me.POLLING_TIMES;
  13044. } else {
  13045. me.totalTimes = me.times;
  13046. }
  13047. } else {
  13048. if (me.times < me.totalTimes) {
  13049. me.totalTimes = me.times;
  13050. }
  13051. }
  13052. } else {
  13053. if (me.totalTimes > me.POLLING_TIMES) {
  13054. me.totalTimes = me.POLLING_TIMES;
  13055. }
  13056. }
  13057. me.totalTimes--;
  13058. }
  13059. /**
  13060. * @function SuperMap.CommonServiceBase.prototype.isServiceSupportPolling
  13061. * @description 判断服务是否支持轮询。
  13062. */
  13063. isServiceSupportPolling() {
  13064. let me = this;
  13065. return !(
  13066. me.CLASS_NAME === "SuperMap.REST.ThemeService" ||
  13067. me.CLASS_NAME === "SuperMap.REST.EditFeaturesService"
  13068. );
  13069. }
  13070. /**
  13071. * @function SuperMap.CommonServiceBase.prototype.serviceProcessCompleted
  13072. * @description 状态完成,执行此方法。
  13073. * @param {Object} result - 服务器返回的结果对象。
  13074. */
  13075. serviceProcessCompleted(result) {
  13076. result = Util.transformResult(result);
  13077. this.events.triggerEvent("processCompleted", {
  13078. result: result
  13079. });
  13080. }
  13081. /**
  13082. * @function SuperMap.CommonServiceBase.prototype.serviceProcessFailed
  13083. * @description 状态失败,执行此方法。
  13084. * @param {Object} result - 服务器返回的结果对象。
  13085. */
  13086. serviceProcessFailed(result) {
  13087. result = Util.transformResult(result);
  13088. let error = result.error || result;
  13089. this.events.triggerEvent("processFailed", {
  13090. error: error
  13091. });
  13092. }
  13093. _commit(options) {
  13094. if (options.method === "POST" || options.method === "PUT") {
  13095. if (options.params) {
  13096. options.url = Util.urlAppend(options.url,
  13097. Util.getParameterString(options.params || {}));
  13098. }
  13099. options.params = options.data;
  13100. }
  13101. FetchRequest.commit(options.method, options.url, options.params, {
  13102. headers: options.headers,
  13103. withCredentials: options.withCredentials,
  13104. crossOrigin: options.crossOrigin,
  13105. timeout: options.async ? 0 : null,
  13106. proxy: options.proxy
  13107. }).then(function (response) {
  13108. if (response.text) {
  13109. return response.text();
  13110. }
  13111. if (response.json) {
  13112. return response.json();
  13113. }
  13114. return response;
  13115. }).then(function (text) {
  13116. var result = text;
  13117. if (typeof text === "string") {
  13118. result = new JSONFormat().read(text);
  13119. }
  13120. if (!result || result.error || result.code >= 300 && result.code !== 304) {
  13121. if (result && result.error) {
  13122. result = {
  13123. error: result.error
  13124. };
  13125. } else {
  13126. result = {
  13127. error: result
  13128. };
  13129. }
  13130. }
  13131. if (result.error) {
  13132. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  13133. failure(result);
  13134. } else {
  13135. result.succeed = result.succeed == undefined ? true : result.succeed;
  13136. var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
  13137. success(result);
  13138. }
  13139. }).catch(function (e) {
  13140. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  13141. failure(e);
  13142. })
  13143. }
  13144. }
  13145. SuperMap.CommonServiceBase = CommonServiceBase;
  13146. /**
  13147. * 服务器请求回调函数
  13148. * @callback RequestCallback
  13149. * @example
  13150. * var requestCallback = function (serviceResult){
  13151. * console.log(serviceResult.result);
  13152. * }
  13153. * new QueryService(url).queryByBounds(param, requestCallback);
  13154. * @param {Object} serviceResult
  13155. * @param {Object} serviceResult.result 服务器返回结果。
  13156. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  13157. * @param {Object} serviceResult.type 事件类型。
  13158. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  13159. */
  13160. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  13161. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13162. * This program are made available under the terms of the Apache License, Version 2.0
  13163. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13164. /**
  13165. * @class SuperMap.GeoCodingParameter
  13166. * @category iServer AddressMatch
  13167. * @classdesc 地理正向匹配参数类。
  13168. * @param {Object} options - 参数。
  13169. * @param {string} options.address - 地点关键词。
  13170. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  13171. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  13172. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  13173. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  13174. * @param {number} [options.maxReturn] - 最大返回结果数。
  13175. */
  13176. class GeoCodingParameter {
  13177. constructor(options) {
  13178. if (options.filters && typeof(options.filters) === 'string') {
  13179. options.filters = options.filters.split(',');
  13180. }
  13181. /**
  13182. * @member {string} SuperMap.GeoCodingParameter.prototype.address
  13183. * @description 地点关键词。
  13184. */
  13185. this.address = null;
  13186. /**
  13187. * @member {number} [SuperMap.GeoCodingParameter.prototype.fromIndex]
  13188. * @description 设置返回对象的起始索引值。
  13189. */
  13190. this.fromIndex = null;
  13191. /**
  13192. * @member {number} [SuperMap.GeoCodingParameter.prototype.toIndex]
  13193. * @description 设置返回对象的结束索引值。
  13194. */
  13195. this.toIndex = null;
  13196. /**
  13197. * @member {Array.<string>} [SuperMap.GeoCodingParameter.prototype.filters]
  13198. * @description 过滤字段,限定查询区域。
  13199. */
  13200. this.filters = null;
  13201. /**
  13202. * @member {string} [SuperMap.GeoCodingParameter.prototype.prjCoordSys]
  13203. * @description 查询结果的坐标系。
  13204. */
  13205. this.prjCoordSys = null;
  13206. /**
  13207. * @member {number} [SuperMap.GeoCodingParameter.prototype.maxReturn]
  13208. * @description 最大返回结果数。
  13209. */
  13210. this.maxReturn = null;
  13211. Util.extend(this, options);
  13212. }
  13213. /**
  13214. * @function SuperMap.GeoCodingParameter.prototype.destroy
  13215. * @description 释放资源,将引用资源的属性置空。
  13216. */
  13217. destroy() {
  13218. this.address = null;
  13219. this.fromIndex = null;
  13220. this.toIndex = null;
  13221. this.filters = null;
  13222. this.prjCoordSys = null;
  13223. this.maxReturn = null;
  13224. }
  13225. }
  13226. SuperMap.GeoCodingParameter = GeoCodingParameter;
  13227. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  13228. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13229. * This program are made available under the terms of the Apache License, Version 2.0
  13230. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13231. /**
  13232. * @class SuperMap.GeoDecodingParameter
  13233. * @category iServer AddressMatch
  13234. * @classdesc 地理反向匹配参数类。
  13235. * @param {Object} options - 参数。
  13236. * @param {number} options.x - 查询位置的横坐标。
  13237. * @param {number} options.y - 查询位置的纵坐标。
  13238. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  13239. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  13240. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  13241. * @param {number} [options.maxReturn] - 最大返回结果数。
  13242. * @param {number} [options.geoDecodingRadius] - 查询半径。
  13243. */
  13244. class GeoDecodingParameter {
  13245. constructor(options) {
  13246. if (options.filters) {
  13247. options.filters = options.filters.split(',');
  13248. }
  13249. /**
  13250. * @member {number} SuperMap.GeoDecodingParameter.prototype.x
  13251. * @description 查询位置的横坐标。
  13252. */
  13253. this.x = null;
  13254. /**
  13255. * @member {number} SuperMap.GeoDecodingParameter.prototype.y
  13256. * @description 查询位置的纵坐标。
  13257. */
  13258. this.y = null;
  13259. /**
  13260. * @member {number} [SuperMap.GeoDecodingParameter.prototype.fromIndex]
  13261. * @description 设置返回对象的起始索引值。
  13262. */
  13263. this.fromIndex = null;
  13264. /**
  13265. * @member {number} [SuperMap.GeoDecodingParameter.prototype.toIndex]
  13266. * @description 设置返回对象的结束索引值。
  13267. */
  13268. this.toIndex = null;
  13269. /**
  13270. * @member {Array.<string>} [SuperMap.GeoDecodingParameter.prototype.filters]
  13271. * @description 过滤字段,限定查询区域。
  13272. */
  13273. this.filters = null;
  13274. /**
  13275. * @member {string} [SuperMap.GeoDecodingParameter.prototype.prjCoordSys]
  13276. * @description 查询结果的坐标系。
  13277. */
  13278. this.prjCoordSys = null;
  13279. /**
  13280. * @member {number} [SuperMap.GeoDecodingParameter.prototype.maxReturn]
  13281. * @description 最大返回结果数。
  13282. */
  13283. this.maxReturn = null;
  13284. /**
  13285. * @member {number} SuperMap.GeoDecodingParameter.prototype.geoDecodingRadius
  13286. * @description 查询半径。
  13287. */
  13288. this.geoDecodingRadius = null;
  13289. Util.extend(this, options);
  13290. }
  13291. /**
  13292. * @function SuperMap.GeoDecodingParameter.prototype.destroy
  13293. * @description 释放资源,将引用资源的属性置空。
  13294. */
  13295. destroy() {
  13296. this.x = null;
  13297. this.y = null;
  13298. this.fromIndex = null;
  13299. this.toIndex = null;
  13300. this.filters = null;
  13301. this.prjCoordSys = null;
  13302. this.maxReturn = null;
  13303. this.geoDecodingRadius = null;
  13304. }
  13305. }
  13306. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  13307. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  13308. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13309. * This program are made available under the terms of the Apache License, Version 2.0
  13310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13311. /**
  13312. * @class SuperMap.AddressMatchService
  13313. * @category iServer AddressMatch
  13314. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  13315. * @param {string} url - 地址匹配服务地址。
  13316. * @param {Object} options - 参数。
  13317. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13318. * @param {Object} [options.headers] - 请求头。
  13319. */
  13320. class AddressMatchService_AddressMatchService extends CommonServiceBase {
  13321. constructor(url, options) {
  13322. super(url, options);
  13323. this.options = options || {};
  13324. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  13325. }
  13326. /**
  13327. * @function SuperMap.AddressMatchService.prototype.destroy
  13328. * @override
  13329. */
  13330. destroy() {
  13331. super.destroy();
  13332. }
  13333. /**
  13334. * @function SuperMap.AddressMatchService.prototype.code
  13335. * @param {string} url - 正向地址匹配服务地址。
  13336. * @param {SuperMap.GeoCodingParameter} params - 正向地址匹配服务参数。
  13337. */
  13338. code(url, params) {
  13339. if (!(params instanceof GeoCodingParameter)) {
  13340. return;
  13341. }
  13342. this.processAsync(url, params);
  13343. }
  13344. /**
  13345. * @function SuperMap.AddressMatchService.prototype.decode
  13346. * @param {string} url - 反向地址匹配服务地址。
  13347. * @param {SuperMap.GeoDecodingParameter} params - 反向地址匹配服务参数。
  13348. */
  13349. decode(url, params) {
  13350. if (!(params instanceof GeoDecodingParameter)) {
  13351. return;
  13352. }
  13353. this.processAsync(url, params);
  13354. }
  13355. /**
  13356. * @function SuperMap.AddressMatchService.prototype.processAsync
  13357. * @description 负责将客户端的动态分段服务参数传递到服务端。
  13358. * @param {string} url - 服务地址。
  13359. * @param {Object} params - 参数。
  13360. */
  13361. processAsync(url, params) {
  13362. this.request({
  13363. method: 'GET',
  13364. url,
  13365. params,
  13366. scope: this,
  13367. success: this.serviceProcessCompleted,
  13368. failure: this.serviceProcessFailed
  13369. });
  13370. }
  13371. /**
  13372. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  13373. * @param {Object} result - 服务器返回的结果对象。
  13374. * @description 服务流程是否完成
  13375. */
  13376. serviceProcessCompleted(result) {
  13377. if (result.succeed) {
  13378. delete result.succeed;
  13379. }
  13380. super.serviceProcessCompleted(result);
  13381. }
  13382. /**
  13383. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  13384. * @param {Object} result - 服务器返回的结果对象。
  13385. * @description 服务流程是否失败
  13386. */
  13387. serviceProcessFailed(result) {
  13388. super.serviceProcessFailed(result);
  13389. }
  13390. }
  13391. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  13392. ;// CONCATENATED MODULE: ./src/common/iServer/AggQueryBuilderParameter.js
  13393. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13394. * This program are made available under the terms of the Apache License, Version 2.0
  13395. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13396. /**
  13397. * @class SuperMap.AggQueryBuilderParameter
  13398. * @classdesc 聚合查询 QueryBuilder 参数基类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  13399. * @category iServer Data FeatureResults
  13400. * @param {Object} option - 初始化参数。
  13401. * @param {string} option.name - 查询结果名称。
  13402. * @param {SuperMap.AggregationQueryBuilderType} option.queryType - 查询类型。
  13403. */
  13404. class AggQueryBuilderParameter {
  13405. constructor(option) {
  13406. /**
  13407. * @member {string} SuperMap.AggQueryBuilderParameter.prototype.name
  13408. * @description 查询结果名称。
  13409. */
  13410. this.name = null;
  13411. /**
  13412. * @member {SuperMap.AggregationQueryBuilderType} SuperMap.AggQueryBuilderParameter.prototype.queryType
  13413. * @description 查询类型。
  13414. */
  13415. this.queryType = null;
  13416. this.CLASS_NAME = "SuperMap.AggQueryBuilderParameter";
  13417. Util.extend(this, option);
  13418. }
  13419. destroy() {
  13420. var me = this;
  13421. me.name = null;
  13422. me.queryType = null;
  13423. }
  13424. }
  13425. SuperMap.AggQueryBuilderParameter = AggQueryBuilderParameter;
  13426. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  13427. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13428. * This program are made available under the terms of the Apache License, Version 2.0
  13429. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13430. /**
  13431. * @class SuperMap.AggregationParameter
  13432. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  13433. * @category iServer Data FeatureResults
  13434. * @param {Object} options - 初始化参数。
  13435. * @param {string} options.aggName - 聚合名称。
  13436. * @param {SuperMap.AggregationType} options.aggType - 聚合类型设置。
  13437. * @param {string} options.aggFieldName - 聚合字段。
  13438. * @param {SuperMap.AggregationParameter} options.subAgg - 子聚合类。
  13439. *
  13440. */
  13441. class AggregationParameter {
  13442. constructor(options) {
  13443. /**
  13444. * @member {string} SuperMap.AggregationParameter.prototype.aggName
  13445. * @description 聚合名称。
  13446. */
  13447. this.aggName = null;
  13448. /**
  13449. * @member {SuperMap.AggregationType} SuperMap.AggregationParameter.prototype.aggType
  13450. * @description 聚合类型设置类。
  13451. */
  13452. this.aggType = null;
  13453. /**
  13454. * @member {string} SuperMap.AggregationParameter.prototype.aggFieldName
  13455. * @description 聚合字段。
  13456. */
  13457. this.aggFieldName = null;
  13458. /**
  13459. * @member {SuperMap.AggregationParameter} SuperMap.AggregationParameter.prototype.subAgg
  13460. * @description 子聚合。
  13461. */
  13462. this.subAgg = null;
  13463. this.CLASS_NAME = "SuperMap.AggregationParameter";
  13464. Util.extend(this, options);
  13465. }
  13466. destroy() {
  13467. var me = this;
  13468. me.aggName = null;
  13469. me.aggFieldName = null;
  13470. me.aggType = null;
  13471. if (me.subAgg) {
  13472. me.subAgg = null;
  13473. }
  13474. }
  13475. }
  13476. SuperMap.AggregationParameter = AggregationParameter;
  13477. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  13478. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13479. * This program are made available under the terms of the Apache License, Version 2.0
  13480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13481. /**
  13482. * @class SuperMap.AreaSolarRadiationParameters
  13483. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  13484. * @classdesc 地区太阳辐射参数类。
  13485. * @param {Object} options - 参数。
  13486. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  13487. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  13488. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  13489. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  13490. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  13491. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  13492. * @param {number} options.latitude - 待计算区域的纬度值。
  13493. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  13494. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  13495. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  13496. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  13497. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  13498. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  13499. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  13500. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  13501. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  13502. */
  13503. class AreaSolarRadiationParameters {
  13504. constructor(options) {
  13505. /**
  13506. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.dataset
  13507. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  13508. */
  13509. this.dataset = null;
  13510. /**
  13511. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.targetDatasourceName
  13512. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  13513. */
  13514. this.targetDatasourceName = null;
  13515. /**
  13516. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.totalGridName
  13517. * @description 指定地区太阳辐射总辐射量数据集的名称。
  13518. */
  13519. this.totalGridName = null;
  13520. /**
  13521. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  13522. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  13523. */
  13524. this.diffuseDatasetGridName = null;
  13525. /**
  13526. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  13527. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  13528. */
  13529. this.durationDatasetGridName = null;
  13530. /**
  13531. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  13532. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  13533. */
  13534. this.directDatasetGridName = null;
  13535. /**
  13536. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.latitude
  13537. * @description 待计算区域的纬度值。
  13538. */
  13539. this.latitude = null;
  13540. /**
  13541. * @member {string} [SuperMap.AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  13542. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  13543. */
  13544. this.timeMode = "MULTIDAYS";
  13545. /**
  13546. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayStart
  13547. * @description 起始日期(年内的第几天)。
  13548. */
  13549. this.dayStart = null;
  13550. /**
  13551. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayEnd
  13552. * @description 结束日期(年内的第几天)。
  13553. */
  13554. this.dayEnd = null;
  13555. /**
  13556. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourStart]
  13557. * @description 起始时间(一天中的第几个小时)。
  13558. */
  13559. this.hourStart = null;
  13560. /**
  13561. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourEnd]
  13562. * @description 结束时间(一天中的第几个小时)。
  13563. */
  13564. this.hourEnd = null;
  13565. /**
  13566. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.transmittance]
  13567. * @description 太阳辐射穿过大气的透射率。
  13568. */
  13569. this.transmittance = null;
  13570. /**
  13571. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  13572. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  13573. */
  13574. this.hourInterval = null;
  13575. /**
  13576. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.dayInterval=5]
  13577. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  13578. */
  13579. this.dayInterval = null;
  13580. /**
  13581. * @member {boolean} [SuperMap.AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  13582. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  13583. */
  13584. this.deleteExistResultDataset = false;
  13585. Util.extend(this, options);
  13586. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  13587. }
  13588. /**
  13589. * @function SuperMap.AreaSolarRadiationParameters.prototype.destroy
  13590. * @description 释放资源,将引用资源的属性置空。
  13591. */
  13592. destroy() {
  13593. var me = this;
  13594. me.dataset = null;
  13595. me.zFactor = 1.0;
  13596. me.averageCurvatureName = null;
  13597. me.profileCurvatureName = null;
  13598. me.planCurvatureName = null;
  13599. me.deleteExistResultDataset = true;
  13600. }
  13601. /**
  13602. * @function SuperMap.AreaSolarRadiationParameters.toObject
  13603. * @param {SuperMap.AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  13604. * @param {SuperMap.AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  13605. * @returns {Object} JSON对象。
  13606. * @description 将SuperMap.AreaSolarRadiationParameters对象转换成JSON对象。
  13607. */
  13608. static toObject(param, tempObj) {
  13609. var parameter = {};
  13610. for (var name in param) {
  13611. if (name !== "dataset") {
  13612. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  13613. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  13614. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  13615. if (name1 || name2 || name3) {
  13616. parameter[name] = param[name];
  13617. } else {
  13618. tempObj[name] = param[name];
  13619. }
  13620. }
  13621. }
  13622. tempObj["parameter"] = parameter;
  13623. }
  13624. }
  13625. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  13626. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  13627. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13628. * This program are made available under the terms of the Apache License, Version 2.0
  13629. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13630. /**
  13631. * @class SuperMap.SpatialAnalystBase
  13632. * @category iServer SpatialAnalyst
  13633. * @classdesc 空间分析服务基类。
  13634. * @param {string} url - 地址。
  13635. * @param {Object} options - 参数。
  13636. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13637. * @param {Object} [options.headers] - 请求头。
  13638. * @extends {SuperMap.CommonServiceBase}
  13639. */
  13640. class SpatialAnalystBase extends CommonServiceBase {
  13641. constructor(url, options) {
  13642. super(url, options);
  13643. /**
  13644. * @member {SuperMap.DataFormat} [SuperMap.SpatialAnalystBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  13645. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"。
  13646. */
  13647. this.format = DataFormat.GEOJSON;
  13648. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  13649. }
  13650. /**
  13651. * @function SuperMap.SpatialAnalystBase.prototype.destroy
  13652. * @override
  13653. */
  13654. destroy() {
  13655. super.destroy();
  13656. this.format = null;
  13657. }
  13658. /**
  13659. * @function SuperMap.SpatialAnalystBase.prototype.serviceProcessCompleted
  13660. * @description 分析完成,执行此方法。
  13661. * @param {Object} result - 服务器返回的结果对象。
  13662. */
  13663. serviceProcessCompleted(result) {
  13664. var me = this, analystResult;
  13665. result = Util.transformResult(result);
  13666. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  13667. //批量分析时会返回多个结果
  13668. if (Util.isArray(result)) {
  13669. for (var i = 0; i < result.length; i++) {
  13670. result[i] = me.toGeoJSONResult(result[i])
  13671. }
  13672. analystResult = result;
  13673. } else {
  13674. analystResult = me.toGeoJSONResult(result);
  13675. }
  13676. }
  13677. if (!analystResult) {
  13678. analystResult = result;
  13679. }
  13680. me.events.triggerEvent("processCompleted", {result: analystResult});
  13681. }
  13682. /**
  13683. * @function SuperMap.SpatialAnalystBase.prototype.toGeoJSONResult
  13684. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  13685. * @param {Object} result - 服务器返回的结果对象。
  13686. *
  13687. */
  13688. toGeoJSONResult(result) {
  13689. if (!result) {
  13690. return null;
  13691. }
  13692. //批量叠加分析时结果这样处理
  13693. if (result.result && result.result.resultGeometry) {
  13694. result = result.result
  13695. }
  13696. var geoJSONFormat = new GeoJSON();
  13697. if (result.recordsets) {
  13698. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  13699. if (recordsets[i].features) {
  13700. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  13701. }
  13702. }
  13703. } else if (result.recordset && result.recordset.features) {
  13704. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  13705. }
  13706. if (result.resultGeometry) {
  13707. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  13708. }
  13709. if (result.regions) {
  13710. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  13711. }
  13712. return result;
  13713. }
  13714. }
  13715. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  13716. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  13717. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13718. * This program are made available under the terms of the Apache License, Version 2.0
  13719. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13720. /**
  13721. * @class SuperMap.AreaSolarRadiationService
  13722. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  13723. * @classdesc 地区太阳辐射服务类。
  13724. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  13725. * @param {Object} options - 参数。</br>
  13726. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  13727. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13728. * @param {Object} [options.headers] - 请求头。
  13729. * @extends {SuperMap.SpatialAnalystBase}
  13730. * @example 例如:
  13731. * (start code)
  13732. * var myAreaSolarRadiationService = new SuperMap.AreaSolarRadiationService(url);
  13733. * myAreaSolarRadiationService.on({
  13734. * "processCompleted": processCompleted,
  13735. * "processFailed": processFailed
  13736. * }
  13737. * );
  13738. * (end)
  13739. *
  13740. */
  13741. class AreaSolarRadiationService extends SpatialAnalystBase {
  13742. constructor(url, options) {
  13743. super(url, options);
  13744. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  13745. }
  13746. /**
  13747. * @function SuperMap.AreaSolarRadiationService.prototype.destroy
  13748. * @override
  13749. */
  13750. destroy() {
  13751. super.destroy();
  13752. }
  13753. /**
  13754. * @function SuperMap.AreaSolarRadiationService.prototype.processAsync
  13755. * @description 负责将客户端的查询参数传递到服务端。
  13756. * @param {SuperMap.AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  13757. */
  13758. processAsync(parameter) {
  13759. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  13760. return;
  13761. }
  13762. var me = this;
  13763. var parameterObject = {};
  13764. if (parameter instanceof AreaSolarRadiationParameters) {
  13765. me.url = Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  13766. }
  13767. me.url = Util.urlAppend(me.url, 'returnContent=true');
  13768. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  13769. var jsonParameters = Util.toJSON(parameterObject);
  13770. me.request({
  13771. method: 'POST',
  13772. data: jsonParameters,
  13773. scope: me,
  13774. success: me.serviceProcessCompleted,
  13775. failure: me.serviceProcessFailed
  13776. });
  13777. }
  13778. }
  13779. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  13780. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  13781. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13782. * This program are made available under the terms of the Apache License, Version 2.0
  13783. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13784. /**
  13785. * @class SuperMap.BufferDistance
  13786. * @category iServer SpatialAnalyst BufferAnalyst
  13787. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  13788. * @param {Object} options - 参数。
  13789. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  13790. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  13791. */
  13792. class BufferDistance {
  13793. constructor(options) {
  13794. /**
  13795. * @member {string} [SuperMap.BufferDistance.prototype.exp]
  13796. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  13797. */
  13798. this.exp = null;
  13799. /**
  13800. * @member {number} [SuperMap.BufferDistance.prototype.value=100]
  13801. * @description 以数值作为缓冲区分析的距离值。单位:米。
  13802. */
  13803. this.value = 100;
  13804. Util.extend(this, options);
  13805. this.CLASS_NAME = "SuperMap.BufferDistance";
  13806. }
  13807. /**
  13808. * @function SuperMap.BufferDistance.prototype.destroy
  13809. * @description 释放资源,将引用资源的属性置空。
  13810. */
  13811. destroy() {
  13812. this.exp = null;
  13813. this.value = null;
  13814. }
  13815. }
  13816. SuperMap.BufferDistance = BufferDistance;
  13817. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  13818. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13819. * This program are made available under the terms of the Apache License, Version 2.0
  13820. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13821. /**
  13822. * @class SuperMap.BufferSetting
  13823. * @category iServer SpatialAnalyst BufferAnalyst
  13824. * @classdesc 缓冲区分析通用设置类。
  13825. * @param {Object} options - 参数。
  13826. * @param {SuperMap.BufferEndType} [options.endType=SuperMap.BufferEndType.FLAT] - 缓冲区端点枚举值。
  13827. * @param {SuperMap.BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  13828. * @param {SuperMap.BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  13829. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  13830. * @param {SuperMap.BufferRadiusUnit} [options.radiusUnit=SuperMap.BufferRadiusUnit.METER] - 缓冲半径单位。
  13831. */
  13832. class BufferSetting {
  13833. constructor(options) {
  13834. /**
  13835. * @member {SuperMap.BufferEndType} [SuperMap.BufferSetting.prototype.endType = SuperMap.BufferEndType.FLAT]
  13836. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  13837. */
  13838. this.endType = BufferEndType.FLAT;
  13839. /**
  13840. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.leftDistance=100]
  13841. * @description 左侧缓冲距离。
  13842. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  13843. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  13844. */
  13845. this.leftDistance = new BufferDistance();
  13846. /**
  13847. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.rightDistance=100]
  13848. * @description 右侧缓冲距离。
  13849. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  13850. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  13851. */
  13852. this.rightDistance = new BufferDistance();
  13853. /**
  13854. * @member {number} [SuperMap.BufferSetting.prototype.semicircleLineSegment=4]
  13855. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  13856. */
  13857. this.semicircleLineSegment = 4;
  13858. /**
  13859. * @member {SuperMap.BufferRadiusUnit} [SuperMap.BufferSetting.prototype.radiusUnit = SuperMap.BufferRadiusUnit.METER]
  13860. * @description 缓冲半径单位,可以是{@link SuperMap.BufferRadiusUnit.METER}、{@link SuperMap.BufferRadiusUnit.MILIMETER}、
  13861. * {@link SuperMap.BufferRadiusUnit.CENTIMETER}、{@link SuperMap.BufferRadiusUnit.DECIMETER}、{@link SuperMap.BufferRadiusUnit.KILOMETER}、
  13862. * {@link SuperMap.BufferRadiusUnit.FOOT}、{@link SuperMap.BufferRadiusUnit.INCH}、{@link SuperMap.BufferRadiusUnit.MILE}、{@link SuperMap.BufferRadiusUnit.YARD}。
  13863. * 仅对BufferAnalyst有效。
  13864. */
  13865. this.radiusUnit = BufferRadiusUnit.METER;
  13866. if (options) {
  13867. Util.extend(this, options);
  13868. }
  13869. this.CLASS_NAME = "SuperMap.BufferSetting";
  13870. }
  13871. /**
  13872. * @function SuperMap.BufferSetting.prototype.destroy
  13873. * @description 释放资源,将引用资源的属性置空。
  13874. */
  13875. destroy() {
  13876. let me = this;
  13877. me.endType = null;
  13878. if (me.leftDistance) {
  13879. me.leftDistance.destroy();
  13880. me.leftDistance = null;
  13881. }
  13882. if (me.rightDistance) {
  13883. me.rightDistance.destroy();
  13884. me.rightDistance = null;
  13885. }
  13886. me.semicircleLineSegment = null;
  13887. me.radiusUnit = null;
  13888. }
  13889. }
  13890. SuperMap.BufferSetting = BufferSetting;
  13891. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  13892. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13893. * This program are made available under the terms of the Apache License, Version 2.0
  13894. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13895. /**
  13896. * @class SuperMap.BufferAnalystParameters
  13897. * @category iServer SpatialAnalyst BufferAnalyst
  13898. * @classdesc 缓冲区分析参数基类。
  13899. * @param {Object} options - 参数。
  13900. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  13901. */
  13902. class BufferAnalystParameters {
  13903. constructor(options) {
  13904. var me = this;
  13905. /**
  13906. * @member {SuperMap.BufferSetting} [SuperMap.BufferAnalystParameters.prototype.bufferSetting]
  13907. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  13908. */
  13909. me.bufferSetting = new BufferSetting();
  13910. Util.extend(this, options);
  13911. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  13912. }
  13913. /**
  13914. * @function SuperMap.BufferAnalystParameters.prototype.destroy
  13915. * @description 释放资源,将引用资源的属性置空。
  13916. */
  13917. destroy() {
  13918. var me = this;
  13919. if (me.bufferSetting) {
  13920. me.bufferSetting.destroy();
  13921. me.bufferSetting = null;
  13922. }
  13923. }
  13924. }
  13925. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  13926. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  13927. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13928. * This program are made available under the terms of the Apache License, Version 2.0
  13929. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13930. /**
  13931. * @class SuperMap.DataReturnOption
  13932. * @category iServer SpatialAnalyst
  13933. * @classdesc 数据返回设置类。
  13934. * @param {Object} options - 参数。
  13935. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  13936. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link SuperMap.DataReturnMode.DATASET_ONLY}或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  13937. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  13938. * @param {SuperMap.DataReturnMode} [options.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  13939. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  13940. */
  13941. class DataReturnOption {
  13942. constructor(options) {
  13943. /**
  13944. * @member {number} [SuperMap.DataReturnOption.prototype.expectCount=1000]
  13945. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  13946. */
  13947. this.expectCount = 1000;
  13948. /**
  13949. * @member {string} [SuperMap.DataReturnOption.prototype.dataset]
  13950. * @description 设置结果数据集标识,当dataReturnMode为 {@link SuperMap.DataReturnMode.DATASET_ONLY}
  13951. * 或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  13952. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  13953. */
  13954. this.dataset = null;
  13955. /**
  13956. * @member {SuperMap.DataReturnMode} [SuperMap.DataReturnOption.prototype.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY]
  13957. * @description 数据返回模式。
  13958. */
  13959. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  13960. /**
  13961. * @member {boolean} [SuperMap.DataReturnOption.prototype.deleteExistResultDataset=true]
  13962. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  13963. */
  13964. this.deleteExistResultDataset = true;
  13965. Util.extend(this, options);
  13966. this.CLASS_NAME = "SuperMap.DataReturnOption";
  13967. }
  13968. /**
  13969. * @function SuperMap.DataReturnOption.prototype.destroy
  13970. * @description 释放资源,将引用资源的属性置空。
  13971. */
  13972. destroy() {
  13973. var me = this;
  13974. me.expectCount = null;
  13975. me.dataset = null;
  13976. me.dataReturnMode = null;
  13977. me.deleteExistResultDataset = null;
  13978. }
  13979. }
  13980. SuperMap.DataReturnOption = DataReturnOption;
  13981. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  13982. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13983. * This program are made available under the terms of the Apache License, Version 2.0
  13984. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13985. /**
  13986. * @class SuperMap.JoinItem
  13987. * @category iServer
  13988. * @classdesc 连接信息类。
  13989. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  13990. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  13991. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  13992. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  13993. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  13994. *(注意:SuperMap.JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  13995. * @param {Object} options - 参数。
  13996. * @param {string} options.foreignTableName - 外部表的名称。
  13997. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  13998. * @param {SuperMap.JoinType} options.joinType - 两个表之间连接类型。
  13999. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  14000. *(start code)
  14001. * function queryBySQL() {
  14002. * // 设置与外部表的连接信息
  14003. * var joinItem = new SuperMap.JoinItem({
  14004. * foreignTableName: "foreignTable",
  14005. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  14006. * joinType: "LEFTJOIN"
  14007. * })
  14008. * var queryParam, queryBySQLParams, queryBySQLService;
  14009. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  14010. * queryParam = new SuperMap.FilterParameter({
  14011. * name: "Countries@World",
  14012. * joinItems: [joinItem]
  14013. * }),
  14014. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  14015. * queryParams: [queryParam]
  14016. * }),
  14017. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  14018. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  14019. * });
  14020. * queryBySQLService.processAsync(queryBySQLParams);
  14021. * }
  14022. * function processCompleted(queryEventArgs) {//todo}
  14023. * function processFailed(e) {//todo}
  14024. * (end)
  14025. */
  14026. class JoinItem {
  14027. constructor(options) {
  14028. /**
  14029. * @member {string} SuperMap.JoinItem.prototype.foreignTableName
  14030. * @description 外部表的名称。
  14031. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  14032. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  14033. */
  14034. this.foreignTableName = null;
  14035. /**
  14036. * @member {string} SuperMap.JoinItem.prototype.joinFilter
  14037. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  14038. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  14039. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  14040. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  14041. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  14042. */
  14043. this.joinFilter = null;
  14044. /**
  14045. * @member {SuperMap.JoinType} SuperMap.JoinItem.prototype.joinType
  14046. * @description 两个表之间连接类型。
  14047. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  14048. */
  14049. this.joinType = null;
  14050. if (options) {
  14051. Util.extend(this, options);
  14052. }
  14053. this.CLASS_NAME = "SuperMap.JoinItem";
  14054. }
  14055. /**
  14056. * @function SuperMap.JoinItem.prototype.destroy
  14057. * @description 释放资源,将引用资源的属性置空。
  14058. */
  14059. destroy() {
  14060. var me = this;
  14061. me.foreignTableName = null;
  14062. me.joinFilter = null;
  14063. me.joinType = null;
  14064. }
  14065. /**
  14066. * @function SuperMap.JoinItem.prototype.toServerJSONObject
  14067. * @description 转换成对应的 JSON 格式对象。
  14068. */
  14069. toServerJSONObject() {
  14070. var dataObj = {};
  14071. dataObj = Util.copyAttributes(dataObj, this);
  14072. //joinFilter基本是个纯属性对象,这里不再做转换
  14073. return dataObj;
  14074. }
  14075. }
  14076. SuperMap.JoinItem = JoinItem;
  14077. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  14078. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14079. * This program are made available under the terms of the Apache License, Version 2.0
  14080. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14081. // eslint-disable-line no-unused-vars
  14082. /**
  14083. * @class SuperMap.DatasourceConnectionInfo
  14084. * @category iServer Data
  14085. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  14086. * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  14087. * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  14088. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  14089. * @category iServer Data
  14090. * @param {Object} options - 参数。
  14091. * @param {string} options.alias - 数据源别名。
  14092. * @param {string} options.dataBase - 数据源连接的数据库名。
  14093. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  14094. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  14095. * @param {SuperMap.EngineType} [options.engineType] - 数据源连接的引擎类型。
  14096. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  14097. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  14098. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  14099. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  14100. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  14101. * @param {string} [options.user] - 登录数据库的用户名。
  14102. */
  14103. class DatasourceConnectionInfo {
  14104. constructor(options) {
  14105. /**
  14106. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.alias
  14107. * @description 数据源别名。
  14108. */
  14109. this.alias = null;
  14110. /**
  14111. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.connect]
  14112. * @description 数据源是否自动连接数据。
  14113. */
  14114. this.connect = null;
  14115. /**
  14116. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.dataBase
  14117. * @description 数据源连接的数据库名。
  14118. */
  14119. this.dataBase = null;
  14120. /**
  14121. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.driver]
  14122. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  14123. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  14124. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  14125. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  14126. */
  14127. this.driver = null;
  14128. /**
  14129. * @member {SuperMap.EngineType} [SuperMap.DatasourceConnectionInfo.prototype.engineType]
  14130. * @description 数据源连接的引擎类型。
  14131. */
  14132. this.engineType = null;
  14133. /**
  14134. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.exclusive]
  14135. * @description 是否以独占方式打开数据源。
  14136. */
  14137. this.exclusive = null;
  14138. /**
  14139. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.OpenLinkTable]
  14140. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  14141. */
  14142. this.OpenLinkTable = null;
  14143. /**
  14144. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.password]
  14145. * @description 登录数据源连接的数据库或文件的密码。
  14146. */
  14147. this.password = null;
  14148. /**
  14149. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.readOnly]
  14150. * @description 是否以只读方式打开数据源。
  14151. */
  14152. this.readOnly = null;
  14153. /**
  14154. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.server]
  14155. * @description 数据库服务器名、文件名或服务地址。
  14156. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  14157. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  14158. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  14159. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  14160. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  14161. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  14162. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  14163. * 8.对于 SuperMapCould 数据源,为其服务地址。
  14164. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  14165. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  14166. */
  14167. this.server = null;
  14168. /**
  14169. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.user
  14170. * @description 登录数据库的用户名。
  14171. */
  14172. this.user = null;
  14173. if (options) {
  14174. Util.extend(this, options);
  14175. }
  14176. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  14177. }
  14178. /**
  14179. * @function SuperMap.DatasourceConnectionInfo.prototype.destroy
  14180. * @description 释放资源,将引用资源的属性置空。
  14181. */
  14182. destroy() {
  14183. var me = this;
  14184. me.alias = null;
  14185. me.connect = null;
  14186. me.dataBase = null;
  14187. me.driver = null;
  14188. me.engineType = null;
  14189. me.exclusive = null;
  14190. me.OpenLinkTable = null;
  14191. me.password = null;
  14192. me.readOnly = null;
  14193. me.server = null;
  14194. me.user = null;
  14195. }
  14196. }
  14197. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  14198. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  14199. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14200. * This program are made available under the terms of the Apache License, Version 2.0
  14201. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14202. /**
  14203. * @class SuperMap.LinkItem
  14204. * @constructs SuperMap.LinkItem
  14205. * @category iServer
  14206. * @classdesc 关联信息类。
  14207. * @description 该类用于矢量数据集与外部表的关联。 外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  14208. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  14209. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link SuperMap.LinkItem}
  14210. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link SuperMap.LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  14211. * 1. 使用 {@link SuperMap.LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  14212. * 2. 使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  14213. * @param {Object} options - 参数。
  14214. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  14215. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  14216. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  14217. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  14218. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  14219. * @param {string} options.name - 此关联信息对象的名称。
  14220. * @param {Array.<string>} options.primaryKeys - 需要关联的外部属性表的主键。
  14221. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  14222. * function queryBySQL() {
  14223. * // 设置关联的外部数据库信息,alias表示数据库别名
  14224. * var dc = new SuperMap.DatasourceConnectionInfo({
  14225. * dataBase: "RelQuery",
  14226. * server: "{ip}:{port}",
  14227. * user: "sa",
  14228. * password: "map",
  14229. * driver: "SQL Server",
  14230. * connect: true,
  14231. * OpenLinkTable: false,
  14232. * alias: "RelQuery",
  14233. * engineType: EngineType.SQLPLUS,
  14234. * readOnly: false,
  14235. * exclusive: false
  14236. * });
  14237. * // 设置关联信息
  14238. * var linkItem = new SuperMap.LinkItem({
  14239. * datasourceConnectionInfo: dc,
  14240. * foreignKeys: ["name"],
  14241. * foreignTable: "Pop_2011",
  14242. * linkFields: ["SmID as Pid","pop"],
  14243. * name: "link",
  14244. * primatryKeys: ["name"],
  14245. * });
  14246. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  14247. * var queryParam, queryBySQLParams, queryBySQLService;
  14248. * queryParam = new SuperMap.FilterParameter({
  14249. * name: "Province@RelQuery",
  14250. * fields: ["SmID","name"],
  14251. * attributeFilter: "SmID<7",
  14252. * linkItems: [linkItem]
  14253. * }),
  14254. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  14255. * queryParams: [queryParam]
  14256. * }),
  14257. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  14258. * eventListeners: {
  14259. * "processCompleted": processCompleted,
  14260. * "processFailed": processFailed
  14261. * }
  14262. * });
  14263. * queryBySQLService.processAsync(queryBySQLParams);
  14264. * }
  14265. * function processCompleted(queryEventArgs) {//todo}
  14266. * function processFailed(e) {//todo}
  14267. *
  14268. */
  14269. class LinkItem {
  14270. constructor(options) {
  14271. /**
  14272. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.LinkItem.prototype.datasourceConnectionInfo
  14273. * @description 关联的外部数据源信息。
  14274. */
  14275. this.datasourceConnectionInfo = null;
  14276. /**
  14277. * @member {Array.<string>} SuperMap.LinkItem.prototype.foreignKeys
  14278. * @description 主空间数据集的外键。
  14279. */
  14280. this.foreignKeys = null;
  14281. /**
  14282. * @member {string} SuperMap.LinkItem.prototype.foreignTable
  14283. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  14284. */
  14285. this.foreignTable = null;
  14286. /**
  14287. * @member {Array.<string>} SuperMap.LinkItem.prototype.linkFields
  14288. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返
  14289. * 回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  14290. */
  14291. this.linkFields = null;
  14292. /**
  14293. * @member {string} SuperMap.LinkItem.prototype.linkFilter
  14294. * @description 与外部属性表的连接条件。
  14295. */
  14296. this.linkFilter = null;
  14297. /**
  14298. * @member {string} SuperMap.LinkItem.prototype.name
  14299. * @description 此关联信息对象的名称。
  14300. */
  14301. this.name = null;
  14302. /**
  14303. * @member {Array.<string>} SuperMap.LinkItem.prototype.primaryKeys
  14304. * @description 需要关联的外部属性表的主键。
  14305. */
  14306. this.primaryKeys = null;
  14307. if (options) {
  14308. Util.extend(this, options);
  14309. }
  14310. this.CLASS_NAME = "SuperMap.LinkItem";
  14311. }
  14312. /**
  14313. * @function SuperMap.LinkItem.prototype.destroy
  14314. * @description 释放资源,将引用资源的属性置空。
  14315. */
  14316. destroy() {
  14317. var me = this;
  14318. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  14319. me.datasourceConnectionInfo.destroy();
  14320. me.datasourceConnectionInfo = null;
  14321. }
  14322. me.foreignKeys = null;
  14323. me.foreignTable = null;
  14324. me.linkFields = null;
  14325. me.linkFilter = null;
  14326. me.name = null;
  14327. me.primaryKeys = null;
  14328. }
  14329. }
  14330. SuperMap.LinkItem = LinkItem;
  14331. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  14332. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14333. * This program are made available under the terms of the Apache License, Version 2.0
  14334. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14335. /**
  14336. * @class SuperMap.FilterParameter
  14337. * @category iServer
  14338. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  14339. * @param {Object} options - 参数。
  14340. * @param {string} options.attributeFilter - 属性过滤条件。
  14341. * @param {string} options.name - 查询数据集名称或者图层名称。
  14342. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 与外部表的连接信息 SuperMap.JoinItem 数组。
  14343. * @param {Array.<SuperMap.LinkItem>} [options.linkItems] - 与外部表的关联信息 SuperMap.LinkItem 数组。
  14344. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  14345. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  14346. * @param {string} [options.groupBy] - 查询分组条件的字段。
  14347. * @param {Array.<string>} [options.fields] - 查询字段数组。
  14348. */
  14349. class FilterParameter {
  14350. constructor(options) {
  14351. /**
  14352. * @member {string} SuperMap.FilterParameter.prototype.attributeFilter
  14353. * @description 属性过滤条件。
  14354. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  14355. * attributeFilter 就是其中的“条件表达式”。
  14356. * 该字段的用法为 attributeFilter = "过滤条件"。
  14357. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  14358. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  14359. */
  14360. this.attributeFilter = null;
  14361. /**
  14362. * @member {string} SuperMap.FilterParameter.prototype.name
  14363. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  14364. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  14365. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  14366. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  14367. * 而不同的数据源中可能存在同名的数据集,
  14368. * 使用数据集名称不能唯一的确定数据集,
  14369. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  14370. */
  14371. this.name = null;
  14372. /**
  14373. * @member {Array.<SuperMap.JoinItem>} [SuperMap.FilterParameter.prototype.joinItems]
  14374. * @description 与外部表的连接信息 SuperMap.JoinItem 数组。
  14375. */
  14376. this.joinItems = null;
  14377. /**
  14378. * @member {Array.<SuperMap.LinkItem>} [SuperMap.FilterParameter.prototype.linkItems]
  14379. * @description 与外部表的关联信息 LinkItem 数组。
  14380. */
  14381. this.linkItems = null;
  14382. /**
  14383. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.ids]
  14384. * @description 查询 id 数组,即属性表中的 SmID 值。
  14385. */
  14386. this.ids = null;
  14387. /**
  14388. * @member {string} [SuperMap.FilterParameter.prototype.orderBy]
  14389. * @description 查询排序的字段,orderBy的字段须为数值型的。
  14390. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  14391. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  14392. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  14393. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  14394. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  14395. * 分别表示国家的面积和1994年的各国人口数量。
  14396. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  14397. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  14398. */
  14399. this.orderBy = null;
  14400. /**
  14401. * @member {string} [SuperMap.FilterParameter.prototype.groupBy]
  14402. * @description 查询分组条件的字段。
  14403. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  14404. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  14405. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  14406. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  14407. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  14408. * 分别表示某个城市所属的洲和国家。
  14409. * 如果要按照国家对全球的城市进行分组, 可以设置 groupBy = "Country";
  14410. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  14411. */
  14412. this.groupBy = null;
  14413. /**
  14414. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.fields]
  14415. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  14416. */
  14417. this.fields = null;
  14418. if (options) {
  14419. Util.extend(this, options);
  14420. }
  14421. this.CLASS_NAME = "SuperMap.FilterParameter";
  14422. }
  14423. /**
  14424. * @function SuperMap.FilterParameter.prototype.destroy
  14425. * @description 释放资源,将引用资源的属性置空。
  14426. */
  14427. destroy() {
  14428. var me = this;
  14429. me.attributeFilter = null;
  14430. me.name = null;
  14431. if (me.joinItems) {
  14432. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  14433. joinItems[i].destroy();
  14434. }
  14435. me.joinItems = null;
  14436. }
  14437. if (me.linkItems) {
  14438. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  14439. linkItems[i].destroy();
  14440. }
  14441. me.linkItems = null;
  14442. }
  14443. me.ids = null;
  14444. me.orderBy = null;
  14445. me.groupBy = null;
  14446. me.fields = null;
  14447. }
  14448. }
  14449. SuperMap.FilterParameter = FilterParameter;
  14450. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  14451. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14452. * This program are made available under the terms of the Apache License, Version 2.0
  14453. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14454. /**
  14455. * @class SuperMap.DatasetBufferAnalystParameters
  14456. * @category iServer SpatialAnalyst BufferAnalyst
  14457. * @classdesc 数据集缓冲区分析参数类。
  14458. * @param {Object} options - 参数。
  14459. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  14460. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  14461. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  14462. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  14463. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  14464. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  14465. *
  14466. * @extends {SuperMap.BufferAnalystParameters}
  14467. */
  14468. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  14469. constructor(options) {
  14470. super(options);
  14471. /**
  14472. * @member {string} SuperMap.DatasetBufferAnalystParameters.prototype.dataset
  14473. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  14474. */
  14475. this.dataset = null;
  14476. /**
  14477. * @member {SuperMap.FilterParameter} [SuperMap.DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  14478. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  14479. */
  14480. this.filterQueryParameter = new FilterParameter();
  14481. /**
  14482. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetBufferAnalystParameters.prototype.resultSetting]
  14483. * @description 结果返回设置类。
  14484. */
  14485. this.resultSetting = new DataReturnOption();
  14486. /**
  14487. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  14488. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  14489. */
  14490. this.isAttributeRetained = true;
  14491. /**
  14492. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isUnion=false]
  14493. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  14494. */
  14495. this.isUnion = false;
  14496. Util.extend(this, options);
  14497. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  14498. }
  14499. /**
  14500. * @function SuperMap.DatasetBufferAnalystParameters.prototype.destroy
  14501. * @override
  14502. */
  14503. destroy() {
  14504. super.destroy();
  14505. var me = this;
  14506. me.dataset = null;
  14507. if (me.filterQueryParameter) {
  14508. me.filterQueryParameter.destroy();
  14509. me.filterQueryParameter = null;
  14510. }
  14511. if (me.resultSetting) {
  14512. me.resultSetting.destroy();
  14513. me.resultSetting = null;
  14514. }
  14515. me.isAttributeRetained = null;
  14516. me.isUnion = null;
  14517. }
  14518. /**
  14519. * @function SuperMap.DatasetBufferAnalystParameters.toObject
  14520. * @param {SuperMap.DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  14521. * @param {SuperMap.DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  14522. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  14523. * @returns {Object} JSON 对象。
  14524. */
  14525. static toObject(datasetBufferAnalystParameters, tempObj) {
  14526. for (var name in datasetBufferAnalystParameters) {
  14527. if (name === "bufferSetting") {
  14528. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  14529. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  14530. } else if (name === "resultSetting") {
  14531. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  14532. } else if (name === "dataset") {
  14533. continue;
  14534. } else {
  14535. tempObj[name] = datasetBufferAnalystParameters[name];
  14536. }
  14537. }
  14538. }
  14539. }
  14540. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  14541. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  14542. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14543. * This program are made available under the terms of the Apache License, Version 2.0
  14544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14545. /**
  14546. * @class SuperMap.GeometryBufferAnalystParameters
  14547. * @category iServer SpatialAnalyst BufferAnalyst
  14548. * @classdesc 几何对象缓冲区分析参数类
  14549. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  14550. * @param {Object} options - 参数。
  14551. * @param {Object} options.sourceGeometry - 要做缓冲区分析的几何对象。
  14552. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  14553. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  14554. * @extends {SuperMap.BufferAnalystParameters}
  14555. */
  14556. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  14557. constructor(options) {
  14558. super(options);
  14559. /**
  14560. * @member {Object} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometry
  14561. * @description 要做缓冲区分析的几何对象。<br>
  14562. * 点类型可以是:{@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>
  14563. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  14564. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  14565. */
  14566. this.sourceGeometry = null;
  14567. /**
  14568. * @member {number} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  14569. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  14570. */
  14571. this.sourceGeometrySRID = null;
  14572. if (options) {
  14573. Util.extend(this, options);
  14574. }
  14575. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  14576. }
  14577. /**
  14578. * @function SuperMap.GeometryBufferAnalystParameters.prototype.destroy
  14579. * @override
  14580. */
  14581. destroy() {
  14582. super.destroy();
  14583. var me = this;
  14584. if (me.sourceGeometry) {
  14585. me.sourceGeometry.destroy();
  14586. me.sourceGeometry = null;
  14587. }
  14588. }
  14589. /**
  14590. * @function SuperMap.GeometryBufferAnalystParameters.toObject
  14591. * @param {SuperMap.GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  14592. * @param {SuperMap.GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  14593. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  14594. * @returns {Object} JSON 对象。
  14595. */
  14596. static toObject(geometryBufferAnalystParameters, tempObj) {
  14597. for (var name in geometryBufferAnalystParameters) {
  14598. if (name === "bufferSetting") {
  14599. var tempBufferSetting = {};
  14600. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  14601. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  14602. }
  14603. tempObj.analystParameter = tempBufferSetting;
  14604. } else if (name === "sourceGeometry") {
  14605. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  14606. } else {
  14607. tempObj[name] = geometryBufferAnalystParameters[name];
  14608. }
  14609. }
  14610. }
  14611. }
  14612. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  14613. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  14614. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14615. * This program are made available under the terms of the Apache License, Version 2.0
  14616. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14617. /**
  14618. * @class SuperMap.BufferAnalystService
  14619. * @category iServer SpatialAnalyst BufferAnalyst
  14620. * @classdesc 缓冲区分析服务类。
  14621. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  14622. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  14623. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  14624. * @param {Object} options - 参数。</br>
  14625. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  14626. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14627. * @param {Object} [options.headers] - 请求头。
  14628. * @extends {SuperMap.SpatialAnalystBase}
  14629. * @example 例如:
  14630. * (start code)
  14631. * var myBufferAnalystService = new SuperMap.BufferAnalystService(url, {
  14632. * eventListeners: {
  14633. * "processCompleted": bufferCompleted,
  14634. * "processFailed": bufferFailed
  14635. * }
  14636. * });
  14637. * (end)
  14638. *
  14639. *
  14640. */
  14641. class BufferAnalystService extends SpatialAnalystBase {
  14642. constructor(url, options) {
  14643. super(url, options);
  14644. /**
  14645. * @member {string} SuperMap.BufferAnalystService.prototype.mode
  14646. * @description 缓冲区分析类型
  14647. */
  14648. this.mode = null;
  14649. if (options) {
  14650. Util.extend(this, options);
  14651. }
  14652. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  14653. }
  14654. /**
  14655. * @function SuperMap.BufferAnalystService.prototype.destroy
  14656. * @override
  14657. */
  14658. destroy() {
  14659. super.destroy();
  14660. this.mode = null;
  14661. }
  14662. /**
  14663. * @method SuperMap.BufferAnalystService.prototype.processAsync
  14664. * @description 负责将客户端的查询参数传递到服务端。
  14665. * @param {SuperMap.BufferAnalystParameters} parameter - 缓冲区分析参数
  14666. */
  14667. processAsync(parameter) {
  14668. var parameterObject = {};
  14669. var me = this;
  14670. if (parameter instanceof DatasetBufferAnalystParameters) {
  14671. me.mode = 'datasets';
  14672. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  14673. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  14674. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  14675. me.mode = 'geometry';
  14676. me.url = Util.urlPathAppend(me.url, 'geometry/buffer');
  14677. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  14678. }
  14679. var jsonParameters = Util.toJSON(parameterObject);
  14680. me.url = Util.urlAppend(me.url, 'returnContent=true');
  14681. me.request({
  14682. method: "POST",
  14683. data: jsonParameters,
  14684. scope: me,
  14685. success: me.serviceProcessCompleted,
  14686. failure: me.serviceProcessFailed
  14687. });
  14688. }
  14689. }
  14690. SuperMap.BufferAnalystService = BufferAnalystService;
  14691. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  14692. /* Copyright© 2000 - 2021 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.OutputSetting
  14697. * @category iServer ProcessingService
  14698. * @classdesc 分布式分析输出类型设置类。
  14699. * @param {Object} options - 参数。
  14700. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  14701. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  14702. * @param {SuperMap.OutputType} [options.type=SuperMap.OutputType.UDB] - 输出类型。
  14703. * @param {string} [options.outputPath] - 分析结果输出路径。
  14704. */
  14705. class OutputSetting {
  14706. constructor(options) {
  14707. /**
  14708. * @member {SuperMap.OutputType} SuperMap.OutputSetting.prototype.type
  14709. * @description 分布式分析的输出类型。
  14710. */
  14711. this.type = OutputType.UDB;
  14712. /**
  14713. * @member {string} [SuperMap.OutputSetting.prototype.datasetName='analystResult']
  14714. * @description 分布式分析的输出结果数据集名称。
  14715. */
  14716. this.datasetName = "analystResult";
  14717. /**
  14718. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.OutputSetting.prototype.datasourceInfo
  14719. * @description 分布式分析的输出结果数据源连接信息。
  14720. */
  14721. this.datasourceInfo = null;
  14722. /**
  14723. * @member {string} [SuperMap.OutputSetting.prototype.outputPath]
  14724. * @description 分布式分析的分析结果输出路径。
  14725. */
  14726. this.outputPath = "";
  14727. Util.extend(this, options);
  14728. this.CLASS_NAME = "SuperMap.OutputSetting";
  14729. }
  14730. /**
  14731. * @function SuperMap.OutputSetting.prototype.destroy
  14732. * @description 释放资源,将引用资源的属性置空。
  14733. */
  14734. destroy() {
  14735. var me = this;
  14736. me.type = null;
  14737. me.datasetName = null;
  14738. me.outputPath = null;
  14739. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  14740. me.datasourceInfo.destroy();
  14741. me.datasourceInfo = null;
  14742. }
  14743. }
  14744. }
  14745. SuperMap.OutputSetting = OutputSetting;
  14746. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  14747. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14748. * This program are made available under the terms of the Apache License, Version 2.0
  14749. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14750. /**
  14751. * @class SuperMap.MappingParameters
  14752. * @category iServer ProcessingService
  14753. * @classdesc 分析后结果可视化的参数类。
  14754. * @param {Object} options - 参数。
  14755. * @param {Array.<SuperMap.ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  14756. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  14757. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 专题图分段模式。
  14758. * @param {number} [options.rangeCount] - 专题图分段个数。
  14759. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  14760. */
  14761. class MappingParameters {
  14762. constructor(options) {
  14763. /**
  14764. * @member {Array.<SuperMap.ThemeGridRangeItem>} [SuperMap.MappingParameters.prototype.items]
  14765. * @description 栅格分段专题图子项数组。
  14766. */
  14767. this.items = null;
  14768. /**
  14769. * @member {number} [SuperMap.MappingParameters.prototype.numericPrecision=1]
  14770. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  14771. */
  14772. this.numericPrecision = 1;
  14773. /**
  14774. * @member {SuperMap.RangeMode} [SuperMap.MappingParameters.prototype.RangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  14775. * @description 专题图分段模式。
  14776. */
  14777. this.rangeMode = RangeMode.EQUALINTERVAL;
  14778. /**
  14779. * @member {number} [SuperMap.MappingParameters.prototype.rangeCount]
  14780. * @description 专题图分段个数。
  14781. */
  14782. this.rangeCount = "";
  14783. /**
  14784. * @member {SuperMap.ColorGradientType} [SuperMap.MappingParameters.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  14785. * @description 专题图颜色渐变模式。
  14786. */
  14787. this.colorGradientType = ColorGradientType.YELLOW_RED;
  14788. Util.extend(this, options);
  14789. this.CLASS_NAME = "SuperMap.MappingParameters";
  14790. }
  14791. /**
  14792. * @function SuperMap.MappingParameters.prototype.destroy
  14793. * @description 释放资源,将引用资源的属性置空。
  14794. */
  14795. destroy() {
  14796. var me = this;
  14797. if (me.items) {
  14798. if (me.items.length > 0) {
  14799. for (var item in me.items) {
  14800. me.items[item].destroy();
  14801. me.items[item] = null;
  14802. }
  14803. }
  14804. me.items = null;
  14805. }
  14806. me.numericPrecision = null;
  14807. me.rangeMode = null;
  14808. me.rangeCount = null;
  14809. me.colorGradientType = null;
  14810. }
  14811. }
  14812. SuperMap.MappingParameters = MappingParameters;
  14813. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  14814. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14815. * This program are made available under the terms of the Apache License, Version 2.0
  14816. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14817. /**
  14818. * @class SuperMap.BuffersAnalystJobsParameter
  14819. * @category iServer ProcessingService BufferAnalyst
  14820. * @classdesc 缓冲区分析任务参数类。
  14821. * @param {Object} options - 参数。
  14822. * @param {string} options.datasetName - 数据集名。
  14823. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 分析范围(默认为全图范围)。
  14824. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  14825. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  14826. * @param {SuperMap.AnalystSizeUnit} [options.distanceUnit=SuperMap.AnalystSizeUnit.METER] - 缓冲距离单位单位。
  14827. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  14828. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  14829. */
  14830. class BuffersAnalystJobsParameter {
  14831. constructor(options) {
  14832. /**
  14833. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.datasetName
  14834. * @description 数据集名。
  14835. */
  14836. this.datasetName = '';
  14837. /**
  14838. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.BuffersAnalystJobsParameter.prototype.bounds
  14839. * @description 分析范围。
  14840. */
  14841. this.bounds = '';
  14842. /**
  14843. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distance='15']
  14844. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
  14845. */
  14846. this.distance = '';
  14847. /**
  14848. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  14849. * @description 缓冲距离字段。
  14850. */
  14851. this.distanceField = '';
  14852. /**
  14853. * @member {SuperMap.AnalystSizeUnit} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceUnit=SuperMap.AnalystSizeUnit.METER]
  14854. * @description 缓冲距离单位。
  14855. */
  14856. this.distanceUnit = AnalystSizeUnit.METER;
  14857. /**
  14858. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.dissolveField
  14859. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  14860. */
  14861. this.dissolveField = '';
  14862. /**
  14863. * @member {SuperMap.OutputSetting} [SuperMap.BuffersAnalystJobsParameter.prototype.output]
  14864. * @description 输出参数设置类。
  14865. */
  14866. this.output = null;
  14867. /**
  14868. * @member {SuperMap.MappingParameters} [SuperMap.BuffersAnalystJobsParameter.prototype.mappingParameters]
  14869. * @description 分析后结果可视化的参数类。
  14870. */
  14871. this.mappingParameters = null;
  14872. if (!options) {
  14873. return this;
  14874. }
  14875. Util.extend(this, options);
  14876. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  14877. }
  14878. /**
  14879. * @function SuperMap.BuffersAnalystJobsParameter.prototype.destroy
  14880. * @description 释放资源,将引用资源的属性置空。
  14881. */
  14882. destroy() {
  14883. this.datasetName = null;
  14884. this.bounds = null;
  14885. this.distance = null;
  14886. this.distanceField = null;
  14887. this.distanceUnit = null;
  14888. this.dissolveField = null;
  14889. if (this.output instanceof OutputSetting) {
  14890. this.output.destroy();
  14891. this.output = null;
  14892. }
  14893. if (this.mappingParameters instanceof MappingParameters) {
  14894. this.mappingParameters.destroy();
  14895. this.mappingParameters = null;
  14896. }
  14897. }
  14898. /**
  14899. * @function SuperMap.BuffersAnalystJobsParameter.toObject
  14900. * @param {SuperMap.BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  14901. * @param {Object} tempObj - 目标对象。
  14902. * @description 生成缓冲区分析任务对象。
  14903. */
  14904. static toObject(BuffersAnalystJobsParameter, tempObj) {
  14905. for (var name in BuffersAnalystJobsParameter) {
  14906. if (name === 'datasetName') {
  14907. tempObj['input'] = tempObj['input'] || {};
  14908. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  14909. continue;
  14910. }
  14911. if (name === 'output') {
  14912. tempObj['output'] = tempObj['output'] || {};
  14913. tempObj['output'] = BuffersAnalystJobsParameter[name];
  14914. continue;
  14915. }
  14916. tempObj['analyst'] = tempObj['analyst'] || {};
  14917. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  14918. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  14919. } else {
  14920. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  14921. }
  14922. if (name === 'mappingParameters') {
  14923. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  14924. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  14925. }
  14926. }
  14927. }
  14928. }
  14929. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  14930. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  14931. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14932. * This program are made available under the terms of the Apache License, Version 2.0
  14933. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14934. /**
  14935. * @class SuperMap.ProcessingServiceBase
  14936. * @category iServer ProcessingService
  14937. * @classdesc 分布式分析服务基类
  14938. * @extends {SuperMap.CommonServiceBase}
  14939. * @param {string} url - 分布式分析服务地址。
  14940. * @param {Object} options - 参数。
  14941. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  14942. * @param {number} options.index - 服务访问地址在数组中的位置。
  14943. * @param {number} options.length - 服务访问地址数组长度。
  14944. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  14945. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  14946. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14947. * @param {Object} [options.headers] - 请求头。
  14948. */
  14949. class ProcessingServiceBase extends CommonServiceBase {
  14950. constructor(url, options) {
  14951. options = options || {};
  14952. /*
  14953. * Constant: EVENT_TYPES
  14954. * {Array.<string>}
  14955. * 此类支持的事件类型
  14956. * - *processCompleted* 创建成功后触发的事件。
  14957. * - *processFailed* 创建失败后触发的事件 。
  14958. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  14959. */
  14960. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  14961. super(url, options);
  14962. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  14963. }
  14964. /**
  14965. * @function SuperMap.ProcessingServiceBase.prototype.destroy
  14966. * @override
  14967. */
  14968. destroy() {
  14969. super.destroy();
  14970. }
  14971. /**
  14972. * @function SuperMap.ProcessingServiceBase.prototype.getJobs
  14973. * @description 获取分布式分析任务。
  14974. * @param {string} url - 资源地址。
  14975. */
  14976. getJobs(url) {
  14977. var me = this;
  14978. FetchRequest.get(me._processUrl(url), null, {
  14979. proxy: me.proxy
  14980. }).then(function (response) {
  14981. return response.json();
  14982. }).then(function (result) {
  14983. me.events.triggerEvent("processCompleted", {
  14984. result: result
  14985. });
  14986. }).catch(function (e) {
  14987. me.eventListeners.processFailed({
  14988. error: e
  14989. });
  14990. });
  14991. }
  14992. /**
  14993. * @function SuperMap.ProcessingServiceBase.prototype.addJob
  14994. * @description 添加分布式分析任务。
  14995. * @param {string} url - 资源根地址。
  14996. * @param {Object} params - 创建一个空间分析的请求参数。
  14997. * @param {string} paramType - 请求参数类型。
  14998. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  14999. */
  15000. addJob(url, params, paramType, seconds) {
  15001. var me = this,
  15002. parameterObject = null;
  15003. if (params && params instanceof paramType) {
  15004. parameterObject = new Object();
  15005. paramType.toObject(params, parameterObject);
  15006. }
  15007. let headers = Object.assign({
  15008. 'Content-Type': 'application/x-www-form-urlencoded'
  15009. }, me.headers || {})
  15010. var options = {
  15011. proxy: me.proxy,
  15012. headers,
  15013. withCredentials: me.withCredentials,
  15014. crossOrigin: me.crossOrigin,
  15015. isInTheSameDomain: me.isInTheSameDomain
  15016. };
  15017. FetchRequest.post(me._processUrl(url), JSON.stringify(parameterObject), options).then(function (response) {
  15018. return response.json();
  15019. }).then(function (result) {
  15020. if (result.succeed) {
  15021. me.serviceProcessCompleted(result, seconds);
  15022. } else {
  15023. me.serviceProcessFailed(result);
  15024. }
  15025. }).catch(function (e) {
  15026. me.serviceProcessFailed({
  15027. error: e
  15028. });
  15029. });
  15030. }
  15031. serviceProcessCompleted(result, seconds) {
  15032. result = Util.transformResult(result);
  15033. seconds = seconds || 1000;
  15034. var me = this;
  15035. if (result) {
  15036. var id = setInterval(function () {
  15037. FetchRequest.get(me._processUrl(result.newResourceLocation), {
  15038. _t: new Date().getTime()
  15039. })
  15040. .then(function (response) {
  15041. return response.json();
  15042. }).then(function (job) {
  15043. me.events.triggerEvent("processRunning", {
  15044. id: job.id,
  15045. state: job.state
  15046. });
  15047. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  15048. clearInterval(id);
  15049. me.events.triggerEvent("processFailed", {
  15050. error: job.state.errorMsg,
  15051. state: job.state.runState
  15052. });
  15053. }
  15054. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  15055. clearInterval(id);
  15056. me.events.triggerEvent("processCompleted", {
  15057. result: job
  15058. });
  15059. }
  15060. }).catch(function (e) {
  15061. clearInterval(id);
  15062. me.events.triggerEvent("processFailed", {
  15063. error: e
  15064. });
  15065. });
  15066. }, seconds);
  15067. }
  15068. }
  15069. serviceProcessFailed(result) {
  15070. super.serviceProcessFailed(result);
  15071. }
  15072. _processUrl(url) {
  15073. if (SecurityManager.getToken(url)) {
  15074. url = Util.urlAppend(url, 'token=' + SecurityManager.getToken(url));
  15075. }
  15076. return url;
  15077. }
  15078. }
  15079. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  15080. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  15081. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15082. * This program are made available under the terms of the Apache License, Version 2.0
  15083. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15084. /**
  15085. * @class SuperMap.BuffersAnalystJobsService
  15086. * @category iServer ProcessingService BufferAnalyst
  15087. * @classdesc 缓冲区分析服务类
  15088. * @extends {SuperMap.ProcessingServiceBase}
  15089. * @param {string} url - 服务地址。
  15090. * @param {Object} options - 参数。
  15091. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15092. * @param {Object} [options.headers] - 请求头。
  15093. */
  15094. class BuffersAnalystJobsService extends ProcessingServiceBase {
  15095. constructor(url, options) {
  15096. super(url, options);
  15097. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  15098. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  15099. }
  15100. /**
  15101. *@override
  15102. */
  15103. destroy() {
  15104. super.destroy();
  15105. }
  15106. /**
  15107. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJobs
  15108. * @description 获取缓冲区分析所有任务
  15109. */
  15110. getBuffersJobs() {
  15111. super.getJobs(this.url);
  15112. }
  15113. /**
  15114. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJob
  15115. * @description 获取指定id的缓冲区分析服务
  15116. * @param {string} id - 指定要获取数据的id。
  15117. */
  15118. getBuffersJob(id) {
  15119. super.getJobs(Util.urlPathAppend(this.url, id));
  15120. }
  15121. /**
  15122. * @function SuperMap.BuffersAnalystJobsService.prototype.addBufferJob
  15123. * @description 新建缓冲区分析服务
  15124. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  15125. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  15126. */
  15127. addBuffersJob(params, seconds) {
  15128. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  15129. }
  15130. }
  15131. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  15132. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  15133. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15134. * This program are made available under the terms of the Apache License, Version 2.0
  15135. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15136. /**
  15137. * @class SuperMap.BurstPipelineAnalystParameters
  15138. * @category iServer NetworkAnalyst BurstAnalyse
  15139. * @classdesc 爆管分析参数类。
  15140. * @param {Object} options - 参数。
  15141. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  15142. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  15143. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  15144. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  15145. */
  15146. class BurstPipelineAnalystParameters {
  15147. constructor(options) {
  15148. var me = this;
  15149. /**
  15150. * @member {Array.<number>} SuperMap.BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  15151. * @description 指定的设施点 ID 数组。
  15152. */
  15153. this.sourceNodeIDs = null;
  15154. /**
  15155. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.edgeID]
  15156. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  15157. */
  15158. this.edgeID = null;
  15159. /**
  15160. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.nodeID]
  15161. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  15162. */
  15163. this.nodeID = null;
  15164. /**
  15165. * @member {boolean} [SuperMap.BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  15166. * @description 指定不确定流向是否有效。
  15167. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  15168. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  15169. */
  15170. this.isUncertainDirectionValid = false;
  15171. Util.extend(me, options);
  15172. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  15173. }
  15174. /**
  15175. * @function SuperMap.BurstPipelineAnalystParameters.prototype.destroy
  15176. * @description 释放资源,将引用资源的属性置空。
  15177. */
  15178. destroy() {
  15179. var me = this;
  15180. me.sourceNodeIDs = null;
  15181. me.edgeID = null;
  15182. me.nodeID = null;
  15183. me.isUncertainDirectionValid = null;
  15184. }
  15185. }
  15186. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  15187. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  15188. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15189. * This program are made available under the terms of the Apache License, Version 2.0
  15190. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15191. /**
  15192. * @class SuperMap.NetworkAnalystServiceBase
  15193. * @category iServer NetworkAnalyst
  15194. * @classdesc 网络分析服务基类。
  15195. * @description 网络分析服务基类。
  15196. * @extends {SuperMap.CommonServiceBase}
  15197. * @param {string} url - 网络分析服务地址。
  15198. * @param {Object} options - 参数。
  15199. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15200. * @param {Object} [options.headers] - 请求头。
  15201. */
  15202. class NetworkAnalystServiceBase extends CommonServiceBase {
  15203. constructor(url, options) {
  15204. super(url, options);
  15205. /**
  15206. * @member {SuperMap.DataFormat} [SuperMap.NetworkAnalystServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  15207. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  15208. */
  15209. this.format = DataFormat.GEOJSON;
  15210. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  15211. }
  15212. /**
  15213. * @function SuperMap.NetworkAnalystServiceBase.prototype.destroy
  15214. * @description 释放资源,将引用的资源属性置空。
  15215. */
  15216. destroy() {
  15217. super.destroy();
  15218. this.format = null;
  15219. }
  15220. /**
  15221. * @function SuperMap.NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  15222. * @description 分析完成,执行此方法。
  15223. * @param {Object} result - 服务器返回的结果对象。
  15224. */
  15225. serviceProcessCompleted(result) {
  15226. var me = this, analystResult;
  15227. result = Util.transformResult(result);
  15228. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  15229. analystResult = me.toGeoJSONResult(result);
  15230. }
  15231. if (!analystResult) {
  15232. analystResult = result;
  15233. }
  15234. me.events.triggerEvent("processCompleted", {result: analystResult});
  15235. }
  15236. /**
  15237. * @function SuperMap.NetworkAnalystServiceBase.prototype.toGeoJSONResult
  15238. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  15239. * @param {Object} result - 服务器返回的结果对象。
  15240. * @returns {GeoJSONObject} GeoJSON 对象。
  15241. */
  15242. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  15243. return null;
  15244. }
  15245. }
  15246. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  15247. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  15248. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15249. * This program are made available under the terms of the Apache License, Version 2.0
  15250. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15251. /**
  15252. * @class SuperMap.BurstPipelineAnalystService
  15253. * @category iServer NetworkAnalyst BurstAnalyse
  15254. * @classdesc 爆管分析服务类,即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  15255. * @extends {SuperMap.NetworkAnalystServiceBase}
  15256. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  15257. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  15258. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  15259. * @param {Object} options - 参数。
  15260. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  15261. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15262. * @param {Object} [options.headers] - 请求头。
  15263. */
  15264. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  15265. constructor(url, options) {
  15266. super(url, options);
  15267. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  15268. }
  15269. /**
  15270. * @function SuperMap.BurstPipelineAnalystService.prototype.destroy
  15271. * @override
  15272. */
  15273. destroy() {
  15274. super.destroy();
  15275. }
  15276. /**
  15277. * @function SuperMap.BurstPipelineAnalystService.prototype.processAsync
  15278. * @description 负责将客户端的查询参数传递到服务端。
  15279. * @params {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析参数类
  15280. */
  15281. processAsync(params) {
  15282. if (!(params instanceof BurstPipelineAnalystParameters)) {
  15283. return null;
  15284. }
  15285. var me = this, jsonObject;
  15286. me.url = Util.urlPathAppend(me.url, 'burstAnalyse');
  15287. jsonObject = {
  15288. sourceNodeIDs: params.sourceNodeIDs,
  15289. isUncertainDirectionValid: params.isUncertainDirectionValid
  15290. };
  15291. //必传参数不正确,就终止
  15292. if (params.edgeID !== null && params.nodeID !== null) {
  15293. throw new Error('edgeID and nodeID cannot be null at the same time.');
  15294. }
  15295. if (params.edgeID === null && params.nodeID === null) {
  15296. throw new Error('edgeID and nodeID cannot be null at the same time.');
  15297. }
  15298. if (params.edgeID !== null) {
  15299. jsonObject.edgeID = params.edgeID;
  15300. } else {
  15301. jsonObject.nodeID = params.nodeID;
  15302. }
  15303. me.request({
  15304. method: "GET",
  15305. params: jsonObject,
  15306. scope: me,
  15307. success: me.serviceProcessCompleted,
  15308. failure: me.serviceProcessFailed
  15309. });
  15310. }
  15311. }
  15312. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  15313. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  15314. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15315. * This program are made available under the terms of the Apache License, Version 2.0
  15316. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15317. /**
  15318. * @class SuperMap.ChartFeatureInfoSpecsService
  15319. * @category iServer Map Chart
  15320. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  15321. * 用户可以通过两种方式获取查询结果:
  15322. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  15323. * 另一种是使用 AsyncResponder 类实现异步处理。
  15324. * @extends {SuperMap.CommonServiceBase}
  15325. * @param {string} url - 地图(特指海图)服务地址。
  15326. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  15327. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  15328. * @param {Object} options - 参数。
  15329. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  15330. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  15331. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  15332. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15333. * @param {Object} [options.headers] - 请求头。
  15334. */
  15335. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  15336. constructor(url, options) {
  15337. super(url, options);
  15338. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  15339. }
  15340. /**
  15341. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.destroy
  15342. * @override
  15343. */
  15344. destroy() {
  15345. super.destroy();
  15346. Util.reset(this);
  15347. }
  15348. /**
  15349. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.processAsync
  15350. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  15351. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  15352. * 事件。用可以通过户两种方式获取图层信息:
  15353. * 1. 通过 AsyncResponder 类获取(推荐使用);
  15354. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  15355. */
  15356. processAsync() {
  15357. var me = this, method = "GET";
  15358. if (!me.isTempLayers) {
  15359. Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  15360. }
  15361. me.request({
  15362. method: method,
  15363. params: null,
  15364. scope: me,
  15365. success: me.serviceProcessCompleted,
  15366. failure: me.serviceProcessFailed
  15367. });
  15368. }
  15369. }
  15370. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  15371. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  15372. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15373. * This program are made available under the terms of the Apache License, Version 2.0
  15374. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15375. /**
  15376. * @class SuperMap.ChartQueryFilterParameter
  15377. * @category iServer Map Chart
  15378. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  15379. * @param {Object} options - 参数。
  15380. * @param {string} options.attributeFilter - 属性字段过滤条件。
  15381. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  15382. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  15383. * @param {boolean} [options.isQueryLine] - 是否查询线。
  15384. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  15385. */
  15386. class ChartQueryFilterParameter {
  15387. constructor(options) {
  15388. /**
  15389. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryPoint]
  15390. * @description 是否查询点。
  15391. */
  15392. this.isQueryPoint = null;
  15393. /**
  15394. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryLine]
  15395. * @description 是否查询线。
  15396. */
  15397. this.isQueryLine = null;
  15398. /**
  15399. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryRegion]
  15400. * @description 是否查询面。
  15401. */
  15402. this.isQueryRegion = null;
  15403. /**
  15404. * @member {string} SuperMap.ChartQueryFilterParameter.prototype.attributeFilter
  15405. * @description 属性字段过滤条件。
  15406. */
  15407. this.attributeFilter = null;
  15408. /**
  15409. * @member {number} SuperMap.ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  15410. * @description 查询的物标代号。
  15411. */
  15412. this.chartFeatureInfoSpecCode = null;
  15413. Util.extend(this, options);
  15414. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  15415. }
  15416. /**
  15417. * @function SuperMap.ChartQueryFilterParameter.prototype.destroy
  15418. * @description 释放资源,将引用资源的属性置空。
  15419. */
  15420. destroy() {
  15421. var me = this;
  15422. me.isQueryPoint = null;
  15423. me.isQueryLine = null;
  15424. me.isQueryRegion = null;
  15425. me.attributeFilter = null;
  15426. me.chartFeatureInfoSpecCode = null;
  15427. }
  15428. /**
  15429. * @function SuperMap.ChartQueryFilterParameter.prototype.toJson
  15430. * @description 将属性信息转化成 JSON 格式字符串。
  15431. */
  15432. toJson() {
  15433. var json = "";
  15434. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  15435. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  15436. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  15437. if (this.attributeFilter) {
  15438. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  15439. }
  15440. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  15441. json = "{" + json + "}";
  15442. return json;
  15443. }
  15444. }
  15445. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  15446. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  15447. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15448. * This program are made available under the terms of the Apache License, Version 2.0
  15449. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15450. /**
  15451. * @class SuperMap.ChartQueryParameters
  15452. * @category iServer Map Chart
  15453. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  15454. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  15455. * @param {Object} options - 参数。
  15456. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  15457. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  15458. * @param {Array.<{SuperMap.ChartQueryFilterParameter}>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  15459. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 海图查询范围。当进行海图范围查询时,此参数为必选。
  15460. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  15461. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  15462. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  15463. */
  15464. class ChartQueryParameters {
  15465. constructor(options) {
  15466. /**
  15467. * @member {string} SuperMap.ChartQueryParameters.prototype.queryMode
  15468. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery") 。
  15469. */
  15470. this.queryMode = null;
  15471. /**
  15472. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.ChartQueryParameters.prototype.bounds
  15473. * @description 海图查询范围。
  15474. */
  15475. this.bounds = null;
  15476. /**
  15477. * @member {Array.<string>} SuperMap.ChartQueryParameters.prototype.chartLayerNames
  15478. * @description 查询的海图图层的名称。
  15479. */
  15480. this.chartLayerNames = null;
  15481. /**
  15482. * @member {Array.<SuperMap.ChartQueryFilterParameter>} SuperMap.ChartQueryParameters.prototype.chartQueryFilterParameters
  15483. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  15484. */
  15485. this.chartQueryFilterParameters = null;
  15486. /**
  15487. * @member {boolean} [SuperMap.ChartQueryParameters.prototype.returnContent=true]
  15488. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  15489. */
  15490. this.returnContent = true;
  15491. /**
  15492. * @member {number} [SuperMap.ChartQueryParameters.prototype.startRecord=0]
  15493. * @description 查询起始记录位置。
  15494. */
  15495. this.startRecord = 0;
  15496. /**
  15497. * @member {number} [SuperMap.ChartQueryParameters.prototype.expectCount]
  15498. * @description 期望查询结果返回的记录数,该值大于0。
  15499. */
  15500. this.expectCount = null;
  15501. Util.extend(this, options);
  15502. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  15503. }
  15504. /**
  15505. * @function SuperMap.ChartQueryParameters.prototype.destroy
  15506. * @description 释放资源,将引用资源的属性置空。
  15507. */
  15508. destroy() {
  15509. var me = this;
  15510. me.queryMode = null;
  15511. me.bounds = null;
  15512. me.chartLayerNames = null;
  15513. me.chartQueryFilterParameters = null;
  15514. me.returnContent = true;
  15515. me.startRecord = 0;
  15516. me.expectCount = null;
  15517. }
  15518. /**
  15519. * @function SuperMap.ChartQueryParameters.prototype.getVariablesJson
  15520. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  15521. * @returns {string} JSON 字符串。
  15522. */
  15523. getVariablesJson() {
  15524. var json = "";
  15525. json += "\"queryMode\":\"" + this.queryMode + "\",";
  15526. if (this.chartLayerNames && this.chartLayerNames.length) {
  15527. var chartLayersArray = [];
  15528. var layerLength = this.chartLayerNames.length;
  15529. for (var i = 0; i < layerLength; i++) {
  15530. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  15531. }
  15532. var layerNames = "[" + chartLayersArray.join(",") + "]";
  15533. json += "\"chartLayerNames\":" + layerNames + ",";
  15534. }
  15535. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  15536. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  15537. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  15538. "\"y\":" + this.bounds.top + "}" + "},";
  15539. }
  15540. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  15541. var chartParamArray = [];
  15542. var chartLength = this.chartQueryFilterParameters.length;
  15543. for (var j = 0; j < chartLength; j++) {
  15544. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  15545. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  15546. continue;
  15547. }
  15548. chartParamArray.push(chartQueryFilterParameter.toJson());
  15549. }
  15550. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  15551. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  15552. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  15553. chartParamsJson += "\"expectCount\":" + this.expectCount;
  15554. chartParamsJson = "{" + chartParamsJson + "}";
  15555. json += "\"chartQueryParameters\":" + chartParamsJson;
  15556. }
  15557. json = "{" + json + "}";
  15558. return json;
  15559. }
  15560. }
  15561. SuperMap.ChartQueryParameters = ChartQueryParameters;
  15562. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  15563. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15564. * This program are made available under the terms of the Apache License, Version 2.0
  15565. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15566. /**
  15567. * @class SuperMap.QueryParameters
  15568. * @category iServer Map QueryResults
  15569. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  15570. * @param {Object} options - 参数。
  15571. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  15572. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  15573. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  15574. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  15575. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  15576. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  15577. * @param {number} [options.startRecord=0] - 查询起始记录号。
  15578. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  15579. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  15580. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  15581. */
  15582. class QueryParameters {
  15583. constructor(options) {
  15584. if (!options) {
  15585. return;
  15586. }
  15587. /**
  15588. * @member {string} [SuperMap.QueryParameters.prototype.customParams]
  15589. * @description 自定义参数,供扩展使用。
  15590. */
  15591. this.customParams = null;
  15592. /**
  15593. * @member {Object} [SuperMap.QueryParameters.prototype.prjCoordSys]
  15594. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  15595. */
  15596. this.prjCoordSys = null;
  15597. /**
  15598. * @member {number} [SuperMap.QueryParameters.prototype.expectCount=100000]
  15599. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  15600. * 如果实际不足100000条则返回实际记录条数。
  15601. */
  15602. this.expectCount = 100000;
  15603. /**
  15604. * @member {SuperMap.GeometryType} [SuperMap.QueryParameters.prototype.networkType=SuperMap.GeometryType.LINE]
  15605. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  15606. */
  15607. this.networkType = GeometryType.LINE;
  15608. /**
  15609. * @member {SuperMap.QueryOption} [SuperMap.QueryParameters.prototype.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY]
  15610. * @description 查询结果类型枚举类。
  15611. * 该类描述查询结果返回类型,包括只返回属性、
  15612. * 只返回几何实体以及返回属性和几何实体。
  15613. */
  15614. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  15615. /**
  15616. * @member {Array.<SuperMap.FilterParameter>} SuperMap.QueryParameters.prototype.queryParams
  15617. * @description 查询过滤条件参数数组。
  15618. * 该类用于设置查询数据集的查询过滤参数。
  15619. */
  15620. this.queryParams = null;
  15621. /**
  15622. * @member {number} [SuperMap.QueryParameters.prototype.startRecord=0]
  15623. * @description 查询起始记录号。
  15624. */
  15625. this.startRecord = 0;
  15626. /**
  15627. * @member {number} [SuperMap.QueryParameters.prototype.holdTime=10]
  15628. * @description 资源在服务端保存的时间,单位为分钟。
  15629. */
  15630. this.holdTime = 10;
  15631. /**
  15632. * @member {boolean} [SuperMap.QueryParameters.prototype.returnCustomResult=false]
  15633. * @description 仅供三维使用。
  15634. */
  15635. this.returnCustomResult = false;
  15636. /**
  15637. * @member {boolean} [SuperMap.QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  15638. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  15639. */
  15640. this.returnFeatureWithFieldCaption = false;
  15641. Util.extend(this, options);
  15642. this.CLASS_NAME = "SuperMap.QueryParameters";
  15643. }
  15644. /**
  15645. * @function SuperMap.QueryParameters.prototype.destroy
  15646. * @description 释放资源,将引用资源的属性置空。
  15647. */
  15648. destroy() {
  15649. var me = this;
  15650. me.customParams = null;
  15651. me.expectCount = null;
  15652. me.networkType = null;
  15653. me.queryOption = null;
  15654. if (me.queryParams) {
  15655. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  15656. qps[i].destroy();
  15657. }
  15658. me.queryParams = null;
  15659. }
  15660. me.startRecord = null;
  15661. me.holdTime = null;
  15662. me.returnCustomResult = null;
  15663. me.prjCoordSys = null;
  15664. }
  15665. }
  15666. SuperMap.QueryParameters = QueryParameters;
  15667. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  15668. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15669. * This program are made available under the terms of the Apache License, Version 2.0
  15670. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15671. /**
  15672. * @class SuperMap.ChartQueryService
  15673. * @category iServer Map Chart
  15674. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  15675. * 用户可以通过两种方式获取查询结果:
  15676. * 1.通过 AsyncResponder 类获取(推荐使用);
  15677. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  15678. * @extends {SuperMap.CommonServiceBase}
  15679. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  15680. * @param {Object} options - 参数。
  15681. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  15682. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  15683. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  15684. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15685. * @param {Object} [options.headers] - 请求头。
  15686. * @example
  15687. * 下面示例显示了如何进行海图属性查询:
  15688. * var nameArray = ["GB4X0000_52000"];
  15689. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  15690. * isQueryPoint:true,
  15691. * isQueryLine:true,
  15692. * isQueryRegion:true,
  15693. * attributeFilter:"SmID<10",
  15694. * chartFeatureInfoSpecCode:1
  15695. * });
  15696. *
  15697. * var chartQueryParameters = new SuperMap.ChartQueryParameters({
  15698. * queryMode:"ChartAttributeQuery",
  15699. * chartLayerNames:nameArray,
  15700. * returnContent:true,
  15701. * chartQueryFilterParameters:[chartQueryFilterParameter]
  15702. * });
  15703. *
  15704. * var chartQueryService = new SuperMap.ChartQueryService(url);
  15705. *
  15706. * chartQueryService.events.on({
  15707. * "processCompleted":processCompleted,
  15708. * "processFailed":processFailed
  15709. * });
  15710. * chartQueryService.processAsync(chartQueryParameters);
  15711. */
  15712. class ChartQueryService extends CommonServiceBase {
  15713. constructor(url, options) {
  15714. super(url, options);
  15715. options = options || {};
  15716. /**
  15717. * @member {boolean} SuperMap.ChartQueryService.prototype.returnContent
  15718. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  15719. */
  15720. this.returnContent = null;
  15721. /**
  15722. * @member {SuperMap.DataFormat} SuperMap.ChartQueryService.prototype.format
  15723. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  15724. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  15725. */
  15726. this.format = DataFormat.GEOJSON;
  15727. Util.extend(this, options);
  15728. var me = this;
  15729. if (options.format) {
  15730. me.format = options.format.toUpperCase();
  15731. }
  15732. if (!me.url) {
  15733. return;
  15734. }
  15735. me.url = Util.urlPathAppend(me.url, 'queryResults');
  15736. this.CLASS_NAME = "SuperMap.ChartQueryService";
  15737. }
  15738. /**
  15739. * @function SuperMap.ChartQueryService.prototype.destroy
  15740. * @override
  15741. */
  15742. destroy() {
  15743. var me = this;
  15744. CommonServiceBase.prototype.destroy.apply(this, arguments);
  15745. me.returnContent = null;
  15746. me.format = null;
  15747. }
  15748. /**
  15749. * @function SuperMap.ChartQueryService.prototype.processAsync
  15750. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  15751. * @param {SuperMap.ChartQueryParameters} params - 查询参数。
  15752. */
  15753. processAsync(params) {
  15754. //todo重点需要添加代码的地方
  15755. if (!(params instanceof ChartQueryParameters)) {
  15756. return;
  15757. }
  15758. var me = this, jsonParameters;
  15759. me.returnContent = params.returnContent;
  15760. jsonParameters = params.getVariablesJson();
  15761. if (me.returnContent) {
  15762. me.url = Util.urlAppend(me.url, 'returnContent=true');
  15763. }
  15764. me.request({
  15765. method: "POST",
  15766. data: jsonParameters,
  15767. scope: me,
  15768. success: me.serviceProcessCompleted,
  15769. failure: me.serviceProcessFailed
  15770. });
  15771. }
  15772. /**
  15773. * @function SuperMap.ChartQueryService.prototype.serviceProcessCompleted
  15774. * @description 查询完成,执行此方法。
  15775. * @param {Object} result - 服务器返回的结果对象。
  15776. */
  15777. serviceProcessCompleted(result) {
  15778. var me = this;
  15779. result = Util.transformResult(result);
  15780. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  15781. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  15782. if (recordsets[i].features) {
  15783. var geoJSONFormat = new GeoJSON();
  15784. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  15785. }
  15786. }
  15787. }
  15788. me.events.triggerEvent("processCompleted", {result: result});
  15789. }
  15790. /**
  15791. * @function SuperMap.ChartQueryService.prototype.getQueryParameters
  15792. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  15793. * @param {Object} params - JSON 字符串表示的查询参数。
  15794. * @returns {SuperMap.QueryParameters} 返回查询结果
  15795. */
  15796. getQueryParameters(params) {
  15797. return new QueryParameters({
  15798. queryMode: params.queryMode,
  15799. bounds: params.bounds,
  15800. chartLayerNames: params.chartLayerNames,
  15801. chartQueryFilterParameters: params.chartQueryFilterParameters,
  15802. returnContent: params.returnContent
  15803. });
  15804. }
  15805. }
  15806. SuperMap.ChartQueryService = ChartQueryService;
  15807. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  15808. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15809. * This program are made available under the terms of the Apache License, Version 2.0
  15810. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15811. /**
  15812. * @class SuperMap.ClipParameter
  15813. * @category iServer SpatialAnalyst InterpolationAnalyst
  15814. * @classdesc 用于裁剪的参数。
  15815. * @description 优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  15816. * @param {Object} options - 参数。
  15817. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  15818. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  15819. * @param {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} [options.clipRegion] - 用户指定的裁剪区域。
  15820. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  15821. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  15822. */
  15823. class ClipParameter {
  15824. constructor(options) {
  15825. /**
  15826. * @member {string} SuperMap.ClipParameter.prototype.clipDatasetName
  15827. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  15828. */
  15829. this.clipDatasetName = null;
  15830. /**
  15831. * @member {string} SuperMap.ClipParameter.prototype.clipDatasourceName
  15832. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  15833. */
  15834. this.clipDatasourceName = null;
  15835. /**
  15836. * @member {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} SuperMap.ClipParameter.prototype.clipRegion
  15837. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  15838. */
  15839. this.clipRegion = null;
  15840. /**
  15841. * @member {boolean} [SuperMap.ClipParameter.prototype.isClipInRegion=true]
  15842. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  15843. */
  15844. this.isClipInRegion = true;
  15845. /**
  15846. * @member {boolean} [SuperMap.ClipParameter.prototype.isExactClip=true]
  15847. * @description 是否使用精确裁剪。
  15848. */
  15849. this.isExactClip = null;
  15850. if (options) {
  15851. Util.extend(this, options);
  15852. }
  15853. this.CLASS_NAME = "SuperMap.ClipParameter";
  15854. }
  15855. /**
  15856. * @function SuperMap.ClipParameter.prototype.destroy
  15857. * @description 释放资源,将引用资源的属性置空。
  15858. */
  15859. destroy() {
  15860. var me = this;
  15861. me.clipDatasetName = null;
  15862. me.clipDatasourceName = null;
  15863. me.clipRegion = null;
  15864. me.isClipInRegion = null;
  15865. me.isExactClip = null;
  15866. }
  15867. /**
  15868. * @function SuperMap.ClipParameter.prototype.toJSON
  15869. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  15870. * @returns {string} 返回转换后的 JSON 字符串。
  15871. */
  15872. toJSON() {
  15873. return Util.toJSON({
  15874. isClipInRegion: this.isClipInRegion,
  15875. clipDatasetName: this.clipDatasetName,
  15876. clipDatasourceName: this.clipDatasourceName,
  15877. isExactClip: this.isExactClip,
  15878. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  15879. });
  15880. }
  15881. }
  15882. SuperMap.ClipParameter = ClipParameter;
  15883. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  15884. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15885. * This program are made available under the terms of the Apache License, Version 2.0
  15886. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15887. /**
  15888. * @class SuperMap.ColorDictionary
  15889. * @category iServer Map Theme
  15890. * @classdesc 颜色对照表类。
  15891. * @description 颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  15892. * @param {Object} options - 参数。
  15893. * @param {number} options.elevation - 高程值。
  15894. * @param {SuperMap.ServerColor} options.color - 服务端颜色类。
  15895. */
  15896. class ColorDictionary {
  15897. constructor(options) {
  15898. options = options || {};
  15899. /**
  15900. * @member {number} SuperMap.ColorDictionary.prototype.elevation
  15901. * @description 高程值。
  15902. */
  15903. this.elevation = null;
  15904. /**
  15905. * @member {SuperMap.ServerColor} SuperMap.ColorDictionary.prototype.color
  15906. * @description 服务端颜色类。
  15907. */
  15908. this.color = null;
  15909. Util.extend(this, options);
  15910. var me = this,
  15911. c = me.color;
  15912. if (c) {
  15913. me.color = new ServerColor(c.red, c.green, c.blue);
  15914. }
  15915. this.CLASS_NAME = "SuperMap.ColorDictionary";
  15916. }
  15917. /**
  15918. * @function SuperMap.ColorDictionary.prototype.destroy
  15919. * @description 释放资源,将引用资源的属性置空。
  15920. */
  15921. destroy() {
  15922. Util.reset(this);
  15923. }
  15924. /**
  15925. * @function SuperMap.ColorDictionary.prototype.toServerJSONObject
  15926. * @description 转换成对应的 JSON 格式对象。
  15927. * @returns {Object} JSON 对象。
  15928. */
  15929. toServerJSONObject() {
  15930. var dataObj = {};
  15931. dataObj = Util.copyAttributes(dataObj, this);
  15932. return dataObj;
  15933. }
  15934. }
  15935. SuperMap.ColorDictionary = ColorDictionary;
  15936. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  15937. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15938. * This program are made available under the terms of the Apache License, Version 2.0
  15939. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15940. /**
  15941. * @class SuperMap.TransportationAnalystResultSetting
  15942. * @category iServer NetworkAnalyst
  15943. * @classdesc 交通网络分析结果参数类。
  15944. * @description 通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  15945. * @param {Object} options - 参数。
  15946. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  15947. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  15948. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  15949. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  15950. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  15951. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  15952. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  15953. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  15954. */
  15955. class TransportationAnalystResultSetting {
  15956. constructor(options) {
  15957. if (!options) {
  15958. return;
  15959. }
  15960. /**
  15961. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  15962. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  15963. */
  15964. this.returnEdgeFeatures = false;
  15965. /**
  15966. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  15967. * @description 返回的弧段要素集合中是否包含几何对象信息。
  15968. */
  15969. this.returnEdgeGeometry = false;
  15970. /**
  15971. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  15972. * @description 返回结果中是否包含经过弧段 ID 集合。
  15973. */
  15974. this.returnEdgeIDs = false;
  15975. /**
  15976. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  15977. * @description 是否在分析结果中包含结点要素集合。
  15978. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  15979. */
  15980. this.returnNodeFeatures = false;
  15981. /**
  15982. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  15983. * @description 返回的结点要素集合中是否包含几何对象信息。
  15984. */
  15985. this.returnNodeGeometry = false;
  15986. /**
  15987. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  15988. * @description 返回结果中是否包含经过结点 ID 集合。
  15989. */
  15990. this.returnNodeIDs = false;
  15991. /**
  15992. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnPathGuides
  15993. * @description 返回分析结果中是否包含行驶导引集合。
  15994. */
  15995. this.returnPathGuides = false;
  15996. /**
  15997. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnRoutes
  15998. * @description 返回分析结果中是否包含路由对象的集合。
  15999. */
  16000. this.returnRoutes = false;
  16001. Util.extend(this, options);
  16002. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  16003. }
  16004. /**
  16005. * @function SuperMap.TransportationAnalystResultSetting.prototype.destroy
  16006. * @description 释放资源,将引用资源的属性置空。
  16007. */
  16008. destroy() {
  16009. var me = this;
  16010. me.returnEdgeFeatures = null;
  16011. me.returnEdgeGeometry = null;
  16012. me.returnEdgeIDs = null;
  16013. me.returnNodeFeatures = null;
  16014. me.returnNodeGeometry = null;
  16015. me.returnNodeIDs = null;
  16016. me.returnPathGuides = null;
  16017. me.returnRoutes = null;
  16018. }
  16019. }
  16020. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  16021. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  16022. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16023. * This program are made available under the terms of the Apache License, Version 2.0
  16024. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16025. /**
  16026. * @class SuperMap.TransportationAnalystParameter
  16027. * @category iServer NetworkAnalyst
  16028. * @classdesc 交通网络分析通用参数类。
  16029. * @description 该类主要用来提供交通网络分析所需的通用参数。
  16030. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  16031. * @param {Object} options - 参数。
  16032. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  16033. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  16034. * @param {string} options.turnWeightField - 转向权重字段的名称。
  16035. * @param {SuperMap.TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  16036. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  16037. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  16038. */
  16039. class TransportationAnalystParameter {
  16040. constructor(options) {
  16041. if (!options) {
  16042. return;
  16043. }
  16044. /**
  16045. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierEdgeIDs
  16046. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  16047. */
  16048. this.barrierEdgeIDs = null;
  16049. /**
  16050. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierNodeIDs
  16051. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  16052. */
  16053. this.barrierNodeIDs = null;
  16054. /**
  16055. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransportationAnalystParameter.prototype.barrierPoints
  16056. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  16057. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  16058. */
  16059. this.barrierPoints = null;
  16060. /**
  16061. * @member {string} [SuperMap.TransportationAnalystParameter.prototype.weightFieldName]
  16062. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  16063. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  16064. */
  16065. this.weightFieldName = null;
  16066. /**
  16067. * @member {string} SuperMap.TransportationAnalystParameter.prototype.turnWeightField
  16068. * @description 转向权重字段的名称。
  16069. */
  16070. this.turnWeightField = null;
  16071. /**
  16072. * @member {SuperMap.TransportationAnalystResultSetting} SuperMap.TransportationAnalystParameter.prototype.resultSetting
  16073. * @description 分析结果返回内容。
  16074. */
  16075. this.resultSetting = new TransportationAnalystResultSetting();
  16076. Util.extend(this, options);
  16077. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  16078. }
  16079. /**
  16080. * @function SuperMap.TransportationAnalystParameter.prototype.destroy
  16081. * @description 释放资源,将引用资源的属性置空。
  16082. */
  16083. destroy() {
  16084. var me = this;
  16085. me.barrierEdgeIDs = null;
  16086. me.barrierNodeIDs = null;
  16087. me.weightFieldName = null;
  16088. me.turnWeightField = null;
  16089. if (me.resultSetting) {
  16090. me.resultSetting.destroy();
  16091. me.resultSetting = null;
  16092. }
  16093. if (me.barrierPoints && me.barrierPoints.length) {
  16094. for (var i in me.barrierPoints) {
  16095. me.barrierPoints[i].destroy();
  16096. }
  16097. }
  16098. me.barrierPoints = null;
  16099. }
  16100. }
  16101. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  16102. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  16103. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16104. * This program are made available under the terms of the Apache License, Version 2.0
  16105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16106. /**
  16107. * @class SuperMap.ComputeWeightMatrixParameters
  16108. * @category iServer NetworkAnalyst WeightMatrix
  16109. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  16110. * @param {Object} options - 参数。
  16111. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  16112. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 要计算耗费矩阵的点数组。
  16113. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  16114. */
  16115. class ComputeWeightMatrixParameters {
  16116. constructor(options) {
  16117. /**
  16118. * @member {boolean} [SuperMap.ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  16119. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  16120. */
  16121. this.isAnalyzeById = false;
  16122. /**
  16123. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.ComputeWeightMatrixParameters.prototype.nodes
  16124. * @description 要计算耗费矩阵的点数组。
  16125. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  16126. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  16127. */
  16128. this.nodes = null;
  16129. /**
  16130. * @member {SuperMap.TransportationAnalystParameter} SuperMap.ComputeWeightMatrixParameters.prototype.parameter
  16131. * @description 交通网络分析通用参数。
  16132. */
  16133. this.parameter = new TransportationAnalystParameter();
  16134. Util.extend(this, options);
  16135. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  16136. }
  16137. /**
  16138. * @function SuperMap.ComputeWeightMatrixParameters.prototype.destroy
  16139. * @description 释放资源,将引用资源的属性置空。
  16140. */
  16141. destroy() {
  16142. var me = this;
  16143. me.isAnalyzeById = null;
  16144. me.nodes = null;
  16145. if (me.parameter) {
  16146. me.parameter.destroy();
  16147. me.parameter = null;
  16148. }
  16149. }
  16150. }
  16151. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  16152. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  16153. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16154. * This program are made available under the terms of the Apache License, Version 2.0
  16155. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16156. /**
  16157. * @class SuperMap.ComputeWeightMatrixService
  16158. * @category iServer NetworkAnalyst WeightMatrix
  16159. * @classdesc 耗费矩阵分析服务类。
  16160. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  16161. * 用来存储指定的任意两点间的资源消耗。
  16162. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  16163. * @extends {SuperMap.NetworkAnalystServiceBase}
  16164. * @example
  16165. * var mycomputeWeightMatrixService = new SuperMap.ComputeWeightMatrixService(url,{
  16166. * eventListeners: {
  16167. * "processCompleted": computeWeightMatrixCompleted,
  16168. * "processFailed": computeWeightMatrixnError
  16169. * }
  16170. * });
  16171. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  16172. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  16173. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  16174. * @param {Object} options - 参数。
  16175. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  16176. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16177. * @param {Object} [options.headers] - 请求头。
  16178. */
  16179. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  16180. constructor(url, options) {
  16181. super(url, options);
  16182. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  16183. }
  16184. /**
  16185. * @function SuperMap.ComputeWeightMatrixService.prototype.destroy
  16186. * @override
  16187. */
  16188. destroy() {
  16189. super.destroy();
  16190. }
  16191. /**
  16192. * @function SuperMap.ComputeWeightMatrixService.prototype.processAsync
  16193. * @description 负责将客户端的查询参数传递到服务端。
  16194. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  16195. */
  16196. processAsync(params) {
  16197. if (!(params instanceof ComputeWeightMatrixParameters)) {
  16198. return;
  16199. }
  16200. var me = this,
  16201. jsonObject;
  16202. me.url = Util.urlPathAppend(me.url, 'weightmatrix');
  16203. jsonObject = {
  16204. parameter: Util.toJSON(params.parameter),
  16205. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  16206. };
  16207. me.request({
  16208. method: "GET",
  16209. params: jsonObject,
  16210. scope: me,
  16211. success: me.serviceProcessCompleted,
  16212. failure: me.serviceProcessFailed
  16213. });
  16214. }
  16215. /**
  16216. * @function SuperMap.ComputeWeightMatrixService.prototype.getJson
  16217. * @description 将对象转化为JSON字符串。
  16218. * @param {boolean} isAnalyzeById - 是否通过id分析
  16219. * @param {Array.<SuperMap.ComputeWeightMatrixParameters>} params - 分析参数数组
  16220. * @returns {string} 转化后的JSON字符串。
  16221. */
  16222. getJson(isAnalyzeById, params) {
  16223. var jsonString = "[",
  16224. len = params ? params.length : 0;
  16225. if (isAnalyzeById === false) {
  16226. for (let i = 0; i < len; i++) {
  16227. if (i > 0) {
  16228. jsonString += ",";
  16229. }
  16230. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  16231. }
  16232. } else if (isAnalyzeById === true) {
  16233. for (let i = 0; i < len; i++) {
  16234. if (i > 0) {
  16235. jsonString += ",";
  16236. }
  16237. jsonString += params[i];
  16238. }
  16239. }
  16240. jsonString += ']';
  16241. return jsonString;
  16242. }
  16243. }
  16244. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  16245. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  16246. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16247. * This program are made available under the terms of the Apache License, Version 2.0
  16248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16249. /**
  16250. * @class SuperMap.DataFlowService
  16251. * @category iServer DataFlow
  16252. * @classdesc 数据流服务类
  16253. * @extends {SuperMap.CommonServiceBase}
  16254. * @param {string} url - 数据流服务地址
  16255. * @param {Object} options - 参数。
  16256. * @param {function} options.style - 设置数据加载样式。
  16257. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  16258. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  16259. * @param {Object} [options.excludeField] - -排除字段。
  16260. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16261. * @param {Object} [options.headers] - 请求头。
  16262. */
  16263. class DataFlowService_DataFlowService extends CommonServiceBase {
  16264. constructor(url, options) {
  16265. options = options || {};
  16266. /*
  16267. * @constant EVENT_TYPES
  16268. * {Array.<string>}
  16269. * 此类支持的事件类型
  16270. */
  16271. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  16272. super(url, options);
  16273. /**
  16274. * @member {GeoJSONObject} SuperMap.DataFlowService.prototype.geometry
  16275. * @description 指定几何范围,该范围内的要素才能被订阅。
  16276. */
  16277. this.geometry = null;
  16278. /**
  16279. * @member {Object} SuperMap.DataFlowService.prototype.prjCoordSys
  16280. * @description 动态投影参数
  16281. */
  16282. this.prjCoordSys = null;
  16283. /**
  16284. * @member {Object} SuperMap.DataFlowService.prototype.excludeField
  16285. * @description 排除字段
  16286. */
  16287. this.excludeField = null;
  16288. Util.extend(this, options);
  16289. this.CLASS_NAME = "SuperMap.DataFlowService";
  16290. }
  16291. /**
  16292. * @function SuperMap.DataFlowService.prototype.initBroadcast
  16293. * @description 初始化广播
  16294. * @returns {SuperMap.DataFlowService}
  16295. */
  16296. initBroadcast() {
  16297. var me = this;
  16298. this.broadcastWebSocket = this._connect(Util.urlPathAppend(me.url, 'broadcast'));
  16299. this.broadcastWebSocket.onopen = function (e) {
  16300. me.broadcastWebSocket.isOpen = true;
  16301. e.eventType = 'broadcastSocketConnected';
  16302. me.events.triggerEvent('broadcastSocketConnected', e);
  16303. };
  16304. this.broadcastWebSocket.onclose = function (e) {
  16305. me.broadcastWebSocket.isOpen = false;
  16306. e.eventType = 'broadcastSocketConnected';
  16307. me.events.triggerEvent('broadcastSocketConnected', e);
  16308. };
  16309. this.broadcastWebSocket.onerror = function (e) {
  16310. e.eventType = 'broadcastSocketError';
  16311. me.events.triggerEvent('broadcastSocketError', e);
  16312. };
  16313. return this;
  16314. }
  16315. /**
  16316. * @function SuperMap.DataFlowService.prototype.broadcast
  16317. * @description 加载广播数据。
  16318. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  16319. */
  16320. broadcast(geoJSONFeature) {
  16321. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  16322. this.events.triggerEvent('broadcastFailed');
  16323. return;
  16324. }
  16325. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  16326. this.events.triggerEvent('broadcastSucceeded');
  16327. }
  16328. /**
  16329. * @function SuperMap.DataFlowService.prototype.initSubscribe
  16330. * @description 初始化订阅数据
  16331. * @returns {this} this
  16332. */
  16333. initSubscribe() {
  16334. var me = this;
  16335. this.subscribeWebSocket = this._connect(Util.urlPathAppend(me.url, 'subscribe'));
  16336. this.subscribeWebSocket.onopen = function (e) {
  16337. me.subscribeWebSocket.send(me._getFilterParams());
  16338. e.eventType = 'subscribeSocketConnected';
  16339. me.events.triggerEvent('subscribeSocketConnected', e);
  16340. };
  16341. this.subscribeWebSocket.onerror = function (e) {
  16342. e.eventType = 'subscribeSocketError';
  16343. me.events.triggerEvent('subscribeSocketError', e);
  16344. };
  16345. this.subscribeWebSocket.onmessage = function (e) {
  16346. me._onMessage(e);
  16347. };
  16348. return this;
  16349. }
  16350. /**
  16351. * @function SuperMap.DataFlowService.prototype.setExcludeField
  16352. * @description 设置排除字段
  16353. * @param {Object} excludeField - 排除字段
  16354. * @returns {this} this
  16355. */
  16356. setExcludeField(excludeField) {
  16357. this.excludeField = excludeField;
  16358. this.subscribeWebSocket.send(this._getFilterParams());
  16359. return this;
  16360. }
  16361. /**
  16362. * @function SuperMap.DataFlowService.prototype.setGeometry
  16363. * @description 设置添加的几何要素数据
  16364. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  16365. * @returns {this} this
  16366. */
  16367. setGeometry(geometry) {
  16368. this.geometry = geometry;
  16369. this.subscribeWebSocket.send(this._getFilterParams());
  16370. return this;
  16371. }
  16372. /**
  16373. * @function SuperMap.DataFlowService.prototype.unSubscribe
  16374. * @description 结束订阅数据
  16375. */
  16376. unSubscribe() {
  16377. if (!this.subscribeWebSocket) {
  16378. return;
  16379. }
  16380. this.subscribeWebSocket.close();
  16381. this.subscribeWebSocket = null;
  16382. }
  16383. /**
  16384. * @function SuperMap.DataFlowService.prototype.unBroadcast
  16385. * @description 结束加载广播
  16386. */
  16387. unBroadcast() {
  16388. if (!this.broadcastWebSocket) {
  16389. return;
  16390. }
  16391. this.broadcastWebSocket.close();
  16392. this.broadcastWebSocket = null;
  16393. }
  16394. /**
  16395. * @function SuperMap.DataFlowService.prototype.destroy
  16396. * @override
  16397. */
  16398. destroy() {
  16399. CommonServiceBase.prototype.destroy.apply(this, arguments);
  16400. var me = this;
  16401. me.geometry = null;
  16402. me.prjCoordSys = null;
  16403. me.excludeField = null;
  16404. this.unBroadcast();
  16405. this.unSubscribe();
  16406. }
  16407. _getFilterParams() {
  16408. var filter = {
  16409. filterParam: {
  16410. prjCoordSys: this.prjCoordSys,
  16411. excludeField: this.excludeField,
  16412. geometry: this.geometry
  16413. }
  16414. };
  16415. return Util.toJSON(filter);
  16416. }
  16417. _onMessage(e) {
  16418. if (e.data && e.data.indexOf("filterParam") >= 0) {
  16419. var filterParam = JSON.parse(e.data);
  16420. e.filterParam = filterParam;
  16421. e.eventType = 'setFilterParamSucceeded';
  16422. this.events.triggerEvent('setFilterParamSucceeded', e);
  16423. return;
  16424. }
  16425. var feature = JSON.parse(e.data);
  16426. e.featureResult = feature;
  16427. e.eventType = 'messageSucceeded';
  16428. this.events.triggerEvent('messageSucceeded', e);
  16429. }
  16430. _connect(url) {
  16431. url = this._appendCredentials(url);
  16432. if ("WebSocket" in window) {
  16433. return new WebSocket(url);
  16434. } else if ("MozWebSocket" in window) {
  16435. var mozWebSocket = window.MozWebSocket;
  16436. return new mozWebSocket(url);
  16437. } else {
  16438. console.log("no WebSocket");
  16439. return null;
  16440. }
  16441. }
  16442. _appendCredentials(url) {
  16443. var token = SecurityManager.getToken(url);
  16444. if (token) {
  16445. url = Util.urlAppend(url, "token=" + token);
  16446. }
  16447. return url;
  16448. }
  16449. }
  16450. SuperMap.DataFlowService = DataFlowService_DataFlowService;
  16451. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  16452. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16453. * This program are made available under the terms of the Apache License, Version 2.0
  16454. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16455. /**
  16456. * @class SuperMap.DatasetInfo
  16457. * @category iServer Data
  16458. * @classdesc 数据集信息类。
  16459. * @description 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  16460. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  16461. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  16462. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  16463. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  16464. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  16465. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  16466. * @param {Object} options - 参数。
  16467. * @param {SuperMap.Bounds} [options.bounds] - 数据集范围,该字段只读。
  16468. * @param {string} [options.dataSourceName] - 数据源名称,该字段只读。
  16469. * @param {string} [options.description] - 数据集的描述信息。
  16470. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式,该字段只读。
  16471. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  16472. * @param {string} options.name - 数据集名称,该字段必须且只读。
  16473. * @param {SuperMap.Projection} [options.prjCoordSys] - 数据集的投影信息。
  16474. * @param {string} [options.tableName] - 表名,该字段只读。
  16475. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  16476. */
  16477. class DatasetInfo {
  16478. constructor(options) {
  16479. options = options || {};
  16480. /**
  16481. * @member {SuperMap.Bounds} [SuperMap.DatasetInfo.prototype.bounds]
  16482. * @description 数据集范围,该字段只读。
  16483. */
  16484. this.bounds = null;
  16485. /**
  16486. * @member {string} [SuperMap.DatasetInfo.prototype.dataSourceName]
  16487. * @description 数据源名称,该字段只读。
  16488. */
  16489. this.dataSourceName = null;
  16490. /**
  16491. * @member {string} [SuperMap.DatasetInfo.prototype.description]
  16492. * @description 数据集的描述信息。
  16493. */
  16494. this.description = null;
  16495. /**
  16496. * @member {string} [SuperMap.DatasetInfo.prototype.encodeType]
  16497. * @description 数据集存储时的压缩编码方式,该字段只读。
  16498. */
  16499. this.encodeType = null;
  16500. /**
  16501. * @member {boolean} [SuperMap.DatasetInfo.prototype.isReadOnly]
  16502. * @description 数据集是否为只读。
  16503. */
  16504. this.isReadOnly = null;
  16505. /**
  16506. * @member {string} SuperMap.DatasetInfo.prototype.name
  16507. * @description 数据集名称,该字段必须且只读。
  16508. */
  16509. this.name = null;
  16510. /**
  16511. * @member {SuperMap.Projection} [SuperMap.DatasetInfo.prototype.prjCoordSys]
  16512. * @description 数据集的投影信息。
  16513. */
  16514. this.prjCoordSys = null;
  16515. /**
  16516. * @member {string} [SuperMap.DatasetInfo.prototype.tableName]
  16517. * @description 表名,该字段只读。
  16518. */
  16519. this.tableName = null;
  16520. /**
  16521. * @member {string} SuperMap.DatasetInfo.prototype.type
  16522. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  16523. */
  16524. this.type = null;
  16525. Util.extend(this, options);
  16526. var b = this.bounds;
  16527. if (b) {
  16528. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  16529. }
  16530. this.CLASS_NAME = "SuperMap.DatasetInfo";
  16531. }
  16532. /**
  16533. * @function SuperMap.DatasetInfo.prototype.destroy
  16534. * @description 释放资源,将引用资源的属性置空。
  16535. */
  16536. destroy() {
  16537. Util.reset(this);
  16538. }
  16539. /**
  16540. * @function SuperMap.DatasetInfo.prototype.toServerJSONObject
  16541. * @description 转换成对应的 JSON 格式对象。
  16542. * @returns {Object} JSON 对象。
  16543. */
  16544. toServerJSONObject() {
  16545. var dataObj = {};
  16546. dataObj = Util.copyAttributes(dataObj, this);
  16547. if (dataObj.bounds) {
  16548. if (dataObj.bounds.toServerJSONObject) {
  16549. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  16550. }
  16551. }
  16552. return dataObj;
  16553. }
  16554. }
  16555. SuperMap.DatasetInfo = DatasetInfo;
  16556. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  16557. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16558. * This program are made available under the terms of the Apache License, Version 2.0
  16559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16560. /**
  16561. * @class SuperMap.OverlayAnalystParameters
  16562. * @category iServer SpatialAnalyst OverlayAnalyst
  16563. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  16564. * @param {Object} options - 参数。
  16565. */
  16566. class OverlayAnalystParameters {
  16567. constructor(options) {
  16568. /**
  16569. * @member {SuperMap.OverlayOperationType} [SuperMap.OverlayAnalystParameters.prototype.operation=SuperMap.OverlayOperationType.UNION]
  16570. * @description 指定叠加分析操作类型。
  16571. */
  16572. this.operation = OverlayOperationType.UNION;
  16573. if (options) {
  16574. Util.extend(this, options);
  16575. }
  16576. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  16577. }
  16578. /**
  16579. * @function SuperMap.OverlayAnalystParameters.prototype.destroy
  16580. * @description 释放资源,将引用资源的属性置空。
  16581. */
  16582. destroy() {
  16583. var me = this;
  16584. me.operation = null;
  16585. }
  16586. }
  16587. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  16588. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  16589. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16590. * This program are made available under the terms of the Apache License, Version 2.0
  16591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16592. /**
  16593. * @class SuperMap.DatasetOverlayAnalystParameters
  16594. * @category iServer SpatialAnalyst OverlayAnalyst
  16595. * @classdesc 数据集叠加分析参数类。
  16596. * @param {Object} options - 参数。
  16597. * @param {string} options.operateDataset - 叠加分析中操作数据集的名称。
  16598. * @param {string} options.sourceDataset - 叠加分析中源数据集的名称。
  16599. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  16600. * @param {SuperMap.FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  16601. * @param {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  16602. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  16603. * @param {SuperMap.FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  16604. * @param {number} [options.tolerance=0] - 容限。
  16605. * @param {SuperMap.OverlayOperationType} options.operation - 叠加操作枚举值。
  16606. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  16607. * @extends {SuperMap.GetFeaturesParametersBase}
  16608. */
  16609. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  16610. constructor(options) {
  16611. super(options);
  16612. /**
  16613. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDataset
  16614. * @description 叠加分析中操作数据集的名称。
  16615. */
  16616. this.operateDataset = null;
  16617. /**
  16618. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  16619. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  16620. */
  16621. this.operateDatasetFields = [];
  16622. /**
  16623. * @member {SuperMap.FilterParameter} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  16624. * @description 设置操作数据集中空间对象过滤条件。
  16625. */
  16626. this.operateDatasetFilter = new FilterParameter();
  16627. /**
  16628. * @member {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateRegions]
  16629. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  16630. */
  16631. this.operateRegions = [];
  16632. /**
  16633. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDataset
  16634. * @description 叠加分析中源数据集的名称。
  16635. */
  16636. this.sourceDataset = null;
  16637. /**
  16638. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  16639. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  16640. */
  16641. this.sourceDatasetFields = [];
  16642. /**
  16643. * @member {SuperMap.FilterParameter} [SuperMap.DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  16644. * @description 设置源数据集中空间对象过滤条件。
  16645. */
  16646. this.sourceDatasetFilter = new FilterParameter();
  16647. /**
  16648. * @member {number} [SuperMap.DatasetOverlayAnalystParameters.prototype.tolerance=0]
  16649. * @description 容限。
  16650. */
  16651. this.tolerance = 0;
  16652. /**
  16653. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetOverlayAnalystParameters.prototype.resultSetting]
  16654. * @description 结果返回设置类。
  16655. */
  16656. this.resultSetting = new DataReturnOption();
  16657. Util.extend(this, options);
  16658. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  16659. }
  16660. /**
  16661. * @function SuperMap.DatasetOverlayAnalystParameters.prototype.destroy
  16662. * @override
  16663. */
  16664. destroy() {
  16665. super.destroy();
  16666. var me = this;
  16667. me.operateDataset = null;
  16668. me.operateDatasetFields = null;
  16669. if (me.operateDatasetFilter) {
  16670. me.operateDatasetFilter.destroy();
  16671. me.operateDatasetFilter = null;
  16672. }
  16673. if (me.operateRegions) {
  16674. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  16675. opRegions[i].destroy();
  16676. }
  16677. me.operateRegions = null;
  16678. }
  16679. me.sourceDataset = null;
  16680. me.sourceDatasetFields = null;
  16681. if (me.sourceDatasetFilter) {
  16682. me.sourceDatasetFilter.destroy();
  16683. me.sourceDatasetFilter = null;
  16684. }
  16685. me.tolerance = null;
  16686. if (me.resultSetting) {
  16687. me.resultSetting.destroy();
  16688. me.resultSetting = null;
  16689. }
  16690. }
  16691. /**
  16692. * @function SuperMap.DatasetOverlayAnalystParameters.toObject
  16693. * @param {SuperMap.DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  16694. * @param {SuperMap.DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  16695. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  16696. * @returns {Object} JSON 对象。
  16697. */
  16698. static toObject(datasetOverlayAnalystParameters, tempObj) {
  16699. for (var name in datasetOverlayAnalystParameters) {
  16700. if (name === "sourceDataset") {
  16701. continue;
  16702. } else if (name === "operateRegions") {
  16703. tempObj.operateRegions = [];
  16704. var ors = datasetOverlayAnalystParameters.operateRegions;
  16705. for (var index in ors) {
  16706. if (ors.hasOwnProperty(index)) { //icl542
  16707. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  16708. }
  16709. }
  16710. } else if (name === "resultSetting") {
  16711. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  16712. } else {
  16713. tempObj[name] = datasetOverlayAnalystParameters[name];
  16714. }
  16715. }
  16716. }
  16717. }
  16718. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  16719. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  16720. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16721. * This program are made available under the terms of the Apache License, Version 2.0
  16722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16723. /**
  16724. * @class SuperMap.SurfaceAnalystParametersSetting
  16725. * @category iServer SpatialAnalyst SurfaceAnalyst
  16726. * @classdesc 表面分析参数设置类。
  16727. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  16728. * @param {Object} options - 参数。
  16729. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  16730. * @param {number} [options.datumValue=0] - 获取或设置表面分析中提取等值线、提取等值面的基准值。
  16731. * @param {Array.<number>} options.expectedZValues - 获取或设置期望分析结果的 Z 值集合。
  16732. * @param {number} [options.interval=0] - 获取或设置等值距。等值距是两条等值线之间的间隔值。
  16733. * @param {number} [options.resampleTolerance=0] - 获取或设置重采样容限。
  16734. * @param {SuperMap.SmoothMethod} [options.smoothMethod=SuperMap.SmoothMethod.BSPLINE] - 获取或设置光滑处理所使用的方法。
  16735. * @param {number} [options.smoothness=0] - 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  16736. */
  16737. class SurfaceAnalystParametersSetting {
  16738. constructor(options) {
  16739. /**
  16740. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.SurfaceAnalystParametersSetting.prototype.clipRegion]
  16741. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  16742. */
  16743. this.clipRegion = null;
  16744. /**
  16745. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.datumValue=0]
  16746. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  16747. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。 例如,高程范围为 220 -1550 的 DEM 栅格数据,
  16748. * 如果设基准值为 0, 等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  16749. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  16750. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  16751. */
  16752. this.datumValue = 0;
  16753. /**
  16754. * @member {Array.<number>} SuperMap.SurfaceAnalystParametersSetting.prototype.expectedZValues
  16755. * @description 获取或设置期望分析结果的 Z 值集合。
  16756. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  16757. */
  16758. this.expectedZValues = null;
  16759. /**
  16760. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.interval=0]
  16761. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  16762. */
  16763. this.interval = 0;
  16764. /**
  16765. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  16766. * @description 获取或设置重采样容限。
  16767. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  16768. */
  16769. this.resampleTolerance = 0;
  16770. /**
  16771. * @member {SuperMap.SmoothMethod} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothMethod=SuperMap.SmoothMethod.BSPLINE]
  16772. * @description 获取或设置光滑处理所使用的方法。
  16773. */
  16774. this.smoothMethod = SmoothMethod.BSPLINE;
  16775. /**
  16776. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothness=0]
  16777. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  16778. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  16779. * 随着光滑度的增加,提取的等值线越光滑.当然光滑度越大,
  16780. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  16781. * 光滑度太高会出现等值线相交的问题。
  16782. */
  16783. this.smoothness = 0;
  16784. if (options) {
  16785. Util.extend(this, options);
  16786. }
  16787. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  16788. }
  16789. /**
  16790. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.destroy
  16791. * @description 释放资源,将引用资源的属性置空。
  16792. */
  16793. destroy() {
  16794. var me = this;
  16795. if (me.clipRegion) {
  16796. me.clipRegion.destroy();
  16797. me.clipRegion = null;
  16798. }
  16799. me.datumValue = null;
  16800. me.expectedZValues = null;
  16801. me.interval = null;
  16802. me.resampleTolerance = null;
  16803. me.smoothMethod = null;
  16804. me.smoothness = null;
  16805. }
  16806. /**
  16807. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.toJSON
  16808. * @description 将对象转化为 JSON 字符串。
  16809. * @returns {string} 对象 JSON 字符串。
  16810. */
  16811. toJSON() {
  16812. let json = "'datumValue':" + Util.toJSON(this.datumValue);
  16813. json += ",'interval':" + Util.toJSON(this.interval);
  16814. json += ",'resampleTolerance':" + Util.toJSON(this.resampleTolerance);
  16815. json += ",'smoothMethod':" + Util.toJSON(this.smoothMethod);
  16816. json += ",'smoothness':" + Util.toJSON(this.smoothness);
  16817. if (this.expectedZValues != null) {
  16818. json += "," + "'expectedZValues':" + Util.toJSON(this.expectedZValues);
  16819. }
  16820. if (this.clipRegion != null) {
  16821. var serverGeometry = this.clipRegion;
  16822. if (this.clipRegion instanceof Geometry && this.clipRegion.components) {
  16823. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  16824. }
  16825. json += ",'clipRegion':" + Util.toJSON(serverGeometry);
  16826. }
  16827. return "{" + json + "}";
  16828. }
  16829. }
  16830. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  16831. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  16832. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16833. * This program are made available under the terms of the Apache License, Version 2.0
  16834. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16835. /**
  16836. * @class SuperMap.SurfaceAnalystParameters
  16837. * @category iServer SpatialAnalyst SurfaceAnalyst
  16838. * @classdesc 表面分析提取操作参数类。
  16839. * @description 通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  16840. * {@link SuperMap.DatasetSurfaceAnalystParameters} 和 {@link SuperMap.GeometrySurfaceAnalystParameters} 继承自该类。
  16841. * @param {Object} options - 参数。
  16842. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  16843. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  16844. * @param {SuperMap.DataReturnOption} options.resultSetting - 结果返回设置类。
  16845. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  16846. */
  16847. class SurfaceAnalystParameters {
  16848. constructor(options) {
  16849. /**
  16850. * @member {number} SuperMap.SurfaceAnalystParameters.prototype.resolution
  16851. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  16852. */
  16853. this.resolution = 0;
  16854. /**
  16855. * @member {SuperMap.SurfaceAnalystParametersSetting} SuperMap.SurfaceAnalystParameters.prototype.extractParameter
  16856. * @description 获取或设置表面分析参数。
  16857. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  16858. */
  16859. this.extractParameter = new SurfaceAnalystParametersSetting();
  16860. /**
  16861. * @member {SuperMap.DataReturnOption} SuperMap.SurfaceAnalystParameters.prototype.resultSetting
  16862. * @description 结果返回设置类。
  16863. */
  16864. this.resultSetting = new DataReturnOption();
  16865. /**
  16866. * @member {SuperMap.SurfaceAnalystMethod} [SuperMap.SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE]
  16867. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  16868. */
  16869. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  16870. if (options) {
  16871. Util.extend(this, options);
  16872. }
  16873. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  16874. }
  16875. /**
  16876. * @function SuperMap.SurfaceAnalystParameters.prototype.destroy
  16877. * @description 释放资源,将引用资源的属性置空。
  16878. */
  16879. destroy() {
  16880. var me = this;
  16881. me.resolution = null;
  16882. if (me.extractParameter) {
  16883. me.extractParameter.destroy();
  16884. me.extractParameter = null;
  16885. }
  16886. if (me.resultSetting) {
  16887. me.resultSetting.destroy();
  16888. me.resultSetting = null;
  16889. }
  16890. me.surfaceAnalystMethod = null;
  16891. }
  16892. }
  16893. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  16894. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  16895. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16896. * This program are made available under the terms of the Apache License, Version 2.0
  16897. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16898. /**
  16899. * @class SuperMap.DatasetSurfaceAnalystParameters
  16900. * @category iServer SpatialAnalyst SurfaceAnalyst
  16901. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  16902. * @param {Object} options - 参数。
  16903. * @param {string} options.dataset - 要用来做数据集表面分析的数据源中数据集的名称。
  16904. * @param {string} options.zValueFieldName - 获取或设置用于提取操作的字段名称。
  16905. * @param {integer} options.resolution - 获取或设置指定中间结果(栅格数据集)的分辨率。
  16906. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  16907. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 获取或设置查询过滤条件参数。
  16908. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  16909. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  16910. * @extends {SuperMap.SurfaceAnalystParameters}
  16911. */
  16912. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  16913. constructor(options) {
  16914. super(options);
  16915. /**
  16916. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.dataset
  16917. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  16918. */
  16919. this.dataset = null;
  16920. /**
  16921. * @member {SuperMap.FilterParameter} SuperMap.DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  16922. * @description 获取或设置查询过滤条件参数。
  16923. */
  16924. this.filterQueryParameter = new FilterParameter();
  16925. /**
  16926. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  16927. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  16928. */
  16929. this.zValueFieldName = null;
  16930. if (options) {
  16931. Util.extend(this, options);
  16932. }
  16933. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  16934. }
  16935. /**
  16936. * @function SuperMap.DatasetSurfaceAnalystParameters.prototype.destroy
  16937. * @override
  16938. */
  16939. destroy() {
  16940. super.destroy();
  16941. var me = this;
  16942. me.dataset = null;
  16943. if (me.filterQueryParameter) {
  16944. me.filterQueryParameter.destroy();
  16945. me.filterQueryParameter = null;
  16946. }
  16947. me.zValueFieldName = null;
  16948. }
  16949. /**
  16950. * @function SuperMap.DatasetSurfaceAnalystParameters.toObject
  16951. * @param {SuperMap.DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  16952. * @param {SuperMap.DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  16953. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  16954. * @returns JSON 对象。
  16955. */
  16956. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  16957. for (var name in datasetSurfaceAnalystParameters) {
  16958. if (name === "filterQueryParameter") {
  16959. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  16960. }
  16961. if (name === "extractParameter") {
  16962. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  16963. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  16964. }
  16965. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  16966. } else if (name === "dataset") {
  16967. continue;
  16968. } else if (name === "surfaceAnalystMethod") {
  16969. continue;
  16970. } else {
  16971. tempObj[name] = datasetSurfaceAnalystParameters[name];
  16972. }
  16973. }
  16974. }
  16975. }
  16976. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  16977. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  16978. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16979. * This program are made available under the terms of the Apache License, Version 2.0
  16980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16981. /**
  16982. * @class SuperMap.ThiessenAnalystParameters
  16983. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  16984. * @classdesc 泰森多边形分析参数基类。
  16985. * @param {Object} options - 参数。
  16986. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  16987. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  16988. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  16989. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  16990. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  16991. */
  16992. class ThiessenAnalystParameters {
  16993. constructor(options) {
  16994. if (!options) {
  16995. return;
  16996. }
  16997. /**
  16998. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.ThiessenAnalystParameters.prototype.clipRegion]
  16999. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  17000. */
  17001. this.clipRegion = null;
  17002. /**
  17003. * @member {boolean} [SuperMap.ThiessenAnalystParameters.prototype.createResultDataset=false]
  17004. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  17005. */
  17006. this.createResultDataset = false;
  17007. /**
  17008. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasetName
  17009. * @description 指定结果数据集名称。
  17010. */
  17011. this.resultDatasetName = null;
  17012. /**
  17013. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasourceName
  17014. * @description 指定结果数据集所在数据源。
  17015. */
  17016. this.resultDatasourceName = null;
  17017. /**
  17018. * @member {boolean} SuperMap.ThiessenAnalystParameters.prototype.returnResultRegion
  17019. * @description 是否返回分析得到的多边形面数组。
  17020. */
  17021. this.returnResultRegion = true;
  17022. Util.extend(this, options);
  17023. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  17024. }
  17025. /**
  17026. * @function SuperMap.ThiessenAnalystParameters.prototype.destroy
  17027. * @description 释放资源,将引用资源的属性置空。
  17028. */
  17029. destroy() {
  17030. var me = this;
  17031. if (me.clipRegion) {
  17032. me.clipRegion.destroy();
  17033. me.clipRegion = null;
  17034. }
  17035. me.createResultDataset = null;
  17036. me.resultDatasetName = null;
  17037. me.resultDatasourceName = null;
  17038. me.returnResultRegion = null;
  17039. }
  17040. }
  17041. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  17042. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  17043. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17044. * This program are made available under the terms of the Apache License, Version 2.0
  17045. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17046. /**
  17047. * @class SuperMap.DatasetThiessenAnalystParameters
  17048. * @category iServer SpatialAnalyst ThiessenAnalyst
  17049. * @classdesc 数据集泰森多边形分析参数类。
  17050. * @param {Object} options - 参数。
  17051. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  17052. * @extends {SuperMap.ThiessenAnalystParameters}
  17053. */
  17054. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  17055. constructor(options) {
  17056. super(options);
  17057. /**
  17058. * @member {SuperMap.FilterParameter} [SuperMap.DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  17059. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  17060. * @example
  17061. * var filterQueryParameter = new SuperMap.FilterParameter({
  17062. * name: "Countries@World",
  17063. * attributeFilter: "SmID>100"
  17064. * });
  17065. */
  17066. this.filterQueryParameter = null;
  17067. /**
  17068. * @member {string} SuperMap.DatasetThiessenAnalystParameters.prototype.dataset
  17069. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  17070. */
  17071. this.dataset = null;
  17072. if (options) {
  17073. Util.extend(this, options);
  17074. }
  17075. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  17076. }
  17077. /**
  17078. * @function SuperMap.DatasetThiessenAnalystParameters.prototype.destroy
  17079. * @override
  17080. */
  17081. destroy() {
  17082. super.destroy();
  17083. var me = this;
  17084. if (me.filterQueryParameter) {
  17085. me.filterQueryParameter.destroy();
  17086. me.filterQueryParameter = null;
  17087. }
  17088. }
  17089. /**
  17090. * @function SuperMap.DatasetThiessenAnalystParameters.toObject
  17091. * @param {SuperMap.DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  17092. * @param {SuperMap.DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  17093. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  17094. * @returns JSON 对象。
  17095. */
  17096. static toObject(datasetThiessenAnalystParameters, tempObj) {
  17097. for (var name in datasetThiessenAnalystParameters) {
  17098. if (name === "clipRegion") {
  17099. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  17100. } else {
  17101. tempObj[name] = datasetThiessenAnalystParameters[name];
  17102. }
  17103. }
  17104. }
  17105. }
  17106. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  17107. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  17108. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17109. * This program are made available under the terms of the Apache License, Version 2.0
  17110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17111. /**
  17112. * @class SuperMap.DensityKernelAnalystParameters
  17113. * @category iServer SpatialAnalyst DensityAnalyst
  17114. * @classdesc 核密度分析参数类。
  17115. * @param {Object} options - 参数。
  17116. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  17117. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  17118. * @param {string} options.resultGridName - 指定结果数据集名称。
  17119. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  17120. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  17121. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  17122. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  17123. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  17124. */
  17125. class DensityKernelAnalystParameters {
  17126. constructor(options) {
  17127. /**
  17128. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.dataset
  17129. * @description 要用来做核密度分析数据源中数据集的名称。
  17130. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  17131. * 注:核密度分析支持点数据集和线数据集。
  17132. */
  17133. this.dataset = null;
  17134. /**
  17135. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} [SuperMap.DensityKernelAnalystParameters.prototype.bounds]
  17136. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  17137. * 如果缺省,则默认为原数据集的范围。
  17138. */
  17139. this.bounds = null;
  17140. /**
  17141. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.fieldName
  17142. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  17143. */
  17144. this.fieldName = null;
  17145. /**
  17146. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  17147. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  17148. */
  17149. this.resultGridDatasetResolution = null;
  17150. /**
  17151. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.searchRadius]
  17152. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  17153. */
  17154. this.searchRadius = null;
  17155. /**
  17156. * @member {string} [SuperMap.DensityKernelAnalystParameters.prototype.targetDatasource]
  17157. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  17158. */
  17159. this.targetDatasource = null;
  17160. /**
  17161. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.resultGridName
  17162. * @description 指定结果数据集名称。
  17163. */
  17164. this.resultGridName = null;
  17165. /**
  17166. * @member {boolean} [SuperMap.DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  17167. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  17168. */
  17169. this.deleteExistResultDataset = false;
  17170. Util.extend(this, options);
  17171. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  17172. }
  17173. /**
  17174. * @function SuperMap.DensityKernelAnalystParameters.prototype.destroy
  17175. * @description 释放资源,将引用资源的属性置空。
  17176. */
  17177. destroy() {
  17178. var me = this;
  17179. me.dataset = null;
  17180. me.bounds = null;
  17181. me.fieldName = null;
  17182. me.resultGridDatasetResolution = null;
  17183. me.searchRadius = null;
  17184. me.targetDatasource = null;
  17185. me.resultGridName = null;
  17186. me.deleteExistResultDataset = null;
  17187. }
  17188. /**
  17189. * @function SuperMap.DensityKernelAnalystParameters.toObject
  17190. * @param {SuperMap.DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  17191. * @param {SuperMap.DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  17192. * @description 将核密度分析参数对象转换成 JSON 对象。
  17193. * @returns JSON 对象。
  17194. */
  17195. static toObject(densityKernelAnalystParameters, tempObj) {
  17196. for (var name in densityKernelAnalystParameters) {
  17197. if (name !== "dataset") {
  17198. tempObj[name] = densityKernelAnalystParameters[name];
  17199. }
  17200. }
  17201. }
  17202. }
  17203. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  17204. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  17205. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17206. * This program are made available under the terms of the Apache License, Version 2.0
  17207. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17208. /**
  17209. * @class SuperMap.DensityAnalystService
  17210. * @category iServer SpatialAnalyst DensityAnalyst
  17211. * @classdesc
  17212. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  17213. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  17214. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  17215. * @param {Object} options - 参数。</br>
  17216. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17217. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17218. * @param {Object} [options.headers] - 请求头。
  17219. * @extends {SuperMap.SpatialAnalystBase}
  17220. * @example 例如:
  17221. * var myDensityAnalystService = new SuperMap.DensityAnalystService(url);
  17222. * myDensityAnalystService.on({
  17223. * "processCompleted": processCompleted,
  17224. * "processFailed": processFailed
  17225. * }
  17226. * );
  17227. */
  17228. class DensityAnalystService extends SpatialAnalystBase {
  17229. constructor(url, options) {
  17230. super(url, options);
  17231. /**
  17232. * @member {string} SuperMap.DensityAnalystService.prototype.mode
  17233. * @description 密度分析类型。
  17234. */
  17235. this.mode = null;
  17236. if (options) {
  17237. Util.extend(this, options);
  17238. }
  17239. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  17240. }
  17241. /**
  17242. * @function SuperMap.DensityAnalystService.prototype.destroy
  17243. * @description 释放资源,将引用资源的属性置空。
  17244. */
  17245. destroy() {
  17246. super.destroy();
  17247. this.mode = null;
  17248. }
  17249. /**
  17250. * @function SuperMap.DensityAnalystService.prototype.processAsync
  17251. * @description 负责将客户端的查询参数传递到服务端。
  17252. * @param {SuperMap.DensityKernelAnalystParameters} parameter - 核密度分析参数。
  17253. */
  17254. processAsync(parameter) {
  17255. var me = this;
  17256. var parameterObject = new Object();
  17257. if (parameter instanceof DensityKernelAnalystParameters) {
  17258. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  17259. me.mode = "kernel";
  17260. }
  17261. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  17262. var jsonParameters = Util.toJSON(parameterObject);
  17263. me.url = Util.urlAppend(me.url, 'returnContent=true');
  17264. me.request({
  17265. method: "POST",
  17266. data: jsonParameters,
  17267. scope: me,
  17268. success: me.serviceProcessCompleted,
  17269. failure: me.serviceProcessFailed
  17270. });
  17271. }
  17272. }
  17273. SuperMap.DensityAnalystService = DensityAnalystService;
  17274. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  17275. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17276. * This program are made available under the terms of the Apache License, Version 2.0
  17277. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17278. /**
  17279. * @class SuperMap.EditFeaturesParameters
  17280. * @category iServer Data Feature
  17281. * @classdesc 数据服务中数据集添加、修改、删除参数类。
  17282. * @category iServer Data
  17283. * @param {Object} options - 参数。
  17284. * @param {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} options.features - 当前需要创建或者是修改的要素集。
  17285. * @param {boolean} [options.returnContent=false] - 是返回创建要素的 ID 数组还是返回 featureResult 资源的 URI。
  17286. * @param {SuperMap.EditType} [options.editType=SuperMap.EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  17287. * @param {Array.<string|integer>} [options.IDs] - 删除要素时的要素的 ID 数组。
  17288. */
  17289. class EditFeaturesParameters {
  17290. constructor(options) {
  17291. /**
  17292. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSourceName
  17293. * @description 当前需要创建或者是修改的要素的数据源。
  17294. */
  17295. this.dataSourceName = null;
  17296. /**
  17297. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSetName
  17298. * @description 当前需要创建或者是修改的要素的数据集。
  17299. */
  17300. this.dataSetName = null;
  17301. /**
  17302. * @member {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} SuperMap.EditFeaturesParameters.prototype.features
  17303. * @description 当前需要创建或者是修改的要素集。
  17304. */
  17305. this.features = null;
  17306. /**
  17307. * @member {SuperMap.EditType} [SuperMap.EditFeaturesParameters.prototype.editType=SuperMap.EditType.ADD]
  17308. * @description 要素集更新类型 (add、update、delete)。
  17309. */
  17310. this.editType = EditType.ADD;
  17311. /**
  17312. * @member {Array.<string|number>} [SuperMap.EditFeaturesParameters.prototype.IDs]
  17313. * @description 执行删除时要素集 ID 集合。
  17314. */
  17315. this.IDs = null;
  17316. /**
  17317. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.returnContent=false]
  17318. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  17319. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  17320. */
  17321. this.returnContent = false;
  17322. /**
  17323. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.isUseBatch=false]
  17324. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  17325. */
  17326. this.isUseBatch = false;
  17327. Util.extend(this, options);
  17328. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  17329. }
  17330. /**
  17331. * @function SuperMap.EditFeaturesParameters.prototype.destroy
  17332. * @description 释放资源,将引用资源的属性置空。
  17333. */
  17334. destroy() {
  17335. var me = this;
  17336. me.dataSourceName = null;
  17337. me.dataSetName = null;
  17338. me.features = null;
  17339. me.editType = null;
  17340. me.IDs = null;
  17341. me.returnContent = null;
  17342. }
  17343. /**
  17344. * @function SuperMap.EditFeaturesParameters.prototype.toJsonParameters
  17345. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  17346. * @param {SuperMap.EditFeaturesParameters} params - 地物编辑参数。
  17347. * @returns {string} JSON 字符串。
  17348. */
  17349. static toJsonParameters(params) {
  17350. var feature,
  17351. len,
  17352. features,
  17353. editType = params.editType;
  17354. if (editType === EditType.DELETE) {
  17355. if (params.IDs === null) {
  17356. return;
  17357. }
  17358. features = {ids: params.IDs};
  17359. } else {
  17360. features = [];
  17361. if (params.features) {
  17362. len = params.features.length;
  17363. for (var i = 0; i < len; i++) {
  17364. feature = params.features[i];
  17365. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  17366. features.push(feature);
  17367. }
  17368. }
  17369. }
  17370. return Util.toJSON(features);
  17371. }
  17372. }
  17373. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  17374. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  17375. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17376. * This program are made available under the terms of the Apache License, Version 2.0
  17377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17378. /**
  17379. * @class SuperMap.EditFeaturesService
  17380. * @category iServer Data Feature
  17381. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  17382. * @extends {SuperMap.CommonServiceBase}
  17383. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  17384. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  17385. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  17386. * @param {Object} options - 参数。</br>
  17387. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  17388. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  17389. * @param {SuperMap.DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  17390. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17391. * @param {Object} [options.headers] - 请求头。
  17392. * @example
  17393. * var myService = new SuperMap.EditFeaturesService(url, {eventListeners: {
  17394. * "processCompleted": editFeatureCompleted,
  17395. * "processFailed": editFeatureError
  17396. * }
  17397. * };
  17398. *
  17399. */
  17400. class EditFeaturesService extends CommonServiceBase {
  17401. constructor(url, options) {
  17402. super(url, options);
  17403. /**
  17404. * @member {boolean} [SuperMap.EditFeaturesService.prototype.returnContent=false]
  17405. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  17406. */
  17407. this.returnContent = false;
  17408. /**
  17409. * @member {boolean} [SuperMap.EditFeaturesService.prototype.isUseBatch=false]
  17410. * @description 是否使用批量添加要素功能,要素添加时有效。
  17411. * 批量添加能够提高要素编辑效率。
  17412. * true 表示批量添加;false 表示不使用批量添加。
  17413. */
  17414. this.isUseBatch = false;
  17415. if (options) {
  17416. Util.extend(this, options);
  17417. }
  17418. this.url = Util.urlPathAppend(this.url, 'features');
  17419. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  17420. }
  17421. /**
  17422. * @function SuperMap.EditFeaturesService.prototype.destroy
  17423. * @override
  17424. */
  17425. destroy() {
  17426. super.destroy();
  17427. var me = this;
  17428. me.returnContent = null;
  17429. me.isUseBatch = null;
  17430. me.fromIndex = null;
  17431. me.toIndex = null;
  17432. }
  17433. /**
  17434. * @function SuperMap.EditFeaturesService.prototype.processAsync
  17435. * @description 负责将客户端的更新参数传递到服务端。
  17436. * @param {SuperMap.EditFeaturesParameters} params - 编辑要素参数。
  17437. */
  17438. processAsync(params) {
  17439. if (!(params instanceof EditFeaturesParameters)) {
  17440. return;
  17441. }
  17442. var me = this,
  17443. method = "POST",
  17444. ids = "",
  17445. editType = params.editType,
  17446. jsonParameters = null;
  17447. me.returnContent = params.returnContent;
  17448. me.isUseBatch = params.isUseBatch;
  17449. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  17450. if (editType === EditType.DELETE) {
  17451. ids = Util.toJSON(params.IDs);
  17452. me.url = Util.urlAppend(me.url, "ids=" + ids);
  17453. method = "DELETE";
  17454. jsonParameters = ids;
  17455. } else if (editType === EditType.UPDATE) {
  17456. method = "PUT";
  17457. } else {
  17458. if (me.isUseBatch) {
  17459. me.url = Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  17460. me.returnContent = false;
  17461. }
  17462. if (me.returnContent) {
  17463. me.url = Util.urlAppend(me.url, 'returnContent=true');
  17464. method = "POST";
  17465. }
  17466. }
  17467. me.request({
  17468. method: method,
  17469. data: jsonParameters,
  17470. scope: me,
  17471. success: me.serviceProcessCompleted,
  17472. failure: me.serviceProcessFailed
  17473. });
  17474. }
  17475. }
  17476. SuperMap.EditFeaturesService = EditFeaturesService;
  17477. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  17478. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17479. * This program are made available under the terms of the Apache License, Version 2.0
  17480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17481. /**
  17482. * @class SuperMap.FacilityAnalyst3DParameters
  17483. * @category iServer FacilityAnalyst3D
  17484. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  17485. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  17486. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起
  17487. * 作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  17488. * @param {Object} options - 参数。
  17489. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  17490. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17491. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17492. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17493. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17494. */
  17495. class FacilityAnalyst3DParameters {
  17496. constructor(options) {
  17497. /**
  17498. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.edgeID]
  17499. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17500. */
  17501. this.edgeID = null;
  17502. /**
  17503. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.nodeID]
  17504. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17505. */
  17506. this.nodeID = null;
  17507. /**
  17508. * @member {string} SuperMap.FacilityAnalyst3DParameters.prototype.weightName
  17509. * @description 指定的权值字段信息对象的名称。
  17510. */
  17511. this.weightName = null;
  17512. /**
  17513. * @member {boolean} [SuperMap.FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  17514. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17515. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找
  17516. */
  17517. this.isUncertainDirectionValid = false;
  17518. Util.extend(this, options);
  17519. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  17520. }
  17521. /**
  17522. * @function SuperMap.FacilityAnalyst3DParameters.prototype.destroy
  17523. * @override
  17524. */
  17525. destroy() {
  17526. var me = this;
  17527. me.edgeID = null;
  17528. me.nodeID = null;
  17529. me.weightName = null;
  17530. me.isUncertainDirectionValid = null;
  17531. }
  17532. }
  17533. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  17534. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  17535. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17536. * This program are made available under the terms of the Apache License, Version 2.0
  17537. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17538. /**
  17539. * @class SuperMap.FacilityAnalystSinks3DParameters
  17540. * @category iServer FacilityAnalyst3D Sinks
  17541. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  17542. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟
  17543. * 能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、
  17544. * 转向表、耗费等属性在最近设施分析时同样可设置。
  17545. * @extends {SuperMap.FacilityAnalyst3DParameters}
  17546. * @param {Object} options - 参数。
  17547. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  17548. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17549. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17550. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17551. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17552. */
  17553. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  17554. constructor(options) {
  17555. super(options);
  17556. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  17557. }
  17558. /**
  17559. * @function SuperMap.FacilityAnalystSinks3DParameters.prototype.destroy
  17560. * @override
  17561. */
  17562. destroy() {
  17563. super.destroy();
  17564. }
  17565. }
  17566. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  17567. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  17568. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17569. * This program are made available under the terms of the Apache License, Version 2.0
  17570. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17571. /**
  17572. * @class SuperMap.FacilityAnalystSinks3DService
  17573. * @category iServer FacilityAnalyst3D Sinks
  17574. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  17575. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  17576. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  17577. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  17578. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  17579. * @extends {SuperMap.CommonServiceBase}
  17580. * @example
  17581. * var myFacilityAnalystSinks3DService = new SuperMap.FacilityAnalystSinks3DService(url, {
  17582. * eventListeners: {
  17583. * "processCompleted": facilityAnalystSinks3DCompleted,
  17584. * "processFailed": facilityAnalystSinks3DError
  17585. * }
  17586. * });
  17587. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  17588. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  17589. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  17590. * @param {Object} options - 参数。<br>
  17591. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17592. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17593. * @param {Object} [options.headers] - 请求头。
  17594. */
  17595. class FacilityAnalystSinks3DService extends CommonServiceBase {
  17596. constructor(url, options) {
  17597. super(url, options);
  17598. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  17599. }
  17600. /**
  17601. * @function SuperMap.FacilityAnalystSinks3DService.prototype.destroy
  17602. * @override
  17603. */
  17604. destroy() {
  17605. CommonServiceBase.prototype.destroy.apply(this, arguments);
  17606. }
  17607. /**
  17608. * @function SuperMap.FacilityAnalystSinks3DService.prototype.processAsync
  17609. * @description 负责将客户端的查询参数传递到服务端。
  17610. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  17611. */
  17612. processAsync(params) {
  17613. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  17614. return;
  17615. }
  17616. var me = this, jsonObject;
  17617. me.url = Util.urlPathAppend(me.url, 'sinks');
  17618. jsonObject = {
  17619. edgeID: params.edgeID,
  17620. nodeID: params.nodeID,
  17621. weightName: params.weightName,
  17622. isUncertainDirectionValid: params.isUncertainDirectionValid
  17623. };
  17624. me.request({
  17625. method: "GET",
  17626. params: jsonObject,
  17627. scope: me,
  17628. success: me.serviceProcessCompleted,
  17629. failure: me.serviceProcessFailed
  17630. });
  17631. }
  17632. }
  17633. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  17634. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  17635. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17636. * This program are made available under the terms of the Apache License, Version 2.0
  17637. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17638. /**
  17639. * @class SuperMap.FacilityAnalystSources3DParameters
  17640. * @category iServer FacilityAnalyst3D Sources
  17641. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  17642. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分
  17643. * 钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍
  17644. * 点、转向表、耗费等属性在最近设施分析时同样可设置。
  17645. * @extends {SuperMap.FacilityAnalyst3DParameters}
  17646. * @param {Object} options - 参数。
  17647. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  17648. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17649. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17650. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17651. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17652. */
  17653. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  17654. constructor(options) {
  17655. super(options);
  17656. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  17657. }
  17658. /**
  17659. * @function SuperMap.FacilityAnalystSources3DParameters.prototype.destroy
  17660. * @override
  17661. */
  17662. destroy() {
  17663. super.destroy();
  17664. }
  17665. }
  17666. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  17667. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  17668. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17669. * This program are made available under the terms of the Apache License, Version 2.0
  17670. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17671. /**
  17672. * @class SuperMap.FacilityAnalystSources3DService
  17673. * @category iServer FacilityAnalyst3D Sources
  17674. * @classdesc 最近设施分析服务类(源查找资源)
  17675. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  17676. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  17677. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  17678. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  17679. * @extends {SuperMap.CommonServiceBase}
  17680. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  17681. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  17682. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  17683. * @param {Object} options - 参数。
  17684. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17685. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17686. * @param {Object} [options.headers] - 请求头。
  17687. */
  17688. class FacilityAnalystSources3DService extends CommonServiceBase {
  17689. constructor(url, options) {
  17690. super(url, options);
  17691. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  17692. }
  17693. /**
  17694. * @function SuperMap.FacilityAnalystSources3DService.prototype.destroy
  17695. * @override
  17696. */
  17697. destroy() {
  17698. super.destroy();
  17699. }
  17700. /**
  17701. * @function SuperMap.FacilityAnalystSources3DService.prototype.processAsync
  17702. * @description 负责将客户端的查询参数传递到服务端。
  17703. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  17704. */
  17705. processAsync(params) {
  17706. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  17707. return;
  17708. }
  17709. var me = this, jsonObject;
  17710. me.url = Util.urlPathAppend(me.url, 'sources');
  17711. jsonObject = {
  17712. edgeID: params.edgeID,
  17713. nodeID: params.nodeID,
  17714. weightName: params.weightName,
  17715. isUncertainDirectionValid: params.isUncertainDirectionValid
  17716. };
  17717. me.request({
  17718. method: "GET",
  17719. params: jsonObject,
  17720. scope: me,
  17721. success: me.serviceProcessCompleted,
  17722. failure: me.serviceProcessFailed
  17723. });
  17724. }
  17725. }
  17726. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  17727. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  17728. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17729. * This program are made available under the terms of the Apache License, Version 2.0
  17730. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17731. /**
  17732. * @class SuperMap.FacilityAnalystStreamParameters
  17733. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  17734. * @classdesc 上游/下游关键设施查找资源参数类。
  17735. * @param {Object} options - 参数。
  17736. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  17737. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  17738. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17739. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17740. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  17741. */
  17742. class FacilityAnalystStreamParameters {
  17743. constructor(options) {
  17744. /**
  17745. * @member {Array.<number>} [SuperMap.FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  17746. * @description 指定的设施点 ID 数组。
  17747. */
  17748. this.sourceNodeIDs = null;
  17749. /**
  17750. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.edgeID]
  17751. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17752. */
  17753. this.edgeID = null;
  17754. /**
  17755. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.nodeID]
  17756. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17757. */
  17758. this.nodeID = null;
  17759. /**
  17760. * @member {boolean} [SuperMap.FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  17761. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17762. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17763. */
  17764. this.isUncertainDirectionValid = false;
  17765. /**
  17766. * @member {number} SuperMap.FacilityAnalystStreamParameters.prototype.queryType
  17767. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  17768. */
  17769. this.queryType = null;
  17770. Util.extend(this, options);
  17771. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  17772. }
  17773. /**
  17774. * @function SuperMap.FacilityAnalystStreamParameters.prototype.destroy
  17775. * @description 释放资源,将引用资源的属性置空。
  17776. */
  17777. destroy() {
  17778. var me = this;
  17779. me.edgeID = null;
  17780. me.nodeID = null;
  17781. me.weightName = null;
  17782. me.isUncertainDirectionValid = null;
  17783. me.type = null;
  17784. }
  17785. }
  17786. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  17787. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  17788. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17789. * This program are made available under the terms of the Apache License, Version 2.0
  17790. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17791. /**
  17792. * @class SuperMap.FacilityAnalystStreamService
  17793. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  17794. * @classdesc 上游/下游 关键设施查找资源服务类;即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  17795. * @extends SuperMap.NetworkAnalystServiceBase
  17796. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  17797. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  17798. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  17799. * @param {Object} options - 参数。
  17800. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17801. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17802. * @param {Object} [options.headers] - 请求头。
  17803. */
  17804. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  17805. constructor(url, options) {
  17806. super(url, options);
  17807. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  17808. }
  17809. /**
  17810. * @function SuperMap.FacilityAnalystStreamService.prototype.destroy
  17811. * @override
  17812. */
  17813. destroy() {
  17814. super.destroy();
  17815. }
  17816. /**
  17817. * @function SuperMap.FacilityAnalystStreamService.prototype.processAsync
  17818. * @description 负责将客户端的查询参数传递到服务端。
  17819. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  17820. */
  17821. processAsync(params) {
  17822. if (!(params instanceof FacilityAnalystStreamParameters)) {
  17823. return;
  17824. }
  17825. var me = this,
  17826. jsonObject;
  17827. //URL 通过参数类型来判断是 上游 还是下游 查询
  17828. if (params.queryType === 0) {
  17829. me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  17830. } else if (params.queryType === 1) {
  17831. me.url = Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  17832. } else {
  17833. return;
  17834. }
  17835. jsonObject = {
  17836. sourceNodeIDs: params.sourceNodeIDs,
  17837. isUncertainDirectionValid: params.isUncertainDirectionValid
  17838. };
  17839. if (params.edgeID !== null && params.nodeID !== null) {
  17840. return;
  17841. }
  17842. if (params.edgeID === null && params.nodeID === null) {
  17843. return;
  17844. }
  17845. if (params.edgeID !== null) {
  17846. jsonObject.edgeID = params.edgeID;
  17847. } else {
  17848. jsonObject.nodeID = params.nodeID;
  17849. }
  17850. me.request({
  17851. method: "GET",
  17852. params: jsonObject,
  17853. scope: me,
  17854. success: me.serviceProcessCompleted,
  17855. failure: me.serviceProcessFailed
  17856. });
  17857. }
  17858. }
  17859. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  17860. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  17861. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17862. * This program are made available under the terms of the Apache License, Version 2.0
  17863. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17864. /**
  17865. * @class SuperMap.FacilityAnalystTracedown3DParameters
  17866. * @category iServer FacilityAnalyst3D TraceDownResult
  17867. * @classdesc 下游追踪资源参数类。
  17868. * @extends {SuperMap.FacilityAnalyst3DParameters}
  17869. * @param {Object} options - 参数。
  17870. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  17871. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17872. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17873. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17874. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17875. */
  17876. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  17877. constructor(options) {
  17878. super(options);
  17879. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  17880. }
  17881. /**
  17882. * @function SuperMap.FacilityAnalystTracedown3DParameters.prototype.destroy
  17883. * @override
  17884. */
  17885. destroy() {
  17886. super.destroy();
  17887. }
  17888. }
  17889. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  17890. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  17891. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17892. * This program are made available under the terms of the Apache License, Version 2.0
  17893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17894. /**
  17895. * @class SuperMap.FacilityAnalystTracedown3DService
  17896. * @category iServer FacilityAnalyst3D TraceDownResult
  17897. * @classdesc 下游追踪资源服务类
  17898. * @extends {SuperMap.CommonServiceBase}
  17899. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  17900. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  17901. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  17902. * @param {Object} options - 参数。
  17903. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17904. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17905. * @param {Object} [options.headers] - 请求头。
  17906. */
  17907. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  17908. constructor(url, options) {
  17909. super(url, options);
  17910. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  17911. }
  17912. /**
  17913. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.destroy
  17914. * @override
  17915. */
  17916. destroy() {
  17917. super.destroy();
  17918. }
  17919. /**
  17920. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.processAsync
  17921. * @description 负责将客户端的查询参数传递到服务端。
  17922. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  17923. */
  17924. processAsync(params) {
  17925. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  17926. return;
  17927. }
  17928. var me = this, jsonObject;
  17929. me.url = Util.urlPathAppend(me.url, 'tracedownresult');
  17930. jsonObject = {
  17931. edgeID: params.edgeID,
  17932. nodeID: params.nodeID,
  17933. weightName: params.weightName,
  17934. isUncertainDirectionValid: params.isUncertainDirectionValid
  17935. };
  17936. me.request({
  17937. method: "GET",
  17938. params: jsonObject,
  17939. scope: me,
  17940. success: me.serviceProcessCompleted,
  17941. failure: me.serviceProcessFailed
  17942. });
  17943. }
  17944. }
  17945. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  17946. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  17947. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17948. * This program are made available under the terms of the Apache License, Version 2.0
  17949. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17950. /**
  17951. * @class SuperMap.FacilityAnalystTraceup3DParameters
  17952. * @category iServer FacilityAnalyst3D TraceUpResult
  17953. * @classdesc 上游追踪资源参数类。
  17954. * @extends {SuperMap.FacilityAnalyst3DParameters}
  17955. * @param {Object} options - 参数。
  17956. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  17957. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  17958. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  17959. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  17960. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17961. */
  17962. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  17963. constructor(options) {
  17964. super(options);
  17965. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  17966. }
  17967. /**
  17968. * @function SuperMap.FacilityAnalystTraceup3DParameters.prototype.destroy
  17969. * @override
  17970. */
  17971. destroy() {
  17972. super.destroy();
  17973. }
  17974. }
  17975. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  17976. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  17977. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17978. * This program are made available under the terms of the Apache License, Version 2.0
  17979. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17980. /**
  17981. * @class SuperMap.FacilityAnalystTraceup3DService
  17982. * @category iServer FacilityAnalyst3D TraceUpResult
  17983. * @classdesc 上游追踪资源服务类
  17984. * @extends {SuperMap.CommonServiceBase}
  17985. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  17986. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  17987. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  17988. * @param {Object} options - 参数。
  17989. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17990. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17991. * @param {Object} [options.headers] - 请求头。
  17992. */
  17993. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  17994. /**
  17995. * @function SuperMap.FacilityAnalystTraceup3DService.constructor
  17996. * @description 上游追踪资源服务类构造函数。
  17997. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  17998. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  17999. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18000. * @param {Object} options - 参数。
  18001. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18002. */
  18003. constructor(url, options) {
  18004. super(url, options);
  18005. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  18006. }
  18007. /**
  18008. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.destroy
  18009. * @override
  18010. */
  18011. destroy() {
  18012. super.destroy();
  18013. }
  18014. /**
  18015. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.processAsync
  18016. * @description 负责将客户端的查询参数传递到服务端。
  18017. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  18018. */
  18019. processAsync(params) {
  18020. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  18021. return;
  18022. }
  18023. var me = this, jsonObject;
  18024. me.url = Util.urlPathAppend(me.url, 'traceupresult');
  18025. jsonObject = {
  18026. edgeID: params.edgeID,
  18027. nodeID: params.nodeID,
  18028. weightName: params.weightName,
  18029. isUncertainDirectionValid: params.isUncertainDirectionValid
  18030. };
  18031. me.request({
  18032. method: "GET",
  18033. params: jsonObject,
  18034. scope: me,
  18035. success: me.serviceProcessCompleted,
  18036. failure: me.serviceProcessFailed
  18037. });
  18038. }
  18039. }
  18040. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  18041. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  18042. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18043. * This program are made available under the terms of the Apache License, Version 2.0
  18044. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18045. /**
  18046. * @class SuperMap.FacilityAnalystUpstream3DParameters
  18047. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  18048. * @classdesc 上游关键设施查找资源参数类。
  18049. * @extends {SuperMap.FacilityAnalyst3DParameters}
  18050. * @param {Object} options - 参数。
  18051. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  18052. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  18053. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  18054. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18055. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18056. */
  18057. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  18058. constructor(options) {
  18059. super(options);
  18060. options = options || {};
  18061. this.sourceNodeIDs = null;
  18062. Util.extend(this, options);
  18063. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  18064. }
  18065. /**
  18066. * @function SuperMap.FacilityAnalystUpstream3DParameters.prototype.destroy
  18067. * @override
  18068. */
  18069. destroy() {
  18070. super.destroy();
  18071. this.sourceNodeIDs = null;
  18072. }
  18073. }
  18074. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  18075. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  18076. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18077. * This program are made available under the terms of the Apache License, Version 2.0
  18078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18079. /**
  18080. * @class SuperMap.FacilityAnalystUpstream3DService
  18081. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  18082. * @classdesc 上游关键设施查找资源服务类
  18083. * @extends {SuperMap.CommonServiceBase}
  18084. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18085. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18086. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18087. * @param {Object} options - 参数。
  18088. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18089. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18090. * @param {Object} [options.headers] - 请求头。
  18091. */
  18092. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  18093. constructor(url, options) {
  18094. super(url, options);
  18095. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  18096. }
  18097. /**
  18098. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.destroy
  18099. * @override
  18100. */
  18101. destroy() {
  18102. super.destroy();
  18103. }
  18104. /**
  18105. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.processAsync
  18106. * @description 负责将客户端的查询参数传递到服务端。
  18107. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  18108. */
  18109. processAsync(params) {
  18110. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  18111. return;
  18112. }
  18113. var me = this, jsonObject;
  18114. me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  18115. jsonObject = {
  18116. sourceNodeIDs: params.sourceNodeIDs,
  18117. edgeID: params.edgeID,
  18118. nodeID: params.nodeID,
  18119. isUncertainDirectionValid: params.isUncertainDirectionValid
  18120. };
  18121. me.request({
  18122. method: "GET",
  18123. params: jsonObject,
  18124. scope: me,
  18125. success: me.serviceProcessCompleted,
  18126. failure: me.serviceProcessFailed
  18127. });
  18128. }
  18129. }
  18130. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  18131. ;// CONCATENATED MODULE: ./src/common/iServer/FilterAggParameter.js
  18132. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18133. * This program are made available under the terms of the Apache License, Version 2.0
  18134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18135. /**
  18136. * @class SuperMap.FilterAggParameter
  18137. * @classdesc 过滤条件参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  18138. * @category iServer Data FeatureResults
  18139. * @param {Object} options - 初始化参数。
  18140. * @param {SuperMap.AggQueryBuilderParameter} options.filterParam - 过滤条件参数设置类。
  18141. * @param {SuperMap.AggregationType} [options.aggType=AggregationType.FILTER] - 聚合类型。
  18142. */
  18143. class FilterAggParameter extends AggregationParameter {
  18144. constructor(options) {
  18145. super(options);
  18146. /**
  18147. * @member {SuperMap.AggQueryBuilderParameter} SuperMap.FilterAggParameter.prototype.filterParam
  18148. * @description 过滤条件参数设置类。
  18149. */
  18150. this.filterParam = null;
  18151. /**
  18152. * @member {SuperMap.AggregationType} [SuperMap.FilterAggParameter.prototype.aggType=AggregationType.FILTER]
  18153. * @description 聚合类型。
  18154. */
  18155. this.aggType = AggregationType.FILTER;
  18156. this.CLASS_NAME = "SuperMap.FilterAggParameter";
  18157. Util.extend(this, options);
  18158. }
  18159. destroy() {
  18160. super.destroy();
  18161. var me = this;
  18162. if (me.filterParam) {
  18163. me.filterParam = null;
  18164. }
  18165. }
  18166. }
  18167. SuperMap.FilterAggParameter = FilterAggParameter;
  18168. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  18169. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18170. * This program are made available under the terms of the Apache License, Version 2.0
  18171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18172. /**
  18173. * @class SuperMap.FieldParameters
  18174. * @category iServer Data Field
  18175. * @classdesc 字段信息查询参数类。
  18176. * @param {Object} options - 参数。
  18177. * @param {string} options.datasource - 数据源名称。
  18178. * @param {string} options.dataset - 数据集名称。
  18179. */
  18180. class FieldParameters {
  18181. constructor(options) {
  18182. /**
  18183. * @member {string} SuperMap.FieldParameters.prototype.datasource
  18184. * @description 要查询的数据集所在的数据源名称。
  18185. */
  18186. this.datasource = null;
  18187. /**
  18188. * @member {string} SuperMap.FieldParameters.prototype.dataset
  18189. * @description 要查询的数据集名称。
  18190. */
  18191. this.dataset = null;
  18192. if (options) {
  18193. Util.extend(this, options);
  18194. }
  18195. this.CLASS_NAME = "SuperMap.FieldParameters";
  18196. }
  18197. /**
  18198. * @function SuperMap.FieldParameters.prototype.destroy
  18199. * @description 释放资源,将引用资源的属性置空。
  18200. */
  18201. destroy() {
  18202. var me = this;
  18203. me.datasource = null;
  18204. me.dataset = null;
  18205. }
  18206. }
  18207. SuperMap.FieldParameters = FieldParameters;
  18208. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  18209. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18210. * This program are made available under the terms of the Apache License, Version 2.0
  18211. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18212. /**
  18213. * @class SuperMap.FieldStatisticsParameters
  18214. * @category iServer Data Field
  18215. * @classdesc 字段统计信息查询参数类。
  18216. * @param {Object} options - 参数。
  18217. * @param {string} options.datasource - 数据源名称。
  18218. * @param {string} options.dataset - 数据集名称。
  18219. * @param {string} options.fieldName - 字段名。
  18220. * @param {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} statisticMode - 字段统计方法类型。
  18221. * @extends {SuperMap.FieldParameters}
  18222. */
  18223. class FieldStatisticsParameters extends FieldParameters {
  18224. constructor(options) {
  18225. super(options);
  18226. /**
  18227. * @member {string} SuperMap.FieldStatisticsParameters.prototype.fieldName
  18228. * @description 字段名
  18229. */
  18230. this.fieldName = null;
  18231. /**
  18232. * @member {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} SuperMap.FieldStatisticsParameters.prototype.statisticMode
  18233. * @description 字段统计方法类型
  18234. */
  18235. this.statisticMode = null;
  18236. if (options) {
  18237. Util.extend(this, options);
  18238. }
  18239. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  18240. }
  18241. /**
  18242. * @function SuperMap.FieldStatisticsParameters.prototype.destroy
  18243. * @description 释放资源,将引用资源的属性置空。
  18244. */
  18245. destroy() {
  18246. var me = this;
  18247. me.fieldName = null;
  18248. me.statisticMode = null;
  18249. }
  18250. }
  18251. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  18252. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  18253. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18254. * This program are made available under the terms of the Apache License, Version 2.0
  18255. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18256. /**
  18257. * @class SuperMap.FieldStatisticService
  18258. * @category iServer Data Field
  18259. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  18260. * @extends {SuperMap.CommonServiceBase}
  18261. * @param {string} url - 服务的访问地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  18262. * @param {Object} options - 参数。
  18263. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  18264. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  18265. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  18266. * @param {string} options.datasource - 数据集所在的数据源名称。
  18267. * @param {string} options.dataset - 数据集名称。
  18268. * @param {string} options.field - 查询统计的目标字段名称。
  18269. * @param {SuperMap.StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  18270. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18271. * @param {Object} [options.headers] - 请求头。
  18272. * @example
  18273. * var myService = new SuperMap.FieldStatisticService(url, {eventListeners: {
  18274. * "processCompleted": fieldStatisticCompleted,
  18275. * "processFailed": fieldStatisticError
  18276. * },
  18277. * datasource: "World",
  18278. * dataset: "Countries",
  18279. * field: "SmID",
  18280. * statisticMode: StatisticMode.AVERAGE
  18281. * };
  18282. */
  18283. class FieldStatisticService extends CommonServiceBase {
  18284. constructor(url, options) {
  18285. super(url, options);
  18286. /**
  18287. * @member {string} SuperMap.FieldStatisticService.prototype.datasource
  18288. * @description 数据集所在的数据源名称。
  18289. */
  18290. this.datasource = null;
  18291. /**
  18292. * @member {string} SuperMap.FieldStatisticService.prototype.dataset
  18293. * @description 数据集名称。
  18294. */
  18295. this.dataset = null;
  18296. /**
  18297. * @member {string} SuperMap.FieldStatisticService.prototype.field
  18298. * @description 查询统计的目标字段名称。
  18299. */
  18300. this.field = null;
  18301. /**
  18302. * @member {SuperMap.StatisticMode} SuperMap.FieldStatisticService.prototype.statisticMode
  18303. * @description 字段查询统计的方法类型。
  18304. */
  18305. this.statisticMode = null;
  18306. if (options) {
  18307. Util.extend(this, options);
  18308. }
  18309. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  18310. }
  18311. /**
  18312. * @function SuperMap.FieldStatisticService.prototype.destroy
  18313. * @override
  18314. */
  18315. destroy() {
  18316. super.destroy();
  18317. var me = this;
  18318. me.datasource = null;
  18319. me.dataset = null;
  18320. me.field = null;
  18321. me.statisticMode = null;
  18322. }
  18323. /**
  18324. * @function SuperMap.FieldStatisticService.prototype.processAsync
  18325. * @description 执行服务,进行指定字段的查询统计。
  18326. */
  18327. processAsync() {
  18328. var me = this,
  18329. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  18330. me.url = Util.urlPathAppend(me.url, fieldStatisticURL);
  18331. me.request({
  18332. method: "GET",
  18333. data: null,
  18334. scope: me,
  18335. success: me.serviceProcessCompleted,
  18336. failure: me.serviceProcessFailed
  18337. });
  18338. }
  18339. }
  18340. SuperMap.FieldStatisticService = FieldStatisticService;
  18341. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  18342. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18343. * This program are made available under the terms of the Apache License, Version 2.0
  18344. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18345. /**
  18346. * @class SuperMap.FindClosestFacilitiesParameters
  18347. * @category iServer NetworkAnalyst ClosestFacility
  18348. * @classdesc 最近设施分析参数类。
  18349. * @param {Object} options - 参数。
  18350. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  18351. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  18352. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  18353. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  18354. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  18355. * @param {number} [options.maxWeight=0] - 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  18356. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  18357. */
  18358. class FindClosestFacilitiesParameters {
  18359. constructor(options) {
  18360. /**
  18361. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} SuperMap.FindClosestFacilitiesParameters.prototype.event
  18362. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  18363. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  18364. */
  18365. this.event = null;
  18366. /**
  18367. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  18368. * @description 要查找的设施点数量。
  18369. */
  18370. this.expectFacilityCount = 1;
  18371. /**
  18372. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} [SuperMap.FindClosestFacilitiesParameters.prototype.facilities=false]
  18373. * @description 设施点集合,一般为提供服务的服务设施位置。
  18374. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  18375. */
  18376. this.facilities = null;
  18377. /**
  18378. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.fromEvent=false]
  18379. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  18380. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点
  18381. * 不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最
  18382. * 近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  18383. */
  18384. this.fromEvent = false;
  18385. /**
  18386. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  18387. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  18388. */
  18389. this.isAnalyzeById = false;
  18390. /**
  18391. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.maxWeight=0]
  18392. * @description 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  18393. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  18394. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  18395. */
  18396. this.maxWeight = 0;
  18397. /**
  18398. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindClosestFacilitiesParameters.prototype.parameter]
  18399. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  18400. * 它为 SuperMap.TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  18401. * 则返回结果空间信息等都为空。
  18402. */
  18403. this.parameter = new TransportationAnalystParameter();
  18404. Util.extend(this, options);
  18405. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  18406. }
  18407. /**
  18408. * @function SuperMap.FindClosestFacilitiesParameters.prototype.destroy
  18409. * @description 释放资源,将引用资源的属性置空。
  18410. */
  18411. destroy() {
  18412. var me = this;
  18413. me.event = null;
  18414. me.expectFacilityCount = null;
  18415. me.facilities = null;
  18416. me.fromEvent = null;
  18417. me.isAnalyzeById = null;
  18418. me.maxWeight = null;
  18419. if (me.parameter) {
  18420. me.parameter.destroy();
  18421. me.parameter = null;
  18422. }
  18423. }
  18424. }
  18425. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  18426. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  18427. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18428. * This program are made available under the terms of the Apache License, Version 2.0
  18429. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18430. /**
  18431. * @class SuperMap.FindClosestFacilitiesService
  18432. * @category iServer NetworkAnalyst ClosestFacility
  18433. * @classdesc 最近设施分析服务类。
  18434. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  18435. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18436. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  18437. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  18438. * @extends {SuperMap.NetworkAnalystServiceBase}
  18439. * @example
  18440. * var myfindClosestFacilitiesService = new SuperMap.FindClosestFacilitiesService(url, {
  18441. * eventListeners: {
  18442. * "processCompleted": findClosestFacilitiesCompleted,
  18443. * "processFailed": findClosestFacilitiesError
  18444. * }
  18445. * });
  18446. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18447. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18448. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18449. * @param {Object} options - 参数。
  18450. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18451. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18452. * @param {Object} [options.headers] - 请求头。
  18453. */
  18454. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  18455. /*
  18456. * @function SuperMap.FindClosestFacilitiesService.prototype.constructor
  18457. * @description 最近设施分析服务类构造函数。
  18458. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18459. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18460. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18461. * @param {Object} options - 选参数。<br>
  18462. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18463. */
  18464. constructor(url, options) {
  18465. super(url, options);
  18466. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  18467. }
  18468. /**
  18469. * @function SuperMap.FindClosestFacilitiesService.prototype.destroy
  18470. * @override
  18471. */
  18472. destroy() {
  18473. super.destroy();
  18474. }
  18475. /**
  18476. * @function SuperMap.FindClosestFacilitiesService.prototype.processAsync
  18477. * @description 负责将客户端的查询参数传递到服务端。
  18478. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  18479. */
  18480. processAsync(params) {
  18481. if (!(params instanceof FindClosestFacilitiesParameters)) {
  18482. return;
  18483. }
  18484. var me = this,
  18485. jsonObject;
  18486. me.url = Util.urlPathAppend(me.url, 'closestfacility');
  18487. jsonObject = {
  18488. expectFacilityCount: params.expectFacilityCount,
  18489. fromEvent: params.fromEvent,
  18490. maxWeight: params.maxWeight,
  18491. parameter: Util.toJSON(params.parameter),
  18492. event: Util.toJSON(params.event),
  18493. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  18494. };
  18495. me.request({
  18496. method: "GET",
  18497. params: jsonObject,
  18498. scope: me,
  18499. success: me.serviceProcessCompleted,
  18500. failure: me.serviceProcessFailed
  18501. });
  18502. }
  18503. /**
  18504. * @function SuperMap.FindClosestFacilitiesService.prototype.getJson
  18505. * @description 将对象转化为JSON字符串。
  18506. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  18507. * @param {Array} params - 分析参数数组
  18508. * @returns {Object} 转化后的JSON字符串。
  18509. */
  18510. getJson(isAnalyzeById, params) {
  18511. var jsonString = "[",
  18512. len = params ? params.length : 0;
  18513. if (isAnalyzeById === false) {
  18514. for (let i = 0; i < len; i++) {
  18515. if (i > 0) {
  18516. jsonString += ",";
  18517. }
  18518. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  18519. }
  18520. } else if (isAnalyzeById === true) {
  18521. for (let i = 0; i < len; i++) {
  18522. if (i > 0) {
  18523. jsonString += ",";
  18524. }
  18525. jsonString += params[i];
  18526. }
  18527. }
  18528. jsonString += ']';
  18529. return jsonString;
  18530. }
  18531. /**
  18532. * @function SuperMap.FindClosestFacilitiesService.prototype.toGeoJSONResult
  18533. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  18534. * @param {Object} result - 服务器返回的结果对象。
  18535. */
  18536. toGeoJSONResult(result) {
  18537. if (!result || !result.facilityPathList) {
  18538. return result;
  18539. }
  18540. var geoJSONFormat = new GeoJSON();
  18541. result.facilityPathList.map(function (path) {
  18542. if (path.route) {
  18543. path.route = geoJSONFormat.toGeoJSON(path.route);
  18544. }
  18545. if (path.pathGuideItems) {
  18546. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  18547. }
  18548. if (path.edgeFeatures) {
  18549. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  18550. }
  18551. if (path.nodeFeatures) {
  18552. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  18553. }
  18554. return path;
  18555. });
  18556. return result;
  18557. }
  18558. }
  18559. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  18560. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  18561. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18562. * This program are made available under the terms of the Apache License, Version 2.0
  18563. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18564. /**
  18565. * @class SuperMap.FindLocationParameters
  18566. * @category iServer NetworkAnalyst Location
  18567. * @classdesc 选址分区分析参数类。
  18568. * @param {Object} options - 参数。
  18569. * @param {string} options.turnWeightField - 转向权值字段的名称。
  18570. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  18571. * @param {Array.<SuperMap.SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  18572. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  18573. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  18574. */
  18575. class FindLocationParameters {
  18576. constructor(options) {
  18577. /**
  18578. * @member {number} [SuperMap.FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  18579. * @description 期望用于最终设施选址的资源供给中心数量。
  18580. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  18581. */
  18582. this.expectedSupplyCenterCount = null;
  18583. /**
  18584. * @member {boolean} [SuperMap.FindLocationParameters.prototype.isFromCenter=false]
  18585. * @description 是否从中心点开始分配资源。
  18586. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  18587. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  18588. */
  18589. this.isFromCenter = false;
  18590. /**
  18591. * @member {Array.<SuperMap.SupplyCenter>} SuperMap.FindLocationParameters.prototype.supplyCenters
  18592. * @description 资源供给中心集合。
  18593. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  18594. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  18595. */
  18596. this.supplyCenters = null;
  18597. /**
  18598. * @member {string} SuperMap.FindLocationParameters.prototype.turnWeightField
  18599. * @description 转向权值字段的名称。
  18600. */
  18601. this.turnWeightField = null;
  18602. /**
  18603. * @member {string} SuperMap.FindLocationParameters.prototype.weightName
  18604. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  18605. */
  18606. this.weightName = null;
  18607. Util.extend(this, options);
  18608. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  18609. }
  18610. /**
  18611. * @function SuperMap.FindLocationParameters.prototype.destroy
  18612. * @description 释放资源,将引用资源的属性置空。
  18613. */
  18614. destroy() {
  18615. var me = this;
  18616. me.expectedSupplyCenterCount = null;
  18617. me.isFromCenter = null;
  18618. me.turnWeightField = null;
  18619. me.weightName = null;
  18620. if (me.supplyCenters) {
  18621. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  18622. supplyCenters[i].destroy();
  18623. }
  18624. me.supplyCenters = null;
  18625. }
  18626. }
  18627. }
  18628. SuperMap.FindLocationParameters = FindLocationParameters;
  18629. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  18630. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18631. * This program are made available under the terms of the Apache License, Version 2.0
  18632. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18633. /**
  18634. * @class SuperMap.FindLocationService
  18635. * @category iServer NetworkAnalyst Location
  18636. * @classdesc 选址分区分析服务类。
  18637. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  18638. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  18639. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  18640. * @extends {SuperMap.NetworkAnalystServiceBase}
  18641. * @example
  18642. * (start code)
  18643. * var findLocationService = new SuperMap.FindLocationService(url, {
  18644. * eventListeners: {
  18645. * "processCompleted": findLocationCompleted,
  18646. * "processFailed": findLocationError
  18647. * }
  18648. * });
  18649. * (end)
  18650. * @param {string} url - 服务的访问地址。
  18651. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  18652. * @param {Object} options - 参数。
  18653. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18654. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18655. * @param {Object} [options.headers] - 请求头。
  18656. */
  18657. class FindLocationService extends NetworkAnalystServiceBase {
  18658. constructor(url, options) {
  18659. super(url, options);
  18660. this.CLASS_NAME = "SuperMap.FindLocationService";
  18661. }
  18662. /**
  18663. * @function SuperMap.FindLocationService.prototype.destroy
  18664. * @override
  18665. */
  18666. destroy() {
  18667. super.destroy();
  18668. }
  18669. /**
  18670. * @function SuperMap.FindLocationService.prototype.processAsync
  18671. * @description 负责将客户端的查询参数传递到服务端。
  18672. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类
  18673. */
  18674. processAsync(params) {
  18675. if (!(params instanceof FindLocationParameters)) {
  18676. return;
  18677. }
  18678. var me = this,
  18679. jsonObject;
  18680. me.url = Util.urlPathAppend(me.url, 'location');
  18681. jsonObject = {
  18682. isFromCenter: params.isFromCenter,
  18683. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  18684. weightName: params.weightName,
  18685. turnWeightField: params.turnWeightField,
  18686. returnEdgeFeature: true,
  18687. returnEdgeGeometry: true,
  18688. returnNodeFeature: true,
  18689. mapParameter: Util.toJSON(params.mapParameter),
  18690. supplyCenters: me.getCentersJson(params.supplyCenters)
  18691. };
  18692. me.request({
  18693. method: "GET",
  18694. params: jsonObject,
  18695. scope: me,
  18696. success: me.serviceProcessCompleted,
  18697. failure: me.serviceProcessFailed
  18698. });
  18699. }
  18700. /**
  18701. * @function SuperMap.FindLocationService.prototype.getCentersJson
  18702. * @description 将数组对象转化为JSON字符串。
  18703. * @param {Array} params - 需要转换的参数
  18704. * @returns {string} 转化后的JSON字符串。
  18705. */
  18706. getCentersJson(params) {
  18707. var json = "[",
  18708. len = params ? params.length : 0;
  18709. for (var i = 0; i < len; i++) {
  18710. if (i > 0) {
  18711. json += ",";
  18712. }
  18713. json += Util.toJSON(params[i]);
  18714. }
  18715. json += "]";
  18716. return json;
  18717. }
  18718. /**
  18719. * @function SuperMap.FindLocationService.prototype.toGeoJSONResult
  18720. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  18721. * @param {Object} result - 服务器返回的结果对象。
  18722. */
  18723. toGeoJSONResult(result) {
  18724. if (!result) {
  18725. return null;
  18726. }
  18727. var geoJSONFormat = new GeoJSON();
  18728. if (result.demandResults) {
  18729. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  18730. }
  18731. if (result.supplyResults) {
  18732. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  18733. }
  18734. return result;
  18735. }
  18736. }
  18737. SuperMap.FindLocationService = FindLocationService;
  18738. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  18739. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18740. * This program are made available under the terms of the Apache License, Version 2.0
  18741. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18742. /**
  18743. * @class SuperMap.FindMTSPPathsParameters
  18744. * @category iServer NetworkAnalyst MTSPPath
  18745. * @classdesc 多旅行商分析参数类
  18746. * @param {Object} options - 参数。
  18747. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 配送中心集合。
  18748. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 配送目标集合。
  18749. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  18750. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  18751. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  18752. */
  18753. class FindMTSPPathsParameters {
  18754. constructor(options) {
  18755. /**
  18756. * @member SuperMap.FindMTSPPathsParameters.prototype.centers - {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>}
  18757. * @description 配送中心集合。
  18758. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  18759. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  18760. */
  18761. this.centers = null;
  18762. /**
  18763. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  18764. * @description 配送模式是否为总花费最小方案。
  18765. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  18766. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  18767. */
  18768. this.hasLeastTotalCost = false;
  18769. /**
  18770. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  18771. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  18772. */
  18773. this.isAnalyzeById = false;
  18774. /**
  18775. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindMTSPPathsParameters.prototype.nodes
  18776. * @description 配送目标集合。
  18777. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  18778. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  18779. */
  18780. this.nodes = null;
  18781. /**
  18782. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindMTSPPathsParameters.prototype.parameter]
  18783. * @description 交通网络分析通用参数。
  18784. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  18785. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  18786. */
  18787. this.parameter = new TransportationAnalystParameter();
  18788. Util.extend(this, options);
  18789. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  18790. }
  18791. /**
  18792. * @function SuperMap.FindMTSPPathsParameters.prototype.destroy
  18793. * @description 释放资源,将引用资源的属性置空。
  18794. */
  18795. destroy() {
  18796. var me = this;
  18797. me.centers = null;
  18798. me.hasLeastTotalCost = null;
  18799. me.isAnalyzeById = null;
  18800. me.nodes = null;
  18801. me.maxWeight = null;
  18802. if (me.parameter) {
  18803. me.parameter.destroy();
  18804. me.parameter = null;
  18805. }
  18806. }
  18807. }
  18808. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  18809. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  18810. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18811. * This program are made available under the terms of the Apache License, Version 2.0
  18812. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18813. /**
  18814. * @class SuperMap.FindMTSPPathsService
  18815. * @category iServer NetworkAnalyst MTSPPath
  18816. * @classdesc 多旅行商分析服务类
  18817. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  18818. * 查找经济有效的配送路径,并给出相应的行走路线。
  18819. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  18820. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  18821. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取
  18822. * @extends {SuperMap.NetworkAnalystServiceBase}
  18823. * @example
  18824. * var myFindMTSPPathsService = new SuperMap.FindMTSPPathsService(url, {
  18825. * eventListeners: {
  18826. * "processCompleted": findMTSPPathsCompleted,
  18827. * "processFailed": findMTSPPathsError
  18828. * }
  18829. * });
  18830. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  18831. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18832. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18833. * @param {Object} options - 互服务时所需可选参数。如:
  18834. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18835. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18836. * @param {Object} [options.headers] - 请求头。
  18837. */
  18838. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  18839. constructor(url, options) {
  18840. super(url, options);
  18841. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  18842. }
  18843. /**
  18844. * @function SuperMap.FindMTSPPathsService.prototype.destroy
  18845. * @override
  18846. */
  18847. destroy() {
  18848. super.destroy();
  18849. }
  18850. /**
  18851. * @function SuperMap.FindMTSPPathsService..prototype.processAsync
  18852. * @description 负责将客户端的查询参数传递到服务端。
  18853. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  18854. */
  18855. processAsync(params) {
  18856. if (!(params instanceof FindMTSPPathsParameters)) {
  18857. return;
  18858. }
  18859. var me = this,
  18860. jsonObject,
  18861. //end = me.url.substr(me.url.length - 1, 1),
  18862. centers = me.getJson(params.isAnalyzeById, params.centers),
  18863. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  18864. me.url = Util.urlPathAppend(me.url, 'mtsppath');
  18865. jsonObject = {
  18866. centers: centers,
  18867. nodes: nodes,
  18868. parameter: Util.toJSON(params.parameter),
  18869. hasLeastTotalCost: params.hasLeastTotalCost
  18870. };
  18871. me.request({
  18872. method: "GET",
  18873. params: jsonObject,
  18874. scope: me,
  18875. success: me.serviceProcessCompleted,
  18876. failure: me.serviceProcessFailed
  18877. });
  18878. }
  18879. /**
  18880. * @function SuperMap.FindMTSPPathsService.prototype.getJson
  18881. * @description 将对象转化为JSON字符串。
  18882. * @param {boolean} isAnalyzeById - 是否通过id分析
  18883. * @param {Array} params - 需要转换的数字
  18884. * @returns {Object} 转化后的JSON字符串。
  18885. */
  18886. getJson(isAnalyzeById, params) {
  18887. var jsonString = "[",
  18888. len = params ? params.length : 0;
  18889. if (isAnalyzeById === false) {
  18890. for (let i = 0; i < len; i++) {
  18891. if (i > 0) {
  18892. jsonString += ",";
  18893. }
  18894. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  18895. }
  18896. } else if (isAnalyzeById === true) {
  18897. for (let i = 0; i < len; i++) {
  18898. if (i > 0) {
  18899. jsonString += ",";
  18900. }
  18901. jsonString += params[i];
  18902. }
  18903. }
  18904. jsonString += ']';
  18905. return jsonString;
  18906. }
  18907. /**
  18908. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  18909. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  18910. * @param {Object} result - 服务器返回的结果对象。
  18911. */
  18912. toGeoJSONResult(result) {
  18913. if (!result || !result.pathList) {
  18914. return null;
  18915. }
  18916. var geoJSONFormat = new GeoJSON();
  18917. result.pathList.map(function (path) {
  18918. if (path.route) {
  18919. path.route = geoJSONFormat.toGeoJSON(path.route);
  18920. }
  18921. if (path.pathGuideItems) {
  18922. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  18923. }
  18924. if (path.edgeFeatures) {
  18925. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  18926. }
  18927. if (path.nodeFeatures) {
  18928. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  18929. }
  18930. return path;
  18931. });
  18932. return result;
  18933. }
  18934. }
  18935. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  18936. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  18937. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18938. * This program are made available under the terms of the Apache License, Version 2.0
  18939. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18940. /**
  18941. * @class SuperMap.FindPathParameters
  18942. * @category iServer NetworkAnalyst Path
  18943. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  18944. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  18945. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  18946. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  18947. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  18948. * 阻抗值通过 SuperMap.TransportationAnalystParameter.weightFieldName 设置。
  18949. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link SuperMap.TransportationAnalystParameter.turnWeightField} 设置。
  18950. *
  18951. * @param {Object} options - 参数。
  18952. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  18953. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  18954. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  18955. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  18956. */
  18957. class FindPathParameters {
  18958. constructor(options) {
  18959. /**
  18960. * @member {boolean} [SuperMap.FindPathParameters.prototype.isAnalyzeById=false]
  18961. * @description 是否通过节点 ID 指定路径分析的结点。
  18962. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  18963. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindPathParameters.nodes = [ID1,ID2,...];
  18964. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  18965. */
  18966. this.isAnalyzeById = false;
  18967. /**
  18968. * @member {boolean} [SuperMap.FindPathParameters.prototype.hasLeastEdgeCount=false]
  18969. * @description 是否按照弧段数最少的进行最佳路径分析。
  18970. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  18971. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  18972. */
  18973. this.hasLeastEdgeCount = null;
  18974. /**
  18975. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindPathParameters.prototype.nodes
  18976. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  18977. * 当 SuperMap.FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  18978. * 当 SuperMap.FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  18979. */
  18980. this.nodes = null;
  18981. /**
  18982. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindPathParameters.prototype.parameter
  18983. * @description 交通网络分析通用参数。
  18984. */
  18985. this.parameter = new TransportationAnalystParameter();
  18986. Util.extend(this, options);
  18987. this.CLASS_NAME = "SuperMap.FindPathParameters";
  18988. }
  18989. /**
  18990. * @function SuperMap.FindPathParameters.prototype.destroy
  18991. * @description 释放资源,将引用资源的属性置空。
  18992. */
  18993. destroy() {
  18994. var me = this;
  18995. me.isAnalyzeById = null;
  18996. me.hasLeastEdgeCount = null;
  18997. me.nodes = null;
  18998. if (me.parameter) {
  18999. me.parameter.destroy();
  19000. me.parameter = null;
  19001. }
  19002. }
  19003. }
  19004. SuperMap.FindPathParameters = FindPathParameters;
  19005. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  19006. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19007. * This program are made available under the terms of the Apache License, Version 2.0
  19008. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19009. /**
  19010. * @class SuperMap.FindPathService
  19011. * @category iServer NetworkAnalyst Path
  19012. * @classdesc 最佳路径分析服务类。
  19013. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  19014. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  19015. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  19016. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  19017. * @extends {SuperMap.NetworkAnalystServiceBase}
  19018. * @example
  19019. * var myFindPathService = new SuperMap.FindPathService(url, {
  19020. * eventListeners: {
  19021. * "processCompleted": findPathCompleted,
  19022. * "processFailed": findPathError
  19023. * }
  19024. * });
  19025. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19026. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19027. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19028. * @param {Object} options - 参数。
  19029. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19030. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19031. * @param {Object} [options.headers] - 请求头。
  19032. */
  19033. class FindPathService extends NetworkAnalystServiceBase {
  19034. constructor(url, options) {
  19035. super(url, options);
  19036. this.CLASS_NAME = "SuperMap.FindPathService";
  19037. }
  19038. /**
  19039. * @function SuperMap.FindPathService.prototype.destroy
  19040. * @override
  19041. */
  19042. destroy() {
  19043. super.destroy();
  19044. }
  19045. /**
  19046. * @function SuperMap.FindPathService.prototype.processAsync
  19047. * @description 负责将客户端的查询参数传递到服务端。
  19048. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类
  19049. */
  19050. processAsync(params) {
  19051. if (!(params instanceof FindPathParameters)) {
  19052. return;
  19053. }
  19054. var me = this, jsonObject;
  19055. me.url = Util.urlPathAppend(me.url, 'path');
  19056. jsonObject = {
  19057. hasLeastEdgeCount: params.hasLeastEdgeCount,
  19058. parameter: Util.toJSON(params.parameter),
  19059. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  19060. };
  19061. me.request({
  19062. method: "GET",
  19063. params: jsonObject,
  19064. scope: me,
  19065. success: me.serviceProcessCompleted,
  19066. failure: me.serviceProcessFailed
  19067. });
  19068. }
  19069. /**
  19070. * @function SuperMap.FindPathService.prototype.getJson
  19071. * @description 将对象转化为JSON字符串。
  19072. * @param {boolean} isAnalyzeById - 是否通过id分析
  19073. * @param {Array} params - 需要转换的数字
  19074. * @returns {Object} 转化后的JSON字符串。
  19075. */
  19076. getJson(isAnalyzeById, params) {
  19077. var jsonString = "[",
  19078. len = params ? params.length : 0;
  19079. if (isAnalyzeById === false) {
  19080. for (let i = 0; i < len; i++) {
  19081. if (i > 0) {
  19082. jsonString += ",";
  19083. }
  19084. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  19085. }
  19086. } else if (isAnalyzeById === true) {
  19087. for (let i = 0; i < len; i++) {
  19088. if (i > 0) {
  19089. jsonString += ",";
  19090. }
  19091. jsonString += params[i];
  19092. }
  19093. }
  19094. jsonString += ']';
  19095. return jsonString;
  19096. }
  19097. /**
  19098. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  19099. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19100. * @param {Object} result - 服务器返回的结果对象。
  19101. */
  19102. toGeoJSONResult(result) {
  19103. if (!result || !result.pathList || result.pathList.length < 1) {
  19104. return null;
  19105. }
  19106. var geoJSONFormat = new GeoJSON();
  19107. result.pathList.forEach(function (path) {
  19108. if (path.route) {
  19109. path.route = geoJSONFormat.toGeoJSON(path.route);
  19110. }
  19111. if (path.pathGuideItems) {
  19112. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  19113. }
  19114. if (path.edgeFeatures) {
  19115. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  19116. }
  19117. if (path.nodeFeatures) {
  19118. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  19119. }
  19120. });
  19121. return result;
  19122. }
  19123. }
  19124. SuperMap.FindPathService = FindPathService;
  19125. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  19126. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19127. * This program are made available under the terms of the Apache License, Version 2.0
  19128. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19129. /**
  19130. * @class SuperMap.FindServiceAreasParameters
  19131. * @category iServer NetworkAnalyst ServiceArea
  19132. * @classdesc 服务区分析参数类。
  19133. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  19134. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  19135. * @param {Object} options - 参数。
  19136. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  19137. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 服务站点数组。
  19138. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  19139. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  19140. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  19141. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19142. */
  19143. class FindServiceAreasParameters {
  19144. constructor(options) {
  19145. /**
  19146. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isAnalyzeById=false]
  19147. * @description 是否通过节点 ID 指定路径分析的结点。
  19148. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  19149. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [ID1,ID2,...];
  19150. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  19151. */
  19152. this.isAnalyzeById = false;
  19153. /**
  19154. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  19155. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  19156. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  19157. */
  19158. this.isCenterMutuallyExclusive = false;
  19159. /**
  19160. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindServiceAreasParameters.prototype.centers
  19161. * @description 服务站点数组。
  19162. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  19163. */
  19164. this.centers = null;
  19165. /**
  19166. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isFromCenter=false]
  19167. * @description 是否从中心点开始分析。
  19168. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  19169. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  19170. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  19171. */
  19172. this.isFromCenter = false;
  19173. /**
  19174. * APIProperty: weights
  19175. * @member {Array.<number>} SuperMap.FindServiceAreasParameters.prototype.weights
  19176. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  19177. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  19178. */
  19179. this.weights = null;
  19180. /**
  19181. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindServiceAreasParameters.prototype.parameter
  19182. * @description 交通网络分析通用参数。
  19183. */
  19184. this.parameter = new TransportationAnalystParameter();
  19185. Util.extend(this, options);
  19186. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  19187. }
  19188. /**
  19189. * @function SuperMap.FindServiceAreasParameters.prototype.destroy
  19190. * @description 释放资源,将引用资源的属性置空。
  19191. */
  19192. destroy() {
  19193. var me = this;
  19194. me.isAnalyzeById = null;
  19195. me.isCenterMutuallyExclusive = null;
  19196. me.centers = null;
  19197. me.isFromCenter = null;
  19198. me.weights = null;
  19199. if (me.parameter) {
  19200. me.parameter.destroy();
  19201. me.parameter = null;
  19202. }
  19203. }
  19204. }
  19205. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  19206. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  19207. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19208. * This program are made available under the terms of the Apache License, Version 2.0
  19209. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19210. /**
  19211. * @class SuperMap.FindServiceAreasService
  19212. * @category iServer NetworkAnalyst ServiceArea
  19213. * @classdesc 服务区分析服务类。
  19214. * 服务区分析是以指定服务站点为中心,
  19215. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  19216. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  19217. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  19218. * @extends {SuperMap.NetworkAnalystServiceBase}
  19219. * @example
  19220. * var myFindServiceAreasService = new SuperMap.FindServiceAreasService(url, {
  19221. * eventListeners: {
  19222. * "processCompleted": findServiceAreasCompleted,
  19223. * "processFailed": findServiceAreasError
  19224. * }
  19225. * });
  19226. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19227. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19228. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19229. * @param {Object} options - 互服务时所需可选参数。如:
  19230. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  19231. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19232. * @param {Object} [options.headers] - 请求头。
  19233. */
  19234. class FindServiceAreasService extends NetworkAnalystServiceBase {
  19235. constructor(url, options) {
  19236. super(url, options);
  19237. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  19238. }
  19239. /**
  19240. * @function SuperMap.FindServiceAreasService.prototype.destroy
  19241. * @override
  19242. */
  19243. destroy() {
  19244. super.destroy();
  19245. }
  19246. /**
  19247. * @function SuperMap.FindServiceAreasService.prototype.processAsync
  19248. * @description 负责将客户端的查询参数传递到服务端。
  19249. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类
  19250. */
  19251. processAsync(params) {
  19252. if (!(params instanceof FindServiceAreasParameters)) {
  19253. return;
  19254. }
  19255. var me = this, jsonObject;
  19256. me.url = Util.urlPathAppend(me.url, 'servicearea');
  19257. jsonObject = {
  19258. isFromCenter: params.isFromCenter,
  19259. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  19260. parameter: Util.toJSON(params.parameter),
  19261. centers: me.getJson(params.isAnalyzeById, params.centers),
  19262. weights: me.getJson(true, params.weights)
  19263. };
  19264. me.request({
  19265. method: "GET",
  19266. params: jsonObject,
  19267. scope: me,
  19268. success: me.serviceProcessCompleted,
  19269. failure: me.serviceProcessFailed
  19270. });
  19271. }
  19272. /**
  19273. * @function SuperMap.FindServiceAreasService.prototype.getJson
  19274. * @description 将对象转化为JSON字符串。
  19275. * @param {boolean} isAnalyzeById - 是否通过id分析
  19276. * @param {Array} params - 需要转换的数字
  19277. * @returns {Object} 转化后的JSON字符串。
  19278. */
  19279. getJson(isAnalyzeById, params) {
  19280. var jsonString = "[",
  19281. len = params ? params.length : 0;
  19282. if (isAnalyzeById === false) {
  19283. for (let i = 0; i < len; i++) {
  19284. if (i > 0) {
  19285. jsonString += ",";
  19286. }
  19287. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  19288. }
  19289. } else if (isAnalyzeById === true) {
  19290. for (let i = 0; i < len; i++) {
  19291. if (i > 0) {
  19292. jsonString += ",";
  19293. }
  19294. jsonString += params[i];
  19295. }
  19296. }
  19297. jsonString += ']';
  19298. return jsonString;
  19299. }
  19300. /**
  19301. * @function SuperMap.FindServiceAreasService.prototype.toGeoJSONResult
  19302. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19303. * @param {Object} result - 服务器返回的结果对象。。
  19304. */
  19305. toGeoJSONResult(result) {
  19306. if (!result || !result.serviceAreaList) {
  19307. return result;
  19308. }
  19309. var geoJSONFormat = new GeoJSON();
  19310. result.serviceAreaList.map(function (serviceArea) {
  19311. if (serviceArea.serviceRegion) {
  19312. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  19313. }
  19314. if (serviceArea.edgeFeatures) {
  19315. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  19316. }
  19317. if (serviceArea.nodeFeatures) {
  19318. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  19319. }
  19320. if (serviceArea.routes) {
  19321. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  19322. }
  19323. return serviceArea;
  19324. });
  19325. return result;
  19326. }
  19327. }
  19328. SuperMap.FindServiceAreasService = FindServiceAreasService;
  19329. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  19330. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19331. * This program are made available under the terms of the Apache License, Version 2.0
  19332. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19333. /**
  19334. * @class SuperMap.FindTSPPathsParameters
  19335. * @category iServer NetworkAnalyst TSPPath
  19336. * @classdesc 旅行商分析参数类。
  19337. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  19338. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  19339. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同
  19340. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  19341. * @param {Object} options - 参数。
  19342. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  19343. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  19344. * @param {Array.<(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)>} options.nodes - 配送目标集合。
  19345. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19346. */
  19347. class FindTSPPathsParameters {
  19348. constructor(options) {
  19349. /**
  19350. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.endNodeAssigned=false]
  19351. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  19352. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  19353. */
  19354. this.endNodeAssigned = false;
  19355. /**
  19356. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.isAnalyzeById=false]
  19357. * @description 是否通过节点 ID 号来指定途经点。
  19358. */
  19359. this.isAnalyzeById = false;
  19360. /**
  19361. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindTSPPathsParameters.prototype.nodes
  19362. * @description 旅行商分析途经点数组。
  19363. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  19364. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  19365. */
  19366. this.nodes = null;
  19367. /**
  19368. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindTSPPathsParameters.prototype.parameter]
  19369. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  19370. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  19371. * 字段,则返回结果空间信息等都为空。
  19372. */
  19373. this.parameter = new TransportationAnalystParameter();
  19374. Util.extend(this, options);
  19375. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  19376. }
  19377. /**
  19378. * @function SuperMap.FindTSPPathsParameters.prototype.destroy
  19379. * @description 释放资源,将引用资源的属性置空。
  19380. */
  19381. destroy() {
  19382. var me = this;
  19383. me.endNodeAssigned = null;
  19384. me.isAnalyzeById = null;
  19385. me.nodes = null;
  19386. if (me.parameter) {
  19387. me.parameter.destroy();
  19388. me.parameter = null;
  19389. }
  19390. }
  19391. }
  19392. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  19393. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  19394. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19395. * This program are made available under the terms of the Apache License, Version 2.0
  19396. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19397. /**
  19398. * @class SuperMap.FindTSPPathsService
  19399. * @category iServer NetworkAnalyst TSPPath
  19400. * @classdesc 旅行商分析服务类
  19401. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  19402. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  19403. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  19404. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  19405. * @extends {SuperMap.NetworkAnalystServiceBase}
  19406. * @example
  19407. * (start code)
  19408. * var myFindTSPPathsService = new SuperMap.FindTSPPathsService(url, {
  19409. * eventListeners: {
  19410. * "processCompleted": findTSPPathsCompleted,
  19411. * "processFailed": findTSPPathsError
  19412. * }
  19413. * });
  19414. * (end)
  19415. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19416. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19417. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19418. * @param {Object} options - 参数。
  19419. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19420. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19421. * @param {Object} [options.headers] - 请求头。
  19422. */
  19423. class FindTSPPathsService extends NetworkAnalystServiceBase {
  19424. constructor(url, options) {
  19425. super(url, options);
  19426. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  19427. }
  19428. /**
  19429. * @function SuperMap.FindTSPPathsService.prototype.destroy
  19430. * @override
  19431. */
  19432. destroy() {
  19433. super.destroy();
  19434. }
  19435. /**
  19436. * @function SuperMap.FindTSPPathsService.prototype.processAsync
  19437. * @description 负责将客户端的查询参数传递到服务端。
  19438. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  19439. */
  19440. processAsync(params) {
  19441. if (!(params instanceof FindTSPPathsParameters)) {
  19442. return;
  19443. }
  19444. var me = this, jsonObject;
  19445. me.url = Util.urlPathAppend(me.url, 'tsppath');
  19446. jsonObject = {
  19447. parameter: SuperMap.Util.toJSON(params.parameter),
  19448. endNodeAssigned: params.endNodeAssigned,
  19449. nodes: me.getNodesJson(params)
  19450. };
  19451. me.request({
  19452. method: "GET",
  19453. params: jsonObject,
  19454. scope: me,
  19455. success: me.serviceProcessCompleted,
  19456. failure: me.serviceProcessFailed
  19457. });
  19458. }
  19459. /**
  19460. * @function SuperMap.FindTSPPathsService.prototype.getNodesJson
  19461. * @description 将节点对象转化为JSON字符串。
  19462. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  19463. * @returns {string} 转化后的JSON字符串。
  19464. */
  19465. getNodesJson(params) {
  19466. var jsonParameters = "", nodesString, i, len, nodes;
  19467. if (params.isAnalyzeById === false) {
  19468. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  19469. if (i > 0) {
  19470. nodesString += ",";
  19471. }
  19472. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  19473. }
  19474. nodesString += ']';
  19475. jsonParameters += nodesString;
  19476. } else if (params.isAnalyzeById === true) {
  19477. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  19478. for (let i = 0; i < len; i++) {
  19479. if (i > 0) {
  19480. nodeIDsString += ",";
  19481. }
  19482. nodeIDsString += nodes[i];
  19483. }
  19484. nodeIDsString += ']';
  19485. jsonParameters += nodeIDsString;
  19486. }
  19487. return jsonParameters;
  19488. }
  19489. /**
  19490. * @function SuperMap.FindTSPPathsService.prototype.toGeoJSONResult
  19491. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  19492. * @param {Object} result - 服务器返回的结果对象。
  19493. */
  19494. toGeoJSONResult(result) {
  19495. if (!result || !result.tspPathList) {
  19496. return null;
  19497. }
  19498. var geoJSONFormat = new GeoJSON();
  19499. result.tspPathList.forEach(function (path) {
  19500. if (path.route) {
  19501. path.route = geoJSONFormat.toGeoJSON(path.route);
  19502. }
  19503. if (path.pathGuideItems) {
  19504. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  19505. }
  19506. if (path.edgeFeatures) {
  19507. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  19508. }
  19509. if (path.nodeFeatures) {
  19510. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  19511. }
  19512. });
  19513. return result;
  19514. }
  19515. }
  19516. SuperMap.FindTSPPathsService = FindTSPPathsService;
  19517. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  19518. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19519. * This program are made available under the terms of the Apache License, Version 2.0
  19520. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19521. /**
  19522. * @class SuperMap.GenerateSpatialDataParameters
  19523. * @category iServer SpatialAnalyst GenerateSpatialData
  19524. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  19525. * @param {Object} options - 参数。
  19526. * @param {string} options.routeTable - 路由数据集。
  19527. * @param {string} options.routeIDField - 路由数据集的标识字段。
  19528. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  19529. * @param {SuperMap.DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  19530. * @param {string} [options.attributeFilter] - 属性过滤条件。
  19531. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  19532. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  19533. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  19534. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  19535. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  19536. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  19537. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  19538. */
  19539. class GenerateSpatialDataParameters {
  19540. constructor(options) {
  19541. /**
  19542. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeTable
  19543. * @description 路由数据集。
  19544. */
  19545. this.routeTable = null;
  19546. /**
  19547. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeIDField
  19548. * @description 路由数据集的标识字段。
  19549. */
  19550. this.routeIDField = null;
  19551. /**
  19552. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.attributeFilter]
  19553. * @description 属性过滤条件。
  19554. * 当 {@link SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  19555. */
  19556. this.attributeFilter = null;
  19557. /**
  19558. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventTable
  19559. * @description 用于生成空间数据的事件表名。
  19560. */
  19561. this.eventTable = null;
  19562. /**
  19563. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventRouteIDField
  19564. * @description 用于生成空间数据的事件表的路由标识字段。
  19565. */
  19566. this.eventRouteIDField = null;
  19567. /**
  19568. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureField]
  19569. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义
  19570. */
  19571. this.measureField = null;
  19572. /**
  19573. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureStartField]
  19574. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  19575. */
  19576. this.measureStartField = null;
  19577. /**
  19578. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureEndField]
  19579. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  19580. */
  19581. this.measureEndField = null;
  19582. /**
  19583. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureOffsetField]
  19584. * @description 刻度偏移量字段。
  19585. */
  19586. this.measureOffsetField = null;
  19587. /**
  19588. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.errorInfoField]
  19589. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  19590. */
  19591. this.errorInfoField = null;
  19592. /**
  19593. * @member {Array.<string>} [SuperMap.GenerateSpatialDataParameters.prototype.retainedFields]
  19594. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  19595. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  19596. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  19597. */
  19598. this.retainedFields = null;
  19599. /**
  19600. * @member {SuperMap.DataReturnOption} SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption
  19601. * @description 设置数据返回的选项。
  19602. */
  19603. this.dataReturnOption = null;
  19604. if (options) {
  19605. Util.extend(this, options);
  19606. }
  19607. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  19608. }
  19609. /**
  19610. * @function SuperMap.GenerateSpatialDataParameters.prototype.destroy
  19611. * @description 释放资源,将引用资源的属性置空。
  19612. */
  19613. destroy() {
  19614. var me = this;
  19615. if (me.routeTable) {
  19616. me.routeTable = null;
  19617. }
  19618. me.routeIDField = null;
  19619. me.attributeFilter = null;
  19620. me.eventTable = null;
  19621. me.eventRouteIDField = null;
  19622. me.measureField = null;
  19623. me.measureStartField = null;
  19624. me.measureEndField = null;
  19625. me.measureOffsetField = null;
  19626. me.errorInfoField = null;
  19627. if (me.dataReturnOption) {
  19628. me.dataReturnOption.destroy();
  19629. me.dataReturnOption = null;
  19630. }
  19631. }
  19632. }
  19633. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  19634. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  19635. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19636. * This program are made available under the terms of the Apache License, Version 2.0
  19637. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19638. /**
  19639. * @class SuperMap.GenerateSpatialDataService
  19640. * @category iServer SpatialAnalyst GenerateSpatialData
  19641. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  19642. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  19643. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  19644. * @param {Object} options - 参数。</br>
  19645. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19646. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19647. * @param {Object} [options.headers] - 请求头。
  19648. * @extends {SuperMap.SpatialAnalystBase}
  19649. * @example 实例化该类如下例所示:
  19650. * (start code)
  19651. * function GenerateSpatialData(){
  19652. *
  19653. * //配置数据返回选项(option)
  19654. * var option = new SuperMap.DataReturnOption({
  19655. * expectCount: 1000,
  19656. * dataset: "generateSpatialData",
  19657. * deleteExistResultDataset: true,
  19658. * dataReturnMode: SuperMap.DataReturnMode.DATASET_ONLY
  19659. * }),
  19660. * //配置动态分段参数(Parameters)
  19661. * parameters = new SuperMap.GenerateSpatialDataParameters({
  19662. * routeTable: "RouteDT_road@Changchun",
  19663. * routeIDField: "RouteID",
  19664. * eventTable: "LinearEventTabDT@Changchun",
  19665. * eventRouteIDField: "RouteID",
  19666. * measureField: "",
  19667. * measureStartField: "LineMeasureFrom",
  19668. * measureEndField: "LineMeasureTo",
  19669. * measureOffsetField: "",
  19670. * errorInfoField: "",
  19671. * retainedFields:[],
  19672. * dataReturnOption: option
  19673. * }),
  19674. * //配置动态分段iService
  19675. * iService = new SuperMap.GenerateSpatialDataService(Changchun_spatialanalyst, {
  19676. * eventListeners: {
  19677. * processCompleted: generateCompleted,
  19678. * processFailed: generateFailded
  19679. * }
  19680. * });
  19681. * //执行
  19682. * iService.processAsync(parameters);
  19683. * function Completed(generateSpatialDataEventArgs){//todo};
  19684. * function Error(generateSpatialDataEventArgs){//todo};
  19685. * (end)
  19686. */
  19687. class GenerateSpatialDataService extends SpatialAnalystBase {
  19688. constructor(url, options) {
  19689. super(url, options);
  19690. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  19691. }
  19692. /**
  19693. * @function SuperMap.GenerateSpatialDataService.prototype.destroy
  19694. * @override
  19695. */
  19696. destroy() {
  19697. super.destroy();
  19698. }
  19699. /**
  19700. * @function SuperMap.GenerateSpatialDataService.prototype.processAsync
  19701. * @description 负责将客户端的动态分段服务参数传递到服务端。
  19702. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  19703. */
  19704. processAsync(params) {
  19705. if (!(params instanceof GenerateSpatialDataParameters)) {
  19706. return;
  19707. }
  19708. var me = this,
  19709. jsonParameters;
  19710. jsonParameters = me.getJsonParameters(params);
  19711. me.request({
  19712. method: "POST",
  19713. data: jsonParameters,
  19714. scope: me,
  19715. success: me.serviceProcessCompleted,
  19716. failure: me.serviceProcessFailed
  19717. });
  19718. }
  19719. /**
  19720. * @function SuperMap.GenerateSpatialDataService.prototype.getJsonParameters
  19721. * @description 将参数转化为 JSON 字符串。
  19722. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  19723. * @returns {string}转化后的JSON字符串。
  19724. */
  19725. getJsonParameters(params) {
  19726. var jsonParameters = "",
  19727. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  19728. me = this;
  19729. me.url = Util.urlPathAppend(me.url, jsonStr);
  19730. me.url = Util.urlAppend(me.url, 'returnContent=true');
  19731. jsonParameters = Util.toJSON(params);
  19732. return jsonParameters;
  19733. }
  19734. }
  19735. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  19736. ;// CONCATENATED MODULE: ./src/common/iServer/GeoBoundingBoxQueryBuilderParameter.js
  19737. /* Copyright© 2000 - 2021 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.GeoBoundingBoxQueryBuilderParameter
  19742. * @classdesc bounds 查询参数设置类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  19743. * @category iServer Data FeatureResults
  19744. * @param {Object} options - 参数。
  19745. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 查询范围。
  19746. * @param {SuperMap.AggregationQueryBuilderType} [options.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX] - 查询类型。
  19747. */
  19748. class GeoBoundingBoxQueryBuilderParameter extends AggQueryBuilderParameter {
  19749. constructor(options) {
  19750. super(options);
  19751. /**
  19752. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.bounds
  19753. * @description 查询范围。
  19754. */
  19755. this.bounds = null;
  19756. /**
  19757. * @member {SuperMap.AggregationQueryBuilderType} [SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX]
  19758. * @description 查询类型。
  19759. */
  19760. this.queryType = AggregationQueryBuilderType.GEO_BOUNDING_BOX;
  19761. this.CLASS_NAME = "SuperMap.GeoBoundingBoxQueryBuilderParameter";
  19762. Util.extend(this, options);
  19763. }
  19764. destroy() {
  19765. super.destroy();
  19766. this.bounds = null;
  19767. this.queryType = null;
  19768. }
  19769. }
  19770. SuperMap.GeoBoundingBoxQueryBuilderParameter = GeoBoundingBoxQueryBuilderParameter
  19771. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  19772. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19773. * This program are made available under the terms of the Apache License, Version 2.0
  19774. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19775. /**
  19776. * @class SuperMap.GeoHashGridAggParameter
  19777. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  19778. * @category iServer Data FeatureResults
  19779. * @param {Object} option - 初始化参数。
  19780. * @param {number} [option.precision=5] - 网格中数字的精度。
  19781. * @param {SuperMap.AggregationType} [option.aggType=SuperMap.AggregationType.GEOHASH_GRID] - 格网聚合类型。
  19782. */
  19783. class GeoHashGridAggParameter extends AggregationParameter {
  19784. constructor(option) {
  19785. super(option);
  19786. /**
  19787. * @member {number} [SuperMap.GeoHashGridAggParameter.prototype.precision=5]
  19788. * @description 网格中数字的精度。
  19789. */
  19790. this.precision = 5;
  19791. /**
  19792. * @member {SuperMap.AggregationType} [SuperMap.GeoHashGridAggParameter.prototype.aggType=SuperMap.AggregationType.GEOHASH_GRID]
  19793. * @description 格网聚合类型。
  19794. */
  19795. this.aggType = AggregationType.GEOHASH_GRID;
  19796. Util.extend(this, option);
  19797. this.CLASS_NAME = "SuperMap.GeoHashGridAggParameter";
  19798. }
  19799. destroy() {
  19800. super.destroy();
  19801. this.aggType = null;
  19802. }
  19803. /**
  19804. * @function SuperMap.GeoHashGridAggParameter.toJsonParameters
  19805. * @description 将对象转为 JSON 格式。
  19806. * @param param 转换对象。
  19807. * @returns {string|object}
  19808. */
  19809. static toJsonParameters(param) {
  19810. var parameters = {
  19811. aggName: param.aggName,
  19812. aggFieldName: param.aggFieldName,
  19813. aggType: param.aggType,
  19814. precision: param.precision
  19815. };
  19816. if (param.subAgg) {
  19817. parameters.subAgg = param.subAgg;
  19818. }
  19819. return Util.toJson(parameters);
  19820. }
  19821. }
  19822. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  19823. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  19824. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19825. * This program are made available under the terms of the Apache License, Version 2.0
  19826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19827. /**
  19828. * @class SuperMap.GeometryOverlayAnalystParameters
  19829. * @category iServer SpatialAnalyst OverlayAnalyst
  19830. * @classdesc
  19831. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  19832. * @param {Object} options - 参数。
  19833. * @param {Object} options.operateGeometry - 叠加分析的操作几何对象。 </br>
  19834. * 点类型可以是:{@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>
  19835. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。</br>
  19836. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。
  19837. * @param {Object} options.sourceGeometry - 叠加分析的源几何对象。
  19838. * @param {Array.<Object>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  19839. * @param {Array.<Object>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  19840. * @param {SuperMap.OverlayOperationType} [options.operation] - 叠加操作枚举值。
  19841. * @extends {SuperMap.OverlayAnalystParameters}
  19842. */
  19843. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  19844. constructor(options) {
  19845. super(options);
  19846. if (options && options.operateGeometry) {
  19847. this.operateGeometry = options.operateGeometry;
  19848. }
  19849. if (options && options.sourceGeometry) {
  19850. this.sourceGeometry = options.sourceGeometry;
  19851. }
  19852. if (options && options.operateGeometries) {
  19853. this.operateGeometries = options.operateGeometries;
  19854. }
  19855. if (options && options.sourceGeometries) {
  19856. this.sourceGeometries = options.sourceGeometries;
  19857. }
  19858. if (options) {
  19859. Util.extend(this, options);
  19860. }
  19861. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  19862. }
  19863. /**
  19864. * @function SuperMap.GeometryOverlayAnalystParameters.prototype.destroy
  19865. * @override
  19866. */
  19867. destroy() {
  19868. super.destroy();
  19869. var me = this;
  19870. if (me.sourceGeometry) {
  19871. me.sourceGeometry.destroy();
  19872. me.sourceGeometry = null;
  19873. }
  19874. if (me.sourceGeometries) {
  19875. me.sourceGeometries.destroy();
  19876. me.sourceGeometries = null;
  19877. }
  19878. if (me.sourceGeometry) {
  19879. me.sourceGeometry.destroy();
  19880. me.sourceGeometry = null;
  19881. }
  19882. if (me.operateGeometries) {
  19883. me.operateGeometries.destroy();
  19884. me.operateGeometries = null;
  19885. }
  19886. }
  19887. /**
  19888. * @function SuperMap.GeometryOverlayAnalystParameters.toObject
  19889. * @param {SuperMap.GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  19890. * @param {SuperMap.GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  19891. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  19892. * @returns {Object} JSON 对象。
  19893. */
  19894. static toObject(geometryOverlayAnalystParameters, tempObj) {
  19895. for (var name in geometryOverlayAnalystParameters) {
  19896. if (name === "sourceGeometry") {
  19897. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  19898. } else if (name === "sourceGeometries") {
  19899. var sourceGeometries = [];
  19900. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  19901. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  19902. }
  19903. tempObj.sourceGeometries = sourceGeometries;
  19904. } else if (name === "operateGeometry") {
  19905. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  19906. } else if (name === "operateGeometries") {
  19907. var operateGeometries = [];
  19908. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  19909. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  19910. }
  19911. tempObj.operateGeometries = operateGeometries;
  19912. } else {
  19913. tempObj[name] = geometryOverlayAnalystParameters[name];
  19914. }
  19915. }
  19916. }
  19917. }
  19918. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  19919. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  19920. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19921. * This program are made available under the terms of the Apache License, Version 2.0
  19922. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19923. /**
  19924. * @class SuperMap.GeometrySurfaceAnalystParameters
  19925. * @category iServer SpatialAnalyst SurfaceAnalyst
  19926. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  19927. * @param {Object} options - 参数。
  19928. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 表面分析的坐标点数组。
  19929. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  19930. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  19931. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  19932. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  19933. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod = SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  19934. * @extends {SuperMap.SurfaceAnalystParameters}
  19935. */
  19936. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  19937. constructor(options) {
  19938. super(options);
  19939. /**
  19940. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometrySurfaceAnalystParameters.prototype.points
  19941. * @description 获取或设置用于表面分析的坐标点数组。
  19942. */
  19943. this.points = null;
  19944. /**
  19945. * @member {Array.<number>} SuperMap.GeometrySurfaceAnalystParameters.prototype.zValues
  19946. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  19947. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  19948. */
  19949. this.zValues = null;
  19950. if (options) {
  19951. Util.extend(this, options);
  19952. }
  19953. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  19954. }
  19955. /**
  19956. * @function SuperMap.GeometrySurfaceAnalystParameters.prototype.destroy
  19957. * @override
  19958. */
  19959. destroy() {
  19960. super.destroy();
  19961. var me = this;
  19962. if (me.points) {
  19963. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  19964. points[i].destroy();
  19965. }
  19966. me.points = null;
  19967. }
  19968. me.zValues = null;
  19969. }
  19970. }
  19971. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  19972. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  19973. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19974. * This program are made available under the terms of the Apache License, Version 2.0
  19975. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19976. /**
  19977. * @class SuperMap.GeometryThiessenAnalystParameters
  19978. * @constructs SuperMap.GeometryThiessenAnalystParameters
  19979. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  19980. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  19981. * @param {Object} options - 参数。
  19982. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 使用点数组进行分析时使用的几何对象。
  19983. * @extends {SuperMap.ThiessenAnalystParameters}
  19984. */
  19985. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  19986. constructor(options) {
  19987. super(options);
  19988. /**
  19989. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometryThiessenAnalystParameters.prototype.points
  19990. * @description 使用点数组进行分析时使用的几何对象。
  19991. */
  19992. this.points = null;
  19993. if (options) {
  19994. Util.extend(this, options);
  19995. }
  19996. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  19997. }
  19998. /**
  19999. * @function SuperMap.GeometryThiessenAnalystParameters.prototype.destroy
  20000. * @override
  20001. */
  20002. destroy() {
  20003. super.destroy();
  20004. var me = this;
  20005. if (me.points) {
  20006. for (var i = me.points.length - 1; i >= 0; i--) {
  20007. me.points[i].destroy();
  20008. }
  20009. me.points = null;
  20010. }
  20011. }
  20012. /**
  20013. * @function SuperMap.GeometryThiessenAnalystParameters.toObject
  20014. * @param {SuperMap.GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  20015. * @param {SuperMap.GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  20016. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  20017. * @returns {Object} JSON 对象。
  20018. */
  20019. static toObject(geometryThiessenAnalystParameters, tempObj) {
  20020. for (var name in geometryThiessenAnalystParameters) {
  20021. if (name === "clipRegion") {
  20022. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  20023. } else {
  20024. tempObj[name] = geometryThiessenAnalystParameters[name];
  20025. }
  20026. }
  20027. }
  20028. }
  20029. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  20030. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  20031. /**
  20032. * @class SuperMap.GeoprocessingService
  20033. * @category iServer GeoprocessingService
  20034. * @classdesc 地理处理服务接口的基类。
  20035. * @version 10.1.0
  20036. * @extends {SuperMap.CommonServiceBase}
  20037. * @param {string} url - 服务地址。
  20038. * @param {Object} options - 参数。
  20039. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  20040. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
  20041. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  20042. */
  20043. class GeoprocessingService_GeoprocessingService extends CommonServiceBase {
  20044. constructor(url, options) {
  20045. options = options || {};
  20046. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  20047. super(url, options);
  20048. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  20049. this.headers = {};
  20050. this.crossOrigin = true;
  20051. }
  20052. /**
  20053. * @function SuperMap.GeoprocessingService.prototype.getTools
  20054. * @description 获取地理处理工具列表。
  20055. */
  20056. getTools() {
  20057. this._get(`${this.url}/list`);
  20058. }
  20059. /**
  20060. * @function SuperMap.GeoprocessingService.prototype.getTool
  20061. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  20062. * @param {string} identifier - 地理处理工具ID。
  20063. */
  20064. getTool(identifier) {
  20065. this._get(`${this.url}/${identifier}`);
  20066. }
  20067. /**
  20068. * @function SuperMap.GeoprocessingService.prototype.execute
  20069. * @description 同步执行地理处理工具。
  20070. * @param {string} identifier - 地理处理工具ID。
  20071. * @param {Object} parameter - 地理处理工具的输入参数。
  20072. * @param {Object} environment - 地理处理工具的环境参数。
  20073. */
  20074. execute(identifier, parameter, environment) {
  20075. parameter = parameter ? parameter : null;
  20076. environment = environment ? environment : null;
  20077. const executeParamter = { parameter, environment };
  20078. this._get(`${this.url}/${identifier}/execute`, executeParamter);
  20079. }
  20080. /**
  20081. * @function SuperMap.GeoprocessingService.prototype.submitJob
  20082. * @description 异步执行地理处理工具。
  20083. * @param {string} identifier - 地理处理工具ID。
  20084. * @param {Object} parameter - 地理处理工具的输入参数。
  20085. * @param {Object} environments - 地理处理工具的环境参数。
  20086. */
  20087. submitJob(identifier, parameter, environments) {
  20088. parameter = parameter ? parameter : null;
  20089. environments = environments ? environments : null;
  20090. const asyncParamter = { parameter: parameter, environments: environments };
  20091. this.request({
  20092. url: `${this.url}/${identifier}/jobs`,
  20093. headers: { 'Content-type': 'application/json' },
  20094. method: 'POST',
  20095. data: JSON.stringify(asyncParamter),
  20096. scope: this,
  20097. success: this.serviceProcessCompleted,
  20098. failure: this.serviceProcessFailed
  20099. });
  20100. }
  20101. /**
  20102. * @function SuperMap.GeoprocessingService.prototype.waitForJobCompletion
  20103. * @description 获取地理处理异步执行状态信息。
  20104. * @param {string} jobId - 地理处理任务ID。
  20105. * @param {string} identifier - 地理处理工具ID。
  20106. * @param {Object} options - 状态信息参数。
  20107. * @param {number} options.interval - 定时器时间间隔。
  20108. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  20109. */
  20110. waitForJobCompletion(jobId, identifier, options) {
  20111. const me = this;
  20112. const timer = setInterval(function () {
  20113. const serviceProcessCompleted = function (serverResult) {
  20114. const state = serverResult.state.runState;
  20115. if (options.statusCallback) {
  20116. options.statusCallback(state);
  20117. }
  20118. switch (state) {
  20119. case 'FINISHED':
  20120. clearInterval(timer);
  20121. me.events.triggerEvent('processCompleted', {
  20122. result: serverResult
  20123. });
  20124. break;
  20125. case 'FAILED':
  20126. clearInterval(timer);
  20127. me.events.triggerEvent('processFailed', {
  20128. result: serverResult
  20129. });
  20130. break;
  20131. case 'CANCELED':
  20132. clearInterval(timer);
  20133. me.events.triggerEvent('processFailed', {
  20134. result: serverResult
  20135. });
  20136. break;
  20137. }
  20138. };
  20139. me._get(`${me.url}/${identifier}/jobs/${jobId}`, null, serviceProcessCompleted);
  20140. }, options.interval);
  20141. }
  20142. /**
  20143. * @function SuperMap.GeoprocessingService.prototype.getJobInfo
  20144. * @description 获取地理处理任务的执行信息。
  20145. * @param {string} identifier - 地理处理工具ID。
  20146. * @param {string} jobId - 地理处理任务ID。
  20147. */
  20148. getJobInfo(identifier, jobId) {
  20149. this._get(`${this.url}/${identifier}/jobs/${jobId}`);
  20150. }
  20151. /**
  20152. * @function SuperMap.GeoprocessingService.prototype.cancelJob
  20153. * @description 取消地理处理任务的异步执行。
  20154. * @param {string} identifier - 地理处理工具ID。
  20155. * @param {string} jobId - 地理处理任务ID。
  20156. */
  20157. cancelJob(identifier, jobId) {
  20158. this._get(`${this.url}/${identifier}/jobs/${jobId}/cancel`);
  20159. }
  20160. /**
  20161. * @function SuperMap.GeoprocessingService.prototype.getJobs
  20162. * @description 获取地理处理服务任务列表。
  20163. * @param {string} identifier - 地理处理工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  20164. */
  20165. getJobs(identifier) {
  20166. let url = `${this.url}/jobs`;
  20167. if (identifier) {
  20168. url = `${this.url}/${identifier}/jobs`;
  20169. }
  20170. this._get(url);
  20171. }
  20172. /**
  20173. * @function SuperMap.GeoprocessingService.prototype.getResults
  20174. * @description 地理处理工具执行的结果等,支持结果过滤。
  20175. * @param {string} identifier - 地理处理工具ID。
  20176. * @param {string} jobId - 地理处理任务ID。
  20177. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  20178. */
  20179. getResults(identifier, jobId, filter) {
  20180. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  20181. if (filter) {
  20182. url = `${url}/${filter}`;
  20183. }
  20184. this._get(url);
  20185. }
  20186. _get(url, paramter, serviceProcessCompleted, serviceProcessFailed) {
  20187. this.request({
  20188. url: url,
  20189. method: 'GET',
  20190. params: paramter,
  20191. headers: { 'Content-type': 'application/json' },
  20192. scope: this,
  20193. success: serviceProcessCompleted ? serviceProcessCompleted : this.serviceProcessCompleted,
  20194. failure: serviceProcessFailed ? serviceProcessFailed : this.serviceProcessFailed
  20195. });
  20196. }
  20197. }
  20198. SuperMap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  20199. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  20200. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20201. * This program are made available under the terms of the Apache License, Version 2.0
  20202. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20203. /**
  20204. * @class SuperMap.GeoRelationAnalystParameters
  20205. * @category iServer SpatialAnalyst GeoRelationAnalyst
  20206. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  20207. * @param {Object} options - 参数。
  20208. * @param {SuperMap.FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  20209. * @param {SuperMap.FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  20210. * @param {SuperMap.SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  20211. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  20212. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  20213. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  20214. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  20215. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  20216. */
  20217. class GeoRelationAnalystParameters {
  20218. constructor(options) {
  20219. /**
  20220. * @member {string} SuperMap.GeoRelationAnalystParameters.prototype.dataset
  20221. * @description 源数据集名称。
  20222. */
  20223. this.dataset = null;
  20224. /**
  20225. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.sourceFilter
  20226. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  20227. */
  20228. this.sourceFilter = null;
  20229. /**
  20230. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.referenceFilter
  20231. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  20232. */
  20233. this.referenceFilter = null;
  20234. /**
  20235. * @member {SuperMap.SpatialRelationType} SuperMap.GeoRelationAnalystParameters.prototype.spatialRelationType
  20236. * @description 指定的空间关系类型。
  20237. */
  20238. this.spatialRelationType = null;
  20239. /**
  20240. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.isBorderInside]
  20241. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  20242. */
  20243. this.isBorderInside = null;
  20244. /**
  20245. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnFeature]
  20246. * @description 是否返回 Feature 信息。
  20247. */
  20248. this.returnFeature = null;
  20249. /**
  20250. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  20251. * @description 是否仅返回满足指定空间关系的空间对象。
  20252. */
  20253. this.returnGeoRelatedOnly = null;
  20254. /**
  20255. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  20256. * @description 分析结果起始记录位置。
  20257. */
  20258. this.startRecord = 0;
  20259. /**
  20260. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.expectCount=500]
  20261. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  20262. */
  20263. this.expectCount = 500;
  20264. if (options) {
  20265. Util.extend(this, options);
  20266. }
  20267. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  20268. }
  20269. /**
  20270. * @function SuperMap.GeoRelationAnalystParameters.prototype.destroy
  20271. * @description 释放资源,将引用资源的属性置空。
  20272. */
  20273. destroy() {
  20274. var me = this;
  20275. if (me.sourceFilter) {
  20276. me.sourceFilter.destroy();
  20277. }
  20278. me.sourceFilter = null;
  20279. if (me.referenceFilter) {
  20280. me.referenceFilter.destroy();
  20281. }
  20282. me.referenceFilter = null;
  20283. me.dataset = null;
  20284. me.spatialRelationType = null;
  20285. me.isBorderInside = null;
  20286. me.returnFeature = null;
  20287. me.returnGeoRelatedOnly = null;
  20288. me.startRecord = null;
  20289. me.expectCount = null;
  20290. }
  20291. }
  20292. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  20293. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  20294. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20295. * This program are made available under the terms of the Apache License, Version 2.0
  20296. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20297. /**
  20298. * @class SuperMap.GeoRelationAnalystService
  20299. * @category iServer SpatialAnalyst GeoRelationAnalyst
  20300. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  20301. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  20302. * @param {Object} options - 参数。</br>
  20303. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20304. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20305. * @param {Object} [options.headers] - 请求头。
  20306. * @extends {SuperMap.SpatialAnalystBase}
  20307. * @example 实例化该类如下例所示:
  20308. * (start code)
  20309. * function datasetGeoRelationAnalystProcess() {
  20310. * var referenceFilter = new SuperMap.FilterParameter({
  20311. * name:"Frame_R@Changchun",
  20312. * attributeFilter:"SmID>0"});
  20313. * var sourceFilter = new SuperMap.FilterParameter({
  20314. * attributeFilter:"SmID>0"});
  20315. * //初始化服务类
  20316. * var datasetGeoRelationService = new SuperMap.GeoRelationAnalystService(
  20317. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  20318. * //构建参数类
  20319. * datasetGeoRelationParameters = new SuperMap.GeoRelationAnalystParameters({
  20320. * dataset: "Park@Changchun",
  20321. * startRecord: 0,
  20322. * expectCount: 20,
  20323. * sourceFilter: sourceFilter,
  20324. * referenceFilter: referenceFilter,
  20325. * spatialRelationType: SuperMap.SpatialRelationType.INTERSECT,
  20326. * isBorderInside: true,
  20327. * returnFeature: true,
  20328. * returnGeoRelatedOnly: true
  20329. * });
  20330. * datasetGeoRelationService.events.on({
  20331. * "processCompleted": datasetGeoRelationAnalystCompleted,
  20332. * "processFailed": datasetGeoRelationAnalystFailed});
  20333. * //执行
  20334. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  20335. * }
  20336. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  20337. * function Error(datasetGeoRelationAnalystFailed){//todo};
  20338. * (end)
  20339. *
  20340. */
  20341. class GeoRelationAnalystService extends SpatialAnalystBase {
  20342. constructor(url, options) {
  20343. super(url, options);
  20344. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  20345. }
  20346. /**
  20347. * @function SuperMap.GeoRelationAnalystService.prototype.destroy
  20348. * @override
  20349. */
  20350. destroy() {
  20351. super.destroy();
  20352. }
  20353. /**
  20354. * @function SuperMap.GeoRelationAnalystService.prototype.processAsync
  20355. * @description 负责将客户端的空间关系分析参数传递到服务端
  20356. * @param {SuperMap.GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  20357. */
  20358. processAsync(parameter) {
  20359. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  20360. return;
  20361. }
  20362. var me = this;
  20363. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  20364. var jsonParameters = SuperMap.Util.toJSON(parameter);
  20365. me.url = Util.urlAppend(me.url, 'returnContent=true');
  20366. me.request({
  20367. method: "POST",
  20368. data: jsonParameters,
  20369. scope: me,
  20370. success: me.serviceProcessCompleted,
  20371. failure: me.serviceProcessFailed
  20372. });
  20373. }
  20374. }
  20375. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  20376. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  20377. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20378. * This program are made available under the terms of the Apache License, Version 2.0
  20379. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20380. /**
  20381. * @class SuperMap.GetFeaturesParametersBase
  20382. * @category iServer Data FeatureResults
  20383. * @classdesc 要素查询参数基类。
  20384. * @param {Object} options - 参数。
  20385. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  20386. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  20387. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  20388. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  20389. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  20390. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  20391. */
  20392. class GetFeaturesParametersBase {
  20393. constructor(options) {
  20394. /**
  20395. * @member {Array.<string>} SuperMap.GetFeaturesParametersBase.prototype.datasetName
  20396. * @description 数据集集合中的数据集名称列表。
  20397. */
  20398. this.datasetNames = null;
  20399. /**
  20400. * @member {string} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  20401. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  20402. */
  20403. this.targetEpsgCode = null;
  20404. /**
  20405. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  20406. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  20407. */
  20408. this.targetPrj = null;
  20409. /**
  20410. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnContent=true]
  20411. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  20412. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  20413. * 如果为 false,则返回的是查询结果资源的 URI。
  20414. */
  20415. this.returnContent = true;
  20416. /**
  20417. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.fromIndex=0]
  20418. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  20419. */
  20420. this.fromIndex = 0;
  20421. /**
  20422. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.toIndex=19]
  20423. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  20424. */
  20425. this.toIndex = 19;
  20426. /**
  20427. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnCountOnly=false]
  20428. * @description 只返回查询结果的总数。
  20429. */
  20430. this.returnCountOnly = false;
  20431. /**
  20432. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.maxFeatures=1000]
  20433. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  20434. */
  20435. this.maxFeatures = null;
  20436. /**
  20437. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.aggregations
  20438. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  20439. */
  20440. this.aggregations = null;
  20441. Util.extend(this, options);
  20442. this.CLASS_NAME = "SuperMap.GetFeaturesParametersBase";
  20443. }
  20444. /**
  20445. *
  20446. * @function SuperMap.GetFeaturesParametersBase.prototype.destroy
  20447. * @description 释放资源,将引用资源的属性置空。
  20448. */
  20449. destroy() {
  20450. var me = this;
  20451. me.datasetNames = null;
  20452. me.returnContent = null;
  20453. me.fromIndex = null;
  20454. me.toIndex = null;
  20455. me.maxFeatures = null;
  20456. me.targetEpsgCode = null;
  20457. me.targetPrj = null;
  20458. if (me.aggregation) {
  20459. me.aggregation = null;
  20460. }
  20461. }
  20462. }
  20463. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  20464. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  20465. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20466. * This program are made available under the terms of the Apache License, Version 2.0
  20467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20468. /**
  20469. * @class SuperMap.GetFeaturesByBoundsParameters
  20470. * @category iServer Data FeatureResults
  20471. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  20472. * @param {Object} options - 参数。
  20473. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 用于查询的范围对象。
  20474. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  20475. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  20476. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  20477. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  20478. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  20479. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  20480. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  20481. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  20482. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  20483. * @extends {SuperMap.GetFeaturesParametersBase}
  20484. */
  20485. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  20486. constructor(options) {
  20487. super(options);
  20488. /**
  20489. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.getFeatureMode
  20490. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  20491. */
  20492. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  20493. /**
  20494. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GetFeaturesByBoundsParameters.prototype.bounds
  20495. * @description 用于查询的范围对象。
  20496. *
  20497. */
  20498. this.bounds = null;
  20499. /**
  20500. * @member {Array.<string>} SuperMap.GetFeaturesByBoundsParameters.prototype.fields
  20501. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  20502. */
  20503. this.fields = null;
  20504. /**
  20505. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.attributeFilter
  20506. * @description 范围查询属性过滤条件。
  20507. */
  20508. this.attributeFilter = null;
  20509. /**
  20510. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  20511. * @description 空间查询模式常量。
  20512. */
  20513. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  20514. Util.extend(this, options);
  20515. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsParameters";
  20516. }
  20517. /**
  20518. * @function SuperMap.GetFeaturesByBoundsParameters.prototype.destroy
  20519. * @override
  20520. */
  20521. destroy() {
  20522. super.destroy();
  20523. var me = this;
  20524. if (me.bounds) {
  20525. me.bounds.destroy();
  20526. me.bounds = null;
  20527. }
  20528. if (me.fields) {
  20529. while (me.fields.length > 0) {
  20530. me.fields.pop();
  20531. }
  20532. me.fields = null;
  20533. }
  20534. me.attributeFilter = null;
  20535. me.spatialQueryMode = null;
  20536. me.getFeatureMode = null;
  20537. }
  20538. /**
  20539. * @function SuperMap.GetFeaturesByBoundsParameters.toJsonParameters
  20540. * @description 将 {@link SuperMap.GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  20541. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 范围查询参数。
  20542. * @returns {string} 转化后的 JSON 字符串。
  20543. *
  20544. */
  20545. static toJsonParameters(params) {
  20546. var filterParameter,
  20547. bounds,
  20548. parasByBounds;
  20549. bounds = {
  20550. "leftBottom": {"x": params.bounds.left, "y": params.bounds.bottom},
  20551. "rightTop": {"x": params.bounds.right, "y": params.bounds.top}
  20552. };
  20553. parasByBounds = {
  20554. datasetNames: params.datasetNames,
  20555. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  20556. bounds: bounds,
  20557. spatialQueryMode: params.spatialQueryMode
  20558. };
  20559. if (params.fields) {
  20560. filterParameter = new FilterParameter();
  20561. filterParameter.name = params.datasetNames;
  20562. filterParameter.fields = params.fields;
  20563. parasByBounds.queryParameter = filterParameter;
  20564. }
  20565. if (params.attributeFilter) {
  20566. parasByBounds.attributeFilter = params.attributeFilter;
  20567. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  20568. }
  20569. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  20570. parasByBounds.maxFeatures = params.maxFeatures;
  20571. }
  20572. if (params.targetEpsgCode) {
  20573. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  20574. }
  20575. if (!params.targetEpsgCode && params.targetPrj) {
  20576. parasByBounds.targetPrj = params.targetPrj;
  20577. }
  20578. return Util.toJSON(parasByBounds);
  20579. }
  20580. }
  20581. GetFeaturesByBoundsParameters.getFeatureMode = {
  20582. "BOUNDS": "BOUNDS",
  20583. "BOUNDS_ATTRIBUTEFILTER": "BOUNDS_ATTRIBUTEFILTER"
  20584. };
  20585. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  20586. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  20587. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20588. * This program are made available under the terms of the Apache License, Version 2.0
  20589. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20590. /**
  20591. * @class SuperMap.GetFeaturesServiceBase
  20592. * @category iServer Data FeatureResults
  20593. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  20594. * @extends SuperMap.CommonServiceBase
  20595. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  20596. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  20597. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  20598. * @param {Object} options - 参数。
  20599. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  20600. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  20601. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  20602. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20603. * @param {Object} [options.headers] - 请求头。
  20604. * @example
  20605. * var myService = new SuperMap.GetFeaturesServiceBase(url, {
  20606. * eventListeners: {
  20607. * "processCompleted": getFeatureCompleted,
  20608. * "processFailed": getFeatureError
  20609. * }
  20610. * });
  20611. */
  20612. class GetFeaturesServiceBase extends CommonServiceBase {
  20613. constructor(url, options) {
  20614. super(url, options);
  20615. options = options || {};
  20616. /**
  20617. * @member {boolean} [SuperMap.GetFeaturesServiceBase.prototype.returnContent=true]
  20618. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  20619. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  20620. * 如果为 false,则返回的是查询结果资源的 URI。
  20621. */
  20622. this.returnContent = true;
  20623. /**
  20624. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.fromIndex=0]
  20625. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  20626. */
  20627. this.fromIndex = 0;
  20628. /**
  20629. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.toIndex=19]
  20630. * @description 查询结果的最大索引号。
  20631. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  20632. */
  20633. this.toIndex = 19;
  20634. /**
  20635. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.maxFeatures=1000]
  20636. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  20637. */
  20638. this.maxFeatures = null;
  20639. /**
  20640. * @member {string} [SuperMap.GetFeaturesServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  20641. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。
  20642. * 参数格式为 "ISERVER","GEOJSON"。
  20643. */
  20644. this.format = DataFormat.GEOJSON;
  20645. Util.extend(this, options);
  20646. this.url = Util.urlPathAppend(this.url, 'featureResults');
  20647. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  20648. }
  20649. /**
  20650. * @function SuperMap.GetFeaturesServiceBase.prototype.destroy
  20651. * @description 释放资源,将引用资源的属性置空。
  20652. */
  20653. destroy() {
  20654. super.destroy();
  20655. var me = this;
  20656. me.returnContent = null;
  20657. me.fromIndex = null;
  20658. me.toIndex = null;
  20659. me.maxFeatures = null;
  20660. me.format = null;
  20661. }
  20662. /**
  20663. * @function SuperMap.GetFeaturesServiceBase.prototype.processAsync
  20664. * @description 将客户端的查询参数传递到服务端。
  20665. * @param {Object} params - 查询参数。
  20666. */
  20667. processAsync(params) {
  20668. if (!params) {
  20669. return;
  20670. }
  20671. var me = this,
  20672. jsonParameters = null,
  20673. firstPara = true;
  20674. me.returnContent = params.returnContent;
  20675. me.fromIndex = params.fromIndex;
  20676. me.toIndex = params.toIndex;
  20677. me.maxFeatures = params.maxFeatures;
  20678. if (me.returnContent) {
  20679. me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  20680. firstPara = false;
  20681. }
  20682. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  20683. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  20684. me.url = Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  20685. }
  20686. if (params.returnCountOnly) {
  20687. me.url = Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  20688. }
  20689. jsonParameters = me.getJsonParameters(params);
  20690. me.request({
  20691. method: "POST",
  20692. data: jsonParameters,
  20693. scope: me,
  20694. success: me.serviceProcessCompleted,
  20695. failure: me.serviceProcessFailed
  20696. });
  20697. }
  20698. /**
  20699. * @function SuperMap.GetFeaturesServiceBase.prototype.getFeatureComplete
  20700. * @description 查询完成,执行此方法。
  20701. * @param {Object} result - 服务器返回的结果对象。
  20702. */
  20703. serviceProcessCompleted(result) {
  20704. var me = this;
  20705. result = Util.transformResult(result);
  20706. if (me.format === DataFormat.GEOJSON && result.features) {
  20707. var geoJSONFormat = new GeoJSON();
  20708. result.features = geoJSONFormat.toGeoJSON(result.features);
  20709. }
  20710. me.events.triggerEvent("processCompleted", {result: result});
  20711. }
  20712. }
  20713. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  20714. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  20715. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20716. * This program are made available under the terms of the Apache License, Version 2.0
  20717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20718. /**
  20719. * @class SuperMap.GetFeaturesByBoundsService
  20720. * @category iServer Data FeatureResults
  20721. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  20722. * @description 数据集范围查询服务类构造函数。
  20723. * @extends {SuperMap.GetFeaturesServiceBase}
  20724. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  20725. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  20726. * @param {Object} options - 参数。
  20727. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  20728. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  20729. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  20730. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20731. * @param {Object} [options.headers] - 请求头。
  20732. * @example
  20733. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  20734. * eventListeners: {
  20735. * "processCompleted": getFeatureCompleted,
  20736. * "processFailed": getFeatureError
  20737. * }
  20738. * });
  20739. * function getFeatureCompleted(object){//todo};
  20740. * function getFeatureError(object){//todo}
  20741. */
  20742. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  20743. constructor(url, options) {
  20744. super(url, options);
  20745. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  20746. }
  20747. /**
  20748. * @function SuperMap.GetFeaturesByBoundsService.prototype.destroy
  20749. * @override
  20750. */
  20751. destroy() {
  20752. super.destroy();
  20753. }
  20754. /**
  20755. * @function SuperMap.GetFeaturesByBoundsService.prototype.getJsonParameters
  20756. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  20757. * @param params {SuperMap.GetFeaturesByBoundsParameters}
  20758. * @returns {string} 转化后的 JSON 字符串。
  20759. *
  20760. */
  20761. getJsonParameters(params) {
  20762. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  20763. }
  20764. }
  20765. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  20766. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  20767. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20768. * This program are made available under the terms of the Apache License, Version 2.0
  20769. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20770. /**
  20771. * @class SuperMap.GetFeaturesByBufferParameters
  20772. * @category iServer Data FeatureResults
  20773. * @classdesc 数据服务中数据集缓冲区查询参数类。
  20774. * @param {Object} options - 参数。
  20775. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  20776. * @param {Object} options.geometry - 空间查询条件。</br>
  20777. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  20778. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  20779. * @param {string} [options.attributeFilter] - 属性查询条件。
  20780. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  20781. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  20782. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  20783. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  20784. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  20785. * @extends {SuperMap.GetFeaturesParametersBase}
  20786. */
  20787. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  20788. constructor(options) {
  20789. super(options);
  20790. /**
  20791. * @member {number} SuperMap.GetFeaturesByBufferParameters.prototype.bufferDistance
  20792. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  20793. */
  20794. this.bufferDistance = null;
  20795. /**
  20796. * @member {string} SuperMap.GetFeaturesByBufferParameters.prototype.attributeFilter
  20797. * @description 属性查询条件。
  20798. */
  20799. this.attributeFilter = null;
  20800. /**
  20801. * @member {Object} SuperMap.GetFeaturesByBufferParameters.prototype.geometry
  20802. * @description 空间查询条件。 <br>
  20803. * 点类型可以是:{@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>
  20804. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  20805. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  20806. */
  20807. this.geometry = null;
  20808. /**
  20809. * @member {Array.<string>} SuperMap.GetFeaturesByBufferParameters.prototype.fields
  20810. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  20811. */
  20812. this.fields = null;
  20813. Util.extend(this, options);
  20814. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferParameters";
  20815. }
  20816. /**
  20817. * @function SuperMap.GetFeaturesByBufferParameters.prototype.destroy
  20818. * @override
  20819. */
  20820. destroy() {
  20821. super.destroy();
  20822. var me = this;
  20823. me.bufferDistance = null;
  20824. me.attributeFilter = null;
  20825. if (me.fields) {
  20826. while (me.fields.length > 0) {
  20827. me.fields.pop();
  20828. }
  20829. me.fields = null;
  20830. }
  20831. if (me.geometry) {
  20832. me.geometry.destroy();
  20833. me.geometry = null;
  20834. }
  20835. }
  20836. /**
  20837. * @function SuperMap.GetFeaturesByBufferParameters.toJsonParameters
  20838. * @description 将 SuperMap.GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  20839. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  20840. * @returns {string} 转化后的 JSON 字符串。
  20841. */
  20842. static toJsonParameters(params) {
  20843. var filterParameter,
  20844. paramsBySql,
  20845. geometry;
  20846. geometry = ServerGeometry.fromGeometry(params.geometry);
  20847. paramsBySql = {
  20848. datasetNames: params.datasetNames,
  20849. getFeatureMode: "BUFFER",
  20850. bufferDistance: params.bufferDistance,
  20851. geometry: geometry
  20852. };
  20853. if (params.fields) {
  20854. filterParameter = new FilterParameter();
  20855. filterParameter.name = params.datasetNames;
  20856. filterParameter.fields = params.fields;
  20857. paramsBySql.queryParameter = filterParameter;
  20858. }
  20859. if (params.attributeFilter) {
  20860. paramsBySql.attributeFilter = params.attributeFilter;
  20861. paramsBySql.getFeatureMode = "BUFFER_ATTRIBUTEFILTER";
  20862. }
  20863. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  20864. paramsBySql.maxFeatures = params.maxFeatures;
  20865. }
  20866. if (params.targetEpsgCode) {
  20867. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  20868. }
  20869. if (!params.targetEpsgCode && params.targetPrj) {
  20870. paramsBySql.targetPrj = params.targetPrj;
  20871. }
  20872. return Util.toJSON(paramsBySql);
  20873. }
  20874. }
  20875. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  20876. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  20877. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20878. * This program are made available under the terms of the Apache License, Version 2.0
  20879. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20880. /**
  20881. * @class SuperMap.GetFeaturesByBufferService
  20882. * @category iServer Data FeatureResults
  20883. * @classdesc 数据服务中数据集缓冲区查询服务类。
  20884. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  20885. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  20886. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  20887. * @param {Object} options - 参数。
  20888. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  20889. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  20890. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  20891. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20892. * @param {Object} [options.headers] - 请求头。
  20893. * @extends {SuperMap.GetFeaturesServiceBase}
  20894. * @example
  20895. * var myGetFeaturesByBufferService = new SuperMap.GetFeaturesByBufferService(url, {
  20896. * eventListeners: {
  20897. * "processCompleted": GetFeaturesCompleted,
  20898. * "processFailed": GetFeaturesError
  20899. * }
  20900. * });
  20901. * function GetFeaturesCompleted(object){//todo};
  20902. * function GetFeaturesError(object){//todo};
  20903. */
  20904. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  20905. constructor(url, options) {
  20906. super(url, options);
  20907. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  20908. }
  20909. /**
  20910. * @function SuperMap.GetFeaturesByBufferService.prototype.destroy
  20911. * @override
  20912. */
  20913. destroy() {
  20914. super.destroy();
  20915. }
  20916. /**
  20917. * @function SuperMap.GetFeaturesByBufferService.prototype.getJsonParameters
  20918. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  20919. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  20920. * @returns {Object} 转化后的 JSON 字符串。
  20921. */
  20922. getJsonParameters(params) {
  20923. if (!(params instanceof GetFeaturesByBufferParameters)) {
  20924. return;
  20925. }
  20926. return SuperMap.GetFeaturesByBufferParameters.toJsonParameters(params);
  20927. }
  20928. }
  20929. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  20930. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  20931. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20932. * This program are made available under the terms of the Apache License, Version 2.0
  20933. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20934. /**
  20935. * @class SuperMap.GetFeaturesByGeometryParameters
  20936. * @category iServer Data FeatureResults
  20937. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  20938. * @param {Object} options - 参数。
  20939. * @param {Object} options.geometry - 用于查询的几何对象。
  20940. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  20941. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  20942. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  20943. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  20944. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  20945. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  20946. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  20947. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  20948. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  20949. * @extends {SuperMap.GetFeaturesParametersBase}
  20950. */
  20951. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  20952. constructor(options) {
  20953. super(options);
  20954. /**
  20955. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.getFeatureMode
  20956. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  20957. */
  20958. this.getFeatureMode = "SPATIAL";
  20959. /**
  20960. * @member {Object} SuperMap.GetFeaturesByGeometryParameters.prototype.geometry
  20961. * @description 用于查询的几何对象。 </br>
  20962. * 点类型可以是:{@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>
  20963. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  20964. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  20965. */
  20966. this.geometry = null;
  20967. /**
  20968. * @member {Array.<string>} SuperMap.GetFeaturesByGeometryParameters.prototype.fields
  20969. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  20970. */
  20971. this.fields = null;
  20972. /**
  20973. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.attributeFilter
  20974. * @description 几何查询属性过滤条件。
  20975. */
  20976. this.attributeFilter = null;
  20977. /**
  20978. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  20979. * @description 空间查询模式常量。
  20980. */
  20981. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  20982. Util.extend(this, options);
  20983. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryParameters";
  20984. }
  20985. /**
  20986. * @function SuperMap.GetFeaturesByGeometryParameters.prototype.destroy
  20987. * @description 释放资源,将引用资源的属性置空。
  20988. */
  20989. destroy() {
  20990. super.destroy();
  20991. var me = this;
  20992. if (me.geometry) {
  20993. me.geometry.destroy();
  20994. me.geometry = null;
  20995. }
  20996. if (me.fields) {
  20997. while (me.fields.length > 0) {
  20998. me.fields.pop();
  20999. }
  21000. me.fields = null;
  21001. }
  21002. me.attributeFilter = null;
  21003. me.spatialQueryMode = null;
  21004. me.getFeatureMode = null;
  21005. }
  21006. /**
  21007. * @function SuperMap.GetFeaturesByGeometryParameters.toJsonParameters
  21008. * @description 将 SuperMap.GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  21009. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询参数对象。
  21010. * @returns {string} 转化后的 JSON 字符串。
  21011. */
  21012. static toJsonParameters(params) {
  21013. var filterParameter,
  21014. geometry,
  21015. parasByGeometry;
  21016. geometry = ServerGeometry.fromGeometry(params.geometry);
  21017. parasByGeometry = {
  21018. datasetNames: params.datasetNames,
  21019. getFeatureMode: "SPATIAL",
  21020. geometry: geometry,
  21021. spatialQueryMode: params.spatialQueryMode
  21022. };
  21023. if (params.fields) {
  21024. filterParameter = new FilterParameter();
  21025. filterParameter.name = params.datasetNames;
  21026. filterParameter.fields = params.fields;
  21027. parasByGeometry.queryParameter = filterParameter;
  21028. }
  21029. if (params.attributeFilter) {
  21030. parasByGeometry.attributeFilter = params.attributeFilter;
  21031. parasByGeometry.getFeatureMode = "SPATIAL_ATTRIBUTEFILTER";
  21032. }
  21033. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21034. parasByGeometry.maxFeatures = params.maxFeatures;
  21035. }
  21036. if (params.targetEpsgCode) {
  21037. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  21038. }
  21039. if (!params.targetEpsgCode && params.targetPrj) {
  21040. parasByGeometry.targetPrj = params.targetPrj;
  21041. }
  21042. return Util.toJSON(parasByGeometry);
  21043. }
  21044. }
  21045. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  21046. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  21047. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21048. * This program are made available under the terms of the Apache License, Version 2.0
  21049. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21050. /**
  21051. * @class SuperMap.GetFeaturesByGeometryService
  21052. * @category iServer Data FeatureResults
  21053. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  21054. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  21055. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  21056. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  21057. * @param {Object} options - 参数。</br>
  21058. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21059. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21060. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21061. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21062. * @param {Object} [options.headers] - 请求头。
  21063. * @extends {SuperMap.GetFeaturesServiceBase}
  21064. * @example
  21065. * var myService = new SuperMap.GetFeaturesByGeometryService(url, {
  21066. * eventListeners: {
  21067. * "processCompleted": getFeatureCompleted,
  21068. * "processFailed": getFeatureError
  21069. * }
  21070. * });
  21071. * function getFeatureCompleted(object){//todo};
  21072. * function getFeatureError(object){//todo}
  21073. */
  21074. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  21075. constructor(url, options) {
  21076. super(url, options);
  21077. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  21078. }
  21079. /**
  21080. * @function SuperMap.GetFeaturesByGeometryService.prototype.destroy
  21081. * @override
  21082. */
  21083. destroy() {
  21084. super.destroy();
  21085. }
  21086. /**
  21087. * @function SuperMap.GetFeaturesByGeometryService.prototype.getJsonParameters
  21088. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  21089. * @description 将查询参数转化为 JSON 字符串。
  21090. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  21091. * @returns {Object} 转化后的 JSON 字符串。
  21092. */
  21093. getJsonParameters(params) {
  21094. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  21095. }
  21096. }
  21097. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  21098. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  21099. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21100. * This program are made available under the terms of the Apache License, Version 2.0
  21101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21102. /**
  21103. * @class SuperMap.GetFeaturesByIDsParameters
  21104. * @category iServer Data FeatureResults
  21105. * @classdesc ID查询参数类。
  21106. * @param {Object} options - 参数。
  21107. * @param {Array.<number>} options.IDs - 所要查询指定的元素 ID 信息。
  21108. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21109. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  21110. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21111. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21112. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21113. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21114. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21115. * @extends {SuperMap.GetFeaturesParametersBase}
  21116. */
  21117. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  21118. constructor(options) {
  21119. super(options);
  21120. /**
  21121. * @member {string} SuperMap.GetFeaturesByIDsParameters.prototype.getFeatureMode
  21122. * @description 数据集查询模式。
  21123. */
  21124. this.getFeatureMode = "ID";
  21125. /**
  21126. * @member {Array.<number>} SuperMap.GetFeaturesByIDsParameters.prototype.IDs
  21127. * @description 所要查询指定的元素 ID 信息。
  21128. */
  21129. this.IDs = null;
  21130. /**
  21131. * @member {Array.<string>} SuperMap.GetFeaturesByIDsParameters.prototype.fields
  21132. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21133. */
  21134. this.fields = null;
  21135. Util.extend(this, options);
  21136. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsParameters";
  21137. }
  21138. /**
  21139. * @function SuperMap.GetFeaturesByIDsParameters.prototype.destroy
  21140. * @override
  21141. */
  21142. destroy() {
  21143. super.destroy();
  21144. var me = this;
  21145. me.IDs = null;
  21146. me.getFeatureMode = null;
  21147. if (me.fields) {
  21148. while (me.fields.length > 0) {
  21149. me.fields.pop();
  21150. }
  21151. me.fields = null;
  21152. }
  21153. }
  21154. /**
  21155. * @function SuperMap.GetFeaturesByIDsParameters.toJsonParameters
  21156. * @description 将 SuperMap.GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  21157. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID 查询参数对象。
  21158. * @returns {string} 转化后的 JSON 字符串。
  21159. */
  21160. static toJsonParameters(params) {
  21161. var parasByIDs, filterParameter;
  21162. parasByIDs = {
  21163. datasetNames: params.datasetNames,
  21164. getFeatureMode: "ID",
  21165. ids: params.IDs
  21166. };
  21167. if (params.fields) {
  21168. filterParameter = new FilterParameter();
  21169. filterParameter.name = params.datasetNames;
  21170. filterParameter.fields = params.fields;
  21171. parasByIDs.queryParameter = filterParameter;
  21172. }
  21173. if (params.targetEpsgCode) {
  21174. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  21175. }
  21176. if (!params.targetEpsgCode && params.targetPrj) {
  21177. parasByIDs.targetPrj = params.targetPrj;
  21178. }
  21179. return Util.toJSON(parasByIDs);
  21180. }
  21181. }
  21182. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  21183. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  21184. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21185. * This program are made available under the terms of the Apache License, Version 2.0
  21186. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21187. /**
  21188. * @class SuperMap.GetFeaturesByIDsService
  21189. * @category iServer Data FeatureResults
  21190. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  21191. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  21192. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  21193. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21194. * @param {Object} options - 参数。</br>
  21195. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21196. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21197. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21198. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21199. * @param {Object} [options.headers] - 请求头。
  21200. * @extends {SuperMap.GetFeaturesServiceBase}
  21201. * @example
  21202. * var myGetFeaturesByIDsService = new SuperMap.GetFeaturesByIDsService(url, {
  21203. * eventListeners: {
  21204. * "processCompleted": getFeatureCompleted,
  21205. * "processFailed": getFeatureError
  21206. * }
  21207. * });
  21208. * function getFeatureCompleted(object){//todo};
  21209. * function getFeatureError(object){//todo}
  21210. */
  21211. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  21212. constructor(url, options) {
  21213. super(url, options);
  21214. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  21215. }
  21216. /**
  21217. * @function SuperMap.GetFeaturesByIDsService.prototype.destroy
  21218. * @override
  21219. */
  21220. destroy() {
  21221. super.destroy();
  21222. }
  21223. /**
  21224. * @function SuperMap.GetFeaturesByIDsService.prototype.getJsonParameters
  21225. * @description 将查询参数转化为 JSON 字符串。
  21226. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  21227. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID查询参数类。
  21228. * @returns {string} 转化后的 JSON 字符串。
  21229. */
  21230. getJsonParameters(params) {
  21231. return GetFeaturesByIDsParameters.toJsonParameters(params);
  21232. }
  21233. }
  21234. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  21235. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  21236. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21237. * This program are made available under the terms of the Apache License, Version 2.0
  21238. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21239. /**
  21240. * @class SuperMap.GetFeaturesBySQLParameters
  21241. * @category iServer Data FeatureResults
  21242. * @classdesc 数据服务中数据集 SQL 查询参数类。
  21243. * @param {Object} options - 参数。
  21244. * @param {SuperMap.FilterParameter} options.queryParameter - 查询过滤条件参数。
  21245. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21246. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21247. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21248. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21249. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21250. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21251. * @extends {SuperMap.GetFeaturesParametersBase}
  21252. */
  21253. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  21254. constructor(options) {
  21255. super(options);
  21256. /**
  21257. * @member {string} SuperMap.GetFeaturesBySQLParameters.prototype.getFeatureMode
  21258. * @description 数据集查询模式。
  21259. */
  21260. this.getFeatureMode = "SQL";
  21261. /**
  21262. * @member {SuperMap.FilterParameter} SuperMap.GetFeaturesBySQLParameters.prototype.queryParameter
  21263. * @description 查询过滤条件参数类。
  21264. */
  21265. this.queryParameter = null;
  21266. Util.extend(this, options);
  21267. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLParameters";
  21268. }
  21269. /**
  21270. * @function SuperMap.GetFeaturesBySQLParameters.prototype.destroy
  21271. * @override
  21272. */
  21273. destroy() {
  21274. super.destroy();
  21275. var me = this;
  21276. me.getFeatureMode = null;
  21277. if (me.queryParameter) {
  21278. me.queryParameter.destroy();
  21279. me.queryParameter = null;
  21280. }
  21281. }
  21282. /**
  21283. * @function SuperMap.GetFeaturesBySQLParameters.prototype.toJsonParameters
  21284. * @description 将 SuperMap.GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  21285. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  21286. * @returns {string} 转化后的 JSON 字符串。
  21287. */
  21288. static toJsonParameters(params) {
  21289. var paramsBySql = {
  21290. datasetNames: params.datasetNames,
  21291. getFeatureMode: "SQL",
  21292. queryParameter: params.queryParameter
  21293. };
  21294. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21295. paramsBySql.maxFeatures = params.maxFeatures;
  21296. }
  21297. if (params.aggregations) {
  21298. paramsBySql.aggregations = params.aggregations;
  21299. }
  21300. if (params.targetEpsgCode) {
  21301. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  21302. }
  21303. if (!params.targetEpsgCode && params.targetPrj) {
  21304. paramsBySql.targetPrj = params.targetPrj;
  21305. }
  21306. return Util.toJSON(paramsBySql);
  21307. }
  21308. }
  21309. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  21310. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  21311. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21312. * This program are made available under the terms of the Apache License, Version 2.0
  21313. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21314. /**
  21315. * @class SuperMap.GetFeaturesBySQLService
  21316. * @constructs SuperMap.GetFeaturesBySQLService
  21317. * @category iServer Data FeatureResults
  21318. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  21319. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  21320. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  21321. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21322. * @param {Object} options - 参数。</br>
  21323. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21324. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21325. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21326. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21327. * @param {Object} [options.headers] - 请求头。
  21328. * @extends {SuperMap.GetFeaturesServiceBase}
  21329. * @example
  21330. * var myGetFeaturesBySQLService = new SuperMap.GetFeaturesBySQLService(url, {
  21331. * eventListeners: {
  21332. * "processCompleted": GetFeaturesCompleted,
  21333. * "processFailed": GetFeaturesError
  21334. * }
  21335. * });
  21336. * function getFeaturesCompleted(object){//todo};
  21337. * function getFeaturesError(object){//todo};
  21338. *
  21339. */
  21340. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  21341. constructor(url, options) {
  21342. super(url, options);
  21343. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  21344. }
  21345. /**
  21346. * @function SuperMap.GetFeaturesBySQLService.prototype.destroy
  21347. * @override
  21348. */
  21349. destroy() {
  21350. super.destroy();
  21351. }
  21352. /*
  21353. * @function SuperMap.GetFeaturesBySQLService.prototype.getJsonParameters
  21354. * @description 将查询参数转化为 JSON 字符串。
  21355. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  21356. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  21357. * @returns {string} 转化后的 JSON 字符串。
  21358. */
  21359. getJsonParameters(params) {
  21360. return GetFeaturesBySQLParameters.toJsonParameters(params);
  21361. }
  21362. }
  21363. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  21364. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  21365. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21366. * This program are made available under the terms of the Apache License, Version 2.0
  21367. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21368. /**
  21369. * @class SuperMap.GetFieldsService
  21370. * @category iServer Data Field
  21371. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  21372. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  21373. * @param {Object} options - 参数。</br>
  21374. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21375. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21376. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21377. * @param {string}options.datasource - 要查询的数据集所在的数据源名称。</br>
  21378. * @param {string}options.dataset - 要查询的数据集名称。</br>
  21379. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21380. * @param {Object} [options.headers] - 请求头。
  21381. * @extends {SuperMap.CommonServiceBase}
  21382. * @example
  21383. * var myService = new SuperMap.GetFieldsService(url, {eventListeners: {
  21384. * "processCompleted": getFieldsCompleted,
  21385. * "processFailed": getFieldsError
  21386. * },
  21387. * datasource: "World",
  21388. * dataset: "Countries"
  21389. * };
  21390. *
  21391. */
  21392. class GetFieldsService extends CommonServiceBase {
  21393. constructor(url, options) {
  21394. super(url, options);
  21395. /**
  21396. * @member {string} SuperMap.GetFieldsService.prototype.datasource
  21397. * @description 要查询的数据集所在的数据源名称。
  21398. */
  21399. this.datasource = null;
  21400. /**
  21401. * @member {string} SuperMap.GetFieldsService.prototype.dataset
  21402. * @description 要查询的数据集名称。
  21403. */
  21404. this.dataset = null;
  21405. if (options) {
  21406. Util.extend(this, options);
  21407. }
  21408. this.CLASS_NAME = "SuperMap.GetFieldsService";
  21409. }
  21410. /**
  21411. * @function SuperMap.GetFieldsService.prototype.destroy
  21412. * @override
  21413. */
  21414. destroy() {
  21415. super.destroy();
  21416. var me = this;
  21417. me.datasource = null;
  21418. me.dataset = null;
  21419. }
  21420. /**
  21421. * @function SuperMap.GetFieldsService.prototype.processAsync
  21422. * @description 执行服务,查询指定数据集的字段信息。
  21423. */
  21424. processAsync() {
  21425. var me = this;
  21426. me.url = Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  21427. me.request({
  21428. method: "GET",
  21429. data: null,
  21430. scope: me,
  21431. success: me.serviceProcessCompleted,
  21432. failure: me.serviceProcessFailed
  21433. });
  21434. }
  21435. }
  21436. SuperMap.GetFieldsService = GetFieldsService;
  21437. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  21438. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21439. * This program are made available under the terms of the Apache License, Version 2.0
  21440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21441. /**
  21442. * @class SuperMap.GetGridCellInfosParameters
  21443. * @category iServer Data Grid
  21444. * @classdesc 数据服务栅格查询参数类。
  21445. * @param {Object} options - 参数。
  21446. * @param {string} options.datasetName - 数据集名称。
  21447. * @param {string} options.dataSourceName - 数据源名称。
  21448. * @param {number} options.X - 要查询的地理位置 X 轴。
  21449. * @param {number} options.Y - 要查询的地理位置 Y 轴。
  21450. */
  21451. class GetGridCellInfosParameters {
  21452. constructor(options) {
  21453. /**
  21454. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.datasetName
  21455. * @description 数据集名称。
  21456. */
  21457. this.datasetName = null;
  21458. /**
  21459. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.dataSourceName
  21460. * @description 数据源名称。
  21461. */
  21462. this.dataSourceName = null;
  21463. /**
  21464. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.X
  21465. * @description 要查询的地理位置 X 轴。
  21466. */
  21467. this.X = null;
  21468. /**
  21469. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.Y
  21470. * @description 要查询的地理位置 Y 轴。
  21471. */
  21472. this.Y = null;
  21473. Util.extend(this, options);
  21474. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  21475. }
  21476. /**
  21477. * @function SuperMap.GetGridCellInfosParameters.prototype.destroy
  21478. * @description 释放资源,将引用的资源属性置空。
  21479. */
  21480. destroy() {
  21481. var me = this;
  21482. me.datasetName = null;
  21483. me.dataSourceName = null;
  21484. me.X = null;
  21485. me.Y = null;
  21486. }
  21487. }
  21488. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  21489. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  21490. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21491. * This program are made available under the terms of the Apache License, Version 2.0
  21492. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21493. /**
  21494. * @class SuperMap.GetGridCellInfosService
  21495. * @category iServer Data Grid
  21496. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  21497. * @param {string} url - 查询服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  21498. * @param {Object} options - 参数。</br>
  21499. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  21500. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  21501. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  21502. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21503. * @param {Object} [options.headers] - 请求头。
  21504. * @extends {SuperMap.CommonServiceBase}
  21505. * @example
  21506. * var myService = new SuperMap.GetGridCellInfosService(url, {eventListeners: {
  21507. * "processCompleted": queryCompleted,
  21508. * "processFailed": queryError
  21509. * }
  21510. * });
  21511. *
  21512. */
  21513. class GetGridCellInfosService extends CommonServiceBase {
  21514. constructor(url, options) {
  21515. super(url, options);
  21516. /**
  21517. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetName
  21518. * @description 数据集名称。
  21519. */
  21520. this.datasetName = null;
  21521. /**
  21522. * @member {string} SuperMap.GetGridCellInfosService.prototype.dataSourceName
  21523. * @description 数据源名称。
  21524. */
  21525. this.dataSourceName = null;
  21526. /**
  21527. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetType
  21528. * @description 数据集类型。
  21529. */
  21530. this.datasetType = null;
  21531. /**
  21532. * @member {number} SuperMap.GetGridCellInfosService.prototype.X
  21533. * @description 要查询的地理位置X轴
  21534. */
  21535. this.X = null;
  21536. /**
  21537. * @member {number} SuperMap.GetGridCellInfosService.prototype.Y
  21538. * @description 要查询的地理位置Y轴
  21539. */
  21540. this.Y = null;
  21541. if (options) {
  21542. Util.extend(this, options);
  21543. }
  21544. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  21545. }
  21546. /**
  21547. * @function SuperMap.GetGridCellInfosService.prototype.destroy
  21548. * @override
  21549. */
  21550. destroy() {
  21551. super.destroy();
  21552. var me = this;
  21553. me.X = null;
  21554. me.Y = null;
  21555. me.datasetName = null;
  21556. me.dataSourceName = null;
  21557. me.datasetType = null;
  21558. }
  21559. /**
  21560. * @function SuperMap.GetGridCellInfosService.prototype.processAsync
  21561. * @description 执行服务,查询数据集信息。
  21562. * @param {SuperMap.GetGridCellInfosParameters} params - 查询参数。
  21563. */
  21564. processAsync(params) {
  21565. if (!(params instanceof GetGridCellInfosParameters)) {
  21566. return;
  21567. }
  21568. Util.extend(this, params);
  21569. var me = this;
  21570. me.url = Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  21571. me.queryRequest(me.getDatasetInfoCompleted, me.getDatasetInfoFailed);
  21572. }
  21573. /**
  21574. * @function SuperMap.GetGridCellInfosService.prototype.queryRequest
  21575. * @description 执行服务,查询。
  21576. * @callback {function} successFun - 成功后执行的函数。
  21577. * @callback {function} failedFunc - 失败后执行的函数。
  21578. */
  21579. queryRequest(successFun, failedFunc) {
  21580. var me = this;
  21581. me.request({
  21582. method: "GET",
  21583. data: null,
  21584. scope: me,
  21585. success: successFun,
  21586. failure: failedFunc
  21587. });
  21588. }
  21589. /**
  21590. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoCompleted
  21591. * @description 数据集查询完成,执行此方法。
  21592. * @param {Object} result - 服务器返回的结果对象。
  21593. */
  21594. getDatasetInfoCompleted(result) {
  21595. var me = this;
  21596. result = Util.transformResult(result);
  21597. me.datasetType = result.datasetInfo.type;
  21598. me.queryGridInfos();
  21599. }
  21600. /**
  21601. * @function SuperMap.GetGridCellInfosService.prototype.queryGridInfos
  21602. * @description 执行服务,查询数据集栅格信息信息。
  21603. */
  21604. queryGridInfos() {
  21605. var me = this;
  21606. me.url = Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  21607. if (me.X != null && me.Y != null) {
  21608. me.url = Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  21609. }
  21610. me.queryRequest(me.serviceProcessCompleted, me.serviceProcessFailed);
  21611. }
  21612. /**
  21613. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoFailed
  21614. * @description 数据集查询失败,执行此方法。
  21615. * @param {Object} result - 服务器返回的结果对象。
  21616. */
  21617. getDatasetInfoFailed(result) {
  21618. var me = this;
  21619. me.serviceProcessFailed(result);
  21620. }
  21621. }
  21622. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  21623. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  21624. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21625. * This program are made available under the terms of the Apache License, Version 2.0
  21626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21627. /**
  21628. * @class SuperMap.ThemeMemoryData
  21629. * @category iServer Map Theme
  21630. * @classdesc 专题图内存数据类。
  21631. * @param {Array} srcData - 原始值数组。
  21632. * @param {Array} targetData - 外部值数组。
  21633. */
  21634. class ThemeMemoryData {
  21635. constructor(srcData, targetData) {
  21636. /**
  21637. * @member {Array} SuperMap.ThemeMemoryData.prototype.srcData
  21638. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  21639. */
  21640. this.srcData = srcData;
  21641. /**
  21642. * @member {Array} SuperMap.ThemeMemoryData.prototype.targetData
  21643. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  21644. */
  21645. this.targetData = targetData;
  21646. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  21647. }
  21648. /**
  21649. * @function SuperMap.ThemeMemoryData.prototype.destroy
  21650. * @description 释放资源,将引用资源的属性置空。
  21651. */
  21652. destroy() {
  21653. var me = this;
  21654. me.srcData = null;
  21655. me.targetData = null;
  21656. }
  21657. /**
  21658. * @function SuperMap.ThemeMemoryData.prototype.toJSON
  21659. * @description 将 SuperMap.ThemeMemoryData 对象转化为 JSON 字符串。
  21660. * @returns {string} 返回转换后的 JSON 字符串。
  21661. */
  21662. toJSON() {
  21663. if (this.srcData && this.targetData) {
  21664. var memoryDataStr = "";
  21665. var count = Math.min(this.srcData.length, this.targetData.length);
  21666. for (var i = 0; i < count; i++) {
  21667. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  21668. }
  21669. //去除多余的逗号
  21670. if (i > 0) {
  21671. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  21672. }
  21673. return "{" + memoryDataStr + "}";
  21674. } else {
  21675. return null;
  21676. }
  21677. }
  21678. }
  21679. SuperMap.ThemeMemoryData = ThemeMemoryData;
  21680. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  21681. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21682. * This program are made available under the terms of the Apache License, Version 2.0
  21683. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21684. /**
  21685. * @class SuperMap.Theme
  21686. * @category iServer Map Theme
  21687. * @classdesc 专题图基类。
  21688. * @param {string} type - 专题图类型。
  21689. * @param {Object} options - 参数。
  21690. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  21691. */
  21692. class Theme {
  21693. constructor(type, options) {
  21694. if (!type) {
  21695. return this;
  21696. }
  21697. /**
  21698. * @member {SuperMap.ThemeMemoryData} SuperMap.Theme.prototype.memoryData
  21699. * @description 专题图内存数据。<br>
  21700. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  21701. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  21702. */
  21703. this.memoryData = null;
  21704. /**
  21705. * @member {string} SuperMap.Theme.prototype.type
  21706. * @description 专题图类型。
  21707. */
  21708. this.type = type;
  21709. if (options) {
  21710. Util.extend(this, options);
  21711. }
  21712. this.CLASS_NAME = "SuperMap.Theme";
  21713. }
  21714. /**
  21715. * @function SuperMap.Theme.prototype.destroy
  21716. * @description 释放资源,将引用资源的属性置空。
  21717. */
  21718. destroy() {
  21719. var me = this;
  21720. if (me.memoryData) {
  21721. me.memoryData.destroy();
  21722. me.memoryData = null;
  21723. }
  21724. me.type = null;
  21725. }
  21726. /**
  21727. * @function SuperMap.Theme.prototype.toServerJSONObject
  21728. * @description 转换成对应的 JSON 格式对象。
  21729. * @returns {Object} 对应的 JSON 格式对象。
  21730. */
  21731. toServerJSONObject() {
  21732. //return 子类实现
  21733. return;
  21734. }
  21735. }
  21736. SuperMap.Theme = Theme;
  21737. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  21738. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21739. * This program are made available under the terms of the Apache License, Version 2.0
  21740. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21741. /**
  21742. * @class SuperMap.ServerTextStyle
  21743. * @category iServer Map Theme
  21744. * @classdesc 服务端文本风格类。
  21745. * @description 该类用于定义文本风格的相关属性。
  21746. * @param {Object} options - 参数。
  21747. * @param {SuperMap.TextAlignment} [options.align=SuperMap.TextAlignment.BASELINECENTER] - 文本的对齐方式。
  21748. * @param {SuperMap.ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  21749. * @param {SuperMap.ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  21750. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  21751. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  21752. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  21753. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  21754. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  21755. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  21756. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  21757. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  21758. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  21759. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  21760. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  21761. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  21762. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  21763. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  21764. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  21765. */
  21766. class ServerTextStyle {
  21767. constructor(options) {
  21768. /**
  21769. * @member {SuperMap.TextAlignment} [SuperMap.ServerTextStyle.prototype.align= SuperMap.TextAlignment.BASELINECENTER]
  21770. * @description 文本的对齐方式。
  21771. */
  21772. this.align = TextAlignment.BASELINECENTER;
  21773. /**
  21774. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.backColor=(255, 255, 255)]
  21775. * @description 文本的背景色。
  21776. */
  21777. this.backColor = new ServerColor(255, 255, 255);
  21778. /**
  21779. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  21780. * @description 文本的前景色。
  21781. */
  21782. this.foreColor = new ServerColor(0, 0, 0);
  21783. /**
  21784. * @member {boolean} [SuperMap.ServerTextStyle.prototype.backOpaque=false]
  21785. * @description 文本背景是否不透明。true 表示文本背景不透明。
  21786. */
  21787. this.backOpaque = false;
  21788. /**
  21789. * @member {boolean} [SuperMap.ServerTextStyle.prototype.sizeFixed=true]
  21790. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  21791. */
  21792. this.sizeFixed = true;
  21793. /**
  21794. * @member {number} [SuperMap.ServerTextStyle.prototype.fontHeight=6]
  21795. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  21796. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  21797. */
  21798. this.fontHeight = 6;
  21799. /**
  21800. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWidth=0]
  21801. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  21802. */
  21803. this.fontWidth = 0;
  21804. /**
  21805. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWeight=400]
  21806. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  21807. */
  21808. this.fontWeight = 400;
  21809. /**
  21810. * @member {string} [SuperMap.ServerTextStyle.prototype.fontName="Times New Roman"]
  21811. * @description 文本字体的名称。
  21812. */
  21813. this.fontName = "Times New Roman";
  21814. /**
  21815. * @member {boolean} [SuperMap.ServerTextStyle.prototype.bold=false]
  21816. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  21817. */
  21818. this.bold = false;
  21819. /**
  21820. * @member {boolean} [SuperMap.ServerTextStyle.prototype.italic=false]
  21821. * @description 文本是否采用斜体。true 表示采用斜体。
  21822. */
  21823. this.italic = false;
  21824. /**
  21825. * @member {number} [SuperMap.ServerTextStyle.prototype.italicAngle=0]
  21826. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  21827. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  21828. */
  21829. this.italicAngle = 0;
  21830. /**
  21831. * @member {boolean} [SuperMap.ServerTextStyle.prototype.shadow=false]
  21832. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  21833. */
  21834. this.shadow = false;
  21835. /**
  21836. * @member {boolean} [SuperMap.ServerTextStyle.prototype.strikeout=false]
  21837. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  21838. */
  21839. this.strikeout = false;
  21840. /**
  21841. * @member {boolean} [SuperMap.ServerTextStyle.prototype.outline=false]
  21842. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  21843. */
  21844. this.outline = false;
  21845. /**
  21846. * @member {number} [SuperMap.ServerTextStyle.prototype.opaqueRate=0]
  21847. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  21848. */
  21849. this.opaqueRate = 0;
  21850. /**
  21851. * @member {boolean} [SuperMap.ServerTextStyle.prototype.underline=false]
  21852. * @description 文本字体是否加下划线。true 表示加下划线。
  21853. */
  21854. this.underline = false;
  21855. /**
  21856. * @member {number} [SuperMap.ServerTextStyle.prototype.rotation=0.0]
  21857. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  21858. */
  21859. this.rotation = 0.0;
  21860. if (options) {
  21861. Util.extend(this, options);
  21862. }
  21863. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  21864. }
  21865. /**
  21866. * @function SuperMap.ServerTextStyle.prototype.destroy
  21867. * @description 释放资源,将引用资源的属性置空。
  21868. */
  21869. destroy() {
  21870. var me = this;
  21871. me.align = null;
  21872. if (me.backColor) {
  21873. me.backColor.destroy();
  21874. me.backColor = null;
  21875. }
  21876. if (me.foreColor) {
  21877. me.foreColor.destroy();
  21878. me.foreColor = null;
  21879. }
  21880. me.backOpaque = null;
  21881. me.sizeFixed = null;
  21882. me.fontHeight = null;
  21883. me.fontWidth = null;
  21884. me.fontWeight = null;
  21885. me.fontName = null;
  21886. me.bold = null;
  21887. me.italic = null;
  21888. me.italicAngle = null;
  21889. me.shadow = null;
  21890. me.strikeout = null;
  21891. me.outline = null;
  21892. me.opaqueRate = null;
  21893. me.underline = null;
  21894. me.rotation = null;
  21895. }
  21896. /**
  21897. * @function SuperMap.ServerTextStyle.fromObj
  21898. * @description 从传入对象获服务端文本风格类。
  21899. * @param {Object} obj - 传入对象
  21900. * @returns {SuperMap.ServerTextStyle} 返回服务端文本风格对象
  21901. */
  21902. static fromObj(obj) {
  21903. var res = new ServerTextStyle(obj);
  21904. Util.copy(res, obj);
  21905. res.backColor = ServerColor.fromJson(obj.backColor);
  21906. res.foreColor = ServerColor.fromJson(obj.foreColor);
  21907. return res;
  21908. }
  21909. }
  21910. SuperMap.ServerTextStyle = ServerTextStyle;
  21911. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  21912. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21913. * This program are made available under the terms of the Apache License, Version 2.0
  21914. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21915. /**
  21916. * @class SuperMap.ThemeLabelItem
  21917. * @category iServer Map Theme
  21918. * @classdesc 分段标签专题图的子项。
  21919. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,分段标签专题图允许用户通过 rangeExpression
  21920. * 字段指定用于分段的数值型字段,同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  21921. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  21922. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 SuperMap.ThemeLabelItem[0].start=0,
  21923. * SuperMap.ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  21924. * @param {Object} options - 参数。
  21925. * @param {string} [options.caption] - 专题图子项的名称。
  21926. * @param {number} [options.end=0] - 标签专题图子项的终止值。
  21927. * @param {number} [options.start=0] - 标签专题图子项的分段起始值。
  21928. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  21929. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  21930. */
  21931. class ThemeLabelItem {
  21932. constructor(options) {
  21933. /**
  21934. * @member {string} [SuperMap.ThemeLabelItem.prototype.caption]
  21935. * @description 标签专题子项的标题。
  21936. */
  21937. this.caption = null;
  21938. /**
  21939. * @member {number} [SuperMap.ThemeLabelItem.prototype.end=0]
  21940. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  21941. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  21942. */
  21943. this.end = 0;
  21944. /**
  21945. * @member {number} [SuperMap.ThemeLabelItem.prototype.start=0]
  21946. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  21947. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  21948. */
  21949. this.start = 0;
  21950. /**
  21951. * @member {boolean} [SuperMap.ThemeLabelItem.prototype.visible=true]
  21952. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  21953. */
  21954. this.visible = true;
  21955. /**
  21956. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelItem.prototype.style
  21957. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  21958. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  21959. */
  21960. this.style = new ServerTextStyle();
  21961. if (options) {
  21962. Util.extend(this, options);
  21963. }
  21964. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  21965. }
  21966. /**
  21967. * @function SuperMap.ThemeLabelItem.prototype.destroy
  21968. * @description 释放资源,将引用资源的属性置空。
  21969. */
  21970. destroy() {
  21971. var me = this;
  21972. me.caption = null;
  21973. me.end = null;
  21974. me.start = null;
  21975. if (me.style) {
  21976. me.style.destroy();
  21977. me.style = null;
  21978. }
  21979. me.visible = null;
  21980. }
  21981. /**
  21982. * @function SuperMap.ThemeLabelItem.fromObj
  21983. * @description 从传入对象获取分段标签专题图的子项类。
  21984. * @param {Object} obj - 传入对象。
  21985. * @returns {SuperMap.ThemeLabelItem} ThemeLabelItem 对象。
  21986. */
  21987. static fromObj(obj) {
  21988. if (!obj) {
  21989. return;
  21990. }
  21991. var t = new ThemeLabelItem();
  21992. Util.copy(t, obj);
  21993. return t;
  21994. }
  21995. }
  21996. SuperMap.ThemeLabelItem = ThemeLabelItem;
  21997. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  21998. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21999. * This program are made available under the terms of the Apache License, Version 2.0
  22000. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22001. /**
  22002. * @class SuperMap.ThemeUniqueItem
  22003. * @category iServer Map Theme
  22004. * @classdesc 单值专题图子项类。
  22005. * @description 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表
  22006. * 省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  22007. * @param {Object} options - 参数。
  22008. * @param {string} options.unique - 单值专题图子项的单值。
  22009. * @param {string} [options.caption] - 单值专题图子项的标题。
  22010. * @param {SuperMap.ServerStyle} [options.style] - 单值专题图子项的风格。
  22011. * @param {boolean} [options.visible=true] - 单值专题图子项是否可见。
  22012. */
  22013. class ThemeUniqueItem {
  22014. constructor(options) {
  22015. /**
  22016. * @member {string} [SuperMap.ThemeUniqueItem.prototype.caption]
  22017. * @description 单值专题图子项的标题。
  22018. */
  22019. this.caption = null;
  22020. /**
  22021. * @member {SuperMap.ServerStyle} [SuperMap.ThemeUniqueItem.prototype.style]
  22022. * @description 单值专题图子项的显示风格。
  22023. */
  22024. this.style = new ServerStyle();
  22025. /**
  22026. * @member {string} SuperMap.ThemeUniqueItem.prototype.unique
  22027. * @description 单值专题图子项的值,可以为数字、字符串等。
  22028. */
  22029. this.unique = null;
  22030. /**
  22031. * @member {boolean} [SuperMap.ThemeUniqueItem.prototype.visible=true]
  22032. * @description 单值专题图子项的可见性。
  22033. */
  22034. this.visible = true;
  22035. if (options) {
  22036. Util.extend(this, options);
  22037. }
  22038. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  22039. }
  22040. /**
  22041. * @function SuperMap.ThemeUniqueItem.prototype.destroy
  22042. * @description 释放资源,将引用资源的属性置空。
  22043. */
  22044. destroy() {
  22045. var me = this;
  22046. me.caption = null;
  22047. me.unique = null;
  22048. if (me.style) {
  22049. me.style.destroy();
  22050. me.style = null;
  22051. }
  22052. me.visible = null;
  22053. }
  22054. /**
  22055. * @function SuperMap.ThemeUniqueItem.prototype.toServerJSONObject
  22056. * @description 转换成对应的 JSON 格式对象。
  22057. * @returns {Object} 对应的 JSON 格式对象。
  22058. */
  22059. toServerJSONObject() {
  22060. var obj = {};
  22061. obj = Util.copyAttributes(obj, this);
  22062. if (obj.style) {
  22063. if (obj.style.toServerJSONObject) {
  22064. obj.style = obj.style.toServerJSONObject();
  22065. }
  22066. }
  22067. return obj;
  22068. }
  22069. /**
  22070. * @function SuperMap.ThemeUniqueItem.fromObj
  22071. * @description 从传入对象获取单值专题图子项类。
  22072. * @param {Object} obj - 传入对象。
  22073. * @returns {SuperMap.ThemeUniqueItem} ThemeUniqueItem 对象。
  22074. */
  22075. static fromObj(obj) {
  22076. var res = new ThemeUniqueItem();
  22077. Util.copy(res, obj);
  22078. res.style = ServerStyle.fromJson(obj.style);
  22079. return res;
  22080. }
  22081. }
  22082. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  22083. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  22084. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22085. * This program are made available under the terms of the Apache License, Version 2.0
  22086. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22087. /**
  22088. * @class SuperMap.ThemeFlow
  22089. * @category iServer Map Theme
  22090. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  22091. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  22092. * @param {Object} options - 参数。
  22093. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  22094. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  22095. * @param {SuperMap.ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  22096. */
  22097. class ThemeFlow {
  22098. constructor(options) {
  22099. /**
  22100. * @member {boolean} [SuperMap.ThemeFlow.prototype.flowEnabled=false]
  22101. * @description 是否流动显示标签或符号。<br>
  22102. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  22103. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  22104. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  22105. */
  22106. this.flowEnabled = false;
  22107. /**
  22108. * @member {boolean} [SuperMap.ThemeFlow.prototype.leaderLineDisplayed=false]
  22109. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  22110. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  22111. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  22112. */
  22113. this.leaderLineDisplayed = false;
  22114. /**
  22115. * @member {SuperMap.ServerStyle} SuperMap.ThemeFlow.prototype.leaderLineStyle
  22116. * @description 标签或符号与其标注对象之间牵引线的风格。
  22117. */
  22118. this.leaderLineStyle = new ServerStyle();
  22119. if (options) {
  22120. Util.extend(this, options);
  22121. }
  22122. this.CLASS_NAME = "SuperMap.ThemeFlow";
  22123. }
  22124. /**
  22125. * @function SuperMap.ThemeFlow.prototype.destroy
  22126. * @description 释放资源,将引用资源的属性置空。
  22127. */
  22128. destroy() {
  22129. var me = this;
  22130. me.flowEnabled = null;
  22131. me.leaderLineDisplayed = null;
  22132. if (me.leaderLineStyle) {
  22133. me.leaderLineStyle.destroy();
  22134. me.leaderLineStyle = null;
  22135. }
  22136. }
  22137. /**
  22138. * @function SuperMap.ThemeFlow.fromObj
  22139. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  22140. * @param {Object} obj - 传入对象。
  22141. * @returns {SuperMap.ThemeFlow} ThemeFlow 对象。
  22142. */
  22143. static fromObj(obj) {
  22144. if (!obj) {
  22145. return;
  22146. }
  22147. var res = new ThemeFlow();
  22148. Util.copy(res, obj);
  22149. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  22150. return res;
  22151. }
  22152. }
  22153. SuperMap.ThemeFlow = ThemeFlow;
  22154. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  22155. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22156. * This program are made available under the terms of the Apache License, Version 2.0
  22157. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22158. /**
  22159. * @class SuperMap.ThemeOffset
  22160. * @category iServer Map Theme
  22161. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  22162. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  22163. * @param {Object} options - 参数。
  22164. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  22165. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  22166. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  22167. */
  22168. class ThemeOffset {
  22169. constructor(options) {
  22170. /**
  22171. * @member {boolean} [SuperMap.ThemeOffset.prototype.offsetFixed=false]
  22172. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,则文本或符号的偏移量不随地图的缩放而变化。
  22173. */
  22174. this.offsetFixed = false;
  22175. /**
  22176. * @member {string} [SuperMap.ThemeOffset.prototype.offsetX=0.0]
  22177. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  22178. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  22179. */
  22180. this.offsetX = "0.0";
  22181. /**
  22182. * @member {string} [SuperMap.ThemeOffset.prototype.offsetY=0.0]
  22183. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  22184. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  22185. */
  22186. this.offsetY = "0.0";
  22187. if (options) {
  22188. Util.extend(this, options);
  22189. }
  22190. this.CLASS_NAME = "SuperMap.ThemeOffset";
  22191. }
  22192. /**
  22193. * @function SuperMap.ThemeOffset.prototype.destroy
  22194. * @description 释放资源,将引用资源的属性置空。
  22195. */
  22196. destroy() {
  22197. var me = this;
  22198. me.offsetFixed = null;
  22199. me.offsetX = null;
  22200. me.offsetY = null;
  22201. }
  22202. /**
  22203. * @function SuperMap.ThemeOffset.fromObj
  22204. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  22205. * @param {Object} obj - 传入对象。
  22206. * @returns {SuperMap.ThemeOffset} ThemeOffset 对象。
  22207. */
  22208. static fromObj(obj) {
  22209. if (!obj) {
  22210. return;
  22211. }
  22212. var res = new ThemeOffset();
  22213. Util.copy(res, obj);
  22214. return res;
  22215. }
  22216. }
  22217. SuperMap.ThemeOffset = ThemeOffset;
  22218. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  22219. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22220. * This program are made available under the terms of the Apache License, Version 2.0
  22221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22222. /**
  22223. * @class SuperMap.LabelMixedTextStyle
  22224. * @category iServer Map Theme
  22225. * @classdesc 标签文本复合风格类
  22226. * @description 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段。<br>
  22227. * 1. 利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  22228. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  22229. * 2. 利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  22230. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  22231. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  22232. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  22233. * @param {Object} options - 参数。
  22234. * @param {SuperMap.ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  22235. * @param {string} [options.separator] - 文本的分隔符。
  22236. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  22237. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  22238. * @param {Array.<SuperMap.ServerTextStyle>} [options.styles] - 文本样式集合。
  22239. */
  22240. class LabelMixedTextStyle {
  22241. constructor(options) {
  22242. /**
  22243. * @member {SuperMap.ServerTextStyle} SuperMap.LabelMixedTextStyle.prototype.defaultStyle
  22244. * @description 默认的文本复合风格,即 SuperMap.ServerTextStyle 各字段的默认值。
  22245. */
  22246. this.defaultStyle = null;
  22247. /**
  22248. * @member {string} SuperMap.LabelMixedTextStyle.prototype.separator
  22249. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  22250. * 比如文本 “5_109” 被 “_” 隔符为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  22251. * 在显示时,“5” 和分隔符 “_” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  22252. */
  22253. this.separator = null;
  22254. /**
  22255. * @member {boolean} [SuperMap.LabelMixedTextStyle.prototype.separatorEnabled=false]
  22256. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  22257. * 分段后,同一分段内的字符具有相同的显示风格。
  22258. */
  22259. this.separatorEnabled = false;
  22260. /**
  22261. * @member {Array.<number>} SuperMap.LabelMixedTextStyle.prototype.splitIndexes
  22262. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  22263. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  22264. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  22265. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  22266. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  22267. */
  22268. this.splitIndexes = null;
  22269. /**
  22270. * @member {Array.<SuperMap.ServerTextStyle>} SuperMap.LabelMixedTextStyle.prototype.styles
  22271. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  22272. * 如果有分段没有风格对应则使用 defaultStyle。
  22273. */
  22274. this.styles = new ServerTextStyle();
  22275. if (options) {
  22276. Util.extend(this, options);
  22277. }
  22278. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  22279. }
  22280. /**
  22281. * @function SuperMap.LabelMixedTextStyle.prototype.destroy
  22282. * @description 释放资源,将引用资源的属性置空。
  22283. */
  22284. destroy() {
  22285. var me = this;
  22286. if (me.defaultStyle) {
  22287. me.defaultStyle.destroy();
  22288. me.defaultStyle = null;
  22289. }
  22290. me.separator = null;
  22291. me.separatorEnabled = null;
  22292. if (me.splitIndexes) {
  22293. me.splitIndexes = null;
  22294. }
  22295. if (me.styles) {
  22296. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  22297. styles[i].destroy();
  22298. }
  22299. me.styles = null;
  22300. }
  22301. }
  22302. /**
  22303. * @function SuperMap.LabelMixedTextStyle.fromObj
  22304. * @description 从传入对象获取标签文本复合风格类。
  22305. * @param {Object} obj - 传入对象。
  22306. * @returns {SuperMap.LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  22307. */
  22308. static fromObj(obj) {
  22309. if (!obj) {
  22310. return;
  22311. }
  22312. var res = new LabelMixedTextStyle();
  22313. var stys = obj.styles;
  22314. Util.copy(res, obj);
  22315. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  22316. if (stys) {
  22317. res.styles = [];
  22318. for (var i = 0, len = stys.length; i < len; i++) {
  22319. res.styles.push(new ServerTextStyle(stys[i]));
  22320. }
  22321. }
  22322. return res;
  22323. }
  22324. }
  22325. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  22326. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  22327. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22328. * This program are made available under the terms of the Apache License, Version 2.0
  22329. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22330. /**
  22331. * @class SuperMap.ThemeLabelText
  22332. * @category iServer Map Theme
  22333. * @classdesc 标签中文本风格类。
  22334. * 通过该类可以设置标签中的文本字体大小和显示风格。
  22335. * @param {Object} options - 参数。
  22336. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  22337. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  22338. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  22339. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  22340. * @param {SuperMap.ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  22341. * @param {SuperMap.LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  22342. */
  22343. class ThemeLabelText {
  22344. constructor(options) {
  22345. /**
  22346. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextHeight=0]
  22347. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  22348. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为 0.1 毫米。
  22349. */
  22350. this.maxTextHeight = 0;
  22351. /**
  22352. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextWidth=0]
  22353. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  22354. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为 0.1 毫米。
  22355. */
  22356. this.maxTextWidth = 0;
  22357. /**
  22358. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextHeight=0]
  22359. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  22360. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为 0.1 毫米。
  22361. */
  22362. this.minTextHeight = 0;
  22363. /**
  22364. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextWidth=0]
  22365. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  22366. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为 0.1 毫米。
  22367. */
  22368. this.minTextWidth = 0;
  22369. /**
  22370. * @member {SuperMap.ServerTextStyle} [SuperMap.ThemeLabelText.prototype.uniformStyle]
  22371. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  22372. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  22373. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  22374. */
  22375. this.uniformStyle = new ServerTextStyle();
  22376. /**
  22377. *@member {SuperMap.LabelMixedTextStyle} [SuperMap.ThemeLabelText.prototype.uniformMixedStyle]
  22378. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标
  22379. * 签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  22380. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  22381. */
  22382. this.uniformMixedStyle = null;
  22383. if (options) {
  22384. Util.extend(this, options);
  22385. }
  22386. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  22387. }
  22388. /**
  22389. * @function SuperMap.ThemeLabelText.prototype.destroy
  22390. * @description 释放资源,将引用资源的属性置空。
  22391. */
  22392. destroy() {
  22393. var me = this;
  22394. me.maxTextHeight = null;
  22395. me.maxTextWidth = null;
  22396. me.minTextHeight = null;
  22397. me.minTextWidth = null;
  22398. if (me.uniformStyle) {
  22399. me.uniformStyle.destroy();
  22400. me.uniformStyle = null;
  22401. }
  22402. if (me.uniformMixedStyle) {
  22403. me.uniformMixedStyle.destroy();
  22404. me.uniformMixedStyle = null;
  22405. }
  22406. }
  22407. /**
  22408. * @function SuperMap.ThemeLabelText.fromObj
  22409. * @description 从传入对象获取标签中文本风格类。
  22410. * @param {Object} obj - 传入对象。
  22411. * @returns {SuperMap.ThemeLabelText} ThemeLabelText 对象。
  22412. */
  22413. static fromObj(obj) {
  22414. if (!obj) {
  22415. return;
  22416. }
  22417. var res = new ThemeLabelText();
  22418. Util.copy(res, obj);
  22419. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  22420. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  22421. return res;
  22422. }
  22423. }
  22424. SuperMap.ThemeLabelText = ThemeLabelText;
  22425. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  22426. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22427. * This program are made available under the terms of the Apache License, Version 2.0
  22428. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22429. /**
  22430. * @class SuperMap.ThemeLabelAlongLine
  22431. * @category iServer Map Theme
  22432. * @classdesc 标签沿线标注样式类。
  22433. * @param {Object} options - 参数。
  22434. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  22435. * @param {SuperMap.AlongLineDirection} [options.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  22436. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  22437. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  22438. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  22439. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  22440. */
  22441. class ThemeLabelAlongLine {
  22442. constructor(options) {
  22443. /**
  22444. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.isAlongLine=true]
  22445. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  22446. */
  22447. this.isAlongLine = true;
  22448. /**
  22449. * @member {SuperMap.AlongLineDirection} [SuperMap.ThemeLabelAlongLine.prototype.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT]
  22450. * @description 标签沿线标注方向。
  22451. */
  22452. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  22453. /**
  22454. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.angleFixed=false]
  22455. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  22456. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  22457. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  22458. */
  22459. this.angleFixed = false;
  22460. /**
  22461. * @member {boolean} SuperMap.ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  22462. * @description 沿线循环标注时是否避免标签重复标注。
  22463. */
  22464. this.repeatedLabelAvoided = false;
  22465. /**
  22466. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  22467. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  22468. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  22469. */
  22470. this.repeatIntervalFixed = false;
  22471. /**
  22472. * @member {number} [SuperMap.ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  22473. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  22474. * 的时候,labelRepeatInterval 属性才有效。
  22475. */
  22476. this.labelRepeatInterval = 0;
  22477. if (options) {
  22478. Util.extend(this, options);
  22479. }
  22480. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  22481. }
  22482. /**
  22483. * @function SuperMap.ThemeLabelAlongLine.prototype.destroy
  22484. * @description 释放资源,将引用资源的属性置空。
  22485. */
  22486. destroy() {
  22487. var me = this;
  22488. me.isAlongLine = null;
  22489. me.alongLineDirection = null;
  22490. me.angleFixed = null;
  22491. me.repeatedLabelAvoided = null;
  22492. me.repeatIntervalFixed = null;
  22493. me.labelRepeatInterval = null;
  22494. }
  22495. /**
  22496. * @function SuperMap.ThemeLabelAlongLine.fromObj
  22497. * @description 从传入对象获取标签沿线标注样式类。
  22498. * @param {Object} obj - 传入对象。
  22499. * @returns {SuperMap.ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  22500. */
  22501. static fromObj(obj) {
  22502. if (!obj) {
  22503. return;
  22504. }
  22505. var t = new ThemeLabelAlongLine();
  22506. Util.copy(t, obj);
  22507. return t;
  22508. }
  22509. }
  22510. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  22511. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  22512. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22513. * This program are made available under the terms of the Apache License, Version 2.0
  22514. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22515. /**
  22516. * @class SuperMap.ThemeLabelBackground
  22517. * @category iServer Map Theme
  22518. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  22519. * @param {Object} options - 参数。
  22520. * @param {SuperMap.LabelBackShape} [options.labelBackShape=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景风格。
  22521. * @param {SuperMap.ServerStyle} [options.backStyle=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  22522. */
  22523. class ThemeLabelBackground {
  22524. constructor(options) {
  22525. /**
  22526. * @member {SuperMap.LabelBackShape} [SuperMap.ThemeLabelBackground.prototype.labelBackShape=SuperMap.LabelBackShape.NONE]
  22527. * @description 标签专题图中标签背景风格。当背景形状
  22528. * labelBackShape 属性设为 NONE(即无背景形状) 时,backStyle 属性无效。
  22529. */
  22530. this.labelBackShape = LabelBackShape.NONE;
  22531. /**
  22532. * @member {SuperMap.ServerStyle} [SuperMap.ThemeLabelBackground.prototype.backStyle=SuperMap.LabelBackShape.NON]
  22533. * @description 标签专题图中标签背景的形状枚举类。背景类型可
  22534. * 以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  22535. */
  22536. this.backStyle = new ServerStyle();
  22537. if (options) {
  22538. Util.extend(this, options);
  22539. }
  22540. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  22541. }
  22542. /**
  22543. * @function SuperMap.ThemeLabelBackground.prototype.destroy
  22544. * @description 释放资源,将引用资源的属性置空。
  22545. */
  22546. destroy() {
  22547. var me = this;
  22548. me.labelBackShape = null;
  22549. if (me.backStyle) {
  22550. me.backStyle.destroy();
  22551. me.backStyle = null;
  22552. }
  22553. }
  22554. /**
  22555. * @function SuperMap.ThemeLabelBackground.fromObj
  22556. * @description 从传入对象获取标签背景风格类。
  22557. * @param {Object} obj - 传入对象。
  22558. * @returns {SuperMap.ThemeLabelBackground} ThemeLabelBackground 对象。
  22559. */
  22560. static fromObj(obj) {
  22561. if (!obj) {
  22562. return;
  22563. }
  22564. var t = new ThemeLabelBackground();
  22565. t.labelBackShape = obj.labelBackShape;
  22566. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  22567. return t;
  22568. }
  22569. }
  22570. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  22571. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  22572. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22573. * This program are made available under the terms of the Apache License, Version 2.0
  22574. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22575. /**
  22576. * @class SuperMap.ThemeLabel
  22577. * @category iServer Map Theme
  22578. * @classdesc 标签专题图类。
  22579. * @extends SuperMap.Theme
  22580. * @param {Object} options - 参数。
  22581. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 分段标签专题图的子项数组。
  22582. * @param {string} options.labelExpression - 标注字段表达式。
  22583. * @param {Array.<SuperMap.LabelMatrixCell>} options.matrixCells - 矩阵标签元素数组。
  22584. * @param {SuperMap.ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  22585. * @param {SuperMap.ThemeLabelBackground} [options.background] - 标签专题图中标签的背景风格类。
  22586. * @param {SuperMap.ThemeFlow} [options.flow] - 标签专题图标签流动显示与牵引线设置类。
  22587. * @param {SuperMap.LabelOverLengthMode} [options.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  22588. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  22589. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  22590. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  22591. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  22592. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  22593. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  22594. * @param {SuperMap.ThemeLabelText} options.text - 标签中文本风格。
  22595. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  22596. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  22597. */
  22598. class ThemeLabel extends Theme {
  22599. constructor(options) {
  22600. super("LABEL", options);
  22601. /**
  22602. * @member {SuperMap.ThemeLabelAlongLine} [SuperMap.ThemeLabel.prototype.alongLine]
  22603. * @description 标签沿线标注方向样式类。
  22604. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  22605. */
  22606. this.alongLine = new ThemeLabelAlongLine();
  22607. /**
  22608. * @member {SuperMap.ThemeLabelBackground} [SuperMap.ThemeLabel.prototype.background]
  22609. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  22610. */
  22611. this.background = new ThemeLabelBackground();
  22612. /**
  22613. * @member {SuperMap.ThemeFlow} [SuperMap.ThemeLabel.prototype.flow]
  22614. * @description 标签专题图标签流动显示与牵引线设置类。通过该字段可以设置标签是否流动显示和牵引线风格。
  22615. */
  22616. this.flow = new ThemeFlow();
  22617. /**
  22618. * @member {Array.<SuperMap.ThemeUniqueItem>} [SuperMap.ThemeLabel.prototype.items]
  22619. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  22620. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  22621. */
  22622. this.items = null;
  22623. /**
  22624. * @member {Array.<SuperMap.ThemeLabelUniqueItem>} SuperMap.ThemeLabel.prototype.uniqueItems
  22625. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  22626. */
  22627. this.uniqueItems = null;
  22628. /**
  22629. * @member {string} SuperMap.ThemeLabel.prototype.labelExpression
  22630. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  22631. */
  22632. this.labelExpression = null;
  22633. /**
  22634. * @member {SuperMap.LabelOverLengthMode} [SuperMap.ThemeLabel.prototype.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  22635. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  22636. */
  22637. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  22638. /**
  22639. * @member {Array.<SuperMap.LabelMatrixCell>} SuperMap.ThemeLabel.prototype.matrixCells
  22640. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  22641. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  22642. */
  22643. this.matrixCells = null;
  22644. /**
  22645. * @member {number} [SuperMap.ThemeLabel.prototype.maxLabelLength=256]
  22646. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  22647. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  22648. */
  22649. this.maxLabelLength = 256;
  22650. /**
  22651. * @member {number} [SuperMap.ThemeLabel.prototype.numericPrecision=0]
  22652. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  22653. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  22654. */
  22655. this.numericPrecision = 0;
  22656. /**
  22657. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeLabel.prototype.offset]
  22658. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  22659. */
  22660. this.offset = new ThemeOffset();
  22661. /**
  22662. * @member {boolean} [SuperMap.ThemeLabel.prototype.overlapAvoided=true]
  22663. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  22664. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  22665. */
  22666. this.overlapAvoided = true;
  22667. /**
  22668. * @member {string} SuperMap.ThemeLabel.prototype.rangeExpression
  22669. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  22670. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  22671. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  22672. */
  22673. this.rangeExpression = null;
  22674. /**
  22675. * @member {string} SuperMap.ThemeLabel.prototype.uniqueExpression
  22676. * @description 用于制作单值专题图的字段或字段表达式。
  22677. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  22678. */
  22679. this.uniqueExpression = null;
  22680. /**
  22681. * @member {boolean} [SuperMap.ThemeLabel.prototype.smallGeometryLabeled=false]
  22682. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  22683. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  22684. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  22685. */
  22686. this.smallGeometryLabeled = false;
  22687. /**
  22688. * @member {SuperMap.ThemeLabelText} SuperMap.ThemeLabel.prototype.text
  22689. * @description 标签中文本风格。
  22690. */
  22691. this.text = new ThemeLabelText();
  22692. /**
  22693. * @member {number} [SuperMap.ThemeLabel.prototype.textSpace=0]
  22694. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  22695. */
  22696. this.textSpace = 0;
  22697. if (options) {
  22698. Util.extend(this, options);
  22699. }
  22700. this.CLASS_NAME = "SuperMap.ThemeLabel";
  22701. }
  22702. /**
  22703. * @function SuperMap.ThemeLabel.prototype.destroy
  22704. * @override
  22705. */
  22706. destroy() {
  22707. super.destroy();
  22708. var me = this;
  22709. me.alongLine = null;
  22710. if (me.background) {
  22711. me.background.destroy();
  22712. me.background = null;
  22713. }
  22714. me.flow = null;
  22715. if (me.items) {
  22716. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  22717. items[i].destroy();
  22718. }
  22719. me.items = null;
  22720. }
  22721. if (me.uniqueItems) {
  22722. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  22723. uniqueItems[j].destory();
  22724. }
  22725. me.uniqueItems = null;
  22726. }
  22727. me.labelExpression = null;
  22728. me.labelOverLengthMode = null;
  22729. me.matrixCells = null;
  22730. me.maxLabelLength = null;
  22731. me.numericPrecision = null;
  22732. me.overlapAvoided = null;
  22733. me.rangeExpression = null;
  22734. me.uniqueExpression = null;
  22735. if (me.offset) {
  22736. me.offset.destroy();
  22737. me.offset = null;
  22738. }
  22739. me.overlapAvoided = null;
  22740. me.smallGeometryLabeled = null;
  22741. if (me.text) {
  22742. me.text.destroy();
  22743. me.text = null;
  22744. }
  22745. me.textSpace = null;
  22746. }
  22747. /**
  22748. * @function SuperMap.ThemeLabel.prototype.toJSON
  22749. * @description 将themeLabel对象转化为 JSON 字符串。
  22750. * @returns {string} 返回转换后的 JSON 字符串。
  22751. */
  22752. toJSON() {
  22753. return Util.toJSON(this.toServerJSONObject());
  22754. }
  22755. /**
  22756. * @function SuperMap.ThemeLabel.prototype.toServerJSONObject
  22757. * @description 转换成对应的 JSON 格式对象。
  22758. * @returns {Object} 对应的 JSON 格式对象。
  22759. */
  22760. toServerJSONObject() {
  22761. var obj = {};
  22762. obj.type = this.type;
  22763. obj.memoryData = this.memoryData;
  22764. if (this.alongLine) {
  22765. obj.alongLine = this.alongLine.isAlongLine;
  22766. obj.alongLineDirection = this.alongLine.alongLineDirection;
  22767. obj.angleFixed = this.alongLine.angleFixed;
  22768. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  22769. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  22770. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  22771. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  22772. }
  22773. if (this.offset) {
  22774. obj.offsetFixed = this.offset.offsetFixed;
  22775. obj.offsetX = this.offset.offsetX;
  22776. obj.offsetY = this.offset.offsetY;
  22777. }
  22778. if (this.flow) {
  22779. obj.flowEnabled = this.flow.flowEnabled;
  22780. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  22781. obj.leaderLineStyle = this.flow.leaderLineStyle;
  22782. }
  22783. if (this.text) {
  22784. obj.maxTextHeight = this.text.maxTextHeight;
  22785. obj.maxTextWidth = this.text.maxTextWidth;
  22786. obj.minTextHeight = this.text.minTextHeight;
  22787. obj.minTextWidth = this.text.minTextWidth;
  22788. obj.uniformStyle = this.text.uniformStyle;
  22789. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  22790. }
  22791. if (this.background) {
  22792. obj.labelBackShape = this.background.labelBackShape;
  22793. obj.backStyle = this.background.backStyle;
  22794. }
  22795. obj.labelOverLengthMode = this.labelOverLengthMode;
  22796. obj.maxLabelLength = this.maxLabelLength;
  22797. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  22798. obj.rangeExpression = this.rangeExpression;
  22799. obj.uniqueExpression = this.uniqueExpression;
  22800. obj.numericPrecision = this.numericPrecision;
  22801. obj.items = this.items;
  22802. obj.uniqueItems = this.uniqueItems;
  22803. obj.labelExpression = this.labelExpression;
  22804. obj.overlapAvoided = this.overlapAvoided;
  22805. obj.matrixCells = this.matrixCells;
  22806. obj.textSpace = this.textSpace;
  22807. return obj;
  22808. }
  22809. /**
  22810. * @function SuperMap.ThemeLabel.fromObj
  22811. * @description 从传入对象获取标签专题图类。
  22812. * @param {Object} obj - 传入对象。
  22813. * @returns {SuperMap.ThemeLabel} ThemeLabel 对象。
  22814. */
  22815. static fromObj(obj) {
  22816. if (!obj) {
  22817. return;
  22818. }
  22819. var lab = new ThemeLabel();
  22820. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  22821. obj.matrixCells = null;
  22822. Util.copy(lab, obj);
  22823. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  22824. lab.background = ThemeLabelBackground.fromObj(obj);
  22825. lab.flow = new ThemeFlow({
  22826. flowEnabled: obj.flowEnabled,
  22827. leaderLineDisplayed: obj.leaderLineDisplayed,
  22828. leaderLineStyle: obj.leaderLineStyle
  22829. });
  22830. if (itemsL) {
  22831. lab.items = [];
  22832. for (var i = 0, len = itemsL.length; i < len; i++) {
  22833. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  22834. }
  22835. }
  22836. if (itemsU) {
  22837. lab.uniqueItems = [];
  22838. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  22839. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  22840. }
  22841. }
  22842. if (cells) {
  22843. lab.matrixCells = [];
  22844. for (let i = 0, len = cells.length; i < len; i++) {
  22845. //TODO
  22846. //lab.matrixCells.push(SuperMap.LabelMatrixCell.fromObj(cells[i]));
  22847. }
  22848. }
  22849. lab.offset = ThemeOffset.fromObj(obj);
  22850. lab.text = ThemeLabelText.fromObj(obj);
  22851. return lab;
  22852. }
  22853. }
  22854. SuperMap.ThemeLabel = ThemeLabel;
  22855. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  22856. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22857. * This program are made available under the terms of the Apache License, Version 2.0
  22858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22859. /**
  22860. * @class SuperMap.ThemeUnique
  22861. * @category iServer Map Theme
  22862. * @classdesc 单值专题图。
  22863. * @description 单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  22864. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  22865. * @extends {SuperMap.Theme}
  22866. * @param {Object} options - 参数。
  22867. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 单值专题图子项类数组。
  22868. * @param {string} options.uniqueExpression - 用于制作单值专题图的字段或字段表达式。
  22869. * @param {SuperMap.ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  22870. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  22871. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  22872. */
  22873. class ThemeUnique extends Theme {
  22874. constructor(options) {
  22875. super("UNIQUE", options);
  22876. /**
  22877. * @member {SuperMap.ServerStyle} SuperMap.ThemeUnique.prototype.defaultStyle
  22878. * @description 未参与单值专题图制作的对象的显示风格。
  22879. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  22880. */
  22881. this.defaultStyle = new ServerStyle();
  22882. /**
  22883. * @member {Array.<SuperMap.ThemeUniqueItem>} SuperMap.ThemeUnique.prototype.items
  22884. * @description 单值专题图子项类数组。
  22885. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  22886. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  22887. */
  22888. this.items = null;
  22889. /**
  22890. * @member {string} SuperMap.ThemeUnique.prototype.uniqueExpression
  22891. * @description 用于制作单值专题图的字段或字段表达式。
  22892. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  22893. */
  22894. this.uniqueExpression = null;
  22895. /**
  22896. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeUnique.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  22897. * @description 渐变颜色枚举类。
  22898. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  22899. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  22900. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  22901. * 该配色方案对于这几个子项将不起作用。
  22902. */
  22903. this.colorGradientType = ColorGradientType.YELLOW_RED;
  22904. if (options) {
  22905. Util.extend(this, options);
  22906. }
  22907. this.CLASS_NAME = "SuperMap.ThemeUnique";
  22908. }
  22909. /**
  22910. * @function SuperMap.ThemeUnique.prototype.destroy
  22911. * @override
  22912. */
  22913. destroy() {
  22914. super.destroy();
  22915. var me = this;
  22916. me.uniqueExpression = null;
  22917. me.colorGradientType = null;
  22918. if (me.items) {
  22919. if (me.items.length > 0) {
  22920. for (var item in me.items) {
  22921. me.items[item].destroy();
  22922. me.items[item] = null;
  22923. }
  22924. }
  22925. me.items = null;
  22926. }
  22927. if (me.defaultStyle) {
  22928. me.defaultStyle.destroy();
  22929. me.defaultStyle = null;
  22930. }
  22931. }
  22932. /**
  22933. * @function SuperMap.ThemeUnique.prototype.toServerJSONObject
  22934. * @description 转换成对应的 JSON 格式对象。
  22935. * @returns {Object} 对应的 JSON 格式对象。
  22936. */
  22937. toServerJSONObject() {
  22938. var obj = {};
  22939. obj = Util.copyAttributes(obj, this);
  22940. if (obj.defaultStyle) {
  22941. if (obj.defaultStyle.toServerJSONObject) {
  22942. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  22943. }
  22944. }
  22945. if (obj.items) {
  22946. var items = [],
  22947. len = obj.items.length;
  22948. for (var i = 0; i < len; i++) {
  22949. items.push(obj.items[i].toServerJSONObject());
  22950. }
  22951. obj.items = items;
  22952. }
  22953. return obj;
  22954. }
  22955. /**
  22956. * @function SuperMap.ThemeUnique.fromObj
  22957. * @description 从传入对象获取单值专题图类。
  22958. * @param {Object} obj - 传入对象。
  22959. * @returns {SuperMap.ThemeUnique} ThemeUnique 对象。
  22960. */
  22961. static fromObj(obj) {
  22962. var res = new ThemeUnique();
  22963. var uItems = obj.items;
  22964. var len = uItems ? uItems.length : 0;
  22965. Util.extend(res, obj);
  22966. res.items = [];
  22967. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  22968. for (var i = 0; i < len; i++) {
  22969. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  22970. }
  22971. return res;
  22972. }
  22973. }
  22974. SuperMap.ThemeUnique = ThemeUnique;
  22975. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  22976. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22977. * This program are made available under the terms of the Apache License, Version 2.0
  22978. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22979. /**
  22980. * @class SuperMap.ThemeGraphAxes
  22981. * @category iServer Map Theme
  22982. * @classdesc 统计专题图坐标轴样式类。
  22983. * @param {Object} options - 参数。
  22984. * @param {SuperMap.ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  22985. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  22986. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  22987. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  22988. * @param {SuperMap.ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  22989. */
  22990. class ThemeGraphAxes {
  22991. constructor(options) {
  22992. /**
  22993. * @member {SuperMap.ServerColor} [SuperMap.ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  22994. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  22995. */
  22996. this.axesColor = new ServerColor(0, 0, 0);
  22997. /**
  22998. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesDisplayed=false]
  22999. * @description 是否显示坐标轴。<br>
  23000. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  23001. */
  23002. this.axesDisplayed = false;
  23003. /**
  23004. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesGridDisplayed=false]
  23005. * @description 是否在统计图坐标轴上显示网格。
  23006. */
  23007. this.axesGridDisplayed = false;
  23008. /**
  23009. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesTextDisplayed=false]
  23010. * @description 是否显示坐标轴的文本标注。
  23011. */
  23012. this.axesTextDisplayed = false;
  23013. /**
  23014. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphAxes.prototype.axesTextStyle
  23015. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  23016. */
  23017. this.axesTextStyle = new ServerTextStyle();
  23018. if (options) {
  23019. Util.extend(this, options);
  23020. }
  23021. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  23022. }
  23023. /**
  23024. * @function SuperMap.ThemeGraphAxes.prototype.destroy
  23025. * @description 释放资源,将引用资源的属性置空。
  23026. */
  23027. destroy() {
  23028. var me = this;
  23029. if (me.axesColor) {
  23030. me.axesColor.destroy();
  23031. me.axesColor = null;
  23032. }
  23033. me.axesDisplayed = null;
  23034. me.axesGridDisplayed = null;
  23035. me.axesTextDisplayed = null;
  23036. if (me.axesTextStyle) {
  23037. me.axesTextStyle.destroy();
  23038. me.axesTextStyle = null;
  23039. }
  23040. }
  23041. /**
  23042. * @function SuperMap.ThemeGraphAxes.fromObj
  23043. * @description 从传入对象获取统计专题图坐标轴样式类。
  23044. * @param {Object} obj - 传入对象。
  23045. * @returns {SuperMap.ThemeGraphAxes} ThemeGraphAxes 对象。
  23046. */
  23047. static fromObj(obj) {
  23048. if (!obj) {
  23049. return;
  23050. }
  23051. var res = new ThemeGraphAxes();
  23052. Util.copy(res, obj);
  23053. res.axesColor = ServerColor.fromJson(obj.axesColor);
  23054. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  23055. return res;
  23056. }
  23057. }
  23058. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  23059. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  23060. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23061. * This program are made available under the terms of the Apache License, Version 2.0
  23062. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23063. /**
  23064. * @class SuperMap.ThemeGraphSize
  23065. * @category iServer Map Theme
  23066. * @classdesc 统计专题图符号尺寸类。
  23067. * @param {Object} options - 参数。
  23068. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  23069. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  23070. */
  23071. class ThemeGraphSize {
  23072. constructor(options) {
  23073. /**
  23074. * @member {number} [SuperMap.ThemeGraphSize.prototype.maxGraphSize=0]
  23075. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  23076. */
  23077. this.maxGraphSize = 0;
  23078. /**
  23079. * @member {number} [SuperMap.ThemeGraphSize.prototype.minGraphSize=0]
  23080. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  23081. */
  23082. this.minGraphSize = 0;
  23083. if (options) {
  23084. Util.extend(this, options);
  23085. }
  23086. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  23087. }
  23088. /**
  23089. * @function SuperMap.ThemeGraphSize.prototype.destroy
  23090. * @description 释放资源,将引用资源的属性置空。
  23091. */
  23092. destroy() {
  23093. var me = this;
  23094. me.maxGraphSize = null;
  23095. me.minGraphSize = null;
  23096. }
  23097. /**
  23098. * @function SuperMap.ThemeGraphSize.fromObj
  23099. * @description 从传入对象获统计专题图符号尺寸类。
  23100. * @param {Object} obj - 传入对象。
  23101. * @returns {SuperMap.ThemeGraphSize} ThemeGraphSize 对象。
  23102. */
  23103. static fromObj(obj) {
  23104. var res = new ThemeGraphSize();
  23105. Util.copy(res, obj);
  23106. return res;
  23107. }
  23108. }
  23109. SuperMap.ThemeGraphSize = ThemeGraphSize;
  23110. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  23111. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23112. * This program are made available under the terms of the Apache License, Version 2.0
  23113. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23114. /**
  23115. * @class SuperMap.ThemeGraphText
  23116. * @category iServer Map Theme
  23117. * @classdesc 统计图文字标注风格类。
  23118. * @param {Object} options - 可选参数。
  23119. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  23120. * @param {SuperMap.ThemeGraphTextFormat} [options.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  23121. * @param {SuperMap.ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  23122. */
  23123. class ThemeGraphText {
  23124. constructor(options) {
  23125. /**
  23126. * @member {boolean} [SuperMap.ThemeGraphText.prototype.graphTextDisplayed=false]
  23127. * @description 是否显示统计图上的文字标注。
  23128. */
  23129. this.graphTextDisplayed = false;
  23130. /**
  23131. * @member {SuperMap.ThemeGraphTextFormat} [SuperMap.ThemeGraphText.prototype.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION]
  23132. * @description 统计专题图文本显示格式。
  23133. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  23134. */
  23135. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  23136. /**
  23137. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphText.prototype.graphTextStyle
  23138. * @description 统计图上的文字标注风格。
  23139. */
  23140. this.graphTextStyle = new ServerTextStyle();
  23141. if (options) {
  23142. Util.extend(this, options);
  23143. }
  23144. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  23145. }
  23146. /**
  23147. * @function SuperMap.ThemeGraphText.prototype.destroy
  23148. * @description 释放资源,将引用资源的属性置空。
  23149. */
  23150. destroy() {
  23151. var me = this;
  23152. me.graphTextDisplayed = null;
  23153. me.graphTextFormat = null;
  23154. if (me.graphTextStyle) {
  23155. me.graphTextStyle.destroy();
  23156. me.graphTextStyle = null;
  23157. }
  23158. }
  23159. /**
  23160. * @function SuperMap.ThemeGraphText.fromObj
  23161. * @description 从传入对象获取统计图文字标注风格类。
  23162. * @param {Object} obj - 传入对象。
  23163. * @returns {SuperMap.ThemeGraphText} ThemeGraphText 对象。
  23164. */
  23165. static fromObj(obj) {
  23166. var res = new ThemeGraphText();
  23167. Util.copy(res, obj);
  23168. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  23169. return res;
  23170. }
  23171. }
  23172. SuperMap.ThemeGraphText = ThemeGraphText;
  23173. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  23174. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23175. * This program are made available under the terms of the Apache License, Version 2.0
  23176. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23177. /**
  23178. * @class SuperMap.ThemeGraphItem
  23179. * @category iServer Map Theme
  23180. * @classdesc 统计专题图子项类。
  23181. * @param {Object} options - 参数。
  23182. * @param {string} [options.caption] - 专题图子项的名称。
  23183. * @param {string} options.graphExpression - 统计专题图的专题变量。
  23184. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  23185. * @param {SuperMap.ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格
  23186. */
  23187. class ThemeGraphItem {
  23188. constructor(options) {
  23189. /**
  23190. * @member {string} [SuperMap.ThemeGraphItem.prototype.caption]
  23191. * @description 专题图子项的名称。
  23192. */
  23193. this.caption = null;
  23194. /**
  23195. * @member {string} SuperMap.ThemeGraphItem.prototype.graphExpression
  23196. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  23197. */
  23198. this.graphExpression = null;
  23199. /**
  23200. * @member {Array.<number>} [SuperMap.ThemeGraphItem.prototype.memoryDoubleValues]
  23201. * @description 内存数组方式制作专题图时的值数组。<br>
  23202. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link SuperMap.ThemeGraph.memoryKeys})中的记录制作专题图。
  23203. * 值数组的数值个数必须与键数组中数值的个数一致。 值数组中的值将代替原来的专题值来制作统计专题图。
  23204. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  23205. */
  23206. this.memoryDoubleValues = null;
  23207. /**
  23208. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraphItem.prototype.uniformStyle]
  23209. * @description 统计专题图子项的显示风格。
  23210. * 每一个统计专题图子项都对应一种显示风格。
  23211. */
  23212. this.uniformStyle = new ServerStyle();
  23213. if (options) {
  23214. Util.extend(this, options);
  23215. }
  23216. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  23217. }
  23218. /**
  23219. * @function SuperMap.ThemeGraphItem.prototype.destroy
  23220. * @description 释放资源,将引用资源的属性置空。
  23221. */
  23222. destroy() {
  23223. var me = this;
  23224. me.caption = null;
  23225. me.graphExpression = null;
  23226. me.memoryDoubleValues = null;
  23227. me.uniformStyle = null;
  23228. }
  23229. /**
  23230. * @function SuperMap.ThemeGraphItem.fromObj
  23231. * @description 从传入对象获取统计专题图子项类。
  23232. * @param {Object} obj - 传入对象。
  23233. * @returns {SuperMap.ThemeGraphItem} ThemeGraphItem 对象。
  23234. */
  23235. static fromObj(obj) {
  23236. if (!obj) {
  23237. return;
  23238. }
  23239. var res = new ThemeGraphItem();
  23240. Util.copy(res, obj);
  23241. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  23242. return res;
  23243. }
  23244. }
  23245. SuperMap.ThemeGraphItem = ThemeGraphItem;
  23246. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  23247. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23248. * This program are made available under the terms of the Apache License, Version 2.0
  23249. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23250. /**
  23251. * @class SuperMap.ThemeGraph
  23252. * @category iServer Map Theme
  23253. * @classdesc 统计专题图类。
  23254. * @extends {SuperMap.Theme}
  23255. * @param {Object} options - 参数。
  23256. * @param {Array.<SuperMap.ThemeGraphItem>} options.items - 统计专题图子项集合。
  23257. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  23258. * @param {SuperMap.ThemeFlow} [options.flow] - 统计专题图流动显示与牵引线设置。
  23259. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  23260. * @param {SuperMap.ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  23261. * @param {SuperMap.ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  23262. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  23263. * @param {SuperMap.ThemeGraphText} [options.graphText] - 统计图上的文字是否可以见以及文字标注风格。
  23264. * @param {SuperMap.GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  23265. * @param {SuperMap.ThemeGraphType} [options.graphType=SuperMap.ThemeGraphType.AREA] - 统计专题图类型。
  23266. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  23267. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  23268. * @param {SuperMap.ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  23269. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  23270. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  23271. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  23272. */
  23273. class ThemeGraph extends Theme {
  23274. constructor(options) {
  23275. super("GRAPH", options);
  23276. /**
  23277. * @member {number} [SuperMap.ThemeGraph.prototype.barWidth=0]
  23278. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  23279. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  23280. */
  23281. this.barWidth = 0;
  23282. /**
  23283. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraph.prototype.flow
  23284. * @description 统计专题图流动显示与牵引线设置。
  23285. * 通过该字段可以设置统计符号是否流动显示和牵引线风格。
  23286. */
  23287. this.flow = new ThemeFlow();
  23288. /**
  23289. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraph.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  23290. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  23291. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  23292. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  23293. */
  23294. this.graduatedMode = GraduatedMode.CONSTANT;
  23295. /**
  23296. * @member {SuperMap.ThemeGraphAxes} SuperMap.ThemeGraph.prototype.graphAxes
  23297. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  23298. */
  23299. this.graphAxes = new ThemeGraphAxes();
  23300. /**
  23301. * @member {SuperMap.ThemeGraphSize} [SuperMap.ThemeGraph.prototype.graphSize=0]
  23302. * @description 用于设置统计符号的最大最小尺寸。
  23303. */
  23304. this.graphSize = new ThemeGraphSize();
  23305. /**
  23306. * @member {boolean} [SuperMap.ThemeGraph.prototype.graphSizeFixed=false]
  23307. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  23308. */
  23309. this.graphSizeFixed = false;
  23310. /**
  23311. * @member {SuperMap.ThemeGraphText} SuperMap.ThemeGraph.prototype.graphText
  23312. * @description 统计图上的文字是否可以见以及文字标注风格。
  23313. */
  23314. this.graphText = new ThemeGraphText();
  23315. /**
  23316. * @member {SuperMap.ThemeGraphType} [SuperMap.ThemeGraph.prototype.graphType=SuperMap.ThemeGraphType.AREA]
  23317. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  23318. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  23319. */
  23320. this.graphType = ThemeGraphType.AREA;
  23321. /**
  23322. * @member {SuperMap.GraphAxesTextDisplayMode} [SuperMap.ThemeGraph.prototype.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE]
  23323. * @description 统计专题图坐标轴文本显示模式。
  23324. */
  23325. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  23326. /**
  23327. * @member {Array.<SuperMap.ThemeGraphItem>} SuperMap.ThemeGraph.prototype.items
  23328. * @description 统计专题图子项集合。
  23329. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  23330. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  23331. */
  23332. this.items = null;
  23333. /**
  23334. * @member {Array.<number>} SuperMap.ThemeGraph.prototype.memoryKeys
  23335. * @description 以内存数组方式制作专题图时的键数组。
  23336. * 键数组内的数值代表 SmID 值,它与 SuperMap.ThemeGraphItem 类中的值数组(SuperMap.ThemeGraphItem.memoryDoubleValues)要关联起来应用。
  23337. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  23338. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  23339. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  23340. * @example
  23341. * memoryKeys 的使用方法如下:
  23342. * function addThemeGraph() {
  23343. * removeTheme();
  23344. * //创建统计专题图对象,SuperMap.ThemeGraph 必设 items。
  23345. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  23346. * var style1 = new SuperMap.ServerStyle({
  23347. * fillForeColor: new SuperMap.ServerColor(92,73,234),
  23348. * lineWidth: 0.1
  23349. * }),
  23350. * style2 = new SuperMap.ServerStyle({
  23351. * fillForeColor: new SuperMap.ServerColor(211,111,240),
  23352. * lineWidth: 0.1
  23353. * }),
  23354. * item1 = new SuperMap.ThemeGraphItem({
  23355. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  23356. * caption: "1992-1995人口增长率",
  23357. * graphExpression: "Pop_Rate95",
  23358. * uniformStyle: style1
  23359. * }),
  23360. * item2 = new SuperMap.ThemeGraphItem({
  23361. * //以内存数组方式制作专题图时的值数组
  23362. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  23363. * caption: "1995-1999人口增长率", //专题图子项的名称
  23364. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  23365. * uniformStyle: style2 //统计专题图子项的显示风格
  23366. * }),
  23367. * themeGraph = new SuperMap.ThemeGraph({
  23368. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  23369. * memoryKeys:[1,2,4,8,10,12],
  23370. * items: new Array(item1,item2),
  23371. * barWidth: 0.03,
  23372. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  23373. * graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
  23374. * //graphAxes用于设置统计图中坐标轴样式相关信息
  23375. * graphAxes: new SuperMap.ThemeGraphAxes({
  23376. * axesDisplayed: true
  23377. * }),
  23378. * graphSize: new SuperMap.ThemeGraphSize({
  23379. * maxGraphSize: 1,
  23380. * minGraphSize: 0.35
  23381. * }),
  23382. * //统计图上的文字是否可以见以及文字标注风格
  23383. * graphText: new SuperMap.ThemeGraphText({
  23384. * graphTextDisplayed: true,
  23385. * graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
  23386. * graphTextStyle: new SuperMap.ServerTextStyle({
  23387. * sizeFixed: true,
  23388. * fontHeight: 9,
  23389. * fontWidth: 5
  23390. * })
  23391. * }),
  23392. * //统计专题图类型为三维柱状图
  23393. * graphType: SuperMap.ThemeGraphType.BAR3D
  23394. * }),
  23395. * //专题图参数对象
  23396. * themeParameters = new SuperMap.ThemeParameters({
  23397. * themes: [themeGraph],
  23398. * dataSourceNames: ["Jingjin"],
  23399. * datasetNames: ["BaseMap_R"]
  23400. * }),
  23401. * //与服务端交互
  23402. * themeService=new SuperMap.ThemeService(url, {
  23403. * eventListeners: {
  23404. * "processCompleted": ThemeCompleted,
  23405. * "processFailed": themeFailed
  23406. * }
  23407. * });
  23408. * themeService.processAsync(themeParameters);
  23409. * }
  23410. */
  23411. this.memoryKeys = null;
  23412. /**
  23413. * @member {boolean} [SuperMap.ThemeGraph.prototype.negativeDisplayed=false]
  23414. * @description 专题图中是否显示属性为负值的数据。true 表示显示;falese 不显示。
  23415. */
  23416. this.negativeDisplayed = false;
  23417. /**
  23418. * @member {SuperMap.ThemeOffset} SuperMap.ThemeGraph.prototype.offset
  23419. * @description 用于设置统计图相对于要素内点的偏移量。
  23420. */
  23421. this.offset = new ThemeOffset();
  23422. /**
  23423. * @member {boolean} SuperMap.ThemeGraph.prototype.overlapAvoided
  23424. * @description 统计图是否采用避让方式显示。<br>
  23425. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  23426. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  23427. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  23428. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  23429. */
  23430. this.overlapAvoided = true;
  23431. /**
  23432. * @member {number} [SuperMap.ThemeGraph.prototype.roseAngle=0]
  23433. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  23434. */
  23435. this.roseAngle = 0;
  23436. /**
  23437. * @member {number} [SuperMap.ThemeGraph.prototype.startAngle=0]
  23438. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  23439. */
  23440. this.startAngle = 0;
  23441. if (options) {
  23442. Util.extend(this, options);
  23443. }
  23444. this.CLASS_NAME = "SuperMap.ThemeGraph";
  23445. }
  23446. /**
  23447. * @function SuperMap.ThemeGraph.prototype.destroy
  23448. * @override
  23449. */
  23450. destroy() {
  23451. super.destroy();
  23452. var me = this;
  23453. me.barWidth = null;
  23454. if (me.flow) {
  23455. me.flow.destroy();
  23456. me.flow = null;
  23457. }
  23458. me.graduatedMode = null;
  23459. if (me.graphAxes) {
  23460. me.graphAxes.destroy();
  23461. me.graphAxes = null;
  23462. }
  23463. if (me.graphSize) {
  23464. me.graphSize.destroy();
  23465. me.graphSize = null;
  23466. }
  23467. me.graphSizeFixed = null;
  23468. if (me.graphText) {
  23469. me.graphText.destroy();
  23470. me.graphText = null;
  23471. }
  23472. me.graphType = null;
  23473. if (me.items) {
  23474. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  23475. items[i].destroy();
  23476. }
  23477. me.items = null;
  23478. }
  23479. me.memoryKeys = null;
  23480. me.negativeDisplayed = null;
  23481. if (me.offset) {
  23482. me.offset.destroy();
  23483. me.offset = null;
  23484. }
  23485. me.overlapAvoided = null;
  23486. me.roseAngle = null;
  23487. me.startAngle = null;
  23488. me.graphAxesTextDisplayMode = null;
  23489. }
  23490. /**
  23491. * @function SuperMap.ThemeGraph.prototype.toJSON
  23492. * @description 将 SuperMap.ThemeGraph 对象转化为 JSON 字符串。
  23493. * @returns {string} 返回转换后的 JSON 字符串。
  23494. */
  23495. toJSON() {
  23496. return Util.toJSON(this.toServerJSONObject());
  23497. }
  23498. /**
  23499. * @function SuperMap.ThemeGraph.prototype.toServerJSONObject
  23500. * @description 转换成对应的 JSON 格式对象。
  23501. * @returns {Object} 对应的 JSON 格式对象。
  23502. */
  23503. toServerJSONObject() {
  23504. var obj = {};
  23505. obj.type = this.type;
  23506. if (this.graphText) {
  23507. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  23508. obj.graphTextFormat = this.graphText.graphTextFormat;
  23509. obj.graphTextStyle = this.graphText.graphTextStyle;
  23510. }
  23511. if (this.flow) {
  23512. obj.flowEnabled = this.flow.flowEnabled;
  23513. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  23514. obj.leaderLineStyle = this.flow.leaderLineStyle;
  23515. }
  23516. if (this.graphAxes) {
  23517. obj.axesColor = this.graphAxes.axesColor;
  23518. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  23519. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  23520. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  23521. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  23522. }
  23523. if (this.graphSize) {
  23524. obj.maxGraphSize = this.graphSize.maxGraphSize;
  23525. obj.minGraphSize = this.graphSize.minGraphSize;
  23526. }
  23527. if (this.offset) {
  23528. obj.offsetFixed = this.offset.offsetFixed;
  23529. obj.offsetX = this.offset.offsetX;
  23530. obj.offsetY = this.offset.offsetY;
  23531. }
  23532. obj.barWidth = this.barWidth;
  23533. obj.graduatedMode = this.graduatedMode;
  23534. obj.graphSizeFixed = this.graphSizeFixed;
  23535. obj.graphType = this.graphType;
  23536. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  23537. obj.items = this.items;
  23538. obj.memoryKeys = this.memoryKeys;
  23539. obj.negativeDisplayed = this.negativeDisplayed;
  23540. obj.overlapAvoided = this.overlapAvoided;
  23541. obj.roseAngle = this.roseAngle;
  23542. obj.startAngle = this.startAngle;
  23543. return obj;
  23544. }
  23545. /**
  23546. * @function SuperMap.ThemeGraph.fromObj
  23547. * @description 从传入对象获取统计专题图类。
  23548. * @param {Object} obj - 传入对象。
  23549. * @returns {SuperMap.ThemeGraph} ThemeGraph 对象。
  23550. */
  23551. static fromObj(obj) {
  23552. var res = new ThemeGraph();
  23553. var itemsG = obj.items;
  23554. var len = itemsG ? itemsG.length : 0;
  23555. Util.copy(res, obj);
  23556. res.items = [];
  23557. res.flow = ThemeFlow.fromObj(obj);
  23558. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  23559. res.graphSize = ThemeGraphSize.fromObj(obj);
  23560. res.graphText = ThemeGraphText.fromObj(obj);
  23561. res.offset = ThemeOffset.fromObj(obj);
  23562. for (var i = 0; i < len; i++) {
  23563. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  23564. }
  23565. return res;
  23566. }
  23567. }
  23568. SuperMap.ThemeGraph = ThemeGraph;
  23569. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  23570. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23571. * This program are made available under the terms of the Apache License, Version 2.0
  23572. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23573. /**
  23574. * @class SuperMap.ThemeDotDensity
  23575. * @category iServer Map Theme
  23576. * @classdesc 点密度专题图。
  23577. * @description 点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  23578. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  23579. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  23580. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  23581. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  23582. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  23583. * @extends {SuperMap.Theme}
  23584. * @param {Object} options - 参数。
  23585. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  23586. * @param {SuperMap.ServerStyle} [options.style] - 点密度专题图中点的风格。
  23587. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  23588. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23589. */
  23590. class ThemeDotDensity extends Theme {
  23591. constructor(options) {
  23592. super("DOTDENSITY", options);
  23593. /**
  23594. * @member {string} SuperMap.ThemeDotDensity.prototype.dotExpression
  23595. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  23596. */
  23597. this.dotExpression = null;
  23598. /**
  23599. * @member {SuperMap.ServerStyle} SuperMap.ThemeDotDensity.prototype.style
  23600. * @description 点密度专题图中点的风格。
  23601. */
  23602. this.style = new ServerStyle();
  23603. /**
  23604. * @member {number} SuperMap.ThemeDotDensity.prototype.value
  23605. * @description 专题图中每一个点所代表的数值。<br>
  23606. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  23607. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  23608. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  23609. */
  23610. this.value = null;
  23611. if (options) {
  23612. Util.extend(this, options);
  23613. }
  23614. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  23615. }
  23616. /**
  23617. * @function SuperMap.ThemeDotDensity.prototype.destroy
  23618. * @description 释放资源,将引用资源的属性置空。
  23619. */
  23620. destroy() {
  23621. var me = this;
  23622. me.dotExpression = null;
  23623. me.value = null;
  23624. if (me.style) {
  23625. me.style.destroy();
  23626. me.style = null;
  23627. }
  23628. }
  23629. /**
  23630. * @function SuperMap.ThemeDotDensity.prototype.toServerJSONObject
  23631. * @description 转换成对应的 JSON 格式对象。
  23632. * @returns {Object} 对应的 JSON 格式对象。
  23633. */
  23634. toServerJSONObject() {
  23635. var obj = {};
  23636. obj = Util.copyAttributes(obj, this);
  23637. if (obj.style) {
  23638. if (obj.style.toServerJSONObject) {
  23639. obj.style = obj.style.toServerJSONObject();
  23640. }
  23641. }
  23642. return obj;
  23643. }
  23644. /**
  23645. * @function SuperMap.ThemeDotDensity.fromObj
  23646. * @description 从传入对象获取点密度专题图中点的风格。
  23647. * @param {Object} obj - 传入对象。
  23648. * @returns {SuperMap.ThemeDotDensity} ThemeDotDensity 对象。
  23649. */
  23650. static fromObj(obj) {
  23651. if (!obj) {
  23652. return;
  23653. }
  23654. var res = new ThemeDotDensity();
  23655. Util.copy(res, obj);
  23656. res.style = ServerStyle.fromJson(obj.style);
  23657. return res;
  23658. }
  23659. }
  23660. SuperMap.ThemeDotDensity = ThemeDotDensity;
  23661. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  23662. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23663. * This program are made available under the terms of the Apache License, Version 2.0
  23664. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23665. /**
  23666. * @class SuperMap.ThemeGraduatedSymbolStyle
  23667. * @category iServer Map Theme
  23668. * @classdesc 等级符号专题图正负零值显示风格类。
  23669. * @param {Object} options - 参数。
  23670. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  23671. * @param {SuperMap.ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  23672. * @param {SuperMap.ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  23673. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  23674. * @param {SuperMap.ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  23675. */
  23676. class ThemeGraduatedSymbolStyle {
  23677. constructor(options) {
  23678. /**
  23679. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  23680. * @description 是否显示负值。
  23681. */
  23682. this.negativeDisplayed = false;
  23683. /**
  23684. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  23685. * @description 负值的等级符号风格。
  23686. */
  23687. this.negativeStyle = new ServerStyle();
  23688. /**
  23689. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  23690. * @description 正值的等级符号风格。
  23691. */
  23692. this.positiveStyle = new ServerStyle();
  23693. /**
  23694. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  23695. * @description 是否显示 0 值。
  23696. */
  23697. this.zeroDisplayed = false;
  23698. /**
  23699. * @member {SuperMap.ServerStyle} SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroStyle
  23700. * @description 0 值的等级符号风格。
  23701. */
  23702. this.zeroStyle = new ServerStyle();
  23703. if (options) {
  23704. Util.extend(this, options);
  23705. }
  23706. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  23707. }
  23708. /**
  23709. * @function SuperMap.ThemeGraduatedSymbolStyle.prototype.destroy
  23710. * @description 释放资源,将引用资源的属性置空。
  23711. */
  23712. destroy() {
  23713. var me = this;
  23714. me.negativeDisplayed = null;
  23715. me.negativeStyle = null;
  23716. me.positiveStyle = null;
  23717. me.zeroDisplayed = null;
  23718. me.zeroStyle = null;
  23719. }
  23720. /**
  23721. * @function SuperMap.ThemeGraduatedSymbolStyle.fromObj
  23722. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  23723. * @param {Object} obj - 传入对象。
  23724. * @returns {SuperMap.ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  23725. */
  23726. static fromObj(obj) {
  23727. if (!obj) {
  23728. return;
  23729. }
  23730. var res = new ThemeGraduatedSymbolStyle();
  23731. Util.copy(res, obj);
  23732. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  23733. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  23734. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  23735. return res;
  23736. }
  23737. }
  23738. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  23739. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  23740. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23741. * This program are made available under the terms of the Apache License, Version 2.0
  23742. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23743. /**
  23744. * @class SuperMap.ThemeGraduatedSymbol
  23745. * @category iServer Map Theme
  23746. * @classdesc 等级符号专题图。
  23747. * @extends {SuperMap.Theme}
  23748. * @param {Object} options - 参数。
  23749. * @param {SuperMap.ThemeGraduatedSymbolStyle} options.style - 用于设置等级符号图正负和零值显示风格。
  23750. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  23751. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  23752. * @param {SuperMap.ThemeFlow} [options.flow] - 等级符号专题图符号流动显示与牵引线设置类。
  23753. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  23754. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  23755. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23756. */
  23757. class ThemeGraduatedSymbol extends Theme {
  23758. constructor(options) {
  23759. super("GRADUATEDSYMBOL", options);
  23760. /**
  23761. * @member {number} [SuperMap.ThemeGraduatedSymbol.prototype.baseValue=0]
  23762. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  23763. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  23764. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  23765. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  23766. */
  23767. this.baseValue = 0;
  23768. /**
  23769. * @member {string} SuperMap.ThemeGraduatedSymbol.prototype.expression
  23770. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  23771. */
  23772. this.expression = null;
  23773. /**
  23774. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraduatedSymbol.prototype.flow
  23775. * @description 等级符号专题图符号流动显示与牵引线设置类。<br>
  23776. * 通过该字段可以设置等级符号是否流动显示和牵引线风格。
  23777. */
  23778. this.flow = new ThemeFlow();
  23779. /**
  23780. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraduatedSymbol.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  23781. * @description 等级符号专题图分级模式。<br>
  23782. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  23783. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  23784. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  23785. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  23786. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  23787. */
  23788. this.graduatedMode = SuperMap.GraduatedMode.CONSTAN;
  23789. /**
  23790. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeGraduatedSymbol.prototype.offset]
  23791. * @description 用于设置等级符号图相对于要素内点的偏移量。
  23792. */
  23793. this.offset = new ThemeOffset();
  23794. /**
  23795. * @member {SuperMap.ThemeGraduatedSymbolStyle} SuperMap.ThemeGraduatedSymbol.prototype.style
  23796. * @description 用于设置等级符号图正负和零值显示风格。
  23797. */
  23798. this.style = new ThemeGraduatedSymbolStyle();
  23799. if (options) {
  23800. Util.extend(this, options);
  23801. }
  23802. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  23803. }
  23804. /**
  23805. * @function SuperMap.ThemeGraduatedSymbol.prototype.destroy
  23806. * @description 释放资源,将引用资源的属性置空。
  23807. */
  23808. destroy() {
  23809. super.destroy();
  23810. var me = this;
  23811. me.expression = null;
  23812. if (me.flow) {
  23813. me.flow.destroy();
  23814. me.flow = null;
  23815. }
  23816. me.graduatedMode = GraduatedMode.CONSTANT;
  23817. if (me.offset) {
  23818. me.offset.destroy();
  23819. me.offset = null;
  23820. }
  23821. if (me.style) {
  23822. me.style.destroy();
  23823. me.style = null;
  23824. }
  23825. }
  23826. /**
  23827. * @function SuperMap.ThemeGraduatedSymbol.prototype.toJSON
  23828. * @description 将 themeLabel 对象转化为 JSON 字符串。
  23829. * @returns {string} 返回转换后的 JSON 字符串。
  23830. */
  23831. toJSON() {
  23832. return Util.toJSON(this.toServerJSONObject());
  23833. }
  23834. /**
  23835. * @function SuperMap.ThemeGraduatedSymbol.prototype.toServerJSONObject
  23836. * @description 转换成对应的 JSON 格式对象。
  23837. * @returns {Object} 对应的 JSON 格式对象。
  23838. */
  23839. toServerJSONObject() {
  23840. var obj = {};
  23841. obj.type = this.type;
  23842. obj.memoryData = this.memoryData;
  23843. obj.baseValue = this.baseValue;
  23844. obj.expression = this.expression;
  23845. obj.graduatedMode = this.graduatedMode;
  23846. if (this.flow) {
  23847. obj.flowEnabled = this.flow.flowEnabled;
  23848. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  23849. obj.leaderLineStyle = this.flow.leaderLineStyle;
  23850. }
  23851. if (this.offset) {
  23852. obj.offsetFixed = this.offset.offsetFixed;
  23853. obj.offsetX = this.offset.offsetX;
  23854. obj.offsetY = this.offset.offsetY;
  23855. }
  23856. if (this.style) {
  23857. obj.negativeStyle = this.style.negativeStyle;
  23858. obj.negativeDisplayed = this.style.negativeDisplayed;
  23859. obj.positiveStyle = this.style.positiveStyle;
  23860. obj.zeroDisplayed = this.style.zeroDisplayed;
  23861. obj.zeroStyle = this.style.zeroStyle;
  23862. }
  23863. return obj;
  23864. }
  23865. /**
  23866. * @function SuperMap.ThemeGraduatedSymbol.fromObj
  23867. * @description 从传入对象获取等级符号专题图。
  23868. * @param {Object} obj - 传入对象。
  23869. * @returns {SuperMap.ThemeGraduatedSymbol} 等级符号专题图对象。
  23870. */
  23871. static fromObj(obj) {
  23872. if (!obj) {
  23873. return;
  23874. }
  23875. var res = new SuperMap.ThemeGraduatedSymbol();
  23876. Util.copy(res, obj);
  23877. res.flow = ThemeFlow.fromObj(obj);
  23878. res.offset = ThemeOffset.fromObj(obj);
  23879. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  23880. return res;
  23881. }
  23882. }
  23883. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  23884. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  23885. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23886. * This program are made available under the terms of the Apache License, Version 2.0
  23887. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23888. /**
  23889. * @class SuperMap.ThemeRangeItem
  23890. * @category iServer Map Theme
  23891. * @classdesc 范围分段专题图子项类。
  23892. * @description 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  23893. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  23894. * @param {Object} options - 参数。
  23895. * @param {string} [options.caption] - 分段专题图子项的标题。
  23896. * @param {number} [options.end=0] - 分段专题图子项的终止值。
  23897. * @param {number} [options.start=0] - 分段专题图子项的起始值。
  23898. * @param {SuperMap.ServerStyle} options.style - 分段专题图子项的风格。
  23899. * @param {boolean} [options.visible=true] - 分段专题图子项是否可见。
  23900. */
  23901. class ThemeRangeItem {
  23902. constructor(options) {
  23903. /**
  23904. * @member {string} [SuperMap.ThemeRangeItem.prototype.caption]
  23905. * @description 分段专题图子项的标题。
  23906. */
  23907. this.caption = null;
  23908. /**
  23909. * @member {number} [SuperMap.ThemeRangeItem.prototype.end=0]
  23910. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  23911. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  23912. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  23913. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  23914. */
  23915. this.end = 0;
  23916. /**
  23917. * @member {number} [SuperMap.ThemeRangeItem.prototype.start=0]
  23918. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  23919. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  23920. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  23921. */
  23922. this.start = 0;
  23923. /**
  23924. * @member {SuperMap.ServerStyle} SuperMap.ThemeRangeItem.prototype.style
  23925. * @description 分段专题图子项的风格。
  23926. * 每一个分段专题图子项都对应一种显示风格。
  23927. */
  23928. this.style = new ServerStyle();
  23929. /**
  23930. * @member {boolean} [SuperMap.ThemeRangeItem.prototype.visible=true]
  23931. * @description 分段专题图子项是否可见。
  23932. */
  23933. this.visible = true;
  23934. if (options) {
  23935. Util.extend(this, options);
  23936. }
  23937. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  23938. }
  23939. /**
  23940. * @function SuperMap.ThemeRangeItem.prototype.destroy
  23941. * @description 释放资源,将引用资源的属性置空。
  23942. */
  23943. destroy() {
  23944. var me = this;
  23945. me.caption = null;
  23946. me.end = null;
  23947. me.start = null;
  23948. if (me.style) {
  23949. me.style.destroy();
  23950. me.style = null;
  23951. }
  23952. me.visible = null;
  23953. }
  23954. /**
  23955. * @function SuperMap.ThemeRangeItem.prototypetoServerJSONObject
  23956. * @description 转换成对应的 JSON 格式对象。
  23957. * @returns {Object} 对应的 JSON 格式对象。
  23958. */
  23959. toServerJSONObject() {
  23960. var obj = {};
  23961. obj = Util.copyAttributes(obj, this);
  23962. if (obj.style) {
  23963. if (obj.style.toServerJSONObject) {
  23964. obj.style = obj.style.toServerJSONObject();
  23965. }
  23966. }
  23967. return obj;
  23968. }
  23969. /**
  23970. * @function SuperMap.ThemeRangeItem.fromObj
  23971. * @description 从传入对象获取范围分段专题图子项类。
  23972. * @param {Object} obj - 传入对象。
  23973. * @returns {SuperMap.ThemeRangeItem} ThemeRangeItem 对象。
  23974. */
  23975. static fromObj(obj) {
  23976. if (!obj) {
  23977. return;
  23978. }
  23979. var res = new ThemeRangeItem();
  23980. Util.copy(res, obj);
  23981. res.style = ServerStyle.fromJson(obj.style);
  23982. return res;
  23983. }
  23984. }
  23985. SuperMap.ThemeRangeItem = ThemeRangeItem;
  23986. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  23987. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23988. * This program are made available under the terms of the Apache License, Version 2.0
  23989. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23990. /**
  23991. * @class SuperMap.ThemeRange
  23992. * @category iServer Map Theme
  23993. * @classdesc 范围分段专题图。
  23994. * @description 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  23995. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  23996. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  23997. * @extends {SuperMap.Theme}
  23998. * @param {Object} options - 参数。
  23999. * @param {Array.<SuperMap.ThemeRangeItem>} options.items - 分段专题图子项数组。
  24000. * @param {string} options.rangeExpression - 分段字段表达式。
  24001. * @param {number} options.rangeParameter - 分段参数。
  24002. * @param {number} options.rangeParameter - 分段参数。
  24003. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  24004. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  24005. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24006. */
  24007. class ThemeRange extends Theme {
  24008. constructor(options) {
  24009. super("RANGE", options);
  24010. /**
  24011. * @member {string} SuperMap.ThemeRange.prototype.precision
  24012. * @description 精准度
  24013. */
  24014. this.precision = '1.0E-12';
  24015. /**
  24016. * @member {Array.<SuperMap.ThemeRangeItem>} SuperMap.ThemeRange.prototype.items
  24017. * @description 分段专题图子项数组。<br>
  24018. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  24019. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  24020. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  24021. */
  24022. this.items = null;
  24023. /**
  24024. * @member {string} SuperMap.ThemeRange.prototype.rangeExpression
  24025. * @description 分段字段表达式。<br>
  24026. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  24027. */
  24028. this.rangeExpression = null;
  24029. /**
  24030. * @member {SuperMap.RangeMode} [SuperMap.ThemeRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  24031. * @description 分段专题图的分段模式。<br>
  24032. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  24033. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  24034. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  24035. */
  24036. this.rangeMode = RangeMode.EQUALINTERVAL;
  24037. /**
  24038. * @member {number} SuperMap.ThemeRange.prototype.rangeParameter
  24039. * @description 分段参数。
  24040. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  24041. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  24042. */
  24043. this.rangeParameter = 0;
  24044. /**
  24045. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  24046. * @description 渐变颜色枚举类。<br>
  24047. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  24048. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色
  24049. * 方案完成填*充。但如果为某几个子项的风格进行单独设置后(设置了 {@link SuperMap.ThemeUniqueItem} 或 {@link SuperMap.ThemeRangeItem} 类中Style属性),
  24050. * 该配色方案对于这几个子项将不起作用。
  24051. */
  24052. this.colorGradientType = ColorGradientType.YELLOW_RED;
  24053. if (options) {
  24054. Util.extend(this, options);
  24055. }
  24056. this.CLASS_NAME = "SuperMap.ThemeRange";
  24057. }
  24058. /**
  24059. * @function SuperMap.ThemeRange.prototype.destroy
  24060. * @override
  24061. */
  24062. destroy() {
  24063. super.destroy();
  24064. var me = this;
  24065. if (me.items) {
  24066. if (me.items.length > 0) {
  24067. for (var item in me.items) {
  24068. me.items[item].destroy();
  24069. me.items[item] = null;
  24070. }
  24071. }
  24072. me.items = null;
  24073. }
  24074. me.rangeExpression = null;
  24075. me.rangeMode = null;
  24076. me.rangeParameter = null;
  24077. me.colorGradientType = null;
  24078. }
  24079. /**
  24080. * @function SuperMap.ThemeRange.fromObj
  24081. * @description 从传入对象获取范围分段专题图类。
  24082. * @param {Object} obj - 传入对象。
  24083. * @returns {SuperMap.ThemeRange} ThemeRange 对象。
  24084. */
  24085. static fromObj(obj) {
  24086. if (!obj) {
  24087. return;
  24088. }
  24089. var res = new ThemeRange();
  24090. Util.copy(res, obj);
  24091. var itemsR = obj.items;
  24092. var len = itemsR ? itemsR.length : 0;
  24093. res.items = [];
  24094. for (var i = 0; i < len; i++) {
  24095. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  24096. }
  24097. return res;
  24098. }
  24099. }
  24100. SuperMap.ThemeRange = ThemeRange;
  24101. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  24102. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24103. * This program are made available under the terms of the Apache License, Version 2.0
  24104. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24105. /**
  24106. * @class SuperMap.UGCLayer
  24107. * @category iServer Map Layer
  24108. * @classdesc UGC 图层类。
  24109. * @param {Object} options - 参数。
  24110. * @param {SuperMap.Bounds} options.bounds - 图层范围。
  24111. * @param {string} options.name - 图层的名称。
  24112. * @param {SuperMap.UGCLayerType} options.type - 图层类型
  24113. * @param {string} [options.caption] - 图层的标题。
  24114. * @param {string} [options.description] - 图层的描述信息。
  24115. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  24116. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  24117. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  24118. */
  24119. class UGCLayer {
  24120. constructor(options) {
  24121. options = options || {};
  24122. /**
  24123. * @member {SuperMap.Bounds} SuperMap.UGCLayer.prototype.bounds
  24124. * @description 图层范围。
  24125. */
  24126. this.bounds = null;
  24127. /**
  24128. * @member {string} [SuperMap.UGCLayer.prototype.caption]
  24129. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  24130. */
  24131. this.caption = null;
  24132. /**
  24133. * @member {string} SuperMap.UGCLayer.prototype.description
  24134. * @description 图层的描述信息。
  24135. */
  24136. this.description = null;
  24137. /**
  24138. * @member {string} SuperMap.UGCLayer.prototype.name
  24139. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  24140. */
  24141. this.name = null;
  24142. /**
  24143. * @member {boolean} SuperMap.UGCLayer.prototype.queryable
  24144. * @description 图层中的对象是否可以查询。
  24145. */
  24146. this.queryable = null;
  24147. /**
  24148. * @member {Array} SuperMap.UGCLayer.prototype.subLayers
  24149. * @description 子图层集。
  24150. */
  24151. this.subLayers = null;
  24152. /**
  24153. * @member {SuperMap.UGCLayerType} SuperMap.UGCLayer.prototype.type
  24154. * @description 图层类型。
  24155. */
  24156. this.type = null;
  24157. /**
  24158. * @member {boolean} SuperMap.UGCLayer.prototype.visible
  24159. * @description 地图对象在同一范围内时,是否重叠显示。
  24160. */
  24161. this.visible = null;
  24162. Util.extend(this, options);
  24163. this.CLASS_NAME = "SuperMap.UGCLayer";
  24164. }
  24165. /**
  24166. * @function SuperMap.UGCLayer.prototype.destroy
  24167. * @description 释放资源,将引用资源的属性置空。
  24168. */
  24169. destroy() {
  24170. var me = this;
  24171. Util.reset(me);
  24172. }
  24173. /**
  24174. * @function SuperMap.UGCLayer.prototype.fromJson
  24175. * @description 将服务端 JSON 对象转换成当前客户端对象。
  24176. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24177. */
  24178. fromJson(jsonObject) {
  24179. jsonObject = jsonObject ? jsonObject : {};
  24180. Util.extend(this, jsonObject);
  24181. var b = this.bounds;
  24182. if (b) {
  24183. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  24184. }
  24185. }
  24186. /**
  24187. * @function SuperMap.UGCLayer.prototype.toServerJSONObject
  24188. * @description 转换成对应的 JSON 格式对象。
  24189. * @returns {Object} 对应的 JSON 格式对象。
  24190. */
  24191. toServerJSONObject() {
  24192. var jsonObject = {};
  24193. jsonObject = Util.copyAttributes(jsonObject, this);
  24194. if (jsonObject.bounds) {
  24195. if (jsonObject.bounds.toServerJSONObject) {
  24196. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  24197. }
  24198. }
  24199. return jsonObject;
  24200. }
  24201. }
  24202. SuperMap.UGCLayer = UGCLayer;
  24203. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  24204. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24205. * This program are made available under the terms of the Apache License, Version 2.0
  24206. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24207. /**
  24208. * @class SuperMap.OverlapDisplayedOptions
  24209. * @category iServer Map Layer
  24210. * @classdesc 地图压盖过滤显示选项。
  24211. * @description 在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  24212. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  24213. * @param {Object} options - 参数。
  24214. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  24215. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  24216. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  24217. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  24218. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  24219. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  24220. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  24221. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  24222. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  24223. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  24224. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  24225. */
  24226. class OverlapDisplayedOptions {
  24227. constructor(options) {
  24228. options = options || {};
  24229. /**
  24230. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  24231. * @description 点和点压盖时是否显示压盖的点对象。
  24232. */
  24233. this.allowPointOverlap = true;
  24234. /**
  24235. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  24236. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  24237. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  24238. */
  24239. this.allowPointWithTextDisplay = true;
  24240. /**
  24241. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  24242. * @description 文本压盖时是否显示压盖的文本对象。
  24243. */
  24244. this.allowTextOverlap = false;
  24245. /**
  24246. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  24247. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  24248. */
  24249. this.allowTextAndPointOverlap = true;
  24250. /**
  24251. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  24252. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  24253. */
  24254. this.allowThemeGraduatedSymbolOverlap = false;
  24255. /**
  24256. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  24257. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  24258. */
  24259. this.allowThemeGraphOverlap = false;
  24260. /**
  24261. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  24262. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  24263. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  24264. */
  24265. this.horizontalOverlappedSpaceSize = 0;
  24266. /**
  24267. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  24268. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  24269. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  24270. */
  24271. this.verticalOverlappedSpaceSize = 0;
  24272. Util.extend(this, options);
  24273. this.ugcLayer = new UGCLayer(options);
  24274. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  24275. }
  24276. /**
  24277. * @function SuperMap.OverlapDisplayedOptions.prototype.destroy
  24278. * @description 释放资源,将资源的属性置空。
  24279. */
  24280. destroy() {
  24281. Util.reset(this);
  24282. }
  24283. /**
  24284. * @function SuperMap.OverlapDisplayedOptions.prototype.fromJson
  24285. * @description 将服务端 JSON 对象转换成当前客户端对象。
  24286. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24287. */
  24288. fromJson(jsonObject) {
  24289. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  24290. }
  24291. /**
  24292. * @function SuperMap.OverlapDisplayedOptions.prototype.toServerJSONObject
  24293. * @description 转换成对应的 JSON 格式对象。
  24294. * @returns {Object} 对应的 JSON 格式对象。
  24295. */
  24296. toServerJSONObject() {
  24297. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  24298. return jsonObject;
  24299. }
  24300. /**
  24301. * @function SuperMap.OverlapDisplayedOptions.prototype.toString
  24302. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  24303. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  24304. */
  24305. toString() {
  24306. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  24307. var str = "{";
  24308. for (var attr in jsonObject) {
  24309. if (jsonObject.hasOwnProperty(attr)) {
  24310. str += "'" + attr + "':" + jsonObject[attr] + ",";
  24311. }
  24312. }
  24313. str = str.substr(0, str.length - 1);
  24314. str += "}";
  24315. return str;
  24316. }
  24317. }
  24318. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  24319. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  24320. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24321. * This program are made available under the terms of the Apache License, Version 2.0
  24322. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24323. /**
  24324. * @class SuperMap.UGCMapLayer
  24325. * @category iServer Map Layer
  24326. * @classdesc UGC 地图图层类。
  24327. * @extends {SuperMap.UGCLayer}
  24328. * @param {Object} options - 参数。
  24329. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  24330. * @param {number} [options.maxScale] - 地图最大比例尺。
  24331. * @param {number} [options.minScale] - 地图最小比例尺。
  24332. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  24333. * @param {number} [options.opaqueRate] - 图层的不透明度。
  24334. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  24335. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  24336. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  24337. * @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  24338. */
  24339. class UGCMapLayer extends UGCLayer {
  24340. constructor(options) {
  24341. options = options || {};
  24342. super(options);
  24343. /**
  24344. * @member {boolean} SuperMap.UGCMapLayer.prototype.completeLineSymbolDisplayed
  24345. * @description 是否显示完整线型。
  24346. */
  24347. this.completeLineSymbolDisplayed = null;
  24348. /**
  24349. * @member {number} SuperMap.UGCMapLayer.prototype.maxScale
  24350. * @description 地图最大比例尺。
  24351. */
  24352. this.maxScale = null;
  24353. /**
  24354. * @member {number} SuperMap.UGCMapLayer.prototype.minScale
  24355. * @description 地图最小比例尺。
  24356. */
  24357. this.minScale = null;
  24358. /**
  24359. * @member {number} SuperMap.UGCMapLayer.prototype.minVisibleGeometrySize
  24360. * @description 几何对象的最小可见大小,以像素为单位。
  24361. */
  24362. this.minVisibleGeometrySize = null;
  24363. /**
  24364. * @member {number} SuperMap.UGCMapLayer.prototype.opaqueRate
  24365. * @description 图层的不透明度。
  24366. */
  24367. this.opaqueRate = null;
  24368. /**
  24369. * @member {boolean} SuperMap.UGCMapLayer.prototype.symbolScalable
  24370. * @description 是否允许图层的符号大小随图缩放。
  24371. */
  24372. this.symbolScalable = null;
  24373. /**
  24374. * @member {number} SuperMap.UGCMapLayer.prototype.symbolScale
  24375. * @description 图层的符号缩放基准比例尺。
  24376. */
  24377. this.symbolScale = null;
  24378. /**
  24379. * @member {boolean} [SuperMap.UGCMapLayer.prototype.overlapDisplayed=false]
  24380. * @description 地图对象在同一范围内时,是否重叠显示。
  24381. */
  24382. this.overlapDisplayed = null;
  24383. /**
  24384. * @member {SuperMap.OverlapDisplayedOptions} SuperMap.UGCMapLayer.prototype.overlapDisplayedOptions
  24385. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  24386. */
  24387. this.overlapDisplayedOptions = null;
  24388. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  24389. }
  24390. /**
  24391. * @function SuperMap.UGCMapLayer.prototype.destroy
  24392. * @override
  24393. */
  24394. destroy() {
  24395. super.destroy();
  24396. Util.reset(this);
  24397. }
  24398. /**
  24399. * @function SuperMap.UGCMapLayer.prototype.fromJson
  24400. * @description 将服务端 JSON 对象转换成当前客户端对象
  24401. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24402. */
  24403. fromJson(jsonObject) {
  24404. super.fromJson(jsonObject);
  24405. }
  24406. /**
  24407. * @function SuperMap.UGCMapLayer.prototype.toServerJSONObject
  24408. * @description 转换成对应的 JSON 格式对象。
  24409. * @returns {Object} 对应的 JSON 格式对象。
  24410. */
  24411. toServerJSONObject() {
  24412. return super.toServerJSONObject();
  24413. }
  24414. }
  24415. SuperMap.UGCMapLayer = UGCMapLayer;
  24416. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  24417. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24418. * This program are made available under the terms of the Apache License, Version 2.0
  24419. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24420. /**
  24421. * @class SuperMap.UGCSubLayer
  24422. * @category iServer Map Layer
  24423. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  24424. * @extends {SuperMap.UGCMapLayer}
  24425. * @param {Object} options - 参数。
  24426. * @param {SuperMap.DatasetInfo} options.datasetInfo - 数据集信息。
  24427. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  24428. * @param {SuperMap.JoinItem} [options.joinItems] - 连接信息类。
  24429. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  24430. * @param {SuperMap.LayerType} [options.ugcLayerType] - 图层类型。
  24431. */
  24432. class UGCSubLayer extends UGCMapLayer {
  24433. constructor(options) {
  24434. options = options || {};
  24435. super(options);
  24436. /**
  24437. * @member {SuperMap.DatasetInfo} SuperMap.UGCSubLayer.prototype.datasetInfo
  24438. * @description 数据集信息。
  24439. */
  24440. this.datasetInfo = null;
  24441. /**
  24442. * @member {string} SuperMap.UGCSubLayer.prototype.displayFilter
  24443. * @description 图层显示过滤条件。
  24444. */
  24445. this.displayFilter = null;
  24446. /**
  24447. * @member {SuperMap.JoinItem} SuperMap.UGCSubLayer.prototype.joinItems
  24448. * @description 连接信息类。
  24449. */
  24450. this.joinItems = null;
  24451. /**
  24452. * @member {string} SuperMap.UGCSubLayer.prototype.representationField
  24453. * @description 存储制图表达信息的字段。
  24454. */
  24455. this.representationField = null;
  24456. /**
  24457. * @member {SuperMap.LayerType} SuperMap.UGCSubLayer.prototype.ugcLayerType
  24458. * @description 图层类型。
  24459. */
  24460. this.ugcLayerType = null;
  24461. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  24462. }
  24463. /**
  24464. * @function SuperMap.UGCSubLayer.prototype.fromJson
  24465. * @description 将服务端 JSON 对象转换成当前客户端对象
  24466. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24467. */
  24468. fromJson(jsonObject) {
  24469. super.fromJson(jsonObject);
  24470. if (this.datasetInfo) {
  24471. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  24472. }
  24473. if (this.joinItems && this.joinItems.length) {
  24474. var newJoinItems = [];
  24475. for (var i = 0; i < this.joinItems.length; i++) {
  24476. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  24477. }
  24478. this.joinItems = newJoinItems;
  24479. }
  24480. }
  24481. /**
  24482. * @function SuperMap.UGCSubLayer.prototype.destroy
  24483. * @override
  24484. */
  24485. destroy() {
  24486. super.destroy();
  24487. Util.reset(this);
  24488. }
  24489. /**
  24490. * @function SuperMap.UGCSubLayer.prototype.toServerJSONObject
  24491. * @description 转换成对应的 JSON 格式对象。
  24492. * @returns {Object} 对应的 JSON 格式对象。
  24493. */
  24494. toServerJSONObject() {
  24495. var jsonObject = super.toServerJSONObject();
  24496. if (jsonObject.joinItems) {
  24497. var joinItems = [];
  24498. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  24499. if (jsonObject.joinItems[i].toServerJSONObject) {
  24500. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  24501. }
  24502. }
  24503. jsonObject.joinItems = joinItems;
  24504. }
  24505. if (jsonObject.datasetInfo) {
  24506. if (jsonObject.datasetInfo.toServerJSONObject) {
  24507. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  24508. }
  24509. }
  24510. return jsonObject;
  24511. }
  24512. }
  24513. SuperMap.UGCSubLayer = UGCSubLayer;
  24514. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  24515. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24516. * This program are made available under the terms of the Apache License, Version 2.0
  24517. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24518. /**
  24519. * @class SuperMap.ServerTheme
  24520. * @category iServer Map Theme
  24521. * @classdesc UGC 专题图图层类。
  24522. * @extends {SuperMap.UGCSubLayer}
  24523. * @param {SuperMap.Theme} theme - 专题图对象。
  24524. * @param {SuperMap.LonLat} themeElementPosition - 专题图元素位置。
  24525. */
  24526. class ServerTheme extends UGCSubLayer {
  24527. constructor(options) {
  24528. options = options || {};
  24529. super(options);
  24530. /**
  24531. * @member {SuperMap.Theme} SuperMap.ServerTheme.prototype.theme
  24532. * @description 专题图对象。
  24533. */
  24534. this.theme = null;
  24535. /**
  24536. * @member {SuperMap.LonLat} SuperMap.ServerTheme.prototype.themeElementPosition
  24537. * @description 专题图元素位置。
  24538. */
  24539. this.themeElementPosition = null;
  24540. this.CLASS_NAME = "SuperMap.ServerTheme";
  24541. }
  24542. /**
  24543. * @function SuperMap.ServerTheme.prototype.destroy
  24544. * @override
  24545. */
  24546. destroy() {
  24547. super.destroy();
  24548. Util.reset(this);
  24549. }
  24550. /**
  24551. * @function SuperMap.ServerTheme.prototype.fromJson
  24552. * @description 将服务端 JSON 对象转换成当前客户端对象
  24553. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24554. */
  24555. fromJson(jsonObject) {
  24556. super.fromJson(jsonObject);
  24557. var themeObj = this.theme;
  24558. var themeT = themeObj && themeObj.type;
  24559. switch (themeT) {
  24560. case 'LABEL':
  24561. this.theme = ThemeLabel.fromObj(themeObj);
  24562. break;
  24563. case 'UNIQUE':
  24564. this.theme = ThemeUnique.fromObj(themeObj);
  24565. break;
  24566. case 'GRAPH':
  24567. this.theme = ThemeGraph.fromObj(themeObj);
  24568. break;
  24569. case 'DOTDENSITY':
  24570. this.theme = ThemeDotDensity.fromObj(themeObj);
  24571. break;
  24572. case 'GRADUATEDSYMBOL':
  24573. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  24574. break;
  24575. case 'RANGE':
  24576. this.theme = ThemeRange.fromObj(themeObj);
  24577. break;
  24578. default:
  24579. break;
  24580. }
  24581. if (this.themeElementPosition) {
  24582. //待测试
  24583. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  24584. }
  24585. }
  24586. /**
  24587. * @function SuperMap.ServerTheme.prototype.toServerJSONObject
  24588. * @description 转换成对应的 JSON 格式对象。
  24589. */
  24590. toServerJSONObject() {
  24591. //普通属性直接赋值
  24592. var jsonObject = super.toServerJSONObject();
  24593. if (jsonObject.themeElementPosition) {
  24594. if (jsonObject.themeElementPosition.toServerJSONObject) {
  24595. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  24596. }
  24597. }
  24598. if (jsonObject.theme) {
  24599. if (jsonObject.theme.toServerJSONObject) {
  24600. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  24601. }
  24602. }
  24603. return jsonObject;
  24604. }
  24605. }
  24606. SuperMap.ServerTheme = ServerTheme;
  24607. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  24608. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24609. * This program are made available under the terms of the Apache License, Version 2.0
  24610. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24611. /**
  24612. * @class SuperMap.Grid
  24613. * @category iServer Map Layer
  24614. * @classdesc UGC 栅格图层类。
  24615. * @extends {SuperMap.UGCSubLayer}
  24616. * @param {Object} options - 参数。
  24617. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  24618. * @param {number} [options.brightness] - Grid 图层的亮度。
  24619. * @param {SuperMap.ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  24620. * @param {SuperMap.ServerColor} [options.colors] - 颜色表对象。
  24621. * @param {number} [options.contrast] - Grid 图层的对比度。
  24622. * @param {SuperMap.GridType} [options.gridType] - 格网类型。
  24623. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  24624. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  24625. * @param {SuperMap.ServerStyle} [options.solidStyle] - 格网实线的样式。
  24626. * @param {SuperMap.ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  24627. * @param {number} [options.specialValue] - 图层的特殊值。
  24628. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  24629. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  24630. */
  24631. class Grid extends UGCSubLayer {
  24632. constructor(options) {
  24633. options = options || {};
  24634. super(options);
  24635. /**
  24636. * @member {Array.<SuperMap.ColorDictionary>} SuperMap.Grid.prototype.colorDictionarys
  24637. * @description 颜色对照表对象。
  24638. */
  24639. this.colorDictionarys = null;
  24640. /**
  24641. * @member {number} SuperMap.Grid.prototype.brightness
  24642. * @description Grid 图层的亮度。
  24643. */
  24644. this.brightness = null;
  24645. /**
  24646. * @member {SuperMap.ColorGradientType} SuperMap.Grid.prototype.colorGradientType
  24647. * @description 渐变颜色枚举值。
  24648. */
  24649. this.colorGradientType = null;
  24650. /**
  24651. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.colors
  24652. * @description 颜色表对象。
  24653. */
  24654. this.colors = null;
  24655. /**
  24656. * @member {number} SuperMap.Grid.prototype.contrast
  24657. * @description Grid 图层的对比度。
  24658. */
  24659. this.contrast = null;
  24660. /**
  24661. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.dashStyle
  24662. * @description 栅格数据集特殊值数据的颜色。
  24663. */
  24664. this.dashStyle = null;
  24665. /**
  24666. * @member {SuperMap.GridType} SuperMap.Grid.prototype.gridType
  24667. * @description 格网类型。
  24668. */
  24669. this.gridType = null;
  24670. /**
  24671. * @member {number} SuperMap.Grid.prototype.horizontalSpacing
  24672. * @description 格网水平间隔大小。
  24673. */
  24674. this.horizontalSpacing = null;
  24675. /**
  24676. * @member {boolean} SuperMap.Grid.prototype.sizeFixed
  24677. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  24678. */
  24679. this.sizeFixed = null;
  24680. /**
  24681. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.solidStyle
  24682. * @description 格网实线的样式。
  24683. */
  24684. this.solidStyle = null;
  24685. /**
  24686. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.specialColor
  24687. * @description 栅格数据集无值数据的颜色。
  24688. */
  24689. this.specialColor = null;
  24690. /**
  24691. * @member {number} SuperMap.Grid.prototype.specialValue
  24692. * @description 图层的特殊值。
  24693. */
  24694. this.specialValue = null;
  24695. /**
  24696. * @member {boolean} SuperMap.Grid.prototype.specialValueTransparent
  24697. * @description 图层的特殊值(specialValue)所处区域是否透明。
  24698. */
  24699. this.specialValueTransparent = null;
  24700. /**
  24701. * @member {number} SuperMap.Grid.prototype.verticalSpacing
  24702. * @description 格网垂直间隔大小。
  24703. */
  24704. this.verticalSpacing = null;
  24705. this.CLASS_NAME = "SuperMap.Grid";
  24706. }
  24707. /**
  24708. * @function SuperMap.Grid.prototype.destroy
  24709. * @description 释放资源,将引用资源的属性置空。
  24710. */
  24711. destroy() {
  24712. super.destroy();
  24713. Util.reset(this);
  24714. }
  24715. /**
  24716. * @function SuperMap.Grid.prototype.fromJson
  24717. * @description 将服务端 JSON 对象转换成当前客户端对象。
  24718. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24719. */
  24720. fromJson(jsonObject) {
  24721. super.fromJson(jsonObject);
  24722. if (this.specialColor) {
  24723. this.specialColor = new ServerColor(this.specialColor.red,
  24724. this.specialColor.green,
  24725. this.specialColor.blue);
  24726. }
  24727. if (this.colors) {
  24728. var colors = [],
  24729. color;
  24730. for (var i in this.colors) {
  24731. color = this.colors[i];
  24732. colors.push(new ServerColor(color.red, color.green, color.blue));
  24733. }
  24734. this.colors = colors;
  24735. }
  24736. if (this.dashStyle) {
  24737. this.dashStyle = new ServerStyle(this.dashStyle);
  24738. }
  24739. if (this.solidStyle) {
  24740. this.solidStyle = new ServerStyle(this.solidStyle);
  24741. }
  24742. if (this.colorDictionary) {
  24743. var colorDics = [],
  24744. colorDic;
  24745. for (var key in this.colorDictionary) {
  24746. colorDic = this.colorDictionary[key];
  24747. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  24748. }
  24749. this.colorDictionarys = colorDics;
  24750. }
  24751. delete this.colorDictionary;
  24752. }
  24753. /**
  24754. * @function SuperMap.Grid.prototype.toServerJSONObject
  24755. * @description 转换成对应的 JSON 对象。
  24756. * @returns JSON 对象。
  24757. */
  24758. toServerJSONObject() {
  24759. var jsonObject = super.toServerJSONObject();
  24760. if (jsonObject.dashStyle) {
  24761. if (jsonObject.dashStyle.toServerJSONObject) {
  24762. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  24763. }
  24764. }
  24765. if (jsonObject.solidStyle) {
  24766. if (jsonObject.solidStyle.toServerJSONObject) {
  24767. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  24768. }
  24769. }
  24770. return jsonObject;
  24771. }
  24772. }
  24773. SuperMap.Grid = Grid;
  24774. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  24775. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24776. * This program are made available under the terms of the Apache License, Version 2.0
  24777. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24778. /**
  24779. * @class SuperMap.Image
  24780. * @category iServer Map Layer
  24781. * @classdesc UGC 影像图层类
  24782. * @extends {SuperMap.UGCSubLayer}
  24783. * @param {Object} options - 参数。
  24784. * @param {SuperMap.ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  24785. * @param {number} [options.brightness] - 影像图层的亮度。
  24786. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  24787. * @param {number} [options.contrast] - 影像图层的对比度。
  24788. * @param {boolean} [options.transparent] - 是否背景透明。
  24789. * @param {SuperMap.ServerColor} [options.transparentColor] - 返回背景透明色。
  24790. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  24791. */
  24792. class UGCImage extends UGCSubLayer {
  24793. constructor(options) {
  24794. options = options || {};
  24795. super(options);
  24796. /**
  24797. * @member {number} SuperMap.Image.prototype.brightness
  24798. * @description 影像图层的亮度。
  24799. */
  24800. this.brightness = null;
  24801. /**
  24802. * @member {SuperMap.ColorSpaceType} SuperMap.Image.prototype.colorSpaceType
  24803. * @description 返回影像图层的色彩显示模式。
  24804. */
  24805. this.colorSpaceType = null;
  24806. /**
  24807. * @member {number} SuperMap.Image.prototype.contrast
  24808. * @description 影像图层的对比度。
  24809. */
  24810. this.contrast = null;
  24811. /**
  24812. * @member {Array.<number>} SuperMap.Image.prototype.displayBandIndexes
  24813. * @description 返回当前影像图层显示的波段索引。
  24814. */
  24815. this.displayBandIndexes = null;
  24816. /**
  24817. * @member {boolean} SuperMap.Image.prototype.transparent
  24818. * @description 是否背景透明。
  24819. */
  24820. this.transparent = null;
  24821. /**
  24822. * @member {SuperMap.ServerColor} SuperMap.Image.prototype.transparentColor
  24823. * @description 返回背景透明色。
  24824. */
  24825. this.transparentColor = null;
  24826. /**
  24827. * @member {number} SuperMap.Image.prototype.transparentColorTolerance
  24828. * @description 背景透明色容限。
  24829. */
  24830. this.transparentColorTolerance = null;
  24831. this.CLASS_NAME = "SuperMap.Image";
  24832. }
  24833. /**
  24834. * @function SuperMap.Image.prototype.destroy
  24835. * @override
  24836. */
  24837. destroy() {
  24838. super.destroy();
  24839. Util.reset(this);
  24840. }
  24841. /**
  24842. * @function SuperMap.Image.prototype.fromJson
  24843. * @description 将服务端 JSON 对象转换成当前客户端对象。
  24844. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24845. */
  24846. fromJson(jsonObject) {
  24847. super.fromJson(jsonObject);
  24848. if (this.transparentColor) {
  24849. this.transparentColor = new ServerColor(this.transparentColor.red,
  24850. this.transparentColor.green,
  24851. this.transparentColor.blue);
  24852. }
  24853. }
  24854. /**
  24855. * @function SuperMap.Image.prototype.toServerJSONObject
  24856. * @description 转换成对应的 JSON 格式对象。
  24857. */
  24858. toServerJSONObject() {
  24859. return super.toServerJSONObject();
  24860. }
  24861. }
  24862. SuperMap.Image = UGCImage;
  24863. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  24864. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24865. * This program are made available under the terms of the Apache License, Version 2.0
  24866. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24867. /**
  24868. * @class SuperMap.Vector
  24869. * @category iServer Map TileFeature
  24870. * @classdesc UGC 矢量图层类。
  24871. * @extends {SuperMap.UGCSubLayer}
  24872. * @param {Object} options - 参数。
  24873. * @param {SuperMap.ServerStyle} [options.style] - 矢量图层的风格。
  24874. */
  24875. class Vector_Vector extends UGCSubLayer {
  24876. constructor(options) {
  24877. options = options || {};
  24878. super(options);
  24879. /**
  24880. * @member {SuperMap.ServerStyle} SuperMap.Vector.prototype.style
  24881. * @description 矢量图层的风格。
  24882. */
  24883. this.style = null;
  24884. this.CLASS_NAME = "SuperMap.Vector";
  24885. }
  24886. /**
  24887. * @function SuperMap.Vector.prototype.destroy
  24888. * @override
  24889. */
  24890. destroy() {
  24891. super.destroy();
  24892. Util.reset(this);
  24893. }
  24894. /**
  24895. * @function SuperMap.Vector.prototype.fromJson
  24896. * @description 将服务端 JSON 对象转换成当前客户端对象。
  24897. * @param {Object} jsonObject - 要转换的 JSON 对象。
  24898. */
  24899. fromJson(jsonObject) {
  24900. super.fromJson(jsonObject);
  24901. var sty = this.style;
  24902. if (sty) {
  24903. this.style = new ServerStyle(sty);
  24904. }
  24905. }
  24906. /**
  24907. * @function SuperMap.Vector.prototype.toServerJSONObject
  24908. * @description 转换成对应的 JSON 格式对象。
  24909. * @returns {Object} 对应的 JSON 格式对象
  24910. */
  24911. toServerJSONObject() {
  24912. var jsonObject = SuperMap.toServerJSONObject();
  24913. if (jsonObject.style) {
  24914. if (jsonObject.style.toServerJSONObject) {
  24915. jsonObject.style = jsonObject.style.toServerJSONObject();
  24916. }
  24917. }
  24918. return jsonObject;
  24919. }
  24920. }
  24921. SuperMap.Vector = Vector_Vector;
  24922. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  24923. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24924. * This program are made available under the terms of the Apache License, Version 2.0
  24925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24926. /**
  24927. * @class SuperMap.GetLayersInfoService
  24928. * @category iServer Map Layer
  24929. * @classdesc 获取图层信息服务类构造函数。
  24930. * @extends {SuperMap.CommonServiceBase}
  24931. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  24932. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  24933. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  24934. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  24935. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  24936. * @param {Object} options - 参数。
  24937. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  24938. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  24939. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  24940. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  24941. * @param {Object} [options.headers] - 请求头。
  24942. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  24943. */
  24944. class GetLayersInfoService extends CommonServiceBase {
  24945. constructor(url, options) {
  24946. super(url, options);
  24947. /**
  24948. * @member {boolean} SuperMap.GetLayersInfoService.prototype.isTempLayers
  24949. * @description 当前url对应的图层是否是临时图层。
  24950. */
  24951. this.isTempLayers = false;
  24952. if (options) {
  24953. Util.extend(this, options);
  24954. }
  24955. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  24956. }
  24957. /**
  24958. * @function SuperMap.GetLayersInfoService.prototype.destroy
  24959. * @override
  24960. */
  24961. destroy() {
  24962. super.destroy();
  24963. Util.reset(this);
  24964. }
  24965. /**
  24966. * @function SuperMap.GetLayersInfoService.prototype.processAsync
  24967. * @description 负责将客户端的更新参数传递到服务端。
  24968. */
  24969. processAsync() {
  24970. var me = this,
  24971. method = "GET";
  24972. if (!me.isTempLayers) {
  24973. me.url = Util.urlPathAppend(me.url, 'layers');
  24974. }
  24975. me.request({
  24976. method: method,
  24977. params: null,
  24978. scope: me,
  24979. success: me.serviceProcessCompleted,
  24980. failure: me.serviceProcessFailed
  24981. });
  24982. }
  24983. /**
  24984. * @function SuperMap.GetLayersInfoService.prototype.serviceProcessCompleted
  24985. * @description 编辑完成,执行此方法。
  24986. * @param {Object} result - 服务器返回的结果对象。
  24987. */
  24988. serviceProcessCompleted(result) {
  24989. var me = this, existRes, layers, len;
  24990. result = Util.transformResult(result);
  24991. existRes = !!result && result.length > 0;
  24992. layers = existRes ? result[0].subLayers.layers : null;
  24993. len = layers ? layers.length : 0;
  24994. me.handleLayers(len, layers);
  24995. me.events.triggerEvent("processCompleted", {result: result[0]});
  24996. }
  24997. /**
  24998. * TODO 专题图时候可能会用到
  24999. * @function SuperMap.GetLayersInfoService.prototype.handleLayers
  25000. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  25001. * @param {number} len - subLayers.layers的长度
  25002. * @param {Array.<number>} layers - subLayers.layers的长度数组
  25003. */
  25004. handleLayers(len, layers) {
  25005. var me = this, tempLayer;
  25006. if (len) {
  25007. for (var i = 0; i < len; i++) {
  25008. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  25009. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  25010. } else {
  25011. var type = layers[i].ugcLayerType;
  25012. switch (type) {
  25013. case 'THEME':
  25014. tempLayer = new ServerTheme();
  25015. tempLayer.fromJson(layers[i]);
  25016. layers[i] = tempLayer;
  25017. break;
  25018. case 'GRID':
  25019. tempLayer = new Grid();
  25020. tempLayer.fromJson(layers[i]);
  25021. layers[i] = tempLayer;
  25022. break;
  25023. case 'IMAGE':
  25024. tempLayer = new UGCImage();
  25025. tempLayer.fromJson(layers[i]);
  25026. layers[i] = tempLayer;
  25027. break;
  25028. case 'VECTOR':
  25029. tempLayer = new Vector_Vector();
  25030. tempLayer.fromJson(layers[i]);
  25031. layers[i] = tempLayer;
  25032. break;
  25033. default:
  25034. break;
  25035. }
  25036. }
  25037. }
  25038. }
  25039. }
  25040. }
  25041. SuperMap.GetLayersInfoService = GetLayersInfoService;
  25042. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  25043. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25044. * This program are made available under the terms of the Apache License, Version 2.0
  25045. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25046. /**
  25047. * @class SuperMap.InterpolationAnalystParameters
  25048. * @category iServer SpatialAnalyst InterpolationAnalyst
  25049. * @classdesc 插值分析参数类。
  25050. * @param {Object} options - 参数。
  25051. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  25052. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  25053. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  25054. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。
  25055. * @param {string} [options.dataset] - 用于做插值分析的数据源中数据集的名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  25056. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  25057. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  25058. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  25059. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25060. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  25061. * @param {SuperMap.PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  25062. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  25063. */
  25064. class InterpolationAnalystParameters {
  25065. constructor(options) {
  25066. if (!options) {
  25067. return;
  25068. }
  25069. /**
  25070. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.InterpolationAnalystParameters.prototype.bounds
  25071. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  25072. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  25073. * 因此建议此参数不大于原数据集范围。
  25074. */
  25075. this.bounds = null;
  25076. /**
  25077. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.searchRadius=0]
  25078. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  25079. * 计算某个位置的Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  25080. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  25081. */
  25082. this.searchRadius = 0;
  25083. /**
  25084. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.zValueFieldName
  25085. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  25086. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  25087. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  25088. */
  25089. this.zValueFieldName = null;
  25090. /**
  25091. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.zValueScale=1]
  25092. * @description 用于进行插值分析值的缩放比率。
  25093. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  25094. */
  25095. this.zValueScale = 1;
  25096. /**
  25097. * @member {number} SuperMap.InterpolationAnalystParameters.prototype.resolution
  25098. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25099. * 该值不能超过待分析数据集的范围边长。
  25100. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  25101. */
  25102. this.resolution = null;
  25103. /**
  25104. * @member {SuperMap.FilterParameter} [SuperMap.InterpolationAnalystParameters.prototype.filterQueryParameter]
  25105. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  25106. */
  25107. this.filterQueryParameter = null;
  25108. /**
  25109. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasetName
  25110. * @description 插值分析结果数据集的名称。
  25111. */
  25112. this.outputDatasetName = null;
  25113. /**
  25114. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasourceName
  25115. * @description 插值分析结果数据源的名称。
  25116. */
  25117. this.outputDatasourceName = null;
  25118. /**
  25119. * @member {SuperMap.PixelFormat} [SuperMap.InterpolationAnalystParameters.prototype.pixelFormat]
  25120. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  25121. */
  25122. this.pixelFormat = null;
  25123. /**
  25124. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.dataset]
  25125. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  25126. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  25127. */
  25128. this.dataset = null;
  25129. /**
  25130. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [SuperMap.InterpolationAnalystParameters.prototype.inputPoints]
  25131. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  25132. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  25133. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  25134. */
  25135. this.inputPoints = null;
  25136. /**
  25137. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  25138. * @description 插值分析类型。差值分析包括数据集插值分析和几何插值分析两类,
  25139. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  25140. */
  25141. this.InterpolationAnalystType = "dataset";
  25142. /**
  25143. * @member {Object} SuperMap.InterpolationAnalystParameters.prototype.clipParam
  25144. * @description 对插值分析结果进行裁剪的参数。
  25145. */
  25146. this.clipParam = null;
  25147. Util.extend(this, options);
  25148. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  25149. }
  25150. /**
  25151. * @function SuperMap.InterpolationAnalystParameters.prototype.destroy
  25152. * @description 释放资源,将引用资源的属性置空。
  25153. */
  25154. destroy() {
  25155. var me = this;
  25156. me.bounds = null;
  25157. me.searchRadius = null;
  25158. me.zValueFieldName = null;
  25159. me.zValueScale = null;
  25160. me.resolution = null;
  25161. me.filterQueryParameter = null;
  25162. me.outputDatasetName = null;
  25163. me.pixelFormat = null;
  25164. }
  25165. /**
  25166. * @function SuperMap.InterpolationAnalystParameters.toObject
  25167. * @param {SuperMap.InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  25168. * @param {SuperMap.InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  25169. * @description 将插值分析参数对象转换成 JSON 对象。
  25170. * @returns JSON 对象。
  25171. */
  25172. static toObject(interpolationAnalystParameters, tempObj) {
  25173. for (var name in interpolationAnalystParameters) {
  25174. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  25175. var objs = [];
  25176. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  25177. var item = interpolationAnalystParameters.inputPoints[i];
  25178. var obj = {
  25179. x: item.x,
  25180. y: item.y,
  25181. z: item.tag
  25182. };
  25183. objs.push(obj);
  25184. }
  25185. tempObj[name] = objs;
  25186. } else {
  25187. tempObj[name] = interpolationAnalystParameters[name];
  25188. }
  25189. }
  25190. }
  25191. }
  25192. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  25193. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  25194. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25195. * This program are made available under the terms of the Apache License, Version 2.0
  25196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25197. /**
  25198. * @class SuperMap.InterpolationRBFAnalystParameters
  25199. * @category iServer SpatialAnalyst InterpolationAnalyst
  25200. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  25201. * @extends {SuperMap.InterpolationAnalystParameters}
  25202. * @param {Object} options - 参数。
  25203. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  25204. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  25205. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  25206. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  25207. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  25208. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  25209. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  25210. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与差值运算的点数。
  25211. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  25212. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  25213. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  25214. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  25215. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25216. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  25217. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  25218. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此参数为必选。
  25219. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此参数为必选。
  25220. * @example
  25221. * var myInterpolationRBFAnalystParameters = new SuperMap.InterpolationRBFAnalystParameters({
  25222. * dataset:"SamplesP@Interpolation",
  25223. * smooth: 0.1,
  25224. * tension: 40,
  25225. * searchMode: "QUADTREE",
  25226. * maxPointCountForInterpolation: 20,
  25227. * maxPointCountInNode: 5,
  25228. * pixelFormat: "BIT16",
  25229. * zValueFieldName: "AVG_TMP",
  25230. * resolution: 3000,
  25231. * filterQueryParameter: {
  25232. * attributeFilter: ""
  25233. * },
  25234. * outputDatasetName: "myRBF"
  25235. * });
  25236. */
  25237. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  25238. constructor(options) {
  25239. super(options);
  25240. /**
  25241. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  25242. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  25243. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  25244. */
  25245. this.smooth = 0.1;
  25246. /**
  25247. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.tension=40]
  25248. * @description 张力系数,常用取值如 0、1、5 和 10。
  25249. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  25250. */
  25251. this.tension = 40;
  25252. /**
  25253. * @member {SuperMap.SearchMode} SuperMap.InterpolationRBFAnalystParameters.prototype.searchMode
  25254. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  25255. * 具体如下:
  25256. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  25257. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  25258. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  25259. */
  25260. this.searchMode = null;
  25261. /**
  25262. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  25263. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  25264. */
  25265. this.expectedCount = 12;
  25266. /**
  25267. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  25268. * @description 【块查找】方式下,最多参与插值的点数。
  25269. */
  25270. this.maxPointCountForInterpolation = 200;
  25271. /**
  25272. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  25273. * @description 【块查找】方式下,单个块内最多参与运算点数。
  25274. */
  25275. this.maxPointCountInNode = 50;
  25276. if (options) {
  25277. Util.extend(this, options);
  25278. }
  25279. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  25280. }
  25281. /**
  25282. * @function SuperMap.InterpolationRBFAnalystParameters.prototype.destroy
  25283. * @description 释放资源,将引用资源的属性置空。
  25284. */
  25285. destroy() {
  25286. super.destroy();
  25287. var me = this;
  25288. me.smooth = null;
  25289. me.tension = null;
  25290. me.searchMode = null;
  25291. me.expectedCount = null;
  25292. me.maxPointCountForInterpolation = null;
  25293. me.maxPointCountInNode = null;
  25294. }
  25295. /**
  25296. * @function SuperMap.InterpolationRBFAnalystParameters.toObject
  25297. * @param {SuperMap.InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类
  25298. * @param {SuperMap.InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象
  25299. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  25300. * @returns JSON 对象。
  25301. */
  25302. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  25303. for (var name in datasetInterpolationRBFAnalystParameters) {
  25304. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  25305. }
  25306. }
  25307. }
  25308. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  25309. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  25310. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25311. * This program are made available under the terms of the Apache License, Version 2.0
  25312. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25313. /**
  25314. * @class SuperMap.InterpolationDensityAnalystParameters
  25315. * @category iServer SpatialAnalyst InterpolationAnalyst
  25316. * @classdesc 点密度差值分析参数类。
  25317. * @param {Object} options - 参数。
  25318. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  25319. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  25320. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  25321. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  25322. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型( SuperMap.InterpolationAnalystType)为 dataset 时。此为必选参数。
  25323. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  25324. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25325. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  25326. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  25327. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  25328. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  25329. * @extends {SuperMap.InterpolationAnalystParameters}
  25330. * @example
  25331. * var myInterpolationDensityAnalystParameters = new SuperMap.InterpolationDensityAnalystParameters({
  25332. * dataset: "SamplesP@Interpolation",
  25333. * searchRadius: "100000",
  25334. * pixelFormat: "BIT16",
  25335. * zValueFieldName: "AVG_TMP",
  25336. * resolution: 3000,
  25337. * filterQueryParameter: {
  25338. * attributeFilter: ""
  25339. * },
  25340. * outputDatasetName: "myDensity"
  25341. * });
  25342. */
  25343. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  25344. constructor(options) {
  25345. super(options);
  25346. if (options) {
  25347. Util.extend(this, options);
  25348. }
  25349. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  25350. }
  25351. /**
  25352. * @function SuperMap.InterpolationDensityAnalystParameters.prototype.destroy
  25353. * @description 释放资源,将引用资源的属性置空。
  25354. */
  25355. destroy() {
  25356. super.destroy();
  25357. }
  25358. }
  25359. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  25360. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  25361. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25362. * This program are made available under the terms of the Apache License, Version 2.0
  25363. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25364. /**
  25365. * @class SuperMap.InterpolationIDWAnalystParameters
  25366. * @category iServer SpatialAnalyst InterpolationAnalyst
  25367. * @classdesc 反距离加权插值(IDW)分析参数类。
  25368. * @param {Object} options - 参数。
  25369. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  25370. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  25371. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  25372. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  25373. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  25374. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  25375. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  25376. * @param {number} [options.power=2] - 距离权重计算的幂次。
  25377. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  25378. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25379. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  25380. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  25381. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  25382. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  25383. * @extends {SuperMap.InterpolationAnalystParameters}
  25384. * @example 例如:
  25385. * var myInterpolationIDWAnalystParameters = new SuperMap.InterpolationIDWAnalystParameters({
  25386. * dataset:"SamplesP@Interpolation",
  25387. * power: 2,
  25388. * searchMode: "KDTREE_FIXED_COUNT",
  25389. * expectedCount: 12,
  25390. * pixelFormat: "BIT16",
  25391. * zValueFieldName: "AVG_TMP",
  25392. * resolution: 3000,
  25393. * filterQueryParameter: {
  25394. * attributeFilter: ""
  25395. * },
  25396. * outputDatasetName: "myIDW"
  25397. * });
  25398. *
  25399. */
  25400. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  25401. constructor(options) {
  25402. super(options);
  25403. /**
  25404. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.power=2]
  25405. * @description 距离权重计算的幂次。
  25406. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  25407. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  25408. */
  25409. this.power = 2;
  25410. /**
  25411. * @member {SuperMap.SearchMode} SuperMap.InterpolationIDWAnalystParameters.prototype.searchMode
  25412. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  25413. * 具体如下:
  25414. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  25415. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  25416. */
  25417. this.searchMode = null;
  25418. /**
  25419. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  25420. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  25421. */
  25422. this.expectedCount = 12;
  25423. if (options) {
  25424. Util.extend(this, options);
  25425. }
  25426. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  25427. }
  25428. /**
  25429. * @function SuperMap.InterpolationIDWAnalystParameters.prototype.destroy
  25430. * @description 释放资源,将引用资源的属性置空。
  25431. */
  25432. destroy() {
  25433. super.destroy();
  25434. var me = this;
  25435. me.power = null;
  25436. me.searchMode = null;
  25437. me.expectedCount = null;
  25438. }
  25439. }
  25440. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  25441. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  25442. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25443. * This program are made available under the terms of the Apache License, Version 2.0
  25444. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25445. /**
  25446. * @class SuperMap.InterpolationKrigingAnalystParameters
  25447. * @category iServer SpatialAnalyst InterpolationAnalyst
  25448. * @classdesc 克吕金插值分析参数类。
  25449. * @description 通过该类可以设置克吕金插值分析所需的参数。
  25450. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  25451. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确的指出误差值的大小。
  25452. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  25453. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  25454. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数。
  25455. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。<br>
  25456. *
  25457. * · 块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了上图所示的块金效应,
  25458. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  25459. *
  25460. * · 基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  25461. * 即大于此间距的采样点不再具有空间相关性。<br>
  25462. *
  25463. * · 偏基台值:基台值与块金值的差值。<br>
  25464. *
  25465. * · 自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  25466. *
  25467. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  25468. *
  25469. * · 指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加成指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  25470. *
  25471. * · 球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  25472. *
  25473. * · 高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  25474. *
  25475. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的差值功能基于以下三种常用 Kriging 算法:<br>
  25476. *
  25477. * 1. 简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)已知的某一常数。<br>
  25478. *
  25479. * 2. 普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,<br>
  25480. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。
  25481. *
  25482. * 3. 泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定<br>
  25483. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。
  25484. *
  25485. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  25486. * 计算量大,且变异函数有时需要根据经验人为选定。
  25487. * @param {Object} options - 参数。
  25488. * @param {string} options.type - 克吕金插值的类型。
  25489. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  25490. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  25491. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  25492. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  25493. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  25494. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  25495. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  25496. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  25497. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  25498. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  25499. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  25500. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  25501. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  25502. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  25503. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  25504. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  25505. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  25506. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  25507. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  25508. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  25509. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时。
  25510. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。
  25511. * @extends {SuperMap.InterpolationAnalystParameters}
  25512. * @example 例如:
  25513. * var myInterpolationKrigingAnalystParameters = new SuperMap.InterpolationKrigingAnalystParameters({
  25514. * dataset:"SamplesP@Interpolation",
  25515. * type: "KRIGING",
  25516. * angle: 0,
  25517. * mean: 5,
  25518. * nugget: 30,
  25519. * range: 50,
  25520. * sill: 300,
  25521. * variogramMode: "EXPONENTIAL",
  25522. * searchMode: "QUADTREE",
  25523. * maxPointCountForInterpolation: 20,
  25524. * maxPointCountInNode: 5,
  25525. * pixelFormat: "BIT16",
  25526. * zValueFieldName: "AVG_TMP",
  25527. * resolution: 30000,
  25528. * filterQueryParameter: {
  25529. * attributeFilter: ""
  25530. * },
  25531. * outputDatasetName: "myKriging"
  25532. * });
  25533. *
  25534. */
  25535. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  25536. constructor(options) {
  25537. super(options);
  25538. /**
  25539. * @member {SuperMap.InterpolationAlgorithmType} SuperMap.InterpolationKrigingAnalystParameters.prototype.type
  25540. * @description 克吕金插值的类型。
  25541. * 具体如下:<br>
  25542. * {KRIGING} 普通克吕金插值法。
  25543. * {SimpleKriging} 简单克吕金插值法。
  25544. * {UniversalKriging} 泛克吕金插值法。
  25545. */
  25546. this.type = null;
  25547. /**
  25548. * @member {number} SuperMap.InterpolationKrigingAnalystParameters.prototype.mean
  25549. * @description 【简单克吕金】方式下,插值字段的平均值。
  25550. * 即采样点插值字段值总和除以采样点数目。
  25551. */
  25552. this.mean = null;
  25553. /**
  25554. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.angle=0]
  25555. * @description 克吕金算法中旋转角度值。
  25556. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  25557. */
  25558. this.angle = 0;
  25559. /**
  25560. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.nugget=0]
  25561. * @description 克吕金算法中块金效应值。
  25562. */
  25563. this.nugget = 0;
  25564. /**
  25565. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.range=0]
  25566. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  25567. */
  25568. this.range = 0;
  25569. /**
  25570. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.sill=0]
  25571. * @description 克吕金算法中基台值。
  25572. */
  25573. this.sill = 0;
  25574. /**
  25575. * @member {SuperMap.VariogramMode} [SuperMap.InterpolationKrigingAnalystParameters.prototype.variogramMode=SuperMap.VariogramMode.SPHERICAL]
  25576. * @description 克吕金插值时的半变函数类型。
  25577. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  25578. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  25579. */
  25580. this.variogramMode = VariogramMode.SPHERICAL;
  25581. /**
  25582. * @member {SuperMap.Exponent} [SuperMap.InterpolationKrigingAnalystParameters.prototype.exponent=SuperMap.Exponent.EXP1]
  25583. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  25584. */
  25585. this.exponent = Exponent.EXP1;
  25586. /**
  25587. * @member {SuperMap.SearchMode} SuperMap.InterpolationKrigingAnalystParameters.prototype.searchMode
  25588. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  25589. * 简单克吕金和泛克吕金不支持块查找。
  25590. * 具体如下:<br>
  25591. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  25592. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  25593. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  25594. */
  25595. this.searchMode = null;
  25596. /**
  25597. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  25598. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数,默认值为12。
  25599. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  25600. */
  25601. this.expectedCount = 12;
  25602. /**
  25603. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  25604. * @description 【块查找】方式下,最多参与插值的点数。
  25605. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  25606. */
  25607. this.maxPointCountForInterpolation = 200;
  25608. /**
  25609. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=50]
  25610. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  25611. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  25612. */
  25613. this.maxPointCountInNode = 50;
  25614. if (options) {
  25615. Util.extend(this, options);
  25616. }
  25617. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  25618. }
  25619. /**
  25620. * @function SuperMap.InterpolationKrigingAnalystParameters.prototype.destroy
  25621. * @description 释放资源,将引用资源的属性置空。
  25622. */
  25623. destroy() {
  25624. super.destroy();
  25625. var me = this;
  25626. me.type = null;
  25627. me.mean = null;
  25628. me.angle = null;
  25629. me.nugget = null;
  25630. me.range = null;
  25631. me.sill = null;
  25632. me.variogramMode = null;
  25633. me.exponent = null;
  25634. me.searchMode = null;
  25635. me.expectedCount = null;
  25636. me.maxPointCountForInterpolation = null;
  25637. me.maxPointCountInNode = null;
  25638. }
  25639. }
  25640. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  25641. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  25642. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25643. * This program are made available under the terms of the Apache License, Version 2.0
  25644. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25645. /**
  25646. * @class SuperMap.InterpolationAnalystService
  25647. * @category iServer SpatialAnalyst InterpolationAnalyst
  25648. * @classdesc 插值分析服务类。
  25649. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  25650. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  25651. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  25652. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  25653. * @param {Object} options - 参数。</br>
  25654. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  25655. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  25656. * @param {Object} [options.headers] - 请求头。
  25657. * @extends {SuperMap.SpatialAnalystBase}
  25658. * @example 例如:
  25659. * (start code)
  25660. * var myTInterpolationAnalystService = new SuperMap.InterpolationAnalystService(url);
  25661. * myTInterpolationAnalystService.events.on({
  25662. * "processCompleted": processCompleted,
  25663. * "processFailed": processFailed
  25664. * }
  25665. * );
  25666. * (end)
  25667. *
  25668. */
  25669. class InterpolationAnalystService extends SpatialAnalystBase {
  25670. constructor(url, options) {
  25671. super(url, options);
  25672. /**
  25673. * @member {string} SuperMap.InterpolationAnalystService.prototype.mode
  25674. * @description 插值分析类型。
  25675. */
  25676. this.mode = null;
  25677. if (options) {
  25678. Util.extend(this, options);
  25679. }
  25680. }
  25681. /**
  25682. * @function SuperMap.InterpolationAnalystService.prototype.destroy
  25683. * @description 释放资源,将引用资源的属性置空。
  25684. */
  25685. destroy() {
  25686. super.destroy();
  25687. this.mode = null;
  25688. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  25689. }
  25690. /**
  25691. * @function SuperMap.InterpolationAnalystService.prototype.processAsync
  25692. * @description 负责将客户端的查询参数传递到服务端。
  25693. * @param {SuperMap.InterpolationAnalystParameters} parameter - 插值分析参数类。
  25694. */
  25695. processAsync(parameter) {
  25696. var parameterObject = {};
  25697. var me = this;
  25698. if (parameter instanceof InterpolationDensityAnalystParameters) {
  25699. me.mode = 'Density';
  25700. if (parameter.InterpolationAnalystType === 'geometry') {
  25701. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  25702. } else {
  25703. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  25704. }
  25705. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  25706. me.mode = 'IDW';
  25707. if (parameter.InterpolationAnalystType === 'geometry') {
  25708. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  25709. } else {
  25710. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  25711. }
  25712. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  25713. me.mode = 'RBF';
  25714. if (parameter.InterpolationAnalystType === 'geometry') {
  25715. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  25716. } else {
  25717. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  25718. }
  25719. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  25720. me.mode = 'Kriging';
  25721. if (parameter.InterpolationAnalystType === 'geometry') {
  25722. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  25723. } else {
  25724. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  25725. }
  25726. }
  25727. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  25728. var jsonParameters = Util.toJSON(parameterObject);
  25729. me.url = Util.urlAppend(me.url, 'returnContent=true');
  25730. me.request({
  25731. method: "POST",
  25732. data: jsonParameters,
  25733. scope: me,
  25734. success: me.serviceProcessCompleted,
  25735. failure: me.serviceProcessFailed
  25736. });
  25737. }
  25738. }
  25739. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  25740. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  25741. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25742. * This program are made available under the terms of the Apache License, Version 2.0
  25743. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25744. /**
  25745. * @class SuperMap.KernelDensityJobParameter
  25746. * @category iServer ProcessingService DensityAnalyst
  25747. * @classdesc 密度分析任务参数类。
  25748. * @param {Object} options - 参数。
  25749. * @param {string} options.datasetName - 数据集名。
  25750. * @param {string} options.fields - 权重索引。
  25751. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  25752. * @param {number} [options.resolution=80] - 分辨率。
  25753. * @param {number} [options.method=0] - 分析方法。
  25754. * @param {number} [options.meshType=0] - 分析类型。
  25755. * @param {number} [options.radius=300] - 分析的影响半径。
  25756. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  25757. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  25758. */
  25759. class KernelDensityJobParameter {
  25760. constructor(options) {
  25761. if (!options) {
  25762. return;
  25763. }
  25764. /**
  25765. * @member {string} SuperMap.KernelDensityJobParameter.prototype.datasetName
  25766. * @description 数据集名。
  25767. */
  25768. this.datasetName = "";
  25769. /**
  25770. * @member {SuperMap.Bounds|L.Bounds|ol.extent} [SuperMap.KernelDensityJobParameter.prototype.query]
  25771. * @description 分析范围。
  25772. */
  25773. this.query = "";
  25774. /**
  25775. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.resolution=80]
  25776. * @description 网格大小。
  25777. */
  25778. this.resolution = 80;
  25779. /**
  25780. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.method=0]
  25781. * @description 分析方法。
  25782. */
  25783. this.method = 0;
  25784. /**
  25785. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.meshType=0]
  25786. * @description 分析类型。
  25787. */
  25788. this.meshType = 0;
  25789. /**
  25790. * @member {string} SuperMap.KernelDensityJobParameter.prototype.fields
  25791. * @description 权重索引。
  25792. */
  25793. this.fields = "";
  25794. /**
  25795. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.radius=300]
  25796. * @description 分析的影响半径。
  25797. */
  25798. this.radius = 300;
  25799. /**
  25800. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  25801. * @description 网格大小单位。
  25802. */
  25803. this.meshSizeUnit = AnalystSizeUnit.METER;
  25804. /**
  25805. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.radiusUnit=SuperMap.AnalystSizeUnit.METER]
  25806. * @description 搜索半径单位。
  25807. */
  25808. this.radiusUnit = AnalystSizeUnit.METER;
  25809. /**
  25810. * @member {SuperMap.AnalystAreaUnit} [SuperMap.KernelDensityJobParameter.prototype.areaUnit=SuperMap.AnalystAreaUnit.SQUAREMILE]
  25811. * @description 面积单位。
  25812. */
  25813. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  25814. /**
  25815. * @member {SuperMap.OutputSetting} SuperMap.KernelDensityJobParameter.prototype.output
  25816. * @description 输出参数设置类
  25817. */
  25818. this.output = null;
  25819. /**
  25820. * @member {SuperMap.MappingParameters} [SuperMap.KernelDensityJobParameter.prototype.mappingParameters]
  25821. * @description 分析后结果可视化的参数类。
  25822. */
  25823. this.mappingParameters = null;
  25824. Util.extend(this, options);
  25825. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  25826. }
  25827. /**
  25828. * @function SuperMap.KernelDensityJobParameter.prototype.destroy
  25829. * @description 释放资源,将引用资源的属性置空。
  25830. */
  25831. destroy() {
  25832. this.datasetName = null;
  25833. this.query = null;
  25834. this.resolution = null;
  25835. this.method = null;
  25836. this.radius = null;
  25837. this.meshType = null;
  25838. this.fields = null;
  25839. this.meshSizeUnit = null;
  25840. this.radiusUnit = null;
  25841. this.areaUnit = null;
  25842. if (this.output instanceof OutputSetting) {
  25843. this.output.destroy();
  25844. this.output = null;
  25845. }
  25846. if (this.mappingParameters instanceof MappingParameters) {
  25847. this.mappingParameters.destroy();
  25848. this.mappingParameters = null;
  25849. }
  25850. }
  25851. /**
  25852. * @function SuperMap.KernelDensityJobParameter.toObject
  25853. * @param {SuperMap.KernelDensityJobParameter} kernelDensityJobParameter - 密度分析任务参数类。
  25854. * @param {SuperMap.KernelDensityJobParameter} tempObj - 密度分析任务参数对象。
  25855. * @description 将密度分析任务参数对象转换为 JSON 对象。
  25856. * @returns JSON 对象。
  25857. */
  25858. static toObject(kernelDensityJobParameter, tempObj) {
  25859. for (var name in kernelDensityJobParameter) {
  25860. if (name === "datasetName") {
  25861. tempObj['input'] = tempObj['input'] || {};
  25862. tempObj['input'][name] = kernelDensityJobParameter[name];
  25863. continue;
  25864. }
  25865. if (name === "output") {
  25866. tempObj['output'] = tempObj['output'] || {};
  25867. tempObj['output'] = kernelDensityJobParameter[name];
  25868. continue;
  25869. }
  25870. tempObj['analyst'] = tempObj['analyst'] || {};
  25871. if (name === 'query' && kernelDensityJobParameter[name]) {
  25872. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  25873. } else {
  25874. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  25875. }
  25876. if (name === 'mappingParameters') {
  25877. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  25878. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  25879. }
  25880. }
  25881. }
  25882. }
  25883. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  25884. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  25885. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25886. * This program are made available under the terms of the Apache License, Version 2.0
  25887. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25888. /**
  25889. * @class SuperMap.KernelDensityJobsService
  25890. * @category iServer ProcessingService DensityAnalyst
  25891. * @classdesc 核密度分析服务类
  25892. * @extends {SuperMap.ProcessingServiceBase}
  25893. * @param {string} url -核密度分析服务地址。
  25894. * @param {Object} options - 交互服务时所需可选参数。
  25895. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  25896. * @param {Object} [options.headers] - 请求头。
  25897. */
  25898. class KernelDensityJobsService extends ProcessingServiceBase {
  25899. constructor(url, options) {
  25900. super(url, options);
  25901. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/density');
  25902. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  25903. }
  25904. /**
  25905. * @function SuperMap.KernelDensityJobsService.prototype.destroy
  25906. * @override
  25907. */
  25908. destroy() {
  25909. super.destroy();
  25910. }
  25911. /**
  25912. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  25913. * @description 获取核密度分析任务
  25914. */
  25915. getKernelDensityJobs() {
  25916. super.getJobs(this.url);
  25917. }
  25918. /**
  25919. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  25920. * @description 获取指定id的核密度分析服务
  25921. * @param {string} id - 指定要获取数据的id
  25922. */
  25923. getKernelDensityJob(id) {
  25924. super.getJobs(Util.urlPathAppend(this.url, id));
  25925. }
  25926. /**
  25927. * @function SuperMap.KernelDensityJobsService.prototype.addKernelDensityJob
  25928. * @description 新建核密度分析服务
  25929. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  25930. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  25931. */
  25932. addKernelDensityJob(params, seconds) {
  25933. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  25934. }
  25935. }
  25936. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  25937. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  25938. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25939. * This program are made available under the terms of the Apache License, Version 2.0
  25940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25941. /**
  25942. * @class SuperMap.LabelMatrixCell
  25943. * @category iServer Map Theme
  25944. * @classdesc 矩阵标签元素抽象类。
  25945. * @description 该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  25946. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  25947. */
  25948. class LabelMatrixCell {
  25949. constructor() {
  25950. this.CLASS_NAME = "LabelMatrixCell";
  25951. }
  25952. }
  25953. SuperMap.LabelMatrixCell = LabelMatrixCell;
  25954. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  25955. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25956. * This program are made available under the terms of the Apache License, Version 2.0
  25957. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25958. /**
  25959. * @class SuperMap.LabelImageCell
  25960. * @category iServer Map Theme
  25961. * @classdesc 图片类型的矩阵标签元素类。
  25962. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  25963. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  25964. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  25965. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  25966. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 是一个二维数组,
  25967. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  25968. * @extends {SuperMap.LabelMatrixCell}
  25969. * @param {Object} options - 参数。
  25970. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  25971. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  25972. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  25973. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  25974. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  25975. */
  25976. class LabelImageCell extends LabelMatrixCell {
  25977. constructor(options) {
  25978. super(options);
  25979. /**
  25980. * @member {number} SuperMap.LabelImageCell.prototype.height
  25981. * @description 设置图片的高度,单位为毫米。
  25982. */
  25983. this.height = 0;
  25984. /**
  25985. * @member {string} SuperMap.LabelImageCell.prototype.pathField
  25986. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  25987. */
  25988. this.pathField = null;
  25989. /**
  25990. * @member {number} [SuperMap.LabelImageCell.prototype.rotation=0.0]
  25991. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  25992. */
  25993. this.rotation = 0.0;
  25994. /**
  25995. * @member {number} SuperMap.LabelImageCell.prototype.width
  25996. * @description 设置图片的宽度,单位为毫米。
  25997. */
  25998. this.width = 0;
  25999. /**
  26000. * @member {boolean} [SuperMap.LabelImageCell.prototype.sizeFixed=false]
  26001. * @description 是否固定图片的大小。
  26002. */
  26003. this.sizeFixed = false;
  26004. /**
  26005. * @member {string} SuperMap.LabelImageCell.prototype.type
  26006. * @description 制作矩阵专题图时是必须的。
  26007. */
  26008. this.type = "IMAGE";
  26009. if (options) {
  26010. Util.extend(this, options);
  26011. }
  26012. this.CLASS_NAME = "SuperMap.LabelImageCell";
  26013. }
  26014. /**
  26015. * @function SuperMap.LabelImageCell.prototype.destroy
  26016. * @description 释放资源,将引用资源的属性置空。
  26017. */
  26018. destroy() {
  26019. var me = this;
  26020. me.height = null;
  26021. me.pathField = null;
  26022. me.rotation = null;
  26023. me.width = null;
  26024. me.sizeFixed = null;
  26025. }
  26026. }
  26027. SuperMap.LabelImageCell = LabelImageCell;
  26028. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  26029. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26030. * This program are made available under the terms of the Apache License, Version 2.0
  26031. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26032. /**
  26033. * @class SuperMap.LabelSymbolCell
  26034. * @category iServer Map Theme
  26035. * @classdesc 符号类型的矩阵标签元素类。
  26036. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  26037. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  26038. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  26039. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  26040. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  26041. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  26042. * @extends {SuperMap.LabelMatrixCell}
  26043. * @param {Object} options - 参数。
  26044. * @param {SuperMap.ServerStyle} options.style - 获取或设置符号样式。
  26045. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  26046. */
  26047. class LabelSymbolCell extends LabelMatrixCell {
  26048. constructor(options) {
  26049. super(options);
  26050. /**
  26051. * @member {SuperMap.ServerStyle} SuperMap.LabelSymbolCell.prototype.style
  26052. * @description 获取或设置符号样式—— {@link SuperMap.ServerStyle} 对象,包括符号大小({@link SuperMap.ServerStyle.markerSize})
  26053. * 和符号旋转({@link SuperMap.ServerStyle.markerAngle})角度,其中用于设置符号 ID 的属性({@link SuperMap.ServerStyle.markerSymbolID})在此处不起作用。
  26054. */
  26055. this.style = new ServerStyle();
  26056. /**
  26057. * @member {string} SuperMap.LabelSymbolCell.prototype.symbolIDField
  26058. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  26059. */
  26060. this.symbolIDField = null;
  26061. /**
  26062. * @member {string} SuperMap.LabelSymbolCell.prototype.type
  26063. * @description 制作矩阵专题图时是必须的。
  26064. */
  26065. this.type = "SYMBOL";
  26066. if (options) {
  26067. Util.extend(this, options);
  26068. }
  26069. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  26070. }
  26071. /**
  26072. * @function SuperMap.LabelSymbolCell.prototype.destroy
  26073. * @description 释放资源,将引用资源的属性置空。
  26074. */
  26075. destroy() {
  26076. var me = this;
  26077. if (me.style) {
  26078. me.style.destroy();
  26079. me.style = null;
  26080. }
  26081. me.symbolIDField = null;
  26082. }
  26083. }
  26084. SuperMap.LabelSymbolCell = LabelSymbolCell;
  26085. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  26086. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26087. * This program are made available under the terms of the Apache License, Version 2.0
  26088. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26089. /**
  26090. * @class SuperMap.LabelThemeCell
  26091. * @category iServer Map Theme
  26092. * @classdesc 专题图类型的矩阵标签元素类。
  26093. * @description 该类继承自 {@link SuperMap.LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  26094. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  26095. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  26096. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  26097. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  26098. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  26099. * @extends {SuperMap.LabelMatrixCell}
  26100. * @param {Object} options -参数。
  26101. * @param {SuperMap.ThemeLabel} options.themeLabel - 使用专题图对象作为矩阵标签的一个元素。
  26102. */
  26103. class LabelThemeCell extends LabelMatrixCell {
  26104. constructor(options) {
  26105. super(options);
  26106. /**
  26107. * @member {SuperMap.ThemeLabel} SuperMap.LabelThemeCell.prototype.themeLabel
  26108. * @description 使用专题图对象作为矩阵标签的一个元素。
  26109. */
  26110. this.themeLabel = new ThemeLabel();
  26111. /**
  26112. * @member {string} SuperMap.LabelThemeCell.prototype.type
  26113. * @description 制作矩阵专题图时是必须的。
  26114. */
  26115. this.type = "THEME";
  26116. if (options) {
  26117. Util.extend(this, options);
  26118. }
  26119. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  26120. }
  26121. /**
  26122. * @function SuperMap.LabelThemeCell.prototype.destroy
  26123. * @description 释放资源,将引用资源的属性置空。
  26124. */
  26125. destroy() {
  26126. var me = this;
  26127. if (me.themeLabel) {
  26128. me.themeLabel.destroy();
  26129. me.themeLabel = null;
  26130. }
  26131. }
  26132. }
  26133. SuperMap.LabelThemeCell = LabelThemeCell;
  26134. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  26135. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26136. * This program are made available under the terms of the Apache License, Version 2.0
  26137. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26138. /**
  26139. * @class SuperMap.LayerStatus
  26140. * @category iServer Map Theme
  26141. * @classdesc 子图层显示参数类。
  26142. * @description 该类存储了各个子图层的名字和是否可见的状态。
  26143. * @param {Object} options - 参数。
  26144. * @param {string} options.layerName - 获取或设置图层名称。
  26145. * @param {boolean} [options.isVisible=true] - 获取或设置图层是否可见,true 表示可见。
  26146. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  26147. */
  26148. class LayerStatus {
  26149. constructor(options) {
  26150. /**
  26151. * @member {string} SuperMap.LayerStatus.prototype.layerName
  26152. * @description 获取或设置图层名称。
  26153. */
  26154. this.layerName = null;
  26155. /**
  26156. * @member {boolean} SuperMap.LayerStatus.prototype.isVisible
  26157. * @description 获取或设置图层是否可见,true 表示可见。
  26158. */
  26159. this.isVisible = null;
  26160. /**
  26161. * @member {string} [SuperMap.LayerStatus.prototype.displayFilter]
  26162. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  26163. */
  26164. this.displayFilter = null;
  26165. /**
  26166. * @member {Object} [SuperMap.LayerStatus.prototype.fieldValuesDisplayFilter]
  26167. * @property {Array.<number>} values - 要过滤的值。
  26168. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  26169. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  26170. */
  26171. this.fieldValuesDisplayFilter = null;
  26172. if (options) {
  26173. Util.extend(this, options);
  26174. }
  26175. this.CLASS_NAME = "SuperMap.LayerStatus";
  26176. }
  26177. /**
  26178. * @function SuperMap.LayerStatus.prototype.destroy
  26179. * @description 释放资源,将引用资源的属性置空。
  26180. */
  26181. destroy() {
  26182. var me = this;
  26183. me.layerName = null;
  26184. me.isVisible = null;
  26185. me.displayFilter = null;
  26186. }
  26187. /**
  26188. * @function SuperMap.LayerStatus.prototype.toJSON
  26189. * @description 生成对应的 JSON。
  26190. * @returns {Object} 对应的 JSON。
  26191. */
  26192. toJSON() {
  26193. var json = '{';
  26194. json += '"type":"UGC",';
  26195. var v = [];
  26196. if (this.layerName) {
  26197. v.push('"name":"' + this.layerName + '"');
  26198. v.push('"visible":' + this.isVisible);
  26199. }
  26200. if (this.displayFilter) {
  26201. v.push('"displayFilter":"' + this.displayFilter + '"');
  26202. }
  26203. if (this.minScale || this.minScale == 0) {
  26204. v.push('"minScale":' + this.minScale);
  26205. }
  26206. if (this.maxScale || this.maxScale == 0) {
  26207. v.push('"maxScale":' + this.maxScale);
  26208. }
  26209. if (this.fieldValuesDisplayFilter) {
  26210. v.push('"fieldValuesDisplayFilter":' + Util.toJSON(this.fieldValuesDisplayFilter));
  26211. }
  26212. json += v;
  26213. json += '}';
  26214. return json;
  26215. }
  26216. }
  26217. SuperMap.LayerStatus = LayerStatus;
  26218. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  26219. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26220. * This program are made available under the terms of the Apache License, Version 2.0
  26221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26222. /**
  26223. * @class SuperMap.MapService
  26224. * @category iServer Map
  26225. * @classdesc 地图信息服务类。
  26226. * @extends {SuperMap.CommonServiceBase}
  26227. * @example
  26228. * var myMapService = new SuperMap.MapService(url, {
  26229. * eventListeners:{
  26230. * "processCompleted": MapServiceCompleted,
  26231. * "processFailed": MapServiceFailed
  26232. * }
  26233. * });
  26234. *
  26235. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  26236. * @param {Object} options - 参数。
  26237. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  26238. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  26239. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  26240. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26241. * @param {Object} [options.headers] - 请求头。
  26242. */
  26243. class MapService_MapService extends CommonServiceBase {
  26244. constructor(url, options) {
  26245. super(url, options);
  26246. /**
  26247. * @member {string} SuperMap.MapService.prototype.projection
  26248. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  26249. */
  26250. this.projection = null;
  26251. this.CLASS_NAME = "SuperMap.MapService";
  26252. if (options) {
  26253. Util.extend(this, options);
  26254. }
  26255. var me = this;
  26256. if (me.projection) {
  26257. var arr = me.projection.split(":");
  26258. if (arr instanceof Array) {
  26259. if (arr.length === 2) {
  26260. me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  26261. }
  26262. if (arr.length === 1) {
  26263. me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  26264. }
  26265. }
  26266. }
  26267. }
  26268. /**
  26269. * @function destroy
  26270. * @description 释放资源,将引用的资源属性置空。
  26271. */
  26272. destroy() {
  26273. super.destroy();
  26274. var me = this;
  26275. if (me.events) {
  26276. me.events.un(me.eventListeners);
  26277. me.events.listeners = null;
  26278. me.events.destroy();
  26279. me.events = null;
  26280. me.eventListeners = null;
  26281. }
  26282. }
  26283. /**
  26284. * @function SuperMap.MapService.prototype.processAsync
  26285. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  26286. */
  26287. processAsync() {
  26288. var me = this;
  26289. me.request({
  26290. method: "GET",
  26291. scope: me,
  26292. success: me.serviceProcessCompleted,
  26293. failure: me.serviceProcessFailed
  26294. });
  26295. }
  26296. /*
  26297. * Method: getMapStatusCompleted
  26298. * 获取地图状态完成,执行此方法。
  26299. *
  26300. * Parameters:
  26301. * {Object} result - 服务器返回的结果对象。
  26302. */
  26303. serviceProcessCompleted(result) {
  26304. var me = this;
  26305. result = Util.transformResult(result);
  26306. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  26307. var isCodeValid = result.code && codeStatus;
  26308. if (!result.code || isCodeValid) {
  26309. me.events && me.events.triggerEvent("processCompleted", {result: result});
  26310. } else {
  26311. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  26312. me.events.triggerEvent("processFailed", {error: result});
  26313. }
  26314. }
  26315. }
  26316. SuperMap.MapService = MapService_MapService;
  26317. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  26318. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26319. * This program are made available under the terms of the Apache License, Version 2.0
  26320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26321. /**
  26322. * @class SuperMap.MathExpressionAnalysisParameters
  26323. * @category iServer SpatialAnalyst GridMathAnalyst
  26324. * @classdesc 栅格代数运算参数类。
  26325. * @param {Object} options - 参数。
  26326. * @param {string} options.dataset - 要用来做栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  26327. * @param {string} options.resultGridName - 指定结果数据集名称。
  26328. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  26329. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  26330. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  26331. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  26332. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  26333. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  26334. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  26335. */
  26336. class MathExpressionAnalysisParameters {
  26337. constructor(options) {
  26338. if (!options) {
  26339. return;
  26340. }
  26341. /**
  26342. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.dataset
  26343. * @description 要用来做栅格代数运算数据源中数据集的名称。
  26344. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  26345. *
  26346. */
  26347. this.dataset = null;
  26348. /**
  26349. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.MathExpressionAnalysisParameters.prototype.extractRegion]
  26350. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  26351. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  26352. */
  26353. this.extractRegion = null;
  26354. /**
  26355. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.expression
  26356. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  26357. */
  26358. this.expression = null;
  26359. /**
  26360. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.isZip=false]
  26361. * @description 是否对结果数据集进行压缩处理。
  26362. */
  26363. this.isZip = false;
  26364. /**
  26365. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  26366. * @description 是否忽略无值栅格数据。
  26367. */
  26368. this.ignoreNoValue = false;
  26369. /**
  26370. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.targetDatasource
  26371. * @description 指定存储结果数据集的数据源。
  26372. */
  26373. this.targetDatasource = null;
  26374. /**
  26375. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.resultGridName
  26376. * @description 指定结果数据集名称。
  26377. */
  26378. this.resultGridName = null;
  26379. /**
  26380. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  26381. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  26382. */
  26383. this.deleteExistResultDataset = false;
  26384. Util.extend(this, options);
  26385. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  26386. }
  26387. /**
  26388. * @function SuperMap.MathExpressionAnalysisParameters.prototype.destroy
  26389. * @description 释放资源,将引用资源的属性置空。
  26390. */
  26391. destroy() {
  26392. var me = this;
  26393. me.dataset = null;
  26394. me.bounds = null;
  26395. me.expression = null;
  26396. me.isZip = true;
  26397. me.ignoreNoValue = true;
  26398. me.targetDatasource = null;
  26399. me.resultGridName = null;
  26400. me.deleteExistResultDataset = null;
  26401. }
  26402. /**
  26403. * @function SuperMap.MathExpressionAnalysisParameters.toObject
  26404. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  26405. * @param {Object} tempObj - 目标对象。
  26406. * @description 生成栅格代数运算对象。
  26407. */
  26408. static toObject(mathExpressionAnalysisParameters, tempObj) {
  26409. for (var name in mathExpressionAnalysisParameters) {
  26410. if (name !== "dataset") {
  26411. tempObj[name] = mathExpressionAnalysisParameters[name];
  26412. }
  26413. if (name === "extractRegion") {
  26414. if (mathExpressionAnalysisParameters[name]) {
  26415. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  26416. var region = {},
  26417. points = [],
  26418. type = "REGION";
  26419. var len = bs.length;
  26420. for (var i = 0; i < len - 1; i++) {
  26421. var poi = {};
  26422. poi["x"] = bs[i].x;
  26423. poi["y"] = bs[i].y;
  26424. points.push(poi);
  26425. }
  26426. region["points"] = points;
  26427. region["type"] = type;
  26428. tempObj[name] = region;
  26429. }
  26430. }
  26431. }
  26432. }
  26433. }
  26434. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  26435. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  26436. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26437. * This program are made available under the terms of the Apache License, Version 2.0
  26438. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26439. /**
  26440. * @class SuperMap.MathExpressionAnalysisService
  26441. * @category iServer SpatialAnalyst GridMathAnalyst
  26442. * @classdesc 栅格代数运算服务类。
  26443. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  26444. * @param {Object} options - 参数。</br>
  26445. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  26446. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26447. * @param {Object} [options.headers] - 请求头。
  26448. * @extends {SuperMap.SpatialAnalystBase}
  26449. * @example 例如:
  26450. * (start code)
  26451. * var myMathExpressionAnalysisService = new SuperMap.MathExpressionAnalysisService(url);
  26452. * myMathExpressionAnalysisService.on({
  26453. * "processCompleted": processCompleted,
  26454. * "processFailed": processFailed
  26455. * }
  26456. * );
  26457. * (end)
  26458. *
  26459. */
  26460. class MathExpressionAnalysisService extends SpatialAnalystBase {
  26461. constructor(url, options) {
  26462. super(url, options);
  26463. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  26464. }
  26465. /**
  26466. * @override
  26467. */
  26468. destroy() {
  26469. super.destroy();
  26470. }
  26471. /**
  26472. * @function SuperMap.MathExpressionAnalysisService.prototype.processAsync
  26473. * @description 负责将客户端的查询参数传递到服务端。
  26474. * @param {SuperMap.MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  26475. */
  26476. processAsync(parameter) {
  26477. var me = this;
  26478. var parameterObject = {};
  26479. if (parameter instanceof MathExpressionAnalysisParameters) {
  26480. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  26481. }
  26482. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  26483. var jsonParameters = Util.toJSON(parameterObject);
  26484. me.url = Util.urlAppend(me.url, 'returnContent=true');
  26485. me.request({
  26486. method: "POST",
  26487. data: jsonParameters,
  26488. scope: me,
  26489. success: me.serviceProcessCompleted,
  26490. failure: me.serviceProcessFailed
  26491. });
  26492. }
  26493. }
  26494. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  26495. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  26496. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26497. * This program are made available under the terms of the Apache License, Version 2.0
  26498. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26499. /**
  26500. * @class SuperMap.MeasureParameters
  26501. * @category iServer Map Measure
  26502. * @classdesc 量算参数类。
  26503. * @param {Object} geometry - 要量算的几何对象。
  26504. * @param {Object} options - 参数。
  26505. * @param {SuperMap.Unit} [options.unit=SuperMap.Unit.METER] - 量算单位。
  26506. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  26507. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  26508. */
  26509. class MeasureParameters {
  26510. constructor(geometry, options) {
  26511. if (!geometry) {
  26512. return;
  26513. }
  26514. /**
  26515. * @member {Object} SuperMap.MeasureParameters.prototype.geometry
  26516. * @description 要量算的几何对象。<br>
  26517. * 点类型可以是:{@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>
  26518. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  26519. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  26520. */
  26521. this.geometry = geometry;
  26522. /**
  26523. * @member {SuperMap.Unit} [SuperMap.MeasureParameters.prototype.unit=SuperMap.Unit.METER]
  26524. * @description 量算单位。即量算结果以米为单位。
  26525. */
  26526. this.unit = Unit.METER;
  26527. /**
  26528. * @member {string} [SuperMap.MeasureParameters.prototype.prjCoordSys]
  26529. * @description 用来指定该量算操作所使用的投影。
  26530. */
  26531. this.prjCoordSys = null;
  26532. /**
  26533. * @member {string} [SuperMap.MeasureParameters.prototype.distanceMode="Geodesic"]
  26534. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  26535. * @example
  26536. * var param = new SuperMap.MeasureParameters(getmetry,{distanceMode:'Planar'});
  26537. */
  26538. this.distanceMode = null;
  26539. if (options) {
  26540. Util.extend(this, options);
  26541. }
  26542. this.CLASS_NAME = "SuperMap.MeasureParameters";
  26543. }
  26544. /**
  26545. * @function SuperMap.MeasureParameters.prototype.destroy
  26546. * @description 释放资源,将引用资源的属性置空。
  26547. */
  26548. destroy() {
  26549. var me = this;
  26550. me.geometry = null;
  26551. me.unit = null;
  26552. me.prjCoordSys = null;
  26553. }
  26554. }
  26555. SuperMap.MeasureParameters = MeasureParameters;
  26556. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  26557. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26558. * This program are made available under the terms of the Apache License, Version 2.0
  26559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26560. /**
  26561. * @class SuperMap.MeasureService
  26562. * @category iServer Map Measure
  26563. * @classdesc 量算服务类。
  26564. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  26565. * @extends {SuperMap.CommonServiceBase}
  26566. * @example
  26567. * var myMeasuerService = new SuperMap.MeasureService(url, {
  26568. * measureMode: SuperMap.MeasureMode.DISTANCE,
  26569. * eventListeners:{
  26570. * "processCompleted": measureCompleted
  26571. * }
  26572. * });
  26573. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  26574. * @param {Object} options - 参数。
  26575. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  26576. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  26577. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  26578. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26579. * @param {Object} [options.headers] - 请求头。
  26580. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  26581. */
  26582. class MeasureService_MeasureService extends CommonServiceBase {
  26583. constructor(url, options) {
  26584. super(url, options);
  26585. /**
  26586. * @member {SuperMap.MeasureMode} [SuperMap.MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  26587. * @description 量算模式,包括距离量算模式和面积量算模式。
  26588. */
  26589. this.measureMode = MeasureMode.DISTANCE;
  26590. if (options) {
  26591. Util.extend(this, options);
  26592. }
  26593. this.CLASS_NAME = "SuperMap.MeasureService";
  26594. }
  26595. /**
  26596. * @override
  26597. */
  26598. destroy() {
  26599. super.destroy();
  26600. var me = this;
  26601. me.measureMode = null;
  26602. }
  26603. /**
  26604. * @function SuperMap.MeasureService.prototype.processAsync
  26605. * @description 负责将客户端的量算参数传递到服务端。
  26606. * @param {SuperMap.MeasureParameters} params - 量算参数。
  26607. */
  26608. processAsync(params) {
  26609. if (!(params instanceof MeasureParameters)) {
  26610. return;
  26611. }
  26612. var me = this,
  26613. geometry = params.geometry,
  26614. pointsCount = 0,
  26615. point2ds = null;
  26616. if (!geometry) {
  26617. return;
  26618. }
  26619. me.url = Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  26620. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  26621. if (!serverGeometry) {
  26622. return;
  26623. }
  26624. pointsCount = serverGeometry.parts[0];
  26625. point2ds = serverGeometry.points.splice(0, pointsCount);
  26626. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  26627. if (params.prjCoordSys) {
  26628. if (typeof (params.prjCoordSys) === "object") {
  26629. prjCodeTemp = params.prjCoordSys.projCode;
  26630. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  26631. } else if (typeof (params.prjCoordSys) === "string") {
  26632. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  26633. }
  26634. paramsTemp = {
  26635. "point2Ds": Util.toJSON(point2ds),
  26636. "unit": params.unit,
  26637. "prjCoordSys": prjCoordSysTemp
  26638. };
  26639. } else {
  26640. paramsTemp = {"point2Ds": Util.toJSON(point2ds), "unit": params.unit};
  26641. }
  26642. me.request({
  26643. method: "GET",
  26644. params: paramsTemp,
  26645. scope: me,
  26646. success: me.serviceProcessCompleted,
  26647. failure: me.serviceProcessFailed
  26648. });
  26649. }
  26650. }
  26651. SuperMap.MeasureService = MeasureService_MeasureService;
  26652. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  26653. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26654. * This program are made available under the terms of the Apache License, Version 2.0
  26655. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26656. /**
  26657. * @class SuperMap.OverlayAnalystService
  26658. * @category iServer SpatialAnalyst OverlayAnalyst
  26659. * @classdesc 叠加分析服务类。
  26660. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  26661. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  26662. * @param {string} url - 服务的访问地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  26663. * @param {Object} options - 参数。</br>
  26664. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  26665. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26666. * @param {Object} [options.headers] - 请求头。
  26667. * @extends {SuperMap.CommonServiceBase}
  26668. * @example 例如:
  26669. * (start code)
  26670. * var myOverlayAnalystService = new SuperMap.OverlayAnalystService(url, {
  26671. * eventListeners: {
  26672. * "processCompleted": OverlayCompleted,
  26673. * "processFailed": OverlayFailed
  26674. * }
  26675. * });
  26676. * (end)
  26677. */
  26678. class OverlayAnalystService extends SpatialAnalystBase {
  26679. constructor(url, options) {
  26680. super(url, options);
  26681. /**
  26682. * @member {string} SuperMap.OverlayAnalystService.prototype.mode
  26683. * @description 叠加分析类型
  26684. */
  26685. this.mode = null;
  26686. if (options) {
  26687. Util.extend(this, options);
  26688. }
  26689. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  26690. }
  26691. /**
  26692. * @override
  26693. */
  26694. destroy() {
  26695. super.destroy();
  26696. this.mode = null;
  26697. }
  26698. /**
  26699. * @function SuperMap.OverlayAnalystService.prototype.processAsync
  26700. * @description 负责将客户端的查询参数传递到服务端。
  26701. * @param {SuperMap.OverlayAnalystParameters} parameter - 叠加分析参数类。
  26702. */
  26703. processAsync(parameter) {
  26704. var parameterObject = {};
  26705. var me = this;
  26706. if (parameter instanceof DatasetOverlayAnalystParameters) {
  26707. me.mode = "datasets";
  26708. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  26709. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  26710. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  26711. me.mode = "geometry";
  26712. //支持传入多个几何要素进行叠加分析
  26713. if(parameter.operateGeometries && parameter.sourceGeometries){
  26714. me.url = Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  26715. me.url = Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  26716. }else {
  26717. me.url = Util.urlPathAppend(me.url, 'geometry/overlay');
  26718. }
  26719. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  26720. }
  26721. me.url = Util.urlAppend(me.url, 'returnContent=true');
  26722. var jsonParameters = Util.toJSON(parameterObject);
  26723. me.request({
  26724. method: "POST",
  26725. data: jsonParameters,
  26726. scope: me,
  26727. success: me.serviceProcessCompleted,
  26728. failure: me.serviceProcessFailed
  26729. });
  26730. }
  26731. }
  26732. SuperMap.OverlayAnalystService = OverlayAnalystService;
  26733. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  26734. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26735. * This program are made available under the terms of the Apache License, Version 2.0
  26736. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26737. /**
  26738. * @class SuperMap.OverlayGeoJobParameter
  26739. * @category iServer ProcessingService OverlayAnalyst
  26740. * @classdesc 叠加分析任务参数类。
  26741. * @param {Object} options - 参数。
  26742. * @param {string} options.datasetName - 数据集名。
  26743. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  26744. * @param {string} options.srcFields - 输入数据需要保留的字段。
  26745. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  26746. * @param {string} [options.mode] - 叠加分析模式。
  26747. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  26748. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  26749. */
  26750. class OverlayGeoJobParameter {
  26751. constructor(options) {
  26752. if (!options) {
  26753. return;
  26754. }
  26755. /**
  26756. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetName
  26757. * @description 数据集名。
  26758. */
  26759. this.datasetName = "";
  26760. /**
  26761. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetOverlay
  26762. * @description 叠加对象所在的数据集名称。
  26763. */
  26764. this.datasetOverlay = "";
  26765. /**
  26766. * @member {string} [SuperMap.OverlayGeoJobParameter.prototype.mode]
  26767. * @description 叠加分析模式。
  26768. */
  26769. this.mode = "";
  26770. /**
  26771. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.srcFields
  26772. * @description 输入数据需要保留的字段。
  26773. */
  26774. this.srcFields = "";
  26775. /**
  26776. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.overlayFields
  26777. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  26778. */
  26779. this.overlayFields = "";
  26780. /**
  26781. * @member {SuperMap.OutputSetting} [SuperMap.OverlayGeoJobParameter.prototype.output]
  26782. * @description 输出参数设置类。
  26783. */
  26784. this.output = null;
  26785. /**
  26786. * @member {SuperMap.MappingParameters} [SuperMap.OverlayGeoJobParameter.prototype.mappingParameters]
  26787. * @description 分析后结果可视化的参数类。
  26788. */
  26789. this.mappingParameters = null;
  26790. Util.extend(this, options);
  26791. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  26792. }
  26793. /**
  26794. * @function SuperMap.OverlayGeoJobParameter.destroy
  26795. * @override
  26796. */
  26797. destroy() {
  26798. this.datasetName = null;
  26799. this.datasetOverlay = null;
  26800. this.mode = null;
  26801. this.srcFields = null;
  26802. this.overlayFields = null;
  26803. if (this.output instanceof OutputSetting) {
  26804. this.output.destroy();
  26805. this.output = null;
  26806. }
  26807. if (this.mappingParameters instanceof MappingParameters) {
  26808. this.mappingParameters.destroy();
  26809. this.mappingParameters = null;
  26810. }
  26811. }
  26812. /**
  26813. * @function SuperMap.OverlayGeoJobParameter.toObject
  26814. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  26815. * @param {Object} tempObj - 目标对象。
  26816. * @description 生成点聚合分析任务对象。
  26817. */
  26818. static toObject(OverlayGeoJobParameter, tempObj) {
  26819. for (var name in OverlayGeoJobParameter) {
  26820. if (name == "datasetName") {
  26821. tempObj['input'] = tempObj['input'] || {};
  26822. tempObj['input'][name] = OverlayGeoJobParameter[name];
  26823. continue;
  26824. }
  26825. if (name === "output") {
  26826. tempObj['output'] = tempObj['output'] || {};
  26827. tempObj['output'] = OverlayGeoJobParameter[name];
  26828. continue;
  26829. }
  26830. tempObj['analyst'] = tempObj['analyst'] || {};
  26831. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  26832. if(name === 'mappingParameters'){
  26833. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  26834. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  26835. }
  26836. }
  26837. }
  26838. }
  26839. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  26840. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  26841. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26842. * This program are made available under the terms of the Apache License, Version 2.0
  26843. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26844. /**
  26845. * @class SuperMap.OverlayGeoJobsService
  26846. * @category iServer ProcessingService OverlayAnalyst
  26847. * @classdesc 叠加分析任务类。
  26848. * @param {string} url - 叠加分析任务地址。
  26849. * @param {Object} options - 参数。
  26850. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  26851. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  26852. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  26853. * @param {number} options.index - 服务访问地址在数组中的位置。
  26854. * @param {number} options.length - 服务访问地址数组长度。
  26855. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26856. * @param {Object} [options.headers] - 请求头。
  26857. */
  26858. class OverlayGeoJobsService extends ProcessingServiceBase {
  26859. constructor(url, options) {
  26860. super(url, options);
  26861. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  26862. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  26863. }
  26864. /**
  26865. * @override
  26866. */
  26867. destroy() {
  26868. super.destroy();
  26869. }
  26870. /**
  26871. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJobs
  26872. * @description 获取叠加分析任务
  26873. */
  26874. getOverlayGeoJobs() {
  26875. super.getJobs(this.url);
  26876. }
  26877. /**
  26878. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJob
  26879. * @description 获取指定id的叠加分析任务
  26880. * @param {string} id - 指定要获取数据的id
  26881. */
  26882. getOverlayGeoJob(id) {
  26883. super.getJobs(Util.urlPathAppend(this.url, id));
  26884. }
  26885. /**
  26886. * @function SuperMap.OverlayGeoJobsService.prototype.addOverlayGeoJob
  26887. * @description 新建点叠加析服务
  26888. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  26889. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  26890. */
  26891. addOverlayGeoJob(params, seconds) {
  26892. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  26893. }
  26894. }
  26895. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  26896. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  26897. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26898. * This program are made available under the terms of the Apache License, Version 2.0
  26899. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26900. /**
  26901. * @class SuperMap.QueryByBoundsParameters
  26902. * @category iServer Map QueryResults
  26903. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  26904. * @extends {SuperMap.QueryParameters}
  26905. * @param {Object} options - 参数。
  26906. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 指定的查询范围。
  26907. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  26908. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  26909. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  26910. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  26911. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  26912. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  26913. * @param {number} [options.startRecord=0] - 查询起始记录号。
  26914. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  26915. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  26916. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  26917. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  26918. */
  26919. class QueryByBoundsParameters extends QueryParameters {
  26920. constructor(options) {
  26921. if (!options) {
  26922. return;
  26923. }
  26924. super(options);
  26925. /**
  26926. * @member {boolean} [SuperMap.QueryByBoundsParameters.prototype.returnContent=true]
  26927. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  26928. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  26929. * 为 false,则返回的是查询结果资源的 URI。
  26930. */
  26931. this.returnContent = true;
  26932. /**
  26933. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.QueryByBoundsParameters.prototype.bounds
  26934. * @description 指定的查询范围。
  26935. */
  26936. this.bounds = null;
  26937. Util.extend(this, options);
  26938. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  26939. }
  26940. /**
  26941. * @function SuperMap.QueryByBoundsParameters.prototype.destroy
  26942. * @description 释放资源,将引用资源的属性置空。
  26943. */
  26944. destroy() {
  26945. super.destroy();
  26946. var me = this;
  26947. me.returnContent = null;
  26948. if (me.bounds) {
  26949. me.bounds = null;
  26950. }
  26951. }
  26952. }
  26953. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  26954. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  26955. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26956. * This program are made available under the terms of the Apache License, Version 2.0
  26957. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26958. /**
  26959. * @class SuperMap.QueryService
  26960. * @category iServer Map QueryResults
  26961. * @classdesc 查询服务基类。
  26962. * @extends {SuperMap.CommonServiceBase}
  26963. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  26964. * @param {Object} options - 参数。
  26965. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  26966. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  26967. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  26968. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26969. * @param {Object} [options.headers] - 请求头。
  26970. * @example
  26971. * var myService = new SuperMap.QueryService(url, {
  26972. * eventListeners: {
  26973. * "processCompleted": queryCompleted,
  26974. * "processFailed": queryError
  26975. * }
  26976. * };
  26977. */
  26978. class QueryService extends CommonServiceBase {
  26979. /**
  26980. * @function SuperMap.QueryService.prototype.constructor
  26981. * @description 查询服务基类构造函数。
  26982. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  26983. * @param {Object} options -参数。
  26984. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  26985. */
  26986. constructor(url, options) {
  26987. super(url, options);
  26988. /**
  26989. * @member {boolean} SuperMap.QueryService.prototype.returnContent
  26990. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  26991. */
  26992. this.returnContent = false;
  26993. /**
  26994. * @member {string} SuperMap.QueryService.prototype.format
  26995. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  26996. */
  26997. this.format = DataFormat.GEOJSON;
  26998. this.returnFeatureWithFieldCaption = false;
  26999. if (options) {
  27000. Util.extend(this, options);
  27001. }
  27002. this.CLASS_NAME = "SuperMap.QueryService";
  27003. if (!this.url) {
  27004. return;
  27005. }
  27006. if (options && options.format) {
  27007. this.format = options.format.toUpperCase();
  27008. }
  27009. this.url = Util.urlPathAppend(this.url,'queryResults');
  27010. }
  27011. /**
  27012. * @function SuperMap.QueryService.prototype.destroy
  27013. * @description 释放资源,将引用资源的属性置空。
  27014. */
  27015. destroy() {
  27016. super.destroy();
  27017. var me = this;
  27018. me.returnContent = null;
  27019. me.format = null;
  27020. }
  27021. /**
  27022. * @function SuperMap.QueryService.prototype.processAsync
  27023. * @description 负责将客户端的查询参数传递到服务端。
  27024. * @param {SuperMap.QueryParameters} params - 查询参数。
  27025. */
  27026. processAsync(params) {
  27027. if (!(params instanceof QueryParameters)) {
  27028. return;
  27029. }
  27030. var me = this,
  27031. returnCustomResult = null,
  27032. jsonParameters = null;
  27033. me.returnContent = params.returnContent;
  27034. jsonParameters = me.getJsonParameters(params);
  27035. if (me.returnContent) {
  27036. me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  27037. } else {
  27038. //仅供三维使用 获取高亮图片的bounds
  27039. returnCustomResult = params.returnCustomResult;
  27040. if (returnCustomResult) {
  27041. me.url = Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  27042. }
  27043. }
  27044. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  27045. me.request({
  27046. method: "POST",
  27047. data: jsonParameters,
  27048. scope: me,
  27049. success: me.serviceProcessCompleted,
  27050. failure: me.serviceProcessFailed
  27051. });
  27052. }
  27053. /**
  27054. * @function SuperMap.QueryService.prototype.serviceProcessCompleted
  27055. * @description 查询完成,执行此方法。
  27056. * @param {Object} result - 服务器返回的结果对象。
  27057. */
  27058. serviceProcessCompleted(result) {
  27059. var me = this;
  27060. result = Util.transformResult(result);
  27061. var geoJSONFormat = new GeoJSON();
  27062. if (result && result.recordsets) {
  27063. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  27064. if (recordsets[i].features) {
  27065. if (me.returnFeatureWithFieldCaption === true) {
  27066. recordsets[i].features.map((feature) => {
  27067. feature.fieldNames = recordsets[i].fieldCaptions;
  27068. return feature;
  27069. })
  27070. }
  27071. if (me.format === DataFormat.GEOJSON) {
  27072. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  27073. }
  27074. }
  27075. }
  27076. }
  27077. me.events.triggerEvent("processCompleted", {
  27078. result: result
  27079. });
  27080. }
  27081. /**
  27082. * @function SuperMap.QueryService.prototype.getQueryParameters
  27083. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  27084. * @param {Object} params - JSON 字符串表示的查询参数。
  27085. * @returns {SuperMap.QueryParameters} 返回转化后的 QueryParameters 对象。
  27086. */
  27087. getQueryParameters(params) {
  27088. return new QueryParameters({
  27089. customParams: params.customParams,
  27090. expectCount: params.expectCount,
  27091. networkType: params.networkType,
  27092. queryOption: params.queryOption,
  27093. queryParams: params.queryParams,
  27094. startRecord: params.startRecord,
  27095. prjCoordSys: params.prjCoordSys,
  27096. holdTime: params.holdTime
  27097. });
  27098. }
  27099. }
  27100. SuperMap.QueryService = QueryService;
  27101. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  27102. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27103. * This program are made available under the terms of the Apache License, Version 2.0
  27104. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27105. /**
  27106. * @class SuperMap.QueryByBoundsService
  27107. * @category iServer Map QueryResults
  27108. * @classdesc Bounds 查询服务类。
  27109. * @augments {SuperMap.QueryService}
  27110. * @example
  27111. * (start end)
  27112. * var myQueryByBoundsService = new SuperMap.QueryByBoundsService(url, {
  27113. * eventListeners: {
  27114. * "processCompleted": queryCompleted,
  27115. * "processFailed": queryError
  27116. * }
  27117. * });
  27118. * function queryCompleted(object){//todo};
  27119. * function queryError(object){//todo};
  27120. * (end)
  27121. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27122. * @param {Object} options - 参数。<br>
  27123. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  27124. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27125. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27126. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27127. * @param {Object} [options.headers] - 请求头。
  27128. */
  27129. class QueryByBoundsService extends QueryService {
  27130. constructor(url, options) {
  27131. super(url, options);
  27132. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  27133. }
  27134. /**
  27135. * @override
  27136. */
  27137. destroy() {
  27138. super.destroy();
  27139. }
  27140. /**
  27141. * @function SuperMap.QueryByBoundsService.prototype.getJsonParameters
  27142. * @description 将查询参数转化为 JSON 字符串。
  27143. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  27144. * @param {SuperMap.QueryByBoundsParameters} params - Bounds 查询参数。
  27145. * @returns {Object} 转化后的 JSON 字符串。
  27146. */
  27147. getJsonParameters(params) {
  27148. if (!(params instanceof QueryByBoundsParameters)) {
  27149. return null;
  27150. }
  27151. var me = this,
  27152. jsonParameters = "",
  27153. qp = null,
  27154. bounds = params.bounds;
  27155. qp = me.getQueryParameters(params);
  27156. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  27157. jsonParameters += Util.toJSON(qp);
  27158. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  27159. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  27160. jsonParameters = "{" + jsonParameters + "}";
  27161. return jsonParameters;
  27162. }
  27163. }
  27164. SuperMap.QueryByBoundsService = QueryByBoundsService;
  27165. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  27166. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27167. * This program are made available under the terms of the Apache License, Version 2.0
  27168. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27169. /**
  27170. * @class SuperMap.QueryByDistanceParameters
  27171. * @category iServer Map QueryResults
  27172. * @classdesc Distance 查询参数类。
  27173. * 该类用于设置 Distance 查询的相关参数。
  27174. * @extends {SuperMap.QueryParameters}
  27175. * @param {Object} options - 参数。
  27176. * @param {Object} options.geometry - 用于查询的几何对象。
  27177. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  27178. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  27179. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  27180. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  27181. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  27182. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  27183. * @param {number} [options.startRecord=0] - 查询起始记录号。
  27184. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  27185. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  27186. * @param {number} [options.distance=0] - 查询距离。
  27187. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  27188. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27189. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  27190. */
  27191. class QueryByDistanceParameters extends QueryParameters {
  27192. constructor(options) {
  27193. if (!options) {
  27194. return;
  27195. }
  27196. super(options);
  27197. /**
  27198. * @member {number} [SuperMap.QueryByDistanceParameters.prototype.distance=0]
  27199. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  27200. * 当查找最近地物时,该属性无效。
  27201. */
  27202. this.distance = 0;
  27203. /**
  27204. * @member SuperMap.QueryByDistanceParameters.prototype.geometry
  27205. * @description 用于查询的地理对象。<br>
  27206. * 点类型可以是:{@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>
  27207. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  27208. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  27209. */
  27210. this.geometry = null;
  27211. /**
  27212. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.isNearest=false]
  27213. * @description 是否为最近距离查询。<br>
  27214. * 建议该属性与 expectCount(继承自 {@link SuperMap.QueryParameters})属性联合使用。
  27215. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  27216. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  27217. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  27218. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  27219. * 目前查询结果不支持按远近距离排序。
  27220. */
  27221. this.isNearest = null;
  27222. /**
  27223. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.returnContent=true]
  27224. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27225. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  27226. * 为 false,则返回的是查询结果资源的 URI。
  27227. */
  27228. this.returnContent = true;
  27229. Util.extend(this, options);
  27230. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  27231. }
  27232. /**
  27233. * @function SuperMap.QueryByDistanceParameters.prototype.destroy
  27234. * @description 释放资源,将引用资源的属性置空。
  27235. */
  27236. destroy() {
  27237. super.destroy();
  27238. var me = this;
  27239. me.returnContent = null;
  27240. me.distance = null;
  27241. me.isNearest = null;
  27242. if (me.geometry) {
  27243. me.geometry.destroy();
  27244. me.geometry = null;
  27245. }
  27246. }
  27247. }
  27248. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  27249. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  27250. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27251. * This program are made available under the terms of the Apache License, Version 2.0
  27252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27253. /**
  27254. * @class SuperMap.QueryByDistanceService
  27255. * @category iServer Map QueryResults
  27256. * @classdesc Distance查询服务类。
  27257. * @extends {SuperMap.QueryService}
  27258. * @example
  27259. * var myQueryByDistService = new SuperMap.QueryByDistanceService(url, {
  27260. * eventListeners: {
  27261. * "processCompleted": queryCompleted,
  27262. * "processFailed": queryError
  27263. * }
  27264. * });
  27265. * function queryCompleted(object){//todo};
  27266. * function queryError(object){//todo};
  27267. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27268. * @param {Object} options - 参数。
  27269. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27270. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27271. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27272. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27273. * @param {Object} [options.headers] - 请求头。
  27274. */
  27275. class QueryByDistanceService extends QueryService {
  27276. constructor(url, options) {
  27277. super(url, options);
  27278. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  27279. }
  27280. /**
  27281. * @override
  27282. */
  27283. destroy() {
  27284. super.destroy();
  27285. }
  27286. /**
  27287. * @function SuperMap.QueryByDistanceService.prototype.getJsonParameters
  27288. * @description 将查询参数转化为 JSON 字符串。
  27289. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  27290. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询参数类。
  27291. * @returns {Object} 转化后的 JSON 字符串。
  27292. */
  27293. getJsonParameters(params) {
  27294. if (!(params instanceof QueryByDistanceParameters)) {
  27295. return;
  27296. }
  27297. var me = this,
  27298. jsonParameters = "",
  27299. qp = me.getQueryParameters(params);
  27300. var sg = ServerGeometry.fromGeometry(params.geometry);
  27301. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  27302. jsonParameters += Util.toJSON(qp);
  27303. jsonParameters += ",'geometry':" + Util.toJSON(sg) + ",'distance':" + params.distance;
  27304. jsonParameters = "{" + jsonParameters + "}";
  27305. return jsonParameters;
  27306. }
  27307. }
  27308. SuperMap.QueryByDistanceService = QueryByDistanceService;
  27309. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  27310. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27311. * This program are made available under the terms of the Apache License, Version 2.0
  27312. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27313. /**
  27314. * @class SuperMap.QueryByGeometryParameters
  27315. * @category iServer Map QueryResults
  27316. * @classdesc Geometry 查询参数类。
  27317. * 该类用于设置 Geometry查询的相关参数。
  27318. * @extends {SuperMap.QueryParameters}
  27319. * @param {Object} options - 参数。
  27320. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  27321. * @param {Object} options.geometry - 用于查询的几何对象。
  27322. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  27323. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  27324. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  27325. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  27326. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  27327. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  27328. * @param {number} [options.startRecord=0] - 查询起始记录号。
  27329. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  27330. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27331. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  27332. * @param {SuperMap.SpatialQueryMode} [spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT] - 空间查询模式。
  27333. */
  27334. class QueryByGeometryParameters extends QueryParameters {
  27335. constructor(options) {
  27336. if (!options) {
  27337. return;
  27338. }
  27339. super(options);
  27340. /**
  27341. * @member {boolean} [SuperMap.QueryByGeometryParameters.prototype.returnContent=true]
  27342. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  27343. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  27344. * 为 false,则返回的是查询结果资源的 URI。
  27345. */
  27346. this.returnContent = true;
  27347. /**
  27348. * @member {Object} SuperMap.QueryByGeometryParameters.prototype.geometry
  27349. * @description 用于查询的几何对象。<br>
  27350. * 点类型可以是:{@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>
  27351. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  27352. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  27353. */
  27354. this.geometry = null;
  27355. /**
  27356. * @member {SuperMap.SpatialQueryMode} [SuperMap.QueryByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT]
  27357. * @description 空间查询模式。
  27358. */
  27359. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  27360. Util.extend(this, options);
  27361. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  27362. }
  27363. /**
  27364. * @function SuperMap.QueryByGeometryParameters.prototype.destroy
  27365. * @description 释放资源,将引用资源的属性置空。
  27366. */
  27367. destroy() {
  27368. super.destroy();
  27369. var me = this;
  27370. me.returnContent = null;
  27371. me.geometry = null;
  27372. me.spatialQueryMode = null;
  27373. }
  27374. }
  27375. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  27376. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  27377. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27378. * This program are made available under the terms of the Apache License, Version 2.0
  27379. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27380. /**
  27381. * @class SuperMap.QueryByGeometryService
  27382. * @category iServer Map QueryResults
  27383. * @classdesc Geometry查询服务类。
  27384. * @extends {SuperMap.QueryService}
  27385. * @example
  27386. * var myQueryByGeometryService = new SuperMap.QueryByGeometryService(url, {
  27387. * eventListeners: {
  27388. * "processCompleted": queryCompleted,
  27389. * "processFailed": queryError
  27390. * }
  27391. * });
  27392. * function queryCompleted(object){//todo};
  27393. * function queryError(object){//todo};
  27394. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27395. * @param {Object} options - 参数。
  27396. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27397. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27398. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27399. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27400. * @param {Object} [options.headers] - 请求头。
  27401. */
  27402. class QueryByGeometryService extends QueryService {
  27403. /**
  27404. * @function SuperMap.QueryByGeometryService.prototype.constructor
  27405. * @description Geometry 查询服务类构造函数。
  27406. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27407. * @param {Object} options - 参数。
  27408. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27409. */
  27410. constructor(url, options) {
  27411. super(url, options);
  27412. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  27413. }
  27414. /**
  27415. * @override
  27416. */
  27417. destroy() {
  27418. super.destroy();
  27419. }
  27420. /**
  27421. * @function SuperMap.QueryByGeometryService.prototype.getJsonParameters
  27422. * @description 将查询参数转化为 JSON 字符串。
  27423. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  27424. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询参数类。
  27425. * @returns {Object} 转化后的 JSON 字符串。
  27426. */
  27427. getJsonParameters(params) {
  27428. if (!(params instanceof QueryByGeometryParameters)) {
  27429. return;
  27430. }
  27431. var me = this,
  27432. jsonParameters = "",
  27433. qp = null,
  27434. geometry = params.geometry,
  27435. sg = ServerGeometry.fromGeometry(geometry);
  27436. qp = me.getQueryParameters(params);
  27437. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  27438. jsonParameters += Util.toJSON(qp) + ",'geometry':" + Util.toJSON(sg)
  27439. + ",'spatialQueryMode':" + Util.toJSON(params.spatialQueryMode);
  27440. jsonParameters = "{" + jsonParameters + "}";
  27441. return jsonParameters;
  27442. }
  27443. }
  27444. SuperMap.QueryByGeometryService = QueryByGeometryService;
  27445. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  27446. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27447. * This program are made available under the terms of the Apache License, Version 2.0
  27448. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27449. /**
  27450. * @class SuperMap.QueryBySQLParameters
  27451. * @category iServer Map QueryResults
  27452. * @classdesc SQL 查询参数类。
  27453. * 该类用于设置 SQL 查询的相关参数。
  27454. * @extends {SuperMap.QueryParameters}
  27455. * @param {Object} options - 参数。
  27456. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  27457. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  27458. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  27459. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  27460. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  27461. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  27462. * @param {number} [options.startRecord=0] - 查询起始记录号。
  27463. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  27464. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  27465. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27466. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  27467. */
  27468. class QueryBySQLParameters extends QueryParameters {
  27469. constructor(options) {
  27470. if (!options) {
  27471. return;
  27472. }
  27473. super(options);
  27474. /**
  27475. * @member {boolean} [SuperMap.QueryBySQLParameters.prototype.returnContent=true]
  27476. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  27477. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  27478. * 为 false,则返回的是查询结果资源的 URI。
  27479. */
  27480. this.returnContent = true;
  27481. Util.extend(this, options);
  27482. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  27483. }
  27484. /**
  27485. * @function SuperMap.QueryBySQLParameters.prototype.destroy
  27486. * @description 释放资源,将引用资源的属性置空。
  27487. */
  27488. destroy() {
  27489. super.destroy();
  27490. var me = this;
  27491. me.returnContent = null;
  27492. }
  27493. }
  27494. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  27495. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  27496. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27497. * This program are made available under the terms of the Apache License, Version 2.0
  27498. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27499. /**
  27500. * @class SuperMap.QueryBySQLService
  27501. * @category iServer Map QueryResults
  27502. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  27503. * @extends {SuperMap.QueryService}
  27504. * @example
  27505. * var queryParam = new SuperMap.FilterParameter({
  27506. * name: "Countries@World.1",
  27507. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  27508. * });
  27509. * var queryBySQLParams = new SuperMap.QueryBySQLParameters({
  27510. * queryParams: [queryParam]
  27511. * });
  27512. * var myQueryBySQLService = new SuperMap.QueryBySQLService(url, {eventListeners: {
  27513. * "processCompleted": queryCompleted,
  27514. * "processFailed": queryError
  27515. * }
  27516. * });
  27517. * queryBySQLService.processAsync(queryBySQLParams);
  27518. * function queryCompleted(object){//todo};
  27519. * function queryError(object){//todo};
  27520. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27521. * @param {Object} options - 参数。
  27522. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27523. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27524. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27525. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27526. * @param {Object} [options.headers] - 请求头。
  27527. */
  27528. class QueryBySQLService extends QueryService {
  27529. /**
  27530. * @function SuperMap.QueryBySQLService.prototype.constructor
  27531. * @description SQL 查询服务类构造函数。
  27532. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  27533. * @param {Object} options - 参数。
  27534. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27535. */
  27536. constructor(url, options) {
  27537. super(url, options);
  27538. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  27539. }
  27540. /**
  27541. * @override
  27542. */
  27543. destroy() {
  27544. super.destroy();
  27545. }
  27546. /**
  27547. * @function SuperMap.QueryBySQLService.prototype.getJsonParameters
  27548. * @description 将查询参数转化为 JSON 字符串。
  27549. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  27550. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询参数类。
  27551. * @returns {Object} 转化后的 JSON 字符串。
  27552. */
  27553. getJsonParameters(params) {
  27554. if (!(params instanceof QueryBySQLParameters)) {
  27555. return;
  27556. }
  27557. var me = this,
  27558. jsonParameters = "",
  27559. qp = null;
  27560. qp = me.getQueryParameters(params);
  27561. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  27562. jsonParameters += Util.toJSON(qp);
  27563. jsonParameters = "{" + jsonParameters + "}";
  27564. return jsonParameters;
  27565. }
  27566. }
  27567. SuperMap.QueryBySQLService = QueryBySQLService;
  27568. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  27569. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27570. * This program are made available under the terms of the Apache License, Version 2.0
  27571. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27572. /**
  27573. * @class SuperMap.RouteCalculateMeasureParameters
  27574. * @category iServer SpatialAnalyst RouteCalculateMeasure
  27575. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  27576. * @param {Object} options - 参数。
  27577. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  27578. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  27579. * @param {float} [options.tolerance] - 容限值。
  27580. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  27581. */
  27582. class RouteCalculateMeasureParameters {
  27583. constructor(options) {
  27584. if (!options) {
  27585. return this;
  27586. }
  27587. /**
  27588. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteCalculateMeasureParameters.prototype.sourceRoute
  27589. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  27590. */
  27591. this.sourceRoute = null;
  27592. /**
  27593. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} SuperMap.RouteCalculateMeasureParameters.prototype.point
  27594. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  27595. */
  27596. this.point = null;
  27597. /**
  27598. * @member {float} [SuperMap.RouteCalculateMeasureParameters.prototype.tolerance]
  27599. * @description 容限值。
  27600. */
  27601. this.tolerance = null;
  27602. /**
  27603. * @member {boolean} [SuperMap.RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  27604. * @description 是否忽略子对象之间的距离。
  27605. */
  27606. this.isIgnoreGap = false;
  27607. Util.extend(this, options);
  27608. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  27609. }
  27610. /**
  27611. * @function SuperMap.RouteCalculateMeasureParameters.prototype.destroy
  27612. * @description 释放资源,将引用资源的属性置空。
  27613. */
  27614. destroy() {
  27615. var me = this;
  27616. me.sourceRoute = null;
  27617. me.point = null;
  27618. if (me.tolerance) {
  27619. me.tolerance = null;
  27620. }
  27621. if (me.isIgnoreGap) {
  27622. me.isIgnoreGap = false;
  27623. }
  27624. }
  27625. }
  27626. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  27627. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  27628. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27629. * This program are made available under the terms of the Apache License, Version 2.0
  27630. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27631. /**
  27632. * @class SuperMap.RouteCalculateMeasureService
  27633. * @category iServer SpatialAnalyst RouteCalculateMeasure
  27634. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  27635. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  27636. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  27637. * @extends {SuperMap.SpatialAnalystBase}
  27638. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  27639. * @param {Object} options - 参数。
  27640. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27641. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27642. * @param {Object} [options.headers] - 请求头。
  27643. * @example 实例化该类如下例所示:
  27644. * (start code)
  27645. * var parameters = new SuperMap.RouteCalculateMeasureParameters({
  27646. * "sourceRoute":{
  27647. * "type":"LINEM",
  27648. * "parts":[4],
  27649. * "points":[
  27650. * {
  27651. * "measure":0,
  27652. * "y":-6674.466867067764,
  27653. * "x":3817.3527876130133
  27654. * },
  27655. * {
  27656. * "measure":199.57954019411724,
  27657. * "y":-6670.830929417594,
  27658. * "x":3617.806369901496
  27659. * },
  27660. * {
  27661. * "measure":609.3656478634477,
  27662. * "y":-6877.837541432356,
  27663. * "x":3264.1498746678444
  27664. * },
  27665. * {
  27666. * "measure":936.0174126282958,
  27667. * "y":-7038.687780615184,
  27668. * "x":2979.846206068903
  27669. * }
  27670. * ]
  27671. * },
  27672. * "tolerance":1,
  27673. * "point":{
  27674. * "x":3330.7754269417,
  27675. * "y":-6838.8394457216
  27676. * },
  27677. * "isIgnoreGap":false
  27678. * });
  27679. *
  27680. * var routeCalculateMeasureService = new SuperMap.RouteCalculateMeasureService(spatialAnalystURL, {
  27681. * eventListeners:{
  27682. * processCompleted:calculateCompleted,
  27683. * processFailed:calculateFailded
  27684. * }
  27685. * );
  27686. * routeCalculateMeasureService.processAsync(parameters);
  27687. *
  27688. * //执行
  27689. * function calculateCompleted(){todo}
  27690. * function calculateFailded(){todo}
  27691. * (end)
  27692. *
  27693. */
  27694. class RouteCalculateMeasureService extends SpatialAnalystBase {
  27695. constructor(url, options) {
  27696. super(url, options);
  27697. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  27698. }
  27699. /**
  27700. * @override
  27701. */
  27702. destroy() {
  27703. super.destroy();
  27704. }
  27705. /**
  27706. * @function SuperMap.RouteCalculateMeasureService.prototype.processAsync
  27707. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  27708. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  27709. */
  27710. processAsync(params) {
  27711. if (!(params instanceof RouteCalculateMeasureParameters)) {
  27712. return;
  27713. }
  27714. var me = this, jsonParameters;
  27715. jsonParameters = me.getJsonParameters(params);
  27716. me.request({
  27717. method: "POST",
  27718. data: jsonParameters,
  27719. scope: me,
  27720. success: me.serviceProcessCompleted,
  27721. failure: me.serviceProcessFailed
  27722. });
  27723. }
  27724. /**
  27725. * @function SuperMap.RouteCalculateMeasureService.prototype.getJsonParameters
  27726. * @description 将参数转化为 JSON 字符串。
  27727. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  27728. * @returns {Object} 转化后的 JSON 字符串。
  27729. */
  27730. getJsonParameters(params) {
  27731. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  27732. me.url = Util.urlPathAppend(me.url, jsonStr);
  27733. me.url = Util.urlAppend(me.url, 'returnContent=true');
  27734. jsonParameters = Util.toJSON(params);
  27735. return jsonParameters;
  27736. }
  27737. }
  27738. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  27739. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  27740. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27741. * This program are made available under the terms of the Apache License, Version 2.0
  27742. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27743. /**
  27744. * @class SuperMap.RouteLocatorParameters
  27745. * @category iServer SpatialAnalyst RouteLocator
  27746. * @classdesc 路由对象定位空间对象的参数类。
  27747. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数
  27748. * 如果用户两种参数均设置,优先选择 Dataset 方式。
  27749. * @param {Object} options - 参数。
  27750. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。
  27751. * @param {float} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  27752. * @param {string} [options.type] - 类型:点 or 线。
  27753. * @param {float} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  27754. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  27755. * @param {float} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  27756. * @param {float} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  27757. */
  27758. class RouteLocatorParameters {
  27759. constructor(options) {
  27760. if (!options) {
  27761. return this;
  27762. }
  27763. /**
  27764. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteLocatorParameters.prototype.sourceRoute
  27765. * @description 路由对象。
  27766. */
  27767. this.sourceRoute = null;
  27768. /**
  27769. * @member {string} SuperMap.RouteLocatorParameters.prototype.dataset
  27770. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  27771. */
  27772. this.dataset = null;
  27773. /**
  27774. * @member {string} SuperMap.RouteLocatorParameters.prototype.routeIDField
  27775. * @description 路由对象所在的字段名称。
  27776. *
  27777. */
  27778. this.routeIDField = null;
  27779. /**
  27780. * @member {number} SuperMap.RouteLocatorParameters.prototype.routeID
  27781. * @description 路由对象标识。
  27782. *
  27783. */
  27784. this.routeID = null;
  27785. /**
  27786. * @member {string} [SuperMap.RouteLocatorParameters.prototype.type]
  27787. * @description 类型:点 or 线。
  27788. * 可选值为:
  27789. * LINE :根据起始 M 值及终止 M 值定位线对象。
  27790. * POINT : 根据 M 值定位点对象。
  27791. */
  27792. this.type = null;
  27793. /**
  27794. * @member {float} SuperMap.RouteLocatorParameters.prototype.measure
  27795. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  27796. */
  27797. this.measure = null;
  27798. /**
  27799. * @member {float} [SuperMap.RouteLocatorParameters.prototype.offset=0]
  27800. * @description 定位点偏移量。只当路由对象定位点时有意义。
  27801. */
  27802. this.offset = 0;
  27803. /**
  27804. * @member {boolean} [SuperMap.RouteLocatorParameters.prototype.isIgnoreGap=false]
  27805. * @description 是否忽略子对象之间的距离。
  27806. */
  27807. this.isIgnoreGap = false;
  27808. /**
  27809. * @member {float} [SuperMap.RouteLocatorParameters.prototype.startMeasure]
  27810. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  27811. */
  27812. this.startMeasure = null;
  27813. /**
  27814. * @member {float} [SuperMap.RouteLocatorParameters.prototype.endMeasure]
  27815. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  27816. */
  27817. this.endMeasure = null;
  27818. var routeFromClient = options.sourceRoute;
  27819. var routeHandle = {};
  27820. if (routeFromClient && routeFromClient instanceof Geometry && routeFromClient.components) {
  27821. routeHandle.type = routeFromClient.type;
  27822. routeHandle.parts = routeFromClient.parts;
  27823. var parts = [];
  27824. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  27825. parts = parts.concat(routeFromClient.components[i].components);
  27826. }
  27827. routeHandle.points = parts;
  27828. options.sourceRoute = routeHandle;
  27829. }
  27830. Util.extend(this, options);
  27831. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  27832. }
  27833. /**
  27834. * @function SuperMap.RouteLocatorParameters.prototype.destroy
  27835. * @description 释放资源,将引用资源的属性置空。
  27836. */
  27837. destroy() {
  27838. var me = this;
  27839. me.sourceRoute = null;
  27840. me.type = null;
  27841. me.measure = null;
  27842. me.offset = 0;
  27843. me.isIgnoreGap = false;
  27844. me.startMeasure = null;
  27845. me.endMeasure = null;
  27846. me.dataset = null;
  27847. me.routeID = null;
  27848. me.routeIDField = null;
  27849. }
  27850. }
  27851. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  27852. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  27853. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27854. * This program are made available under the terms of the Apache License, Version 2.0
  27855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27856. /**
  27857. * @class SuperMap.RouteLocatorService
  27858. * @category iServer SpatialAnalyst RouteLocator
  27859. * @classdesc 路由对象定位空间对象的服务类。
  27860. * @extends {SuperMap.SpatialAnalystBase}
  27861. * @param {string} url -服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  27862. * @param {Object} options - 参数。</br>
  27863. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27864. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27865. * @param {Object} [options.headers] - 请求头。
  27866. * @example 实例化该类如下例所示:
  27867. * (start code)
  27868. * var routeLocatorParameters_point = new SuperMap.RouteLocatorParameters({
  27869. * "sourceRoute":{
  27870. * "type":"LINEM",
  27871. * "parts":[4],
  27872. * "points":[
  27873. * {
  27874. * "measure":0,
  27875. * "y":-6674.466867067764,
  27876. * "x":3817.3527876130133
  27877. * },
  27878. * {
  27879. * "measure":199.57954019411724,
  27880. * "y":-6670.830929417594,
  27881. * "x":3617.806369901496
  27882. * },
  27883. * {
  27884. * "measure":609.3656478634477,
  27885. * "y":-6877.837541432356,
  27886. * "x":3264.1498746678444
  27887. * },
  27888. * {
  27889. * "measure":936.0174126282958,
  27890. * "y":-7038.687780615184,
  27891. * "x":2979.846206068903
  27892. * }
  27893. * ]
  27894. * },
  27895. * "type":"POINT",
  27896. * "measure":10,
  27897. * "offset":3,
  27898. * "isIgnoreGap":true
  27899. * });
  27900. * var routeLocatorService = new SuperMap.RouteLocatorService(spatialAnalystURL, {
  27901. * eventListeners:{
  27902. * processCompleted:routeLocatorCompleted,
  27903. * processFailed:routeLocatorFailded
  27904. * }
  27905. * );
  27906. * routeLocatorService.processAsync(routeLocatorParameters_point);
  27907. *
  27908. * //执行
  27909. * function routeLocatorCompleted(){todo}
  27910. * function routeLocatorFailded(){todo}
  27911. * (end)
  27912. *
  27913. */
  27914. class RouteLocatorService extends SpatialAnalystBase {
  27915. constructor(url, options) {
  27916. super(url, options);
  27917. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  27918. }
  27919. /**
  27920. * @override
  27921. */
  27922. destroy() {
  27923. super.destroy();
  27924. }
  27925. /**
  27926. * @function SuperMap.RouteLocatorService.prototype.processAsync
  27927. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  27928. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  27929. */
  27930. processAsync(params) {
  27931. if (!(params instanceof RouteLocatorParameters)) {
  27932. return;
  27933. }
  27934. var me = this, jsonParameters;
  27935. jsonParameters = me.getJsonParameters(params);
  27936. me.request({
  27937. method: "POST",
  27938. data: jsonParameters,
  27939. scope: me,
  27940. success: me.serviceProcessCompleted,
  27941. failure: me.serviceProcessFailed
  27942. });
  27943. }
  27944. /**
  27945. * @function SuperMap.RouteLocatorService.prototype.processAsync
  27946. * @description 将参数转化为 JSON 字符串。
  27947. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  27948. * @returns {Object} 转化后的JSON字符串。
  27949. */
  27950. getJsonParameters(params) {
  27951. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  27952. if (params.dataset) {
  27953. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  27954. params.sourceRoute = null;
  27955. }
  27956. me.url = Util.urlPathAppend(me.url, jsonStr);
  27957. me.url = Util.urlAppend(me.url, 'returnContent=true');
  27958. jsonParameters = Util.toJSON(params);
  27959. return jsonParameters;
  27960. }
  27961. }
  27962. SuperMap.RouteLocatorService = RouteLocatorService;
  27963. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  27964. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27965. * This program are made available under the terms of the Apache License, Version 2.0
  27966. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27967. /**
  27968. * @class SuperMap.ServerFeature
  27969. * @category iServer
  27970. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  27971. * @param {Object} options - 参数。
  27972. * @param {SuperMap.ServerGeometry} geometry - 矢量要素的几何信息。
  27973. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  27974. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  27975. */
  27976. class ServerFeature {
  27977. constructor(options) {
  27978. /**
  27979. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldNames]
  27980. * @description 矢量要素的属性字段名集合。
  27981. */
  27982. this.fieldNames = null;
  27983. /**
  27984. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldValues]
  27985. * @description 矢量要素的属性字段值集合。
  27986. */
  27987. this.fieldValues = null;
  27988. /**
  27989. * @member {SuperMap.ServerGeometry} SuperMap.ServerFeature.prototype.geometry
  27990. * @description 矢量要素的几何信息。
  27991. */
  27992. this.geometry = null;
  27993. if (options) {
  27994. Util.extend(this, options);
  27995. }
  27996. this.CLASS_NAME = "SuperMap.ServerFeature";
  27997. }
  27998. /**
  27999. * @function SuperMap.ServerFeature.prototype.destroy
  28000. * @description 释放资源,将引用资源的属性置空。
  28001. */
  28002. destroy() {
  28003. var me = this;
  28004. me.fieldNames = null;
  28005. me.fieldValues = null;
  28006. if (me.geometry) {
  28007. me.geometry.destroy();
  28008. me.geometry = null;
  28009. }
  28010. }
  28011. /**
  28012. * @function SuperMap.ServerFeature.prototype.toFeature
  28013. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  28014. * @returns {SuperMap.Vector} 转换后的客户端矢量要素。
  28015. */
  28016. toFeature() {
  28017. var names, values, geo,
  28018. attr = {},
  28019. me = this,
  28020. feature;
  28021. names = me.fieldNames;
  28022. values = me.fieldValues;
  28023. for (var i in names) {
  28024. attr[names[i]] = values[i];
  28025. }
  28026. if (me.geometry) {
  28027. geo = me.geometry.toGeometry();
  28028. }
  28029. feature = new Vector(geo, attr);
  28030. if (me.geometry && me.geometry.id) {
  28031. feature.fid = me.geometry.id;
  28032. }
  28033. return feature;
  28034. }
  28035. /**
  28036. * @function SuperMap.ServerFeature.prototype.fromJson
  28037. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  28038. * @param {Object} jsonObject - 要转换的 JSON 对象。
  28039. * @returns {SuperMap.ServerFeature} 转化后的 ServerFeature 对象。
  28040. */
  28041. static fromJson(jsonObject) {
  28042. var geo = null;
  28043. if (!jsonObject) {
  28044. return;
  28045. }
  28046. geo = jsonObject.geometry;
  28047. if (geo) {
  28048. geo = ServerGeometry.fromJson(geo);
  28049. }
  28050. return new ServerFeature({
  28051. fieldNames: jsonObject.fieldNames,
  28052. fieldValues: jsonObject.fieldValues,
  28053. geometry: geo
  28054. });
  28055. }
  28056. }
  28057. SuperMap.ServerFeature = ServerFeature;
  28058. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  28059. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28060. * This program are made available under the terms of the Apache License, Version 2.0
  28061. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28062. /**
  28063. * @class SuperMap.SetLayerInfoParameters
  28064. * @category iServer Map TempLayersSet
  28065. * @classdesc 设置图层信息参数类.
  28066. * @param {Object} options - 参数。
  28067. * @param {string} options.resourceID - 临时图层的资源 ID。
  28068. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  28069. * @param {string} options.layerInfo - 要更新的图层信息。
  28070. */
  28071. class SetLayerInfoParameters {
  28072. constructor(options) {
  28073. options = options || {};
  28074. /**
  28075. * @member {string} SuperMap.SetLayerInfoParameters.prototype.resourceID
  28076. * @description 临时图层的资源 ID。
  28077. */
  28078. this.resourceID = null;
  28079. /**
  28080. * @member {string} SuperMap.SetLayerInfoParameters.prototype.tempLayerName
  28081. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  28082. */
  28083. this.tempLayerName = null;
  28084. /**
  28085. * @member {Object} SuperMap.SetLayerInfoParameters.prototype.layerInfo
  28086. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  28087. */
  28088. this.layerInfo = null;
  28089. Util.extend(this, options);
  28090. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  28091. }
  28092. /**
  28093. * @function SuperMap.SetLayerInfoParameters.prototype.destroy
  28094. * @description 释放资源,将引用资源的属性置空。
  28095. */
  28096. destroy() {
  28097. var me = this;
  28098. me.resourceID = null;
  28099. me.tempLayerName = null;
  28100. me.layerInfo = null;
  28101. }
  28102. }
  28103. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  28104. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  28105. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28106. * This program are made available under the terms of the Apache License, Version 2.0
  28107. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28108. /**
  28109. * @class SuperMap.SetLayerInfoService
  28110. * @category iServer Map TempLayersSet
  28111. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  28112. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  28113. * @extends {SuperMap.CommonServiceBase}
  28114. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  28115. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  28116. * @param {Object} options - 参数。
  28117. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28118. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28119. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28120. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28121. * @param {Object} [options.headers] - 请求头。
  28122. */
  28123. class SetLayerInfoService extends CommonServiceBase {
  28124. constructor(url, options) {
  28125. super(url, options);
  28126. if (options) {
  28127. Util.extend(this, options);
  28128. }
  28129. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  28130. }
  28131. /**
  28132. * @override
  28133. */
  28134. destroy() {
  28135. super.destroy();
  28136. Util.reset(this);
  28137. }
  28138. /**
  28139. * @function SuperMap.SetLayerInfoService.prototype.processAsync
  28140. * @description 负责将客户端的更新参数传递到服务端。
  28141. * @param {Object} params - 修改后的图层资源信息。
  28142. * 该参数可以使用获取图层信息服务<{@link SuperMap.GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  28143. */
  28144. processAsync(params) {
  28145. if (!params) {
  28146. return;
  28147. }
  28148. var me = this;
  28149. var jsonParamsStr = Util.toJSON(params);
  28150. me.request({
  28151. method: "PUT",
  28152. data: jsonParamsStr,
  28153. scope: me,
  28154. success: me.serviceProcessCompleted,
  28155. failure: me.serviceProcessFailed
  28156. });
  28157. }
  28158. }
  28159. SuperMap.SetLayerInfoService = SetLayerInfoService;
  28160. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  28161. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28162. * This program are made available under the terms of the Apache License, Version 2.0
  28163. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28164. /**
  28165. * @class SuperMap.SetLayersInfoParameters
  28166. * @category iServer Map TempLayersSet
  28167. * @classdesc 设置图层信息参数类。
  28168. * @param {Object} options - 参数。
  28169. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  28170. * @param {string} options.resourceID - 临时图层资源 ID。
  28171. * @param {string} options.layersInfo - 要更新的图层信息。
  28172. */
  28173. class SetLayersInfoParameters {
  28174. constructor(options) {
  28175. options = options || {};
  28176. /**
  28177. * @member {boolean} [SuperMap.SetLayersInfoParameters.prototype.isTempLayers=false]
  28178. * @description 是否是临时图层。
  28179. */
  28180. this.isTempLayers = null;
  28181. /**
  28182. * @member {string} SuperMap.SetLayersInfoParameters.prototype.resourceID
  28183. * @description 临时图层资源 ID,
  28184. */
  28185. this.resourceID = null;
  28186. /**
  28187. * @member {Object} SuperMap.SetLayersInfoParameters.prototype.layersInfo
  28188. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  28189. */
  28190. this.layersInfo = null;
  28191. Util.extend(this, options);
  28192. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  28193. }
  28194. /**
  28195. * @function SuperMap.SetLayersInfoParameters.prototype.destroy
  28196. * @description 释放资源,将引用资源的属性置空。
  28197. */
  28198. destroy() {
  28199. var me = this;
  28200. me.isTempLayers = null;
  28201. me.resourceID = null;
  28202. me.layersInfo = null;
  28203. }
  28204. }
  28205. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  28206. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  28207. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28208. * This program are made available under the terms of the Apache License, Version 2.0
  28209. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28210. /**
  28211. * @class SuperMap.SetLayersInfoService
  28212. * @category iServer Map TempLayersSet
  28213. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  28214. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  28215. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  28216. * @extends {SuperMap.CommonServiceBase}
  28217. * @param url - {string} 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  28218. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  28219. * @param {Object} options - 参数。
  28220. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  28221. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  28222. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28223. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28224. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28225. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28226. * @param {Object} [options.headers] - 请求头。
  28227. */
  28228. class SetLayersInfoService extends CommonServiceBase {
  28229. constructor(url, options) {
  28230. super(url, options);
  28231. /**
  28232. * @member {string} SuperMap.SetLayersInfoService.prototype.resourceID
  28233. * @description 图层资源ID,临时图层的资源ID标记。
  28234. */
  28235. this.resourceID = null;
  28236. /**
  28237. * @function {boolean} SuperMap.SetLayersInfoService.prototype.isTempLayers
  28238. * @description 当前url对应的图层是否是临时图层。
  28239. */
  28240. this.isTempLayers = false;
  28241. if (options) {
  28242. SuperMap.Util.extend(this, options);
  28243. }
  28244. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  28245. }
  28246. /**
  28247. * @override
  28248. */
  28249. destroy() {
  28250. super.destroy();
  28251. Util.reset(this);
  28252. }
  28253. /**
  28254. * @function SuperMap.SetLayersInfoService.prototype.processAsync
  28255. * @description 负责将客户端的更新参数传递到服务端。
  28256. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link SuperMap.GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  28257. */
  28258. processAsync(params) {
  28259. if (!params) {
  28260. return;
  28261. }
  28262. var jsonParams,
  28263. subLayers = [],
  28264. me = this,
  28265. method = "";
  28266. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  28267. if (me.isTempLayers) {
  28268. me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  28269. method = "PUT";
  28270. } else {
  28271. me.url = Util.urlPathAppend(me.url, "tempLayersSet");
  28272. method = "POST";
  28273. }
  28274. if (!params.subLayers) {
  28275. params.subLayers = {layers: []}
  28276. }
  28277. if (!params.subLayers.layers) {
  28278. params.subLayers.layers = [];
  28279. }
  28280. var layers = params.subLayers.layers,
  28281. len = layers.length;
  28282. for (let i in layers) {
  28283. if (layers[i].ugcLayerType === "GRID") {
  28284. var colorDictionary = {};
  28285. var colorDics = layers[i].colorDictionarys;
  28286. for (var j in colorDics) {
  28287. var key = colorDics[j].elevation;
  28288. colorDictionary[key] = colorDics[j].color;
  28289. }
  28290. }
  28291. layers[i].colorDictionary = colorDictionary;
  28292. delete layers[i].colorDictionarys;
  28293. }
  28294. for (let i = 0; i < len; i++) {
  28295. if (layers[i].toJsonObject) {
  28296. //将图层信息转换成服务端能识别的简单json对象
  28297. subLayers.push(layers[i].toJsonObject());
  28298. } else {
  28299. subLayers.push(layers[i]);
  28300. }
  28301. }
  28302. jsonParams = Util.extend(jsonParams, params);
  28303. jsonParams.subLayers = {"layers": subLayers};
  28304. jsonParams.object = null;
  28305. var jsonParamsStr = Util.toJSON([jsonParams]);
  28306. me.request({
  28307. method: method,
  28308. data: jsonParamsStr,
  28309. scope: me,
  28310. success: me.serviceProcessCompleted,
  28311. failure: me.serviceProcessFailed
  28312. });
  28313. }
  28314. }
  28315. SuperMap.SetLayersInfoService = SetLayersInfoService;
  28316. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  28317. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28318. * This program are made available under the terms of the Apache License, Version 2.0
  28319. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28320. /**
  28321. * @class SuperMap.SetLayerStatusParameters
  28322. * @category iServer Map TempLayersSet
  28323. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  28324. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  28325. * @param {Object} options - 参数。
  28326. * @param {Array.<SuperMap.LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,
  28327. * 集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  28328. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  28329. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  28330. */
  28331. class SetLayerStatusParameters {
  28332. constructor(options) {
  28333. /**
  28334. * @member {Array.<SuperMap.LayerStatus>} SuperMap.SetLayerStatusParameters.prototype.layerStatusList
  28335. * @description 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  28336. */
  28337. this.layerStatusList = [];
  28338. /**
  28339. * @member {number} [SuperMap.SetLayerStatusParameters.prototype.holdTime=15]
  28340. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  28341. */
  28342. this.holdTime = 15;
  28343. /**
  28344. * @member {string} SuperMap.SetLayerStatusParameters.prototype.resourceID
  28345. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 进行图层的显示控制;
  28346. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 进行图层的显示控制。
  28347. */
  28348. this.resourceID = null;
  28349. if (options) {
  28350. Util.extend(this, options);
  28351. }
  28352. }
  28353. /**
  28354. * @function SuperMap.SetLayerStatusParameters.prototype.destroy
  28355. * @description 释放资源,将引用资源的属性置空。
  28356. */
  28357. destroy() {
  28358. var me = this;
  28359. me.layerStatusList = null;
  28360. me.holdTime = null;
  28361. me.resourceID = null;
  28362. }
  28363. /**
  28364. * @function SuperMap.SetLayerStatusParameters.prototype.toJSON
  28365. * @description 生成 JSON。
  28366. * @returns {Object} 对应的 JSON 对象。
  28367. */
  28368. toJSON() {
  28369. var json = '{';
  28370. json += '"layers":[';
  28371. var v = [];
  28372. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  28373. v.push(this.layerStatusList[i].toJSON());
  28374. }
  28375. json += v;
  28376. json += ']';
  28377. json += '}';
  28378. return json;
  28379. }
  28380. }
  28381. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  28382. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  28383. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28384. * This program are made available under the terms of the Apache License, Version 2.0
  28385. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28386. /**
  28387. * @class SuperMap.SetLayerStatusService
  28388. * @category iServer Map TempLayersSet
  28389. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  28390. * 用户获取服务端返回的各子图层显示状态有两种方式:
  28391. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  28392. * 一种是使用 AsyncResponder 类实现异步处理。
  28393. * @extends {SuperMap.CommonServiceBase}
  28394. * @param {string} url - 地图服务访问地址。请求地图服务,URL 应为:
  28395. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  28396. * @param {Object} options - 参数。
  28397. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28398. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28399. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28400. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28401. * @param {Object} [options.headers] - 请求头。
  28402. */
  28403. class SetLayerStatusService extends CommonServiceBase {
  28404. constructor(url, options) {
  28405. super(url, options);
  28406. this.lastparams = null;
  28407. this.mapUrl = url;
  28408. if (options) {
  28409. Util.extend(this, options);
  28410. }
  28411. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  28412. }
  28413. /**
  28414. * @override
  28415. */
  28416. destroy() {
  28417. super.destroy();
  28418. Util.reset(this);
  28419. }
  28420. /**
  28421. * @function SuperMap.SetLayerStatusService.prototype.processAsync
  28422. * @description 负责将客户端的更新参数传递到服务端。
  28423. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SuperMap.SetLayerStatusParameters}
  28424. * 返回图层信息,然后对其属性进行修改来获取。
  28425. */
  28426. processAsync(params) {
  28427. if (!(params instanceof SetLayerStatusParameters)) {
  28428. return;
  28429. }
  28430. var me = this,
  28431. method = "POST";
  28432. me.url = me.mapUrl;
  28433. if (params.resourceID == null) {
  28434. me.url = Util.urlPathAppend(me.url, 'tempLayersSet');
  28435. me.lastparams = params;
  28436. me.request({
  28437. method: method,
  28438. scope: me,
  28439. success: me.createTempLayerComplete,
  28440. failure: me.serviceProcessFailed
  28441. });
  28442. } else {
  28443. me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  28444. me.url = Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  28445. var jsonParameters = '[{';
  28446. jsonParameters += '"type":"UGC",';
  28447. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  28448. jsonParameters += '"subLayers":' + params.toJSON();
  28449. }
  28450. jsonParameters += ',"visible":' + true + ',';
  28451. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  28452. jsonParameters += '}]';
  28453. me.request({
  28454. method: "PUT",
  28455. data: jsonParameters,
  28456. scope: me,
  28457. success: me.serviceProcessCompleted,
  28458. failure: me.serviceProcessFailed
  28459. });
  28460. }
  28461. }
  28462. /**
  28463. * @function SuperMap.SetLayerStatusService.prototype.createTempLayerComplete
  28464. * @description 设置完成,执行此方法。
  28465. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  28466. */
  28467. createTempLayerComplete(result) {
  28468. var me = this;
  28469. result = Util.transformResult(result);
  28470. if (result.succeed) {
  28471. me.lastparams.resourceID = result.newResourceID;
  28472. }
  28473. me.processAsync(me.lastparams);
  28474. }
  28475. /**
  28476. * @function SuperMap.SetLayerStatusService.prototype.getMapName
  28477. * @description 获取地图名称。
  28478. * @param {Object} url - 服务地址。
  28479. */
  28480. getMapName(url) {
  28481. var mapUrl = url;
  28482. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  28483. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  28484. }
  28485. var index = mapUrl.lastIndexOf("/");
  28486. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  28487. return mapName;
  28488. }
  28489. /**
  28490. * @function SuperMap.SetLayerStatusService.prototype.setLayerCompleted
  28491. * @description 设置完成,执行此方法。
  28492. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  28493. */
  28494. serviceProcessCompleted(result) {
  28495. var me = this;
  28496. result = Util.transformResult(result);
  28497. if (result != null && me.lastparams != null) {
  28498. result.newResourceID = me.lastparams.resourceID;
  28499. }
  28500. me.events.triggerEvent("processCompleted", {result: result});
  28501. }
  28502. }
  28503. SuperMap.SetLayerStatusService = SetLayerStatusService;
  28504. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  28505. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28506. * This program are made available under the terms of the Apache License, Version 2.0
  28507. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28508. /**
  28509. * @class SuperMap.SingleObjectQueryJobsParameter
  28510. * @category iServer ProcessingService Query
  28511. * @classdesc 单对象空间查询分析任务参数类。
  28512. * @param {Object} options - 参数。
  28513. * @param {string} options.datasetName - 数据集名。
  28514. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  28515. * @param {SuperMap.SpatialQueryMode} [options.mode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式。
  28516. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  28517. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  28518. */
  28519. class SingleObjectQueryJobsParameter {
  28520. constructor(options) {
  28521. if (!options) {
  28522. return;
  28523. }
  28524. /**
  28525. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetName
  28526. * @description 数据集名。
  28527. */
  28528. this.datasetName = "";
  28529. /**
  28530. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetQuery
  28531. * @description 查询对象所在的数据集名称。
  28532. */
  28533. this.datasetQuery = "";
  28534. /**
  28535. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.geometryQuery
  28536. * @description 查询对象所在的几何对象。
  28537. */
  28538. this.geometryQuery = "";
  28539. /**
  28540. * @member {SuperMap.SpatialQueryMode} [SuperMap.SingleObjectQueryJobsParameter.prototype.mode=SuperMap.SpatialQueryMode.CONTAIN]
  28541. * @description 空间查询模式 。
  28542. */
  28543. this.mode = SpatialQueryMode.CONTAIN;
  28544. /**
  28545. * @member {SuperMap.OutputSetting} [SuperMap.SingleObjectQueryJobsParameter.prototype.output]
  28546. * @description 输出参数设置类。
  28547. */
  28548. this.output = null;
  28549. /**
  28550. * @member {SuperMap.MappingParameters} [SuperMap.SingleObjectQueryJobsParameter.prototype.mappingParameters]
  28551. * @description 分析后结果可视化的参数类。
  28552. */
  28553. this.mappingParameters = null;
  28554. Util.extend(this, options);
  28555. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  28556. }
  28557. /**
  28558. * @function SuperMap.SingleObjectQueryJobsParameter.prototype.destroy
  28559. * @description 释放资源,将引用资源的属性置空。
  28560. */
  28561. destroy() {
  28562. this.datasetName = null;
  28563. this.datasetQuery = null;
  28564. this.geometryQuery = null;
  28565. this.mode = null;
  28566. if (this.output instanceof OutputSetting) {
  28567. this.output.destroy();
  28568. this.output = null;
  28569. }
  28570. if (this.mappingParameters instanceof MappingParameters){
  28571. this.mappingParameters.destroy();
  28572. this.mappingParameters = null;
  28573. }
  28574. }
  28575. /**
  28576. * @function SuperMap.SingleObjectQueryJobsParameter.toObject
  28577. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  28578. * @param {Object} tempObj - 目标对象。
  28579. * @description 生成单对象空间查询分析任务对象。
  28580. */
  28581. static toObject(singleObjectQueryJobsParameter, tempObj) {
  28582. for (var name in singleObjectQueryJobsParameter) {
  28583. if (name === "datasetName") {
  28584. tempObj['input'] = tempObj['input'] || {};
  28585. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  28586. continue;
  28587. }
  28588. if (name === "output"){
  28589. tempObj['output'] = tempObj['output'] || {};
  28590. tempObj['output'] = singleObjectQueryJobsParameter[name];
  28591. continue;
  28592. }
  28593. tempObj['analyst'] = tempObj['analyst'] || {};
  28594. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  28595. if(name === 'mappingParameters'){
  28596. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  28597. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  28598. }
  28599. }
  28600. }
  28601. }
  28602. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  28603. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  28604. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28605. * This program are made available under the terms of the Apache License, Version 2.0
  28606. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28607. /**
  28608. * @class SuperMap.SingleObjectQueryJobsService
  28609. * @category iServer ProcessingService Query
  28610. * @classdesc 单对象查询分析服务类
  28611. * @extends {SuperMap.ProcessingServiceBase}
  28612. * @param {string} url - 单对象空间查询分析服务地址。
  28613. * @param {Object} options - 参数。
  28614. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28615. * @param {Object} [options.headers] - 请求头。
  28616. */
  28617. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  28618. constructor(url, options) {
  28619. super(url, options);
  28620. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/query');
  28621. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  28622. }
  28623. /**
  28624. *@override
  28625. */
  28626. destroy() {
  28627. super.destroy();
  28628. }
  28629. /**
  28630. * @function SuperMap.SingleObjectQueryJobsService.protitype.getQueryJobs
  28631. * @description 获取单对象空间查询分析所有任务
  28632. */
  28633. getQueryJobs() {
  28634. super.getJobs(this.url);
  28635. }
  28636. /**
  28637. * @function SuperMap.KernelDensityJobsService.protitype.getQueryJob
  28638. * @description 获取指定id的单对象空间查询分析服务
  28639. * @param {string} id - 指定要获取数据的id
  28640. */
  28641. getQueryJob(id) {
  28642. super.getJobs(Util.urlPathAppend(this.url, id));
  28643. }
  28644. /**
  28645. * @function SuperMap.SingleObjectQueryJobsService.protitype.addQueryJob
  28646. * @description 新建单对象空间查询分析服务
  28647. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  28648. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  28649. */
  28650. addQueryJob(params, seconds) {
  28651. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  28652. }
  28653. }
  28654. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  28655. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  28656. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28657. * This program are made available under the terms of the Apache License, Version 2.0
  28658. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28659. /**
  28660. * @class SuperMap.StopQueryParameters
  28661. * @category iServer TrafficTransferAnalyst TransferStops
  28662. * @classdesc 站点查询参数类。
  28663. * @param {Object} options - 参数。
  28664. * @param {string} options.keyWord - 站点名称关键字。
  28665. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  28666. */
  28667. class StopQueryParameters {
  28668. constructor(options) {
  28669. options = options || {};
  28670. /**
  28671. * @member {string} SuperMap.StopQueryParameters.prototype.keyWord
  28672. * @description 站点名称关键字。
  28673. */
  28674. this.keyWord = null;
  28675. /**
  28676. * @member {boolean} [SuperMap.StopQueryParameters.prototype.returnPosition=false]
  28677. * @description 是否返回站点坐标信息。
  28678. */
  28679. this.returnPosition = false;
  28680. Util.extend(this, options);
  28681. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  28682. }
  28683. /**
  28684. * @function SuperMap.StopQueryParameters.prototype.destroy
  28685. * @description 释放资源,将引用资源的属性置空。
  28686. */
  28687. destroy() {
  28688. Util.reset(this);
  28689. }
  28690. }
  28691. SuperMap.StopQueryParameters = StopQueryParameters;
  28692. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  28693. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28694. * This program are made available under the terms of the Apache License, Version 2.0
  28695. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28696. /**
  28697. * @class SuperMap.StopQueryService
  28698. * @category iServer TrafficTransferAnalyst TransferStops
  28699. * @classdesc 站点查询服务类。
  28700. * 返回结果通过该类支持的事件的监听函数参数获取
  28701. * @extends {SuperMap.CommonServiceBase}
  28702. * @param {string} url - 与客户端交互的站点查询服务地址。
  28703. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  28704. * @param {Object} options - 参数。</br>
  28705. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28706. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28707. * @param {Object} [options.headers] - 请求头。
  28708. * @example 例如:
  28709. * (start code)
  28710. * var myService = new SuperMap.StopQueryService(url, {eventListeners: {
  28711. * "processCompleted": StopQueryCompleted,
  28712. * "processFailed": StopQueryError
  28713. * }
  28714. * };
  28715. * (end)
  28716. *
  28717. *
  28718. */
  28719. class StopQueryService extends CommonServiceBase {
  28720. constructor(url, options) {
  28721. super(url, options);
  28722. options = options || {};
  28723. Util.extend(this, options);
  28724. this.CLASS_NAME = "SuperMap.StopQueryService";
  28725. }
  28726. /**
  28727. *@override
  28728. */
  28729. destroy() {
  28730. super.destroy();
  28731. Util.reset(this);
  28732. }
  28733. /**
  28734. * @function SuperMap.StopQueryService.prototype.processAsync
  28735. * @description 负责将客户端的更新参数传递到服务端。
  28736. * @param {SuperMap.StopQueryParameters} params - 交通换乘参数。
  28737. */
  28738. processAsync(params) {
  28739. if (!(params instanceof StopQueryParameters)) {
  28740. return;
  28741. }
  28742. var me = this;
  28743. me.url = Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  28744. me.request({
  28745. method: "GET",
  28746. params: {returnPosition: params.returnPosition},
  28747. scope: me,
  28748. success: me.serviceProcessCompleted,
  28749. failure: me.serviceProcessFailed
  28750. });
  28751. }
  28752. }
  28753. SuperMap.StopQueryService = StopQueryService;
  28754. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  28755. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28756. * This program are made available under the terms of the Apache License, Version 2.0
  28757. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28758. /**
  28759. * @class SuperMap.SummaryAttributesJobsParameter
  28760. * @category iServer ProcessingService SummaryAttributes
  28761. * @classdesc 属性汇总分析任务参数类
  28762. * @param {Object} options - 参数。
  28763. * @param {string} options.datasetName - 数据集名。
  28764. * @param {string} options.groupField - 分组字段。
  28765. * @param {string} options.attributeField - 属性字段。
  28766. * @param {string} options.statisticModes - 统计模式。
  28767. * @param {SuperMap.OutputSetting} [options.output] -输出参数设置。
  28768. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  28769. */
  28770. class SummaryAttributesJobsParameter {
  28771. constructor(options) {
  28772. if (!options) {
  28773. return;
  28774. }
  28775. /**
  28776. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.datasetName
  28777. * @description 汇总数据集名称。
  28778. */
  28779. this.datasetName = "";
  28780. /**
  28781. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.groupField
  28782. * @description 分组字段。
  28783. */
  28784. this.groupField = "";
  28785. /**
  28786. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.attributeField
  28787. * @description 属性字段。
  28788. */
  28789. this.attributeField = "";
  28790. /**
  28791. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.statisticModes
  28792. * @description 属性汇总统计模式。
  28793. */
  28794. this.statisticModes = "";
  28795. /**
  28796. * @member {SuperMap.OutputSetting} SuperMap.SummaryAttributesJobsParameter.prototype.output
  28797. * @description 输出参数设置类。
  28798. */
  28799. this.output = null;
  28800. /**
  28801. * @member {SuperMap.MappingParameters} [SuperMap.SummaryAttributesJobsParameter.prototype.mappingParameters]
  28802. * @description 分析后结果可视化的参数类。
  28803. */
  28804. this.mappingParameters = null;
  28805. Util.extend(this, options);
  28806. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  28807. }
  28808. /**
  28809. * @function SuperMap.SummaryAttributesJobsParameter.destroy
  28810. * @override
  28811. */
  28812. destroy() {
  28813. this.datasetName = null;
  28814. this.groupField = null;
  28815. this.attributeField = null;
  28816. this.statisticModes = null;
  28817. if (this.output instanceof OutputSetting) {
  28818. this.output.destroy();
  28819. this.output = null;
  28820. }
  28821. if (this.mappingParameters instanceof MappingParameters){
  28822. this.mappingParameters.destroy();
  28823. this.mappingParameters = null;
  28824. }
  28825. }
  28826. /**
  28827. * @function SuperMap.SummaryAttributesJobsParameter.toObject
  28828. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  28829. * @param {Object} tempObj - 目标对象。
  28830. * @description 生成属性汇总分析任务对象。
  28831. */
  28832. static toObject(SummaryAttributesJobsParameter, tempObj) {
  28833. for (var name in SummaryAttributesJobsParameter) {
  28834. if (name === "datasetName") {
  28835. tempObj['input'] = tempObj['input'] || {};
  28836. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  28837. continue;
  28838. }
  28839. if (name === "output") {
  28840. tempObj['output'] = tempObj['output'] || {};
  28841. tempObj['output'] = SummaryAttributesJobsParameter[name];
  28842. continue;
  28843. }
  28844. tempObj['analyst'] = tempObj['analyst'] || {};
  28845. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  28846. if(name === 'mappingParameters'){
  28847. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  28848. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  28849. }
  28850. }
  28851. }
  28852. }
  28853. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  28854. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  28855. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28856. * This program are made available under the terms of the Apache License, Version 2.0
  28857. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28858. /**
  28859. * @class SuperMap.SummaryAttributesJobsService
  28860. * @category iServer ProcessingService SummaryAttributes
  28861. * @classdesc 属性汇总分析服务类
  28862. * @extends {SuperMap.ProcessingServiceBase}
  28863. * @param {string} url - 汇总统计分析服务地址。
  28864. * @param {Object} options - 参数。
  28865. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28866. * @param {Object} [options.headers] - 请求头。
  28867. */
  28868. class SummaryAttributesJobsService extends ProcessingServiceBase {
  28869. constructor(url, options) {
  28870. super(url, options);
  28871. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  28872. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  28873. }
  28874. /**
  28875. *@override
  28876. */
  28877. destroy() {
  28878. super.destroy();
  28879. }
  28880. /**
  28881. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  28882. * @description 获取属性汇总分析所有任务
  28883. */
  28884. getSummaryAttributesJobs (){
  28885. super.getJobs(this.url);
  28886. }
  28887. /**
  28888. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  28889. * @description 获取指定id的属性汇总分析服务
  28890. * @param {string} id - 指定要获取数据的id
  28891. */
  28892. getSummaryAttributesJob(id) {
  28893. super.getJobs(Util.urlPathAppend(this.url, id));
  28894. }
  28895. /**
  28896. * @function SuperMap.SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  28897. * @description 新建属性汇总分析服务
  28898. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  28899. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  28900. */
  28901. addSummaryAttributesJob(params, seconds) {
  28902. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  28903. }
  28904. }
  28905. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  28906. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  28907. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28908. * This program are made available under the terms of the Apache License, Version 2.0
  28909. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28910. /**
  28911. * @class SuperMap.SummaryMeshJobParameter
  28912. * @category iServer ProcessingService AggregatePoints
  28913. * @classdesc 点聚合分析任务参数类。
  28914. * @param {Object} options - 参数。
  28915. * @param {string} options.datasetName - 数据集名。
  28916. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  28917. * @param {number} options.fields - 权重索引。
  28918. * @param {number} [options.resolution=100] - 分辨率。
  28919. * @param {SuperMap.StatisticAnalystMode} [options.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE] - 分析模式。
  28920. * @param {number} [options.meshType=0] - 分析类型。
  28921. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 聚合类型。
  28922. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  28923. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  28924. */
  28925. class SummaryMeshJobParameter {
  28926. constructor(options) {
  28927. if (!options) {
  28928. return;
  28929. }
  28930. /**
  28931. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.datasetName
  28932. * @description 数据集名。
  28933. */
  28934. this.datasetName = "";
  28935. /**
  28936. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.regionDataset
  28937. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  28938. */
  28939. this.regionDataset = "";
  28940. /**
  28941. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryMeshJobParameter.prototype.query
  28942. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  28943. */
  28944. this.query = "";
  28945. /**
  28946. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.resolution=100]
  28947. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  28948. */
  28949. this.resolution = 100;
  28950. /**
  28951. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.meshType=0]
  28952. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  28953. */
  28954. this.meshType = 0;
  28955. /**
  28956. * @member {SuperMap.StatisticAnalystMode} [SuperMap.SummaryMeshJobParameter.prototype.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE]
  28957. * @description 统计模式。
  28958. */
  28959. this.statisticModes = StatisticAnalystMode.AVERAGE;
  28960. /**
  28961. * @member {number} SuperMap.SummaryMeshJobParameter.prototype.fields
  28962. * @description 权重字段。
  28963. */
  28964. this.fields = "";
  28965. /**
  28966. * @member {SuperMap.SummaryType} [SuperMap.SummaryMeshJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  28967. * @description 聚合类型。
  28968. */
  28969. this.type = SummaryType.SUMMARYMESH;
  28970. /**
  28971. * @member {SuperMap.OutputSetting} [SuperMap.SummaryMeshJobParameter.prototype.output]
  28972. * @description 输出参数设置类。
  28973. */
  28974. this.output = null;
  28975. /**
  28976. * @member {SuperMap.MappingParameters} [SuperMap.SummaryMeshJobParameter.prototype.mappingParameters]
  28977. * @description 分析后结果可视化的参数类。
  28978. */
  28979. this.mappingParameters = null;
  28980. Util.extend(this, options);
  28981. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  28982. }
  28983. /**
  28984. * @function SuperMap.SummaryMeshJobParameter.destroy
  28985. * @override
  28986. */
  28987. destroy() {
  28988. this.datasetName = null;
  28989. this.query = null;
  28990. this.resolution = null;
  28991. this.statisticModes = null;
  28992. this.meshType = null;
  28993. this.fields = null;
  28994. this.regionDataset = null;
  28995. this.type = null;
  28996. if (this.output instanceof OutputSetting) {
  28997. this.output.destroy();
  28998. this.output = null;
  28999. }
  29000. if (this.mappingParameters instanceof MappingParameters){
  29001. this.mappingParameters.destroy();
  29002. this.mappingParameters = null;
  29003. }
  29004. }
  29005. /**
  29006. * @function SuperMap.SummaryMeshJobParameter.toObject
  29007. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  29008. * @param {Object} tempObj - 目标对象。
  29009. * @description 生成点聚合分析任务对象。
  29010. */
  29011. static toObject(summaryMeshJobParameter, tempObj) {
  29012. for (var name in summaryMeshJobParameter) {
  29013. if (name === "datasetName") {
  29014. tempObj['input'] = tempObj['input'] || {};
  29015. tempObj['input'][name] = summaryMeshJobParameter[name];
  29016. continue;
  29017. }
  29018. if (name === "type") {
  29019. tempObj['type'] = summaryMeshJobParameter[name];
  29020. continue;
  29021. }
  29022. if (name === "output") {
  29023. tempObj['output'] = tempObj['output'] || {};
  29024. tempObj['output'] = summaryMeshJobParameter[name];
  29025. continue;
  29026. }
  29027. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  29028. tempObj['analyst'] = tempObj['analyst'] || {};
  29029. if (name === 'query' && summaryMeshJobParameter[name]) {
  29030. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  29031. } else {
  29032. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  29033. }
  29034. if(name === 'mappingParameters'){
  29035. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  29036. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  29037. }
  29038. }
  29039. }
  29040. function contains(arr, obj) {
  29041. var i = arr.length;
  29042. while (i--) {
  29043. if (arr[i] === obj) {
  29044. return true;
  29045. }
  29046. }
  29047. return false;
  29048. }
  29049. }
  29050. }
  29051. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  29052. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  29053. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29054. * This program are made available under the terms of the Apache License, Version 2.0
  29055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29056. /**
  29057. * @class SuperMap.SummaryMeshJobsService
  29058. * @category iServer ProcessingService AggregatePoints
  29059. * @classdesc 点聚合分析任务类。
  29060. * @param {string} url -点聚合分析任务地址。
  29061. * @param {Object} options - 参数。
  29062. * @param {SuperMap.Events} options.events - 处理所有事件的对象。<br>
  29063. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29064. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  29065. * @param {number} options.index - 服务访问地址在数组中的位置。<br>
  29066. * @param {number} options.length - 服务访问地址数组长度。
  29067. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29068. * @param {Object} [options.headers] - 请求头。
  29069. */
  29070. class SummaryMeshJobsService extends ProcessingServiceBase {
  29071. constructor(url, options) {
  29072. super(url, options);
  29073. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  29074. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  29075. }
  29076. /**
  29077. * @override
  29078. */
  29079. destroy() {
  29080. super.destroy();
  29081. }
  29082. /**
  29083. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJobs
  29084. * @description 获取点聚合分析任务
  29085. */
  29086. getSummaryMeshJobs() {
  29087. super.getJobs(this.url);
  29088. }
  29089. /**
  29090. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJob
  29091. * @description 获取指定ip的点聚合分析任务
  29092. * @param {string} id - 指定要获取数据的id
  29093. */
  29094. getSummaryMeshJob(id) {
  29095. super.getJobs(Util.urlPathAppend(this.url, id));
  29096. }
  29097. /**
  29098. * @function SuperMap.SummaryMeshJobsService.prototype.addSummaryMeshJob
  29099. * @description 新建点聚合分析服务
  29100. * @param {SuperMap.SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  29101. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  29102. */
  29103. addSummaryMeshJob(params, seconds) {
  29104. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  29105. }
  29106. }
  29107. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  29108. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  29109. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29110. * This program are made available under the terms of the Apache License, Version 2.0
  29111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29112. /**
  29113. * @class SuperMap.SummaryRegionJobParameter
  29114. * @category iServer ProcessingService SummaryRegion
  29115. * @classdesc 区域汇总分析任务参数类。
  29116. * @param {Object} options - 参数。
  29117. * @param {string} options.datasetName - 数据集名。
  29118. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  29119. * @param {string} [options.standardFields] - 标准属性字段名称。
  29120. * @param {string} [options.weightedFields] - 权重字段名称。
  29121. * @param {SuperMap.StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  29122. * @param {SuperMap.StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  29123. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  29124. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
  29125. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  29126. * @param {number} [options.resolution=100] - 网格大小。
  29127. * @param {number} [options.meshType=0] - 网格面汇总类型。
  29128. * @param {SuperMap.AnalystSizeUnit} [options.meshSizeUnit=SuperMap.AnalystSizeUnit.METER] - 网格大小单位。
  29129. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 汇总类型。
  29130. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  29131. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  29132. */
  29133. class SummaryRegionJobParameter {
  29134. constructor(options) {
  29135. if (!options) {
  29136. return;
  29137. }
  29138. /**
  29139. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.datasetName
  29140. * @description 数据集名。
  29141. */
  29142. this.datasetName = "";
  29143. /**
  29144. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.regionDataset
  29145. * @description 汇总数据源(多边形汇总时用到的参数)。
  29146. */
  29147. this.regionDataset = "";
  29148. /**
  29149. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.sumShape=true]
  29150. * @description 是否统计长度或面积。
  29151. */
  29152. this.sumShape = true;
  29153. /**
  29154. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryRegionJobParameter.prototype.query
  29155. * @description 分析范围。
  29156. */
  29157. this.query = "";
  29158. /**
  29159. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  29160. * @description 是否以标准属字段统计。
  29161. */
  29162. this.standardSummaryFields = false;
  29163. /**
  29164. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.standardFields
  29165. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  29166. */
  29167. this.standardFields = "";
  29168. /**
  29169. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.standardStatisticModes
  29170. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  29171. */
  29172. this.standardStatisticModes = "";
  29173. /**
  29174. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  29175. * @description 是否以权重字段统计。
  29176. */
  29177. this.weightedSummaryFields = false;
  29178. /**
  29179. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.weightedFields
  29180. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  29181. */
  29182. this.weightedFields = "";
  29183. /**
  29184. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.weightedStatisticModes
  29185. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  29186. */
  29187. this.weightedStatisticModes = "";
  29188. /**
  29189. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.meshType=0]
  29190. * @description 网格面汇总类型。
  29191. */
  29192. this.meshType = 0;
  29193. /**
  29194. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.resolution=100]
  29195. * @description 网格大小。
  29196. */
  29197. this.resolution = 100;
  29198. /**
  29199. * @member {SuperMap.AnalystSizeUnit} [SuperMap.SummaryRegionJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  29200. * @description 网格大小单位。
  29201. */
  29202. this.meshSizeUnit = AnalystSizeUnit.METER;
  29203. /**
  29204. * @member {SuperMap.SummaryType} [SuperMap.SummaryRegionJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  29205. * @description 汇总类型。
  29206. */
  29207. this.type = SummaryType.SUMMARYMESH;
  29208. /**
  29209. * @member {SuperMap.OutputSetting} SuperMap.SummaryRegionJobParameter.prototype.output
  29210. * @description 输出参数设置类
  29211. */
  29212. this.output = null;
  29213. /**
  29214. * @member {SuperMap.MappingParameters} [SuperMap.SummaryRegionJobParameter.prototype.mappingParameters]
  29215. * @description 分析后结果可视化的参数类。
  29216. */
  29217. this.mappingParameters = null;
  29218. Util.extend(this, options);
  29219. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  29220. }
  29221. /**
  29222. * @function SuperMap.SummaryRegionJobParameter.prototype.destroy
  29223. * @description 释放资源,将引用资源的属性置空。
  29224. */
  29225. destroy() {
  29226. this.datasetName = null;
  29227. this.sumShape = null;
  29228. this.regionDataset = null;
  29229. this.query = null;
  29230. this.standardSummaryFields = null;
  29231. this.standardFields = null;
  29232. this.standardStatisticModes = null;
  29233. this.weightedSummaryFields = null;
  29234. this.weightedFields = null;
  29235. this.weightedStatisticModes = null;
  29236. this.meshType = null;
  29237. this.resolution = null;
  29238. this.meshSizeUnit = null;
  29239. this.type = null;
  29240. if (this.output instanceof OutputSetting) {
  29241. this.output.destroy();
  29242. this.output = null;
  29243. }
  29244. if (this.mappingParameters instanceof MappingParameters){
  29245. this.mappingParameters.destroy();
  29246. this.mappingParameters = null;
  29247. }
  29248. }
  29249. /**
  29250. * @function SuperMap.SummaryRegionJobParameter.toObject
  29251. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  29252. * @param {Object} tempObj - 目标对象。
  29253. * @description 生成区域汇总分析服务对象。
  29254. */
  29255. static toObject(summaryRegionJobParameter, tempObj) {
  29256. for (var name in summaryRegionJobParameter) {
  29257. if (name === "datasetName") {
  29258. tempObj['input'] = tempObj['input'] || {};
  29259. tempObj['input'][name] = summaryRegionJobParameter[name];
  29260. continue;
  29261. }
  29262. if (name === "type") {
  29263. tempObj['type'] = summaryRegionJobParameter[name];
  29264. continue;
  29265. }
  29266. if (name === "type") {
  29267. tempObj['type'] = summaryRegionJobParameter[name];
  29268. continue;
  29269. }
  29270. if (name === "output") {
  29271. tempObj['output'] = tempObj['output'] || {};
  29272. tempObj['output'] = summaryRegionJobParameter[name];
  29273. continue;
  29274. }
  29275. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  29276. tempObj['analyst'] = tempObj['analyst'] || {};
  29277. if (name === 'query' && summaryRegionJobParameter[name]) {
  29278. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  29279. } else {
  29280. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  29281. }
  29282. if(name === 'mappingParameters'){
  29283. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  29284. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  29285. }
  29286. }
  29287. }
  29288. }
  29289. }
  29290. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  29291. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  29292. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29293. * This program are made available under the terms of the Apache License, Version 2.0
  29294. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29295. /**
  29296. * @class SuperMap.SummaryRegionJobsService
  29297. * @category iServer ProcessingService SummaryRegion
  29298. * @classdesc 区域汇总分析服务类
  29299. * @extends {SuperMap.ProcessingServiceBase}
  29300. * @param {string} url - 区域汇总分析服务地址。
  29301. * @param {Object} options - 参数。
  29302. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29303. * @param {Object} [options.headers] - 请求头。
  29304. */
  29305. class SummaryRegionJobsService extends ProcessingServiceBase {
  29306. constructor(url, options) {
  29307. super(url, options);
  29308. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  29309. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  29310. }
  29311. /**
  29312. *@override
  29313. */
  29314. destroy() {
  29315. super.destroy();
  29316. }
  29317. /**
  29318. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJobs
  29319. * @description 获取区域汇总分析任务集合。
  29320. */
  29321. getSummaryRegionJobs() {
  29322. super.getJobs(this.url);
  29323. }
  29324. /**
  29325. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJob
  29326. * @description 获取指定id的区域汇总分析任务。
  29327. * @param {string} id -要获取区域汇总分析任务的id
  29328. */
  29329. getSummaryRegionJob(id) {
  29330. super.getJobs(Util.urlPathAppend(this.url, id));
  29331. }
  29332. /**
  29333. * @function SuperMap.SummaryRegionJobsService.prototype.addSummaryRegionJob
  29334. * @description 新建区域汇总任务。
  29335. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总任务的请求参数。
  29336. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  29337. */
  29338. addSummaryRegionJob(params, seconds) {
  29339. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  29340. }
  29341. }
  29342. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  29343. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  29344. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29345. * This program are made available under the terms of the Apache License, Version 2.0
  29346. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29347. /**
  29348. * @class SuperMap.SupplyCenter
  29349. * @category iServer NetworkAnalyst Location
  29350. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  29351. * @param {Object} options - 参数。
  29352. * @param {number} options.maxWeight - 资源供给中心的最大耗费值。
  29353. * @param {number} options.nodeID - 资源供给中心点的结点 ID 号。资源供给中心必须是结点。
  29354. * @param {number} options.resourceValue - 资源供给中心能提供的最大服务量或商品数量。
  29355. * @param {SuperMap.SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  29356. */
  29357. class SupplyCenter {
  29358. constructor(options) {
  29359. /**
  29360. * @member {number} SuperMap.SupplyCenter.prototype.maxWeight
  29361. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  29362. * 最大阻力值是用来限制需求点到中心点的花费。
  29363. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  29364. */
  29365. this.maxWeight = null;
  29366. /**
  29367. * @member {number} SuperMap.SupplyCenter.prototype.nodeID
  29368. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  29369. */
  29370. this.nodeID = null;
  29371. /**
  29372. * @member {number} SuperMap.SupplyCenter.prototype.resourceValue
  29373. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  29374. */
  29375. this.resourceValue = null;
  29376. /**
  29377. * @member {SuperMap.SupplyCenterType} [SuperMap.SupplyCenter.prototype.type]
  29378. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  29379. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  29380. */
  29381. this.type = null;
  29382. if (options) {
  29383. Util.extend(this, options);
  29384. }
  29385. this.CLASS_NAME = "SuperMap.SupplyCenter";
  29386. }
  29387. /**
  29388. * @function SuperMap.SupplyCenter.prototype.destroy
  29389. * @description 释放资源,将引用资源的属性置空。
  29390. */
  29391. destroy() {
  29392. var me = this;
  29393. me.maxWeight = null;
  29394. me.nodeID = null;
  29395. me.resourceValue = null;
  29396. me.type = null;
  29397. }
  29398. /**
  29399. * @function SuperMap.SupplyCenter.fromJson
  29400. * @description 将服务端 JSON 对象转换成当前客户端对象。
  29401. * @param {Object} jsonObject - 要转换的 JSON 对象。
  29402. * @returns {SuperMap.SupplyCenter} SupplyCenter 对象。
  29403. */
  29404. static fromJson(jsonObject) {
  29405. if (!jsonObject) {
  29406. return;
  29407. }
  29408. return new SupplyCenter({
  29409. maxWeight: jsonObject.maxWeight,
  29410. nodeID: jsonObject.nodeID,
  29411. resourceValue: jsonObject.resourceValue,
  29412. type: jsonObject.type
  29413. });
  29414. }
  29415. }
  29416. SuperMap.SupplyCenter = SupplyCenter;
  29417. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  29418. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29419. * This program are made available under the terms of the Apache License, Version 2.0
  29420. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29421. /**
  29422. * @class SuperMap.SurfaceAnalystService
  29423. * @category iServer SpatialAnalyst SurfaceAnalyst
  29424. * @classdesc 表面分析服务类。
  29425. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  29426. * 表面分析结果通过该类支持的事件的监听函数参数获取
  29427. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  29428. * @param {Object} options - 参数。</br>
  29429. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29430. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29431. * @param {Object} [options.headers] - 请求头。
  29432. * @extends {SuperMap.SpatialAnalystBase}
  29433. * @example 例如:
  29434. * (start code)
  29435. * var mySurfaceAnalystService = new SuperMap.SurfaceAnalystService(url, {
  29436. * eventListeners: {
  29437. * "processCompleted": surfaceAnalysCompleted,
  29438. * "processFailed": surfaceAnalysFailed
  29439. * }
  29440. * });
  29441. * (end)
  29442. *
  29443. */
  29444. class SurfaceAnalystService extends SpatialAnalystBase {
  29445. constructor(url, options) {
  29446. super(url, options);
  29447. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  29448. }
  29449. /**
  29450. * @function SuperMap.SurfaceAnalystService.prototype.destroy
  29451. * @description 释放资源,将引用的资源属性置空。
  29452. */
  29453. destroy() {
  29454. super.destroy();
  29455. }
  29456. /**
  29457. * @function SuperMap.SurfaceAnalystService.prototype.processAsync
  29458. * @description 负责将客户端的表面分析服务参数传递到服务端。
  29459. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  29460. */
  29461. processAsync(params) {
  29462. if (!(params instanceof SurfaceAnalystParameters)) {
  29463. return;
  29464. }
  29465. var me = this, jsonParameters;
  29466. jsonParameters = me.getJsonParameters(params);
  29467. me.request({
  29468. method: "POST",
  29469. data: jsonParameters,
  29470. scope: me,
  29471. success: me.serviceProcessCompleted,
  29472. failure: me.serviceProcessFailed
  29473. });
  29474. }
  29475. /**
  29476. * @function SuperMap.SurfaceAnalystService.prototype.getJsonParameters
  29477. * @description 将参数转化为 JSON 字符串。
  29478. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  29479. * @returns {Object} 转化后的JSON字符串。
  29480. */
  29481. getJsonParameters(params) {
  29482. var jsonParameters = '';
  29483. var parameterObject = {};
  29484. var me = this;
  29485. if (params instanceof DatasetSurfaceAnalystParameters) {
  29486. me.url = Util.urlPathAppend(
  29487. me.url,
  29488. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  29489. );
  29490. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  29491. jsonParameters = Util.toJSON(parameterObject);
  29492. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  29493. me.url = Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  29494. jsonParameters = Util.toJSON(params);
  29495. } else {
  29496. return;
  29497. }
  29498. me.url = Util.urlAppend(me.url, 'returnContent=true');
  29499. return jsonParameters;
  29500. }
  29501. }
  29502. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  29503. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  29504. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29505. * This program are made available under the terms of the Apache License, Version 2.0
  29506. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29507. /**
  29508. * @class SuperMap.TerrainCurvatureCalculationParameters
  29509. * @category iServer SpatialAnalyst TerrainCalculation
  29510. * @classdesc 地形曲率计算参数类。
  29511. * @param {Object} options - 参数。
  29512. * @param {string} options.dataset - 要用来做地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  29513. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  29514. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  29515. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  29516. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  29517. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  29518. */
  29519. class TerrainCurvatureCalculationParameters {
  29520. constructor(options) {
  29521. if (!options) {
  29522. return;
  29523. }
  29524. /**
  29525. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.dataset
  29526. * @description 要用来做地形曲率计算数据源中数据集的名称。
  29527. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  29528. * 注:地形曲率计算必须为栅格数据集。
  29529. */
  29530. this.dataset = null;
  29531. /**
  29532. * @member {number} [SuperMap.TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  29533. * @description 指定的高程缩放系数。1.0 表示不缩放。
  29534. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  29535. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  29536. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  29537. */
  29538. this.zFactor = 1.0;
  29539. /**
  29540. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  29541. * @description 结果数据集:平均曲率数据集的名称。
  29542. */
  29543. this.averageCurvatureName = null;
  29544. /**
  29545. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  29546. * @description 结果数据集:剖面曲率数据集的名称。
  29547. */
  29548. this.profileCurvatureName = "";
  29549. /**
  29550. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  29551. * @description 结果数据集:平面曲率数据集的名称。
  29552. */
  29553. this.planCurvatureName = "";
  29554. /**
  29555. * @member {boolean} [SuperMap.TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  29556. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  29557. */
  29558. this.deleteExistResultDataset = false;
  29559. Util.extend(this, options);
  29560. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  29561. }
  29562. /**
  29563. * @function SuperMap.TerrainCurvatureCalculationParameters.prototype.destroy
  29564. * @description 释放资源,将引用资源的属性置空。
  29565. */
  29566. destroy() {
  29567. var me = this;
  29568. me.dataset = null;
  29569. me.zFactor = 1.0;
  29570. me.averageCurvatureName = null;
  29571. me.profileCurvatureName = null;
  29572. me.planCurvatureName = null;
  29573. me.deleteExistResultDataset = true;
  29574. }
  29575. /**
  29576. * @function SuperMap.TerrainCurvatureCalculationParameters.toObject
  29577. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  29578. * @param {Object} tempObj - 目标对象。
  29579. * @description 生成地形曲率计算对象。
  29580. */
  29581. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  29582. for (var name in derrainCurvatureCalculationParameters) {
  29583. if (name !== "dataset") {
  29584. tempObj[name] = derrainCurvatureCalculationParameters[name];
  29585. }
  29586. }
  29587. }
  29588. }
  29589. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  29590. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  29591. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29592. * This program are made available under the terms of the Apache License, Version 2.0
  29593. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29594. /**
  29595. * @class SuperMap.TerrainCurvatureCalculationService
  29596. * @category iServer SpatialAnalyst TerrainCalculation
  29597. * @classdesc 地形曲率计算服务类。
  29598. * @extends {SuperMap.SpatialAnalystBase}
  29599. * @param {Object} options - 参数。
  29600. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29601. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  29602. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29603. * @param {Object} [options.headers] - 请求头。
  29604. * @example 例如:
  29605. * (start code)
  29606. * var myTerrainCurvatureCalculationService = new SuperMap.TerrainCurvatureCalculationService(url);
  29607. * myTerrainCurvatureCalculationService.on({
  29608. * "processCompleted": processCompleted,
  29609. * "processFailed": processFailed
  29610. * }
  29611. * );
  29612. * (end)
  29613. *
  29614. */
  29615. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  29616. constructor(url, options) {
  29617. super(url, options);
  29618. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  29619. }
  29620. /**
  29621. *@override
  29622. */
  29623. destroy() {
  29624. super.destroy();
  29625. }
  29626. /**
  29627. * @function SuperMap.TerrainCurvatureCalculationService.prototype.processAsync
  29628. * @description 负责将客户端的查询参数传递到服务端。
  29629. * @param {SuperMap.TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  29630. */
  29631. processAsync(parameter) {
  29632. var me = this;
  29633. var parameterObject = {};
  29634. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  29635. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  29636. }
  29637. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  29638. var jsonParameters = SuperMap.Util.toJSON(parameterObject);
  29639. me.url = Util.urlAppend(me.url, 'returnContent=true');
  29640. me.request({
  29641. method: "POST",
  29642. data: jsonParameters,
  29643. scope: me,
  29644. success: me.serviceProcessCompleted,
  29645. failure: me.serviceProcessFailed
  29646. });
  29647. }
  29648. }
  29649. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  29650. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  29651. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29652. * This program are made available under the terms of the Apache License, Version 2.0
  29653. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29654. /**
  29655. * @class SuperMap.ThemeGridRangeItem
  29656. * @category iServer Map Theme
  29657. * @classdesc 栅格分段专题图子项类。
  29658. * @description 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  29659. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  29660. * @param {Object} options - 参数。
  29661. * @param {SuperMap.ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  29662. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  29663. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  29664. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  29665. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  29666. */
  29667. class ThemeGridRangeItem {
  29668. constructor(options) {
  29669. /**
  29670. * @member {string} [SuperMap.ThemeGridRangeItem.prototype.caption]
  29671. * @description 栅格分段专题图子项的标题。
  29672. */
  29673. this.caption = null;
  29674. /**
  29675. * @member {SuperMap.ServerColor} SuperMap.ThemeGridRangeItem.prototype.color
  29676. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  29677. */
  29678. this.color = new ServerColor();
  29679. /**
  29680. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.end=0]
  29681. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  29682. */
  29683. this.end = 0;
  29684. /**
  29685. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.start=0]
  29686. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  29687. */
  29688. this.start = 0;
  29689. /**
  29690. * @member {boolean} [SuperMap.ThemeGridRangeItem.prototype.visible=true]
  29691. * @description 栅格分段专题图子项是否可见。
  29692. */
  29693. this.visible = true;
  29694. if (options) {
  29695. Util.extend(this, options);
  29696. }
  29697. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  29698. }
  29699. /**
  29700. * @function SuperMap.ThemeGridRangeItem.prototype.destroy
  29701. * @description 释放资源,将引用资源的属性置空。
  29702. */
  29703. destroy() {
  29704. var me = this;
  29705. me.caption = null;
  29706. me.end = null;
  29707. me.start = null;
  29708. //需要验证是够存在destroy方法
  29709. if (me.color) {
  29710. me.color.destroy();
  29711. me.color = null;
  29712. }
  29713. me.visible = null;
  29714. }
  29715. /**
  29716. * @function SuperMap.ThemeGridRangeItem.prototype.toServerJSONObject
  29717. * @description 转换成对应的 JSON 格式对象。
  29718. * @returns {Object} 对应的 JSON 格式对象。
  29719. */
  29720. toServerJSONObject() {
  29721. var obj = {};
  29722. obj = Util.copyAttributes(obj, this);
  29723. if (obj.color) {
  29724. if (obj.color.toServerJSONObject) {
  29725. obj.color = obj.color.toServerJSONObject();
  29726. }
  29727. }
  29728. return obj;
  29729. }
  29730. /**
  29731. * @function SuperMap.ThemeGridRangeItem.fromObj
  29732. * @description 从传入对象获取栅格分段专题图子项类。
  29733. * @param {Object} obj - 传入对象。
  29734. * @returns {SuperMap.ThemeGridRangeItem} ThemeGridRangeItem 对象。
  29735. */
  29736. static fromObj(obj) {
  29737. if (!obj) {
  29738. return;
  29739. }
  29740. var res = new ThemeGridRangeItem();
  29741. Util.copy(res, obj);
  29742. res.color = ServerColor.fromJson(obj.color);
  29743. return res;
  29744. }
  29745. }
  29746. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  29747. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  29748. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29749. * This program are made available under the terms of the Apache License, Version 2.0
  29750. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29751. /**
  29752. * @class SuperMap.ThemeGridRange
  29753. * @category iServer Map Theme
  29754. * @classdesc 栅格分段专题图。
  29755. * @description 栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。
  29756. * 栅格分段专题图一般用来反映连续分布现象的数量或程度特征。比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  29757. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  29758. * @extends {SuperMap.Theme}
  29759. * @param {Object} options - 参数。
  29760. * @param {Array.<SuperMap.ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  29761. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  29762. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  29763. * @param {number} [options.rangeParameter=0] - 分段参数。
  29764. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  29765. */
  29766. class ThemeGridRange extends Theme {
  29767. constructor(options) {
  29768. super("GRIDRANGE", options);
  29769. /**
  29770. * @member {Array.<SuperMap.ThemeGridRangeItem>} SuperMap.ThemeGridRange.prototype.items
  29771. * @description 栅格分段专题图子项数组。<br>
  29772. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  29773. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  29774. */
  29775. this.items = null;
  29776. /**
  29777. * @member {SuperMap.RangeMode} [SuperMap.ThemeGridRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  29778. * @description 分段专题图的分段模式。<br>
  29779. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  29780. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  29781. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  29782. */
  29783. this.rangeMode = RangeMode.EQUALINTERVAL;
  29784. /**
  29785. * @member {number} [SuperMap.ThemeGridRange.prototype.rangeParameter=0]
  29786. * @description 分段参数。<br>
  29787. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  29788. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  29789. */
  29790. this.rangeParameter = 0;
  29791. /**
  29792. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeGridRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  29793. * @description 渐变颜色枚举类。
  29794. *
  29795. */
  29796. this.colorGradientType = ColorGradientType.YELLOW_RED;
  29797. /**
  29798. * @member {boolean} SuperMap.ThemeGridRange.prototype.reverseColor
  29799. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  29800. */
  29801. this.reverseColor = false;
  29802. if (options) {
  29803. Util.extend(this, options);
  29804. }
  29805. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  29806. }
  29807. /**
  29808. * @function SuperMap.ThemeGridRange.prototype.destroy
  29809. * @override
  29810. */
  29811. destroy() {
  29812. super.destroy();
  29813. var me = this;
  29814. if (me.items) {
  29815. if (me.items.length > 0) {
  29816. for (var item in me.items) {
  29817. me.items[item].destroy();
  29818. me.items[item] = null;
  29819. }
  29820. }
  29821. me.items = null;
  29822. }
  29823. me.reverseColor = null;
  29824. me.rangeMode = null;
  29825. me.rangeParameter = null;
  29826. me.colorGradientType = null;
  29827. }
  29828. /**
  29829. * @function SuperMap.ThemeGridRange.fromObj
  29830. * @description 从传入对象获取栅格分段专题图。
  29831. * @param {Object} obj - 传入对象。
  29832. * @returns {SuperMap.ThemeGridRange} ThemeGridRange 对象。
  29833. */
  29834. static fromObj(obj) {
  29835. if (!obj) {
  29836. return;
  29837. }
  29838. var res = new ThemeGridRange();
  29839. Util.copy(res, obj);
  29840. var itemsR = obj.items;
  29841. var len = itemsR ? itemsR.length : 0;
  29842. res.items = [];
  29843. for (var i = 0; i < len; i++) {
  29844. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  29845. }
  29846. return res;
  29847. }
  29848. }
  29849. SuperMap.ThemeGridRange = ThemeGridRange;
  29850. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  29851. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29852. * This program are made available under the terms of the Apache License, Version 2.0
  29853. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29854. /**
  29855. * @class SuperMap.ThemeGridUniqueItem
  29856. * @category iServer Map Theme
  29857. * @classdesc 栅格单值专题图子项类。
  29858. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  29859. * @param {Object} options - 参数。
  29860. * @param {string} [options.caption] - 栅格单值专题图子项的名称。
  29861. * @param {SuperMap.ServerColor} [options.color] - 栅格单值专题图子项的显示颜色。
  29862. * @param {number} options.unique - 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  29863. * @param {boolean} [options.visible=true] - 栅格单值专题图子项是否可见。
  29864. */
  29865. class ThemeGridUniqueItem {
  29866. constructor(options) {
  29867. /**
  29868. * @member {string} [SuperMap.ThemeGridUniqueItem.prototype.caption]
  29869. * @description 栅格单值专题图子项的名称。
  29870. */
  29871. this.caption = null;
  29872. /**
  29873. * @member {SuperMap.ServerColor} [SuperMap.ThemeGridUniqueItem.prototype.color]
  29874. * @description 栅格单值专题图子项的显示颜色。
  29875. */
  29876. this.color = new ServerColor();
  29877. /**
  29878. * @member {number} SuperMap.ThemeGridUniqueItem.prototype.unique
  29879. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  29880. */
  29881. this.unique = null;
  29882. /**
  29883. * @member {boolean} [SuperMap.ThemeGridUniqueItem.prototype.visible=true]
  29884. * @description 栅格单值专题图子项是否可见。
  29885. */
  29886. this.visible = true;
  29887. if (options) {
  29888. Util.extend(this, options);
  29889. }
  29890. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  29891. }
  29892. /**
  29893. * @function SuperMap.ThemeGridUniqueItem.prototype.destroy
  29894. * @description 释放资源,将引用资源的属性置空。
  29895. */
  29896. destroy() {
  29897. var me = this;
  29898. me.caption = null;
  29899. me.unique = null;
  29900. if (me.color) {
  29901. me.color.destroy();
  29902. me.color = null;
  29903. }
  29904. me.visible = null;
  29905. }
  29906. /**
  29907. * @function SuperMap.ThemeGridUniqueItem.prototype.toServerJSONObject
  29908. * @description 转换成对应的 JSON 格式对象。
  29909. * @returns {Object} 对应的 JSON 格式对象。
  29910. */
  29911. toServerJSONObject() {
  29912. var obj = {};
  29913. obj = Util.copyAttributes(obj, this);
  29914. if (obj.color) {
  29915. if (obj.color.toServerJSONObject) {
  29916. obj.color = obj.color.toServerJSONObject();
  29917. }
  29918. }
  29919. return obj;
  29920. }
  29921. /**
  29922. * @function SuperMap.ThemeGridUniqueItem.fromObj
  29923. * @description 从传入对象获取栅格单值专题图子项类。
  29924. * @param {Object} obj - 传入对象。
  29925. * @returns {SuperMap.ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  29926. */
  29927. static fromObj(obj) {
  29928. var res = new ThemeGridUniqueItem();
  29929. Util.copy(res, obj);
  29930. res.color = ServerColor.fromJson(obj.color);
  29931. return res;
  29932. }
  29933. }
  29934. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  29935. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  29936. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29937. * This program are made available under the terms of the Apache License, Version 2.0
  29938. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29939. /**
  29940. * @class SuperMap.ThemeGridUnique
  29941. * @category iServer Map Theme
  29942. * @classdesc 栅格单值专题图类。
  29943. * @description 栅格单值专题图,是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。<br>
  29944. * 栅格单值专题图适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  29945. * @extends {SuperMap.Theme}
  29946. * @param {Object} options - 参数。
  29947. * @param {Array.<SuperMap.ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  29948. * @param {SuperMap.ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  29949. */
  29950. class ThemeGridUnique extends Theme {
  29951. constructor(options) {
  29952. super("GRIDUNIQUE", options);
  29953. /**
  29954. * @member {SuperMap.ServerColor} SuperMap.ThemeGridUnique.prototype.defaultcolor
  29955. * @description 栅格单值专题图的默认颜色。
  29956. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  29957. */
  29958. this.defaultcolor = new ServerColor();
  29959. /**
  29960. * @member {Array.<SuperMap.ThemeGridUniqueItem>} SuperMap.ThemeGridUnique.prototype.items
  29961. * @description 栅格单值专题图子项数组。
  29962. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  29963. */
  29964. this.items = null;
  29965. if (options) {
  29966. Util.extend(this, options);
  29967. }
  29968. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  29969. }
  29970. /**
  29971. * @function SuperMap.ThemeGridUnique.prototype.destroy
  29972. * @override
  29973. */
  29974. destroy() {
  29975. super.destroy();
  29976. var me = this;
  29977. if (me.items) {
  29978. if (me.items.length > 0) {
  29979. for (var item in me.items) {
  29980. me.items[item].destroy();
  29981. me.items[item] = null;
  29982. }
  29983. }
  29984. me.items = null;
  29985. }
  29986. if (me.defaultcolor) {
  29987. me.defaultcolor.destroy();
  29988. me.defaultcolor = null;
  29989. }
  29990. }
  29991. /**
  29992. * @function SuperMap.ThemeGridUnique.prototype.toServerJSONObject
  29993. * @description 转换成对应的 JSON 格式对象。
  29994. * @returns {Object} 对应的 JSON 格式对象
  29995. */
  29996. toServerJSONObject() {
  29997. var obj = {};
  29998. obj = Util.copyAttributes(obj, this);
  29999. if (obj.defaultcolor) {
  30000. if (obj.defaultcolor.toServerJSONObject) {
  30001. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  30002. }
  30003. }
  30004. if (obj.items) {
  30005. var items = [],
  30006. len = obj.items.length;
  30007. for (var i = 0; i < len; i++) {
  30008. items.push(obj.items[i].toServerJSONObject());
  30009. }
  30010. obj.items = items;
  30011. }
  30012. return obj;
  30013. }
  30014. /**
  30015. * @function SuperMap.ThemeGridUnique.fromObj
  30016. * @description 从传入对象获取栅格单值专题图类。
  30017. * @param {Object} obj - 传入对象
  30018. * @returns {SuperMap.ThemeGridUnique} ThemeGridUnique 对象
  30019. */
  30020. static fromObj(obj) {
  30021. var res = new ThemeGridUnique();
  30022. var uItems = obj.items;
  30023. var len = uItems ? uItems.length : 0;
  30024. Util.extend(res, obj);
  30025. res.items = [];
  30026. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  30027. for (var i = 0; i < len; i++) {
  30028. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  30029. }
  30030. return res;
  30031. }
  30032. }
  30033. SuperMap.ThemeGridUnique = ThemeGridUnique;
  30034. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  30035. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30036. * This program are made available under the terms of the Apache License, Version 2.0
  30037. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30038. /**
  30039. * @class SuperMap.ThemeLabelUniqueItem
  30040. * @category iServer Map Theme
  30041. * @classdesc 单值标签专题图的子项。
  30042. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  30043. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  30044. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  30045. * @param {Object} options - 参数。
  30046. * @param {string} options.unique - 单值专题图子项的值,可以为数字、字符串等。
  30047. * @param {string} [options.caption] - 专题图子项的名称。
  30048. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  30049. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  30050. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  30051. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  30052. */
  30053. class ThemeLabelUniqueItem {
  30054. constructor(options) {
  30055. /**
  30056. * @member {string} [SuperMap.ThemeLabelUniqueItem.prototype.caption]
  30057. * @description 标签专题子项的标题。
  30058. */
  30059. this.caption = null;
  30060. /**
  30061. * @member {string} SuperMap.ThemeLabelUniqueItem.prototype.unique
  30062. * @description 单值专题图子项的值,可以为数字、字符串等。
  30063. */
  30064. this.unique = null;
  30065. /**
  30066. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetX=0]
  30067. * @description 标签在 X 方向偏移量。
  30068. */
  30069. this.offsetX = 0;
  30070. /**
  30071. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetY=0]
  30072. * @description 标签在 Y 方向偏移量。
  30073. */
  30074. this.offsetY = 0;
  30075. /**
  30076. * @member {boolean} [SuperMap.ThemeLabelUniqueItem.prototype.visible=true]
  30077. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  30078. */
  30079. this.visible = true;
  30080. /**
  30081. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelUniqueItem.prototype.style
  30082. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  30083. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  30084. */
  30085. this.style = new ServerTextStyle();
  30086. if (options) {
  30087. Util.extend(this, options);
  30088. }
  30089. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  30090. }
  30091. /**
  30092. * @function SuperMap.ThemeLabelUniqueItem.prototype.destroy
  30093. * @description 释放资源,将引用资源的属性置空。
  30094. */
  30095. destroy() {
  30096. var me = this;
  30097. me.unique = null;
  30098. me.caption = null;
  30099. me.offsetX = null;
  30100. me.offsetY = null;
  30101. if (me.style) {
  30102. me.style.destroy();
  30103. me.style = null;
  30104. }
  30105. me.visible = null;
  30106. }
  30107. /**
  30108. * @function SuperMap.ThemeLabelUniqueItem.fromObj
  30109. * @description 从传入对象获取单值标签专题图的子项类。
  30110. * @param {Object} obj - 传入对象。
  30111. * @returns {SuperMap.ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  30112. */
  30113. static fromObj(obj) {
  30114. if (!obj) {
  30115. return;
  30116. }
  30117. var t = new ThemeLabelUniqueItem();
  30118. Util.copy(t, obj);
  30119. return t;
  30120. }
  30121. }
  30122. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  30123. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  30124. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30125. * This program are made available under the terms of the Apache License, Version 2.0
  30126. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30127. /**
  30128. * @class SuperMap.ThemeParameters
  30129. * @category iServer Map Theme
  30130. * @classdesc 专题图参数类。
  30131. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  30132. * @param {Object} options - 参数。
  30133. * @param {Array.<string>} options.datasetNames - 要制作专题图的数据集数组。
  30134. * @param {Array.<string>} options.dataSourceNames - 要制作专题图的数据集所在的数据源数组。
  30135. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  30136. * @param {Array.<SuperMap.Theme>} options.themes - 专题图对象列表。
  30137. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  30138. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  30139. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  30140. */
  30141. class ThemeParameters {
  30142. constructor(options) {
  30143. /**
  30144. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.datasetNames
  30145. * @description 要制作专题图的数据集数组。
  30146. */
  30147. this.datasetNames = null;
  30148. /**
  30149. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.dataSourceNames
  30150. * @description 要制作专题图的数据集所在的数据源数组。
  30151. */
  30152. this.dataSourceNames = null;
  30153. /**
  30154. * @member {Array.<SuperMap.JoinItem>} [SuperMap.ThemeParameters.prototype.joinItems]
  30155. * @description 设置与外部表的连接信息 JoinItem 数组。
  30156. * 使用此属性可以制作与外部表连接的专题图。
  30157. */
  30158. this.joinItems = null;
  30159. /**
  30160. * @member {Array.<SuperMap.Theme>} SuperMap.ThemeParameters.prototype.themes
  30161. * @description 专题图对象列表。
  30162. * 该参数为实例化的各类专题图对象的集合。
  30163. */
  30164. this.themes = null;
  30165. /**
  30166. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayFilters]
  30167. * @description 专题图属性过滤条件。
  30168. */
  30169. this.displayFilters = null;
  30170. /**
  30171. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayOrderBys]
  30172. * @description 专题图对象生成符号叠加次序排序字段。
  30173. */
  30174. this.displayOrderBys = null;
  30175. /**
  30176. * @member {Object} [SuperMap.ThemeParameters.prototype.fieldValuesDisplayFilter]
  30177. * @property {Array.<number>} values - 需要过滤的值。
  30178. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  30179. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  30180. */
  30181. this.fieldValuesDisplayFilter = null;
  30182. if (options) {
  30183. Util.extend(this, options);
  30184. }
  30185. this.CLASS_NAME = "SuperMap.ThemeParameters";
  30186. }
  30187. /**
  30188. * @function SuperMap.ThemeParameters.prototype.destroy
  30189. * @description 释放资源,将引用资源的属性置空。
  30190. */
  30191. destroy() {
  30192. var me = this;
  30193. me.datasetNames = null;
  30194. me.dataSourceNames = null;
  30195. if (me.joinItems) {
  30196. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  30197. joinItems[i].destroy();
  30198. }
  30199. me.joinItems = null;
  30200. }
  30201. if (me.themes) {
  30202. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  30203. themes[i].destroy();
  30204. }
  30205. me.themes = null;
  30206. }
  30207. }
  30208. }
  30209. SuperMap.ThemeParameters = ThemeParameters;
  30210. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  30211. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30212. * This program are made available under the terms of the Apache License, Version 2.0
  30213. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30214. /**
  30215. * @class SuperMap.ThemeService
  30216. * @category iServer Map Theme
  30217. * @classdesc 专题图服务类。
  30218. * @extends {SuperMap.CommonServiceBase}
  30219. * @example
  30220. * var myThemeService = new SuperMap.ThemeService(url, {
  30221. * eventListeners: {
  30222. * "processCompleted": themeCompleted,
  30223. * "processFailed": themeFailed
  30224. * }
  30225. * });
  30226. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  30227. * @param {Object} options - 参数。
  30228. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30229. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30230. * @param {Object} [options.headers] - 请求头。
  30231. */
  30232. class ThemeService_ThemeService extends CommonServiceBase {
  30233. constructor(url, options) {
  30234. super(url, options);
  30235. if (options) {
  30236. SuperMap.Util.extend(this, options);
  30237. }
  30238. this.url = Util.urlPathAppend(this.url, 'tempLayersSet');
  30239. this.CLASS_NAME = 'SuperMap.ThemeService';
  30240. }
  30241. /**
  30242. * @override
  30243. */
  30244. destroy() {
  30245. super.destroy();
  30246. }
  30247. /**
  30248. * @function SuperMap.ThemeService.prototype.processAsync
  30249. * @description 负责将客户端的专题图参数传递到服务端。
  30250. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  30251. */
  30252. processAsync(params) {
  30253. if (!(params instanceof ThemeParameters)) {
  30254. return;
  30255. }
  30256. var me = this,
  30257. jsonParameters = null;
  30258. jsonParameters = me.getJsonParameters(params);
  30259. me.request({
  30260. method: "POST",
  30261. data: jsonParameters,
  30262. scope: me,
  30263. success: me.serviceProcessCompleted,
  30264. failure: me.serviceProcessFailed
  30265. });
  30266. }
  30267. /**
  30268. * @function SuperMap.ThemeService.prototype.getJsonParameters
  30269. * @description 将专题图参数参数转化为 JSON 字符串。
  30270. * @param {SuperMap.ThemeParameters} parameter - 专题图参数类。
  30271. * @returns {Object} 转化后的JSON字符串。
  30272. */
  30273. getJsonParameters(parameter) {
  30274. var jsonParameters = "",
  30275. themeObj = null,
  30276. filters = null,
  30277. orderBys = null,
  30278. fieldValuesDisplayFilter;
  30279. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  30280. for (var i = 0; i < parameter.themes.length; i++) {
  30281. themeObj = parameter.themes[i];
  30282. var jsonTheme = Util.toJSON(themeObj);
  30283. jsonTheme = jsonTheme.slice(0, -1);
  30284. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  30285. filters = parameter.displayFilters;
  30286. if (filters && filters.length > 0) {
  30287. if (filters.length === 1) {
  30288. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  30289. } else {
  30290. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  30291. }
  30292. }
  30293. orderBys = parameter.displayOrderBy;
  30294. if (orderBys && orderBys.length > 0) {
  30295. if (orderBys.length === 1) {
  30296. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  30297. } else {
  30298. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  30299. }
  30300. }
  30301. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  30302. if (fieldValuesDisplayFilter) {
  30303. jsonParameters += "'fieldValuesDisplayFilter':" + Util.toJSON(fieldValuesDisplayFilter) + ",";
  30304. }
  30305. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  30306. jsonParameters += "'joinItems':[" + Util.toJSON(parameter.joinItems[i]) + "],";
  30307. }
  30308. if (parameter.datasetNames && parameter.dataSourceNames) {
  30309. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  30310. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  30311. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  30312. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  30313. } else {
  30314. jsonParameters += "},";
  30315. }
  30316. }
  30317. //去除多余的逗号
  30318. if (parameter.themes && parameter.themes.length > 0) {
  30319. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  30320. }
  30321. jsonParameters += "]},";
  30322. var urlArray = this.url.split("/");
  30323. var jsonMapName = urlArray[urlArray.length - 2];
  30324. jsonParameters += "'name': '" + jsonMapName + "'}]";
  30325. return jsonParameters;
  30326. }
  30327. }
  30328. SuperMap.ThemeService = ThemeService_ThemeService;
  30329. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  30330. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30331. * This program are made available under the terms of the Apache License, Version 2.0
  30332. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30333. /**
  30334. * @class SuperMap.ThiessenAnalystService
  30335. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  30336. * @classdesc
  30337. * 泰森多边形分析服务类
  30338. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  30339. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  30340. * 泰森多边形分析的参数支持两种,当参数为 {SuperMap.DatasetThiessenAnalystParameters} 类型
  30341. * 时,执行数据集泰森多边形分析,当参数为 {SuperMap.GeometryThiessenAnalystParameters} 类型时,
  30342. * 执行几何对象泰森多边形分析。
  30343. * @param url - {string} 服务的访问地址。
  30344. * 如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  30345. * @param {Object} options - 参数。</br>
  30346. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30347. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30348. * @param {Object} [options.headers] - 请求头。
  30349. * @extends {SuperMap.SpatialAnalystBase}
  30350. * @example 例如:
  30351. * (start code)
  30352. * var myThiessenAnalystService = new SuperMap.ThiessenAnalystService(url, {
  30353. * eventListeners: {
  30354. * "processCompleted": bufferCompleted,
  30355. * "processFailed": bufferFailed
  30356. * }
  30357. * });
  30358. * (end)
  30359. *
  30360. */
  30361. class ThiessenAnalystService extends SpatialAnalystBase {
  30362. constructor(url, options) {
  30363. super(url, options);
  30364. /**
  30365. * @member {string} SuperMap.ThiessenAnalystService.prototype.mode
  30366. * @description 缓冲区分析类型
  30367. */
  30368. this.mode = null;
  30369. if (options) {
  30370. Util.extend(this, options);
  30371. }
  30372. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  30373. }
  30374. /**
  30375. * @override
  30376. */
  30377. destroy() {
  30378. super.destroy();
  30379. this.mode = null;
  30380. }
  30381. /**
  30382. * @function SuperMap.ThiessenAnalystService.prototype.processAsync
  30383. * @description 负责将客户端的查询参数传递到服务端。
  30384. * @param {(SuperMap.DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters)} parameter - 泰森多边形分析参数基类。
  30385. */
  30386. processAsync(parameter) {
  30387. var parameterObject = {};
  30388. var me = this;
  30389. if (parameter instanceof DatasetThiessenAnalystParameters) {
  30390. me.mode = "datasets";
  30391. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  30392. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  30393. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  30394. me.mode = "geometry";
  30395. me.url = Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  30396. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  30397. }
  30398. var jsonParameters = Util.toJSON(parameterObject);
  30399. me.url = Util.urlAppend(me.url, 'returnContent=true');
  30400. me.request({
  30401. method: "POST",
  30402. data: jsonParameters,
  30403. scope: me,
  30404. success: me.serviceProcessCompleted,
  30405. failure: me.serviceProcessFailed
  30406. });
  30407. }
  30408. }
  30409. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  30410. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  30411. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30412. * This program are made available under the terms of the Apache License, Version 2.0
  30413. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30414. /**
  30415. * @class SuperMap.GeometryBatchAnalystService
  30416. * @category iServer SpatialAnalyst BatchAnalyst
  30417. * @classdesc 批量空间分析服务类
  30418. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  30419. * 叠加分析结果通过该类支持的事件的监听函数参数获取,参数类型为 {<SuperMap.REST.OverlayAnalystEventArgs>}; 获取的结果数据包括 originResult 、result 两种,
  30420. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  30421. * @extends {SuperMap.SpatialAnalystBase}
  30422. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  30423. * @param {Object} options - 参数。
  30424. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30425. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30426. * @param {Object} [options.headers] - 请求头。
  30427. * @example
  30428. * var myOverlayAnalystService = new SuperMap.REST.GeometryBatchAnalystService(url, {
  30429. * eventListeners: {
  30430. * "processCompleted": OverlayCompleted,
  30431. * "processFailed": OverlayFailed
  30432. * }
  30433. * });
  30434. */
  30435. class GeometryBatchAnalystService extends SpatialAnalystBase {
  30436. constructor(url, options) {
  30437. super(url, options);
  30438. if (options) {
  30439. Util.extend(this, options);
  30440. }
  30441. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  30442. }
  30443. /**
  30444. * @function SuperMap.GeometryBatchAnalystService.prototype.processAsync
  30445. * @description 负责将客户端的查询参数传递到服务端。
  30446. * @param {SuperMap.GeometryBatchOverlayAnalystParameters} parameter - 批量几何对象叠加分析参数类
  30447. *
  30448. */
  30449. processAsync(parameters) {
  30450. var me = this;
  30451. me.url = Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  30452. me.url = Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  30453. var parameterObjects = me._processParams(parameters);
  30454. var jsonParameters = Util.toJSON(parameterObjects);
  30455. me.request({
  30456. method: "POST",
  30457. data: jsonParameters,
  30458. scope: me,
  30459. success: me.serviceProcessCompleted,
  30460. failure: me.serviceProcessFailed
  30461. });
  30462. }
  30463. _processParams(parameters) {
  30464. var me = this;
  30465. if (!Util.isArray(parameters)) {
  30466. return;
  30467. }
  30468. var processParams = [];
  30469. parameters.map(function (item) {
  30470. processParams.push(me._toJSON(item));
  30471. return item;
  30472. });
  30473. return processParams;
  30474. }
  30475. _toJSON(parameter) {
  30476. var tempObj = {};
  30477. if(parameter.analystName ==="buffer"){
  30478. tempObj.analystName = "buffer";
  30479. tempObj.param = {};
  30480. //几何对象的批量空间分析,
  30481. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  30482. }else if(parameter.analystName ==="overlay"){
  30483. tempObj.analystName = "overlay";
  30484. tempObj.param = {};
  30485. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  30486. }else if(parameter.analystName ==="interpolationDensity"){
  30487. tempObj.analystName = "interpolationDensity";
  30488. tempObj.param = {};
  30489. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  30490. }else if(parameter.analystName ==="interpolationidw"){
  30491. tempObj.analystName = "interpolationidw";
  30492. tempObj.param = {};
  30493. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  30494. }else if(parameter.analystName ==="interpolationRBF"){
  30495. tempObj.analystName = "interpolationRBF";
  30496. tempObj.param = {};
  30497. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  30498. }else if(parameter.analystName ==="interpolationKriging"){
  30499. tempObj.analystName = "interpolationKriging";
  30500. tempObj.param = {};
  30501. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  30502. }else if(parameter.analystName ==="thiessenpolygon"){
  30503. tempObj.analystName = "thiessenpolygon";
  30504. tempObj.param = {};
  30505. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  30506. }else {
  30507. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  30508. return parameter;
  30509. }
  30510. return tempObj;
  30511. }
  30512. /**
  30513. * @override
  30514. */
  30515. destroy() {
  30516. super.destroy();
  30517. }
  30518. }
  30519. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  30520. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  30521. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30522. * This program are made available under the terms of the Apache License, Version 2.0
  30523. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30524. /**
  30525. * @class SuperMap.TilesetsService
  30526. * @category iServer Map Tilesets
  30527. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  30528. * @extends {SuperMap.CommonServiceBase}
  30529. * @param {string} url - 地图服务地址。URL 应为:
  30530. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  30531. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  30532. * @param {Object} options - 参数。
  30533. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  30534. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  30535. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  30536. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30537. * @param {Object} [options.headers] - 请求头。
  30538. */
  30539. class TilesetsService extends CommonServiceBase {
  30540. constructor(url, options) {
  30541. super(url, options);
  30542. this.CLASS_NAME = "SuperMap.TilesetsService";
  30543. }
  30544. /**
  30545. * @override
  30546. */
  30547. destroy() {
  30548. super.destroy();
  30549. }
  30550. /**
  30551. * @function SuperMap.TilesetsService.prototype.processAsync
  30552. * @description 负责将客户端的查询参数传递到服务端。
  30553. */
  30554. processAsync() {
  30555. if (!this.url) {
  30556. return;
  30557. }
  30558. var me = this;
  30559. me.url = Util.urlPathAppend(me.url, 'tilesets');
  30560. me.request({
  30561. method: "GET",
  30562. scope: me,
  30563. success: me.serviceProcessCompleted,
  30564. failure: me.serviceProcessFailed
  30565. });
  30566. }
  30567. }
  30568. SuperMap.TilesetsService = TilesetsService;
  30569. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  30570. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30571. * This program are made available under the terms of the Apache License, Version 2.0
  30572. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30573. /**
  30574. * @class SuperMap.TopologyValidatorJobsParameter
  30575. * @category iServer ProcessingService TopologyValidator
  30576. * @classdesc 拓扑检查分析任务参数类。
  30577. * @param {Object} options - 必填参数。
  30578. * @param {string} options.datasetName - 数据集名。
  30579. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  30580. * @param {SuperMap.TopologyValidatorRule} [options.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  30581. * @param {string} [options.tolerance] - 容限。
  30582. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  30583. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30584. */
  30585. class TopologyValidatorJobsParameter {
  30586. constructor(options) {
  30587. if (!options) {
  30588. return;
  30589. }
  30590. /**
  30591. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetName
  30592. * @description 数据集名。
  30593. */
  30594. this.datasetName = "";
  30595. /**
  30596. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetTopology
  30597. * @description 拓扑检查对象所在的数据集名称。
  30598. */
  30599. this.datasetTopology = "";
  30600. /**
  30601. * @member {string} [SuperMap.TopologyValidatorJobsParameter.prototype.tolerance]
  30602. * @description 容限,指定的拓扑错误检查时使用的容限。
  30603. */
  30604. this.tolerance = "";
  30605. /**
  30606. * @member {SuperMap.TopologyValidatorRule} [SuperMap.TopologyValidatorJobsParameter.prototype.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP]
  30607. * @description 拓扑检查模式。
  30608. */
  30609. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  30610. /**
  30611. * @member {SuperMap.OutputSetting} [SuperMap.TopologyValidatorJobsParameter.prototype.output]
  30612. * @description 输出参数设置类。
  30613. */
  30614. this.output = null;
  30615. /**
  30616. * @member {SuperMap.MappingParameters} [SuperMap.TopologyValidatorJobsParameter.prototype.mappingParameters]
  30617. * @description 分析后结果可视化的参数类。
  30618. */
  30619. this.mappingParameters = null;
  30620. Util.extend(this, options);
  30621. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  30622. }
  30623. /**
  30624. * @function SuperMap.TopologyValidatorJobsParameter.prototype.destroy
  30625. * @description 释放资源,将引用资源的属性置空。
  30626. */
  30627. destroy() {
  30628. this.datasetName = null;
  30629. this.datasetTopology = null;
  30630. this.tolerance = null;
  30631. this.rule = null;
  30632. if (this.output instanceof OutputSetting) {
  30633. this.output.destroy();
  30634. this.output = null;
  30635. }
  30636. if (this.mappingParameters instanceof MappingParameters) {
  30637. this.mappingParameters.destroy();
  30638. this.mappingParameters = null;
  30639. }
  30640. }
  30641. /**
  30642. * @function SuperMap.TopologyValidatorJobsParameter.toObject
  30643. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  30644. * @param {Object} tempObj - 目标对象。
  30645. * @description 生成拓扑检查分析任务对象。
  30646. */
  30647. static toObject(TopologyValidatorJobsParameter, tempObj) {
  30648. for (var name in TopologyValidatorJobsParameter) {
  30649. if (name === "datasetName") {
  30650. tempObj['input'] = tempObj['input'] || {};
  30651. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  30652. continue;
  30653. }
  30654. if (name === "output") {
  30655. tempObj['output'] = tempObj['output'] || {};
  30656. tempObj['output'] = TopologyValidatorJobsParameter[name];
  30657. continue;
  30658. }
  30659. tempObj['analyst'] = tempObj['analyst'] || {};
  30660. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  30661. if(name === 'mappingParameters'){
  30662. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30663. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  30664. }
  30665. }
  30666. }
  30667. }
  30668. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  30669. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  30670. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30671. * This program are made available under the terms of the Apache License, Version 2.0
  30672. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30673. /**
  30674. * @class SuperMap.TopologyValidatorJobsService
  30675. * @category iServer ProcessingService TopologyValidator
  30676. * @classdesc 拓扑检查分析服务类
  30677. * @extends {SuperMap.ProcessingServiceBase}
  30678. * @param {string} url - 拓扑检查分析服务地址。
  30679. * @param {Object} options - 参数。
  30680. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30681. * @param {Object} [options.headers] - 请求头。
  30682. */
  30683. class TopologyValidatorJobsService extends ProcessingServiceBase {
  30684. constructor(url, options) {
  30685. super(url, options);
  30686. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  30687. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  30688. }
  30689. /**
  30690. *@override
  30691. */
  30692. destroy() {
  30693. super.destroy();
  30694. }
  30695. /**
  30696. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  30697. * @description 获取拓扑检查分析所有任务
  30698. */
  30699. getTopologyValidatorJobs() {
  30700. super.getJobs(this.url);
  30701. }
  30702. /**
  30703. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  30704. * @description 获取指定id的拓扑检查分析服务
  30705. * @param {string} id - 指定要获取数据的id
  30706. */
  30707. getTopologyValidatorJob(id) {
  30708. super.getJobs( Util.urlPathAppend(this.url, id));
  30709. }
  30710. /**
  30711. * @function SuperMap.TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  30712. * @description 新建拓扑检查分析服务
  30713. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  30714. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30715. */
  30716. addTopologyValidatorJob(params, seconds) {
  30717. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  30718. }
  30719. }
  30720. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  30721. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  30722. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30723. * This program are made available under the terms of the Apache License, Version 2.0
  30724. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30725. /**
  30726. * @class SuperMap.TransferLine
  30727. * @category iServer TrafficTransferAnalyst TransferPath
  30728. * @classdesc 换乘路线信息类。
  30729. * @param {Object} options - 参数。
  30730. * @param {number} options.lineID - 乘车路线 ID。
  30731. * @param {string} options.lineName - 乘车路线名称。
  30732. * @param {string} options.lineAliasName - 乘车路线别名。
  30733. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  30734. * @param {string} options.startStopName - 上车站点名称。
  30735. * @param {string} options.startStopAliasName - 上车站点别名。
  30736. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  30737. * @param {string} options.endStopName - 下车站点名称。
  30738. * @param {string} options.endStopAliasName - 下车站点别名。
  30739. */
  30740. class TransferLine {
  30741. constructor(options) {
  30742. options = options || {};
  30743. /**
  30744. * @member {number} SuperMap.TransferLine.prototype.lineID
  30745. * @description 乘车路线 ID。
  30746. */
  30747. this.lineID = null;
  30748. /**
  30749. * @member {string} SuperMap.TransferLine.prototype.lineName
  30750. * @description 乘车路线名称。
  30751. */
  30752. this.lineName = null;
  30753. /**
  30754. * @member {string} SuperMap.TransferLine.prototype.lineAliasName
  30755. * @description 乘车路线别名。
  30756. */
  30757. this.lineAliasName = null;
  30758. /**
  30759. * @member {number} SuperMap.TransferLine.prototype.startStopIndex
  30760. * @description 上车站点在本公交路线中的索引。
  30761. */
  30762. this.startStopIndex = null;
  30763. /**
  30764. * @member {string} SuperMap.TransferLine.prototype.startStopName
  30765. * @description 上车站点名称。
  30766. */
  30767. this.startStopName = null;
  30768. /**
  30769. * @member {string} SuperMap.TransferLine.prototype.startStopAliasName
  30770. * @description 上车站点别名。
  30771. */
  30772. this.startStopAliasName = null;
  30773. /**
  30774. * @member {number} SuperMap.TransferLine.prototype.endStopIndex
  30775. * @description 下车站点在本公交路线中的索引。
  30776. */
  30777. this.endStopIndex = null;
  30778. /**
  30779. * @member {string} SuperMap.TransferLine.prototype.endStopName
  30780. * @description 下车站点名称。
  30781. */
  30782. this.endStopName = null;
  30783. /**
  30784. * @member {string} SuperMap.TransferLine.prototype.endStopAliasName
  30785. * @description 下车站点别名。
  30786. */
  30787. this.endStopAliasName = null;
  30788. Util.extend(this, options);
  30789. this.CLASS_NAME = "SuperMap.TransferLine";
  30790. }
  30791. /**
  30792. * @function SuperMap.TransferLine.prototype.destroy
  30793. * @description 释放资源,将引用资源的属性置空。
  30794. */
  30795. destroy() {
  30796. Util.reset(this);
  30797. }
  30798. /**
  30799. * @function SuperMap.TransferLine.fromJson
  30800. * @description 将返回结果转化为 {@link SuperMap.TransferLine} 对象。
  30801. * @param {Object} jsonObject - 新的返回结果。
  30802. * @returns {SuperMap.TransferLine} 转化后的 {@link SuperMap.TransferLine} 对象。
  30803. */
  30804. static fromJson(jsonObject) {
  30805. if (!jsonObject) {
  30806. return;
  30807. }
  30808. return new TransferLine({
  30809. lineID: jsonObject['lineID'],
  30810. lineName: jsonObject['lineName'],
  30811. lineAliasName: jsonObject['lineAliasName'],
  30812. startStopIndex: jsonObject['startStopIndex'],
  30813. startStopName: jsonObject['startStopName'],
  30814. startStopAliasName: jsonObject['startStopAliasName'],
  30815. endStopIndex: jsonObject['endStopIndex'],
  30816. endStopName: jsonObject['endStopName'],
  30817. endStopAliasName: jsonObject['endStopAliasName']
  30818. });
  30819. }
  30820. }
  30821. SuperMap.TransferLine = TransferLine;
  30822. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  30823. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30824. * This program are made available under the terms of the Apache License, Version 2.0
  30825. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30826. /**
  30827. * @class SuperMap.TransferPathParameters
  30828. * @category iServer TrafficTransferAnalyst TransferPaths
  30829. * @classdesc 交通换乘线路查询参数类。
  30830. * @param {Object} options - 参数。
  30831. * @param {Array.<SuperMap.TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  30832. * @param {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  30833. *
  30834. */
  30835. class TransferPathParameters {
  30836. constructor(options) {
  30837. options = options || {};
  30838. /**
  30839. * @member {Array.<SuperMap.TransferLine>} SuperMap.TransferPathParameters.prototype.transferLines
  30840. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  30841. */
  30842. this.transferLines = null;
  30843. /**
  30844. * @member {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransferPathParameters.prototype.points
  30845. * @description 两种查询方式:<br>
  30846. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  30847. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  30848. */
  30849. this.points = null;
  30850. Util.extend(this, options);
  30851. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  30852. }
  30853. /**
  30854. * @function SuperMap.TransferPathParameters.prototype.destroy
  30855. * @description 释放资源,将引用资源的属性置空。
  30856. */
  30857. destroy() {
  30858. Util.reset(this);
  30859. }
  30860. /**
  30861. * @function SuperMap.TransferPathParameters.toJson
  30862. * @description 将 {@link SuperMap.TransferPathParameters} 对象参数转换为 JSON 字符串。
  30863. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  30864. * @returns {string} 转化后的 JSON 字符串。
  30865. */
  30866. static toJson(params) {
  30867. if (params) {
  30868. return Util.toJSON(params);
  30869. }
  30870. }
  30871. }
  30872. SuperMap.TransferPathParameters = TransferPathParameters;
  30873. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  30874. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30875. * This program are made available under the terms of the Apache License, Version 2.0
  30876. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30877. /**
  30878. * @class SuperMap.TransferPathService
  30879. * @category iServer TrafficTransferAnalyst TransferPath
  30880. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  30881. * 返回结果通过该类支持的事件的监听函数参数获取
  30882. * @extends {SuperMap.CommonServiceBase}
  30883. * @example 例如:
  30884. * var myService = new SuperMap.TransferPathService(url, {eventListeners: {
  30885. * "processCompleted": TrafficTransferCompleted,
  30886. * "processFailed": TrafficTransferError
  30887. * }
  30888. * };
  30889. * @param {string} url - 与客户端交互的交通换乘线路查询服务地址。
  30890. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  30891. * @param {Object} options - 参数。</br>
  30892. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30893. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30894. * @param {Object} [options.headers] - 请求头。
  30895. */
  30896. class TransferPathService extends CommonServiceBase {
  30897. constructor(url, options) {
  30898. super(url, options);
  30899. this.CLASS_NAME = "SuperMap.TransferPathService";
  30900. }
  30901. /**
  30902. * @override
  30903. */
  30904. destroy() {
  30905. super.destroy();
  30906. }
  30907. /**
  30908. * @function SuperMap.TransferPathService.prototype.processAsync
  30909. * @description 负责将客户端的更新参数传递到服务端。
  30910. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  30911. */
  30912. processAsync(params) {
  30913. if (!(params instanceof TransferPathParameters)) {
  30914. return;
  30915. }
  30916. var me = this,
  30917. method = "GET",
  30918. jsonParameters;
  30919. me.url = Util.urlPathAppend(me.url, 'path');
  30920. jsonParameters = {
  30921. points: Util.toJSON(params.points),
  30922. transferLines: Util.toJSON(params['transferLines'])
  30923. };
  30924. me.request({
  30925. method: method,
  30926. params: jsonParameters,
  30927. scope: me,
  30928. success: me.serviceProcessCompleted,
  30929. failure: me.serviceProcessFailed
  30930. });
  30931. }
  30932. }
  30933. SuperMap.TransferPathService = TransferPathService;
  30934. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  30935. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30936. * This program are made available under the terms of the Apache License, Version 2.0
  30937. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30938. /**
  30939. * @class SuperMap.TransferSolutionParameters
  30940. * @category iServer TrafficTransferAnalyst TransferSolutions
  30941. * @classdesc 交通换乘方案查询参数类。
  30942. * @param {Object} options - 参数。
  30943. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|number)>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  30944. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  30945. * @param {SuperMap.TransferTactic} [options.transferTactic=SuperMap.TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  30946. * @param {SuperMap.TransferPreference} [options.transferPreference=SuperMap.TransferPreference.NONE] - 乘车偏好枚举。
  30947. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  30948. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  30949. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  30950. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  30951. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  30952. * @param {string} [options.travelTime] - 出行的时间。
  30953. */
  30954. class TransferSolutionParameters {
  30955. constructor(options) {
  30956. options = options || {};
  30957. /**
  30958. * @member {number} [SuperMap.TransferSolutionParameters.prototype.solutionCount=6]
  30959. * @description 乘车方案的数量。
  30960. */
  30961. this.solutionCount = 6;
  30962. /**
  30963. * @member {SuperMap.TransferPreference} [SuperMap.TransferSolutionParameters.prototype.transferPreference=SuperMap.TransferPreference.NONE]
  30964. * @description 乘车偏好枚举。
  30965. */
  30966. this.transferPreference = TransferPreference.NONE;
  30967. /**
  30968. * @member {SuperMap.TransferTactic} [SuperMap.TransferSolutionParameters.prototype.transferTactic=TransferTactic|SuperMap.TransferTactic.LESS_TIME]
  30969. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  30970. */
  30971. this.transferTactic = TransferTactic.LESS_TIME;
  30972. /**
  30973. * @member {number} [SuperMap.TransferSolutionParameters.prototype.walkingRatio=10]
  30974. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  30975. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  30976. * 方案1:坐车 10 公里,走路 1 公里;</br>
  30977. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  30978. * 1. 假设权重比为 15:</br>
  30979. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  30980. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  30981. * 此时方案 2 消耗更低。</br>
  30982. * 2. 假设权重比为2:</br>
  30983. * •方案 1 的总消耗为:10+1*2 = 12</br>
  30984. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  30985. * 此时方案 1 消耗更低。</br>
  30986. */
  30987. this.walkingRatio = null;
  30988. /**
  30989. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|string)>} SuperMap.TransferSolutionParameters.prototype.points
  30990. * @description 两种查询方式:</br>
  30991. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  30992. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  30993. */
  30994. this.points = false;
  30995. /**
  30996. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeLinesnull]
  30997. * @description 避让路线 ID。
  30998. * */
  30999. this.evadeLines = null;
  31000. /**
  31001. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeStops=TransferLine]
  31002. * @description 避让站点 ID。
  31003. * */
  31004. this.evadeStops = null;
  31005. /**
  31006. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorLines]
  31007. * @description 优先路线 ID。
  31008. * */
  31009. this.priorLines = null;
  31010. /**
  31011. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorStops]
  31012. * @description 优先站点 ID。
  31013. * */
  31014. this.priorStops = null;
  31015. /**
  31016. * @member {string} SuperMap.TransferSolutionParameters.prototype.travelTime
  31017. * @description 出行的时间; 格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  31018. */
  31019. this.travelTime = null;
  31020. Util.extend(this, options);
  31021. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  31022. }
  31023. /**
  31024. * @function SuperMap.TransferSolutionParameters.prototype.destroy
  31025. * @description 释放资源,将引用资源的属性置空。
  31026. */
  31027. destroy() {
  31028. Util.reset(this);
  31029. }
  31030. /**
  31031. * @function SuperMap.TransferSolutionParameters.toJsonParameters
  31032. * @description 将 {@link SuperMap.TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  31033. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  31034. * @returns {string} 转化后的 JSON 字符串。
  31035. */
  31036. static toJson(params) {
  31037. if (params) {
  31038. return Util.toJSON(params);
  31039. }
  31040. }
  31041. }
  31042. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  31043. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  31044. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31045. * This program are made available under the terms of the Apache License, Version 2.0
  31046. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31047. /**
  31048. * @class SuperMap.TransferSolutionService
  31049. * @category iServer TrafficTransferAnalyst TransferSolutions
  31050. * @classdesc 交通换乘方案查询服务类。
  31051. * 返回结果通过该类支持的事件的监听函数参数获取。
  31052. * @param {string} url - 与客户端交互的交通换乘方案查询服务地址。
  31053. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  31054. * @param {Object} options - 参数。</br>
  31055. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  31056. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31057. * @param {Object} [options.headers] - 请求头。
  31058. * @extends {SuperMap.CommonServiceBase}
  31059. * @example 例如:
  31060. * (start code)
  31061. * var myService = new SuperMap.TransferSolutionService(url, {eventListeners: {
  31062. * "processCompleted": trafficTransferCompleted,
  31063. * "processFailed": trafficTransferError
  31064. * }
  31065. * };
  31066. * (end)
  31067. *
  31068. */
  31069. class TransferSolutionService extends CommonServiceBase {
  31070. constructor(url, options) {
  31071. super(url, options);
  31072. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  31073. }
  31074. /**
  31075. * @override
  31076. */
  31077. destroy() {
  31078. super.destroy();
  31079. }
  31080. /**
  31081. * @function SuperMap.TransferSolutionService.prototype.processAsync
  31082. * @description 负责将客户端的更新参数传递到服务端。
  31083. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  31084. */
  31085. processAsync(params) {
  31086. if (!(params instanceof TransferSolutionParameters)) {
  31087. return;
  31088. }
  31089. var me = this,
  31090. method = "GET",
  31091. jsonParameters;
  31092. me.url = Util.urlPathAppend(me.url, 'solutions');
  31093. jsonParameters = {
  31094. points: Util.toJSON(params.points),
  31095. walkingRatio: params['walkingRatio'],
  31096. transferTactic: params['transferTactic'],
  31097. solutionCount: params['solutionCount'],
  31098. transferPreference: params["transferPreference"]
  31099. };
  31100. if (params.evadeLines) {
  31101. jsonParameters["evadeLines"] = Util.toJSON(params.evadeLines);
  31102. }
  31103. if (params.evadeStops) {
  31104. jsonParameters["evadeStops"] = Util.toJSON(params.evadeStops);
  31105. }
  31106. if (params.priorLines) {
  31107. jsonParameters["priorLines"] = Util.toJSON(params.priorLines);
  31108. }
  31109. if (params.priorStops) {
  31110. jsonParameters["priorStops"] = Util.toJSON(params.priorStops);
  31111. }
  31112. if (params.travelTime) {
  31113. jsonParameters["travelTime"] = params.travelTime;
  31114. }
  31115. me.request({
  31116. method: method,
  31117. params: jsonParameters,
  31118. scope: me,
  31119. success: me.serviceProcessCompleted,
  31120. failure: me.serviceProcessFailed
  31121. });
  31122. }
  31123. }
  31124. SuperMap.TransferSolutionService = TransferSolutionService;
  31125. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  31126. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31127. * This program are made available under the terms of the Apache License, Version 2.0
  31128. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31129. /**
  31130. * @class SuperMap.UpdateEdgeWeightParameters
  31131. * @category iServer NetworkAnalyst EdgeWeight
  31132. * @classdesc 边的耗费权重更新服务参数类。
  31133. * @param {Object} options - 参数。
  31134. * @param {string} options.edgeId - 所在边的 ID。
  31135. * @param {string} options.fromNodeId - 起始转向点的 ID。
  31136. * @param {string} options.toNodeId - 终止转向点的 ID。
  31137. * @param {string} options.weightField - 边的耗费字段。
  31138. * @param {string} options.edgeWeight - 耗费权重。
  31139. */
  31140. class UpdateEdgeWeightParameters {
  31141. constructor(options) {
  31142. if (!options) {
  31143. return;
  31144. }
  31145. /**
  31146. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeId
  31147. * @description 所在边的 ID。
  31148. */
  31149. this.edgeId = "";
  31150. /**
  31151. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.fromNodeId
  31152. * @description 起始转向点的 ID。
  31153. */
  31154. this.fromNodeId = "";
  31155. /**
  31156. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.toNodeId
  31157. * @description 终止转向点的 ID。
  31158. */
  31159. this.toNodeId = "";
  31160. /**
  31161. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.weightField
  31162. * @description 边的耗费字段。
  31163. */
  31164. this.weightField = "";
  31165. /**
  31166. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeWeight
  31167. * @description 耗费权重。
  31168. */
  31169. this.edgeWeight = "";
  31170. Util.extend(this, options);
  31171. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  31172. }
  31173. /**
  31174. * @function SuperMap.UpdateEdgeWeightParameters.prototype.destroy
  31175. * @description 释放资源,将引用资源的属性置空。
  31176. */
  31177. destroy() {
  31178. this.edgeId = null;
  31179. this.fromNodeId = null;
  31180. this.toNodeId = null;
  31181. this.weightField = null;
  31182. this.edgeWeight = null;
  31183. }
  31184. }
  31185. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  31186. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  31187. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31188. * This program are made available under the terms of the Apache License, Version 2.0
  31189. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31190. /**
  31191. * @class SuperMap.UpdateEdgeWeightService
  31192. * @category iServer NetworkAnalyst EdgeWeight
  31193. * @classdesc 更新边的边的耗费权重服务
  31194. * @extends {SuperMap.NetworkAnalystServiceBase}
  31195. * @example
  31196. *(start code)
  31197. * var updateEdgeWeightService = new SuperMap.UpdateEdgeWeightService(url, {
  31198. * eventListeners: {
  31199. * "processCompleted": UpdateEdgeWeightCompleted, //参数为SuperMap.UpdateEdgeWeightEventArgs
  31200. * "processFailed": UpdateEdgeWeightError //参数为SuperMap.ServiceFailedEventArgs
  31201. * }
  31202. * });
  31203. * (end)
  31204. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  31205. * @param {Object} options - 参数。
  31206. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31207. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31208. * @param {Object} [options.headers] - 请求头。
  31209. */
  31210. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  31211. constructor(url, options) {
  31212. super(url, options);
  31213. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  31214. }
  31215. /**
  31216. * @override
  31217. */
  31218. destroy() {
  31219. super.destroy();
  31220. }
  31221. /**
  31222. * @function SuperMap.UpdateEdgeWeightService.prototype.processAsync
  31223. * @description 开始异步执行边的边的耗费权重的更新
  31224. * @param {SuperMap.UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  31225. * @example
  31226. * (code)
  31227. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  31228. * edgeId:"20",
  31229. * fromNodeId:"26",
  31230. * toNodeId:"109",
  31231. * weightField:"time",
  31232. * edgeWeight:"25"
  31233. * });
  31234. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  31235. * (end)
  31236. */
  31237. processAsync(params) {
  31238. if (!(params instanceof UpdateEdgeWeightParameters)) {
  31239. return;
  31240. }
  31241. var me = this;
  31242. var paramStr = me.parse(params);
  31243. me.url = Util.urlPathAppend(me.url, paramStr);
  31244. var data = params.edgeWeight ? params.edgeWeight : null;
  31245. me.request({
  31246. method: "PUT",
  31247. scope: me,
  31248. data: data,
  31249. success: me.serviceProcessCompleted,
  31250. failure: me.serviceProcessFailed
  31251. });
  31252. }
  31253. /**
  31254. * @function SuperMap.UpdateEdgeWeightService.prototype.parse
  31255. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  31256. */
  31257. parse(params) {
  31258. if (!params) {
  31259. return;
  31260. }
  31261. var paramStr = "";
  31262. for (var attr in params) {
  31263. if (params[attr] === "" || params[attr] === "edgeWeight") {
  31264. continue;
  31265. }
  31266. switch (attr) {
  31267. case "edgeId":
  31268. paramStr += "/edgeweight/" + params[attr];
  31269. break;
  31270. case "fromNodeId":
  31271. paramStr += "/fromnode/" + params[attr];
  31272. break;
  31273. case "toNodeId":
  31274. paramStr += "/tonode/" + params[attr];
  31275. break;
  31276. case "weightField":
  31277. paramStr += "/weightfield/" + params[attr];
  31278. break;
  31279. default :
  31280. break;
  31281. }
  31282. }
  31283. return paramStr;
  31284. }
  31285. }
  31286. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  31287. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  31288. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31289. * This program are made available under the terms of the Apache License, Version 2.0
  31290. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31291. /**
  31292. * @class SuperMap.UpdateTurnNodeWeightParameters
  31293. * @category iServer NetworkAnalyst TurnNodeWeight
  31294. * @classdesc 转向耗费权重更新服务参数类。
  31295. * @param {Object} options - 参数。
  31296. * @param {string} options.nodeId - 转向结点的 ID。
  31297. * @param {string} options.fromEdgeId - 起始边的 ID。
  31298. * @param {string} options.toEdgeId - 终止边的 ID。
  31299. * @param {string} options.weightField - 转向结点的耗费字段。
  31300. * @param {string} options.turnNodeWeight - 耗费权重。
  31301. */
  31302. class UpdateTurnNodeWeightParameters {
  31303. constructor(options) {
  31304. if (!options) {
  31305. return;
  31306. }
  31307. /**
  31308. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.nodeId
  31309. * @description 转向结点的 ID。
  31310. */
  31311. this.nodeId = "";
  31312. /**
  31313. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  31314. * @description 起始边的 ID。
  31315. */
  31316. this.fromEdgeId = "";
  31317. /**
  31318. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.toEdgeId
  31319. * @description 终止边的 ID。
  31320. */
  31321. this.toEdgeId = "";
  31322. /**
  31323. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.weightField
  31324. * @description 转向结点的耗费字段。
  31325. */
  31326. this.weightField = "";
  31327. /**
  31328. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  31329. * @description 耗费权重。
  31330. */
  31331. this.turnNodeWeight = "";
  31332. Util.extend(this, options);
  31333. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  31334. }
  31335. /**
  31336. * @function SuperMap.UpdateTurnNodeWeightParameters.prototype.destroy
  31337. * @description 释放资源,将引用资源的属性置空。
  31338. */
  31339. destroy() {
  31340. this.nodeId = null;
  31341. this.fromEdgeId = null;
  31342. this.toEdgeId = null;
  31343. this.weightField = null;
  31344. this.turnNodeWeight = null;
  31345. }
  31346. }
  31347. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  31348. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  31349. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31350. * This program are made available under the terms of the Apache License, Version 2.0
  31351. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31352. /**
  31353. * @class SuperMap.UpdateTurnNodeWeightService
  31354. * @category iServer NetworkAnalyst TurnNodeWeight
  31355. * @classdesc 转向耗费权重更新服务类
  31356. * @extends {SuperMap.NetworkAnalystServiceBase}
  31357. * @example
  31358. * var UpdateTurnNodeWeightService = new SuperMap.UpdateTurnNodeWeightService(url, {
  31359. * eventListeners: {
  31360. * "processCompleted": UpdateTurnNodeWeightCompleted, //参数为SuperMap.UpdateTurnNodeWeightEventArgs
  31361. * "processFailed": UpdateTurnNodeWeightError //参数为SuperMap.ServiceFailedEventArgs
  31362. * }
  31363. * });
  31364. * @param {string} url - 服务的访问地址。如:
  31365. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  31366. * @param {Object} options - 参数。
  31367. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31368. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31369. * @param {Object} [options.headers] - 请求头。
  31370. */
  31371. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  31372. constructor(url, options) {
  31373. super(url, options);
  31374. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  31375. }
  31376. /**
  31377. * @override
  31378. */
  31379. destroy() {
  31380. super.destroy();
  31381. }
  31382. /**
  31383. * @function SuperMap.UpdateTurnNodeWeightService.prototype.processAsync
  31384. * @description 开始异步执行转向耗费权重的更新
  31385. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  31386. * @example
  31387. * (code)
  31388. * var updateTurnNodeWeightParam=new SuperMap.UpdateTurnNodeWeightParameters({
  31389. * nodeId:"106",
  31390. * fromEdgeId:"6508",
  31391. * toEdgeId:"6504",
  31392. * weightField:"TurnCost",
  31393. * turnNodeWeight:"50"
  31394. * });
  31395. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  31396. * (end)
  31397. **/
  31398. processAsync(params) {
  31399. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  31400. return;
  31401. }
  31402. var me = this;
  31403. var paramStr = me.parse(params);
  31404. me.url = Util.urlPathAppend(me.url, paramStr);
  31405. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  31406. me.request({
  31407. method: "PUT",
  31408. scope: me,
  31409. data: data,
  31410. success: me.serviceProcessCompleted,
  31411. failure: me.serviceProcessFailed
  31412. });
  31413. }
  31414. /**
  31415. * @function SuperMap.UpdateTurnNodeWeightService.prototype.parse
  31416. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  31417. */
  31418. parse(params) {
  31419. if (!params) {
  31420. return;
  31421. }
  31422. var paramStr = "";
  31423. for (var attr in params) {
  31424. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  31425. continue;
  31426. }
  31427. switch (attr) {
  31428. case "nodeId":
  31429. paramStr += "/turnnodeweight/" + params[attr];
  31430. break;
  31431. case "fromEdgeId":
  31432. paramStr += "/fromedge/" + params[attr];
  31433. break;
  31434. case "toEdgeId":
  31435. paramStr += "/toedge/" + params[attr];
  31436. break;
  31437. case "weightField":
  31438. paramStr += "/weightfield/" + params[attr];
  31439. break;
  31440. default :
  31441. break;
  31442. }
  31443. }
  31444. return paramStr;
  31445. }
  31446. }
  31447. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  31448. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  31449. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31450. * This program are made available under the terms of the Apache License, Version 2.0
  31451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31452. /**
  31453. * @class SuperMap.VectorClipJobsParameter
  31454. * @category iServer ProcessingService VectorClip
  31455. * @classdesc 矢量裁剪分析任务参数类。
  31456. * @param {Object} options - 参数。
  31457. * @param {string} options.datasetName - 数据集名。
  31458. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  31459. * @param {SuperMap.ClipAnalystMode} [options.mode=SuperMap.ClipAnalystMode.CLIP] - 裁剪分析模式。
  31460. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  31461. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  31462. */
  31463. class VectorClipJobsParameter {
  31464. constructor(options) {
  31465. options = options || {};
  31466. /**
  31467. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetName
  31468. * @description 数据集名。
  31469. */
  31470. this.datasetName = "";
  31471. /**
  31472. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetOverlay
  31473. * @description 裁剪对象数据集。
  31474. */
  31475. this.datasetVectorClip = "";
  31476. /**
  31477. * @member {string} SuperMap.VectorClipJobsParameter.prototype.geometryClip
  31478. * @description 裁剪几何对象。
  31479. */
  31480. this.geometryClip = "";
  31481. /**
  31482. * @member {SuperMap.ClipAnalystMode} [SuperMap.VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  31483. * @description 裁剪分析模式 。
  31484. */
  31485. this.mode = ClipAnalystMode.CLIP;
  31486. /**
  31487. * @member {SuperMap.OutputSetting} SuperMap.VectorClipJobsParameter.prototype.output
  31488. * @description 输出参数设置类。
  31489. */
  31490. this.output = null;
  31491. /**
  31492. * @member {SuperMap.MappingParameters} [SuperMap.VectorClipJobsParameter.prototype.mappingParameters]
  31493. * @description 分析后结果可视化的参数类。
  31494. */
  31495. this.mappingParameters = null;
  31496. Util.extend(this, options);
  31497. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  31498. }
  31499. /**
  31500. * @function SuperMap.VectorClipJobsParameter.prototype.destroy
  31501. * @description 释放资源,将引用资源的属性置空。
  31502. */
  31503. destroy() {
  31504. this.datasetName = null;
  31505. this.datasetVectorClip = null;
  31506. this.geometryClip = null;
  31507. this.mode = null;
  31508. if (this.output instanceof OutputSetting) {
  31509. this.output.destroy();
  31510. this.output = null;
  31511. }
  31512. if (this.mappingParameters instanceof MappingParameters) {
  31513. this.mappingParameters.destroy();
  31514. this.mappingParameters = null;
  31515. }
  31516. }
  31517. /**
  31518. * @function SuperMap.VectorClipJobsParameter.toObject
  31519. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  31520. * @param {Object} tempObj - 目标对象。
  31521. * @description 矢量裁剪分析任务对象。
  31522. */
  31523. static toObject(vectorClipJobsParameter, tempObj) {
  31524. for (var name in vectorClipJobsParameter) {
  31525. if (name === "datasetName") {
  31526. tempObj['input'] = tempObj['input'] || {};
  31527. tempObj['input'][name] = vectorClipJobsParameter[name];
  31528. continue;
  31529. }
  31530. if (name === "output"){
  31531. tempObj['output'] = tempObj['output'] || {};
  31532. tempObj['output'] = vectorClipJobsParameter[name];
  31533. continue;
  31534. }
  31535. tempObj['analyst'] = tempObj['analyst'] || {};
  31536. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  31537. if(name === 'mappingParameters'){
  31538. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31539. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  31540. }
  31541. }
  31542. }
  31543. }
  31544. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  31545. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  31546. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31547. * This program are made available under the terms of the Apache License, Version 2.0
  31548. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31549. /**
  31550. * @class SuperMap.VectorClipJobsService
  31551. * @category iServer ProcessingService VectorClip
  31552. * @classdesc 矢量裁剪分析服务类
  31553. * @extends {SuperMap.ProcessingServiceBase}
  31554. * @param {string} url -矢量裁剪分析服务地址。
  31555. * @param {Object} options - 交互服务时所需可选参数。
  31556. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31557. * @param {Object} [options.headers] - 请求头。
  31558. */
  31559. class VectorClipJobsService extends ProcessingServiceBase {
  31560. constructor(url, options) {
  31561. super(url, options);
  31562. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  31563. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  31564. }
  31565. /**
  31566. *@override
  31567. */
  31568. destroy() {
  31569. super.destroy();
  31570. }
  31571. /**
  31572. * @function SuperMap.VectorClipJobsService.protitype.getVectorClipJobs
  31573. * @description 获取矢量裁剪分析所有任务
  31574. */
  31575. getVectorClipJobs() {
  31576. super.getJobs(this.url);
  31577. }
  31578. /**
  31579. * @function SuperMap.KernelDensityJobsService.protitype.getVectorClipJob
  31580. * @description 获取指定id的矢量裁剪分析服务
  31581. * @param {string} id - 指定要获取数据的id
  31582. */
  31583. getVectorClipJob(id) {
  31584. super.getJobs(Util.urlPathAppend(this.url, id));
  31585. }
  31586. /**
  31587. * @function SuperMap.VectorClipJobsService.protitype.addVectorClipJob
  31588. * @description 新建矢量裁剪分析服务
  31589. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  31590. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31591. */
  31592. addVectorClipJob(params, seconds) {
  31593. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  31594. }
  31595. }
  31596. SuperMap.VectorClipJobsService = VectorClipJobsService;
  31597. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  31598. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31599. * This program are made available under the terms of the Apache License, Version 2.0
  31600. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31601. /**
  31602. * @class SuperMap.RasterFunctionParameter
  31603. * @category iServer Map
  31604. * @classdesc iServer 地图服务栅格分析参数基类
  31605. * @param {Object} options - 参数。
  31606. * @param {SuperMap.RasterFunctionType} options.type - 栅格分析方法。
  31607. */
  31608. class RasterFunctionParameter {
  31609. constructor(options) {
  31610. options = options || {};
  31611. /**
  31612. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  31613. * @description 栅格分析方法。
  31614. */
  31615. this.type = null;
  31616. Util.extend(this, options);
  31617. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  31618. }
  31619. /**
  31620. * @function SuperMap.RasterFunctionParameter.prototype.destroy
  31621. * @description 释放资源,将资源的属性置空。
  31622. */
  31623. destroy() {
  31624. this.type = null;
  31625. }
  31626. }
  31627. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  31628. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  31629. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31630. * This program are made available under the terms of the Apache License, Version 2.0
  31631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31632. /**
  31633. * @class SuperMap.NDVIParameter
  31634. * @category iServer Map
  31635. * @classdesc 归一化植被指数参数类
  31636. * @param {Object} options - 参数。
  31637. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  31638. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  31639. * @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。仅单波段数据时设定。
  31640. * @extends {SuperMap.RasterFunctionParameter}
  31641. */
  31642. class NDVIParameter extends RasterFunctionParameter {
  31643. constructor(options) {
  31644. super(options);
  31645. /**
  31646. * @member {number} [SuperMap.NDVIParameter.prototype.redIndex=0]
  31647. * @description 红光谱波段索引。
  31648. */
  31649. this.redIndex = 0;
  31650. /**
  31651. * @member {number} [SuperMap.NDVIParameter.prototype.nirIndex=1]
  31652. * @description 近红外光谱波段索引。
  31653. */
  31654. this.nirIndex = 1;
  31655. /**
  31656. * @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"]
  31657. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  31658. */
  31659. this.colorMap =
  31660. '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';
  31661. /**
  31662. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  31663. * @description 栅格分析方法。
  31664. */
  31665. this.type = RasterFunctionType.NDVI;
  31666. Util.extend(this, options);
  31667. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  31668. }
  31669. /**
  31670. * @function SuperMap.NDVIParameter.prototype.destroy
  31671. * @override
  31672. */
  31673. destroy() {
  31674. super.destroy();
  31675. this.redIndex = null;
  31676. this.nirIndex = null;
  31677. this.colorMap = null;
  31678. }
  31679. /**
  31680. * @function SuperMap.NDVIParameter.prototype.toJSON
  31681. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  31682. * @returns {string} 返回转换后的 JSON 字符串。
  31683. */
  31684. toJSON() {
  31685. return {
  31686. redIndex: this.redIndex,
  31687. nirIndex: this.nirIndex,
  31688. colorMap: this.colorMap,
  31689. type: this.type
  31690. };
  31691. }
  31692. }
  31693. SuperMap.NDVIParameter = NDVIParameter;
  31694. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  31695. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31696. * This program are made available under the terms of the Apache License, Version 2.0
  31697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31698. /**
  31699. * @class SuperMap.HillshadeParameter
  31700. * @category iServer Map
  31701. * @classdesc 阴影面分析参数类
  31702. * @param {Object} options - 参数。
  31703. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  31704. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  31705. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  31706. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  31707. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  31708. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  31709. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  31710. * Latitude Z-factor
  31711. * 0 0.00000898
  31712. * 10 0.00000912
  31713. * 20 0.00000956
  31714. * 30 0.00001036
  31715. * 40 0.00001171
  31716. * 50 0.00001395
  31717. * 60 0.00001792
  31718. * 70 0.00002619
  31719. * 80 0.00005156
  31720. * @extends {SuperMap.RasterFunctionParameter}
  31721. */
  31722. class HillshadeParameter extends RasterFunctionParameter {
  31723. constructor(options) {
  31724. super(options);
  31725. /**
  31726. * @member {number} [SuperMap.HillshadeParameter.prototype.altitude = 45]
  31727. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  31728. */
  31729. this.altitude = 45;
  31730. /**
  31731. * @member {number} [SuperMap.HillshadeParameter.prototype.azimuth = 315]
  31732. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  31733. */
  31734. this.azimuth = 315;
  31735. /**
  31736. * @member {number} [SuperMap.HillshadeParameter.prototype.zFactor = 1]
  31737. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  31738. */
  31739. this.zFactor = 1;
  31740. /**
  31741. * @member {SuperMap.RasterFunctionType} SuperMap.RasterFunctionParameter.prototype.type
  31742. * @description 栅格分析方法。
  31743. */
  31744. this.type = RasterFunctionType.HILLSHADE;
  31745. Util.extend(this, options);
  31746. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  31747. }
  31748. /**
  31749. * @function SuperMap.HillshadeParameter.prototype.destroy
  31750. * @override
  31751. */
  31752. destroy() {
  31753. super.destroy();
  31754. this.altitude = null;
  31755. this.azimuth = null;
  31756. this.zFactor = null;
  31757. }
  31758. /**
  31759. * @function SuperMap.HillshadeParameter.prototype.toJSON
  31760. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  31761. * @returns {string} 返回转换后的 JSON 字符串。
  31762. */
  31763. toJSON() {
  31764. return {
  31765. altitude: this.altitude,
  31766. azimuth: this.azimuth,
  31767. zFactor: this.zFactor,
  31768. type: this.type
  31769. };
  31770. }
  31771. }
  31772. SuperMap.HillshadeParameter = HillshadeParameter;
  31773. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  31774. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31775. * This program are made available under the terms of the Apache License, Version 2.0
  31776. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31777. /**
  31778. * @class SuperMap.WebPrintingJobCustomItems
  31779. * @classdesc Web 打印图例元素参数类。
  31780. * @version 10.1.0
  31781. * @category iServer WebPrintingJob
  31782. * @param {Object} option - 初始化参数。
  31783. * @param {string} option.name - 图例元素的名称。
  31784. * @param {string} [option.picAsUrl] - 图例元素 Base64 格式图片。
  31785. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。
  31786. */
  31787. class WebPrintingJobCustomItems {
  31788. constructor(option) {
  31789. /**
  31790. * @member {string} SuperMap.WebPrintingJobCustomItems.prototype.name
  31791. * @description 图例元素的名称。
  31792. */
  31793. this.name = null;
  31794. /**
  31795. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsUrl]
  31796. * @description 图例元素 Base64 格式图片。
  31797. */
  31798. this.picAsUrl = null;
  31799. /**
  31800. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsBase64]
  31801. * @description 图例元素图片的获取地址。
  31802. */
  31803. this.picAsBase64 = null;
  31804. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  31805. Util.extend(this, option);
  31806. }
  31807. /**
  31808. * @function SuperMap.WebPrintingJobCustomItems.prototype.destroy
  31809. * @description 释放资源,将引用资源的属性置空。
  31810. */
  31811. destroy() {
  31812. var me = this;
  31813. me.name = null;
  31814. me.picAsUrl = null;
  31815. me.picAsBase64 = null;
  31816. }
  31817. /**
  31818. * @function SuperMap.WebPrintingJobCustomItems.prototype.toJSON
  31819. * @description 将 SuperMap.WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  31820. * @returns {string} 返回转换后的 JSON 字符串。
  31821. */
  31822. toJSON() {
  31823. var params = {
  31824. name: this.name
  31825. };
  31826. if (this.title) {
  31827. params.title = this.title;
  31828. }
  31829. if (this.picAsUrl) {
  31830. params.picAsUrl = this.picAsUrl;
  31831. } else if (this.picAsBase64) {
  31832. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  31833. }
  31834. return Util.toJSON(params);
  31835. }
  31836. }
  31837. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  31838. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  31839. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31840. * This program are made available under the terms of the Apache License, Version 2.0
  31841. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31842. /**
  31843. * @class SuperMap.WebPrintingJobImage
  31844. * @classdesc 表达小地图的静态图片参数类。
  31845. * @version 10.1.0
  31846. * @category iServer WebPrintingJob
  31847. * @param {Object} option - 初始化参数。
  31848. * @param {string} [option.picAsUrl] - 小地图的图片 url 地址。
  31849. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。
  31850. */
  31851. class WebPrintingJobImage {
  31852. constructor(option) {
  31853. /**
  31854. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsUrl]
  31855. * @description 小地图的图片 url 地址。
  31856. */
  31857. this.picAsUrl = null;
  31858. /**
  31859. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsBase64]
  31860. * @description 小地图的base64位图片信息。
  31861. */
  31862. this.picAsBase64 = null;
  31863. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  31864. Util.extend(this, option);
  31865. }
  31866. /**
  31867. * @function SuperMap.WebPrintingJobImage.prototype.destroy
  31868. * @description 释放资源,将引用资源的属性置空。
  31869. */
  31870. destroy() {
  31871. this.picAsUrl = null;
  31872. this.picAsBase64 = null;
  31873. }
  31874. /**
  31875. * @function SuperMap.WebPrintingJobImage.prototype.toJSON
  31876. * @description 将 SuperMap.WebPrintingJobImage 对象转化为 JSON 字符串。
  31877. * @returns {string} 返回转换后的 JSON 字符串。
  31878. */
  31879. toJSON() {
  31880. var params = {};
  31881. if (this.picAsUrl) {
  31882. params.picAsUrl = this.picAsUrl;
  31883. }
  31884. if (this.picAsBase64) {
  31885. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  31886. }
  31887. return Util.toJSON(params);
  31888. }
  31889. }
  31890. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  31891. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  31892. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31893. * This program are made available under the terms of the Apache License, Version 2.0
  31894. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31895. /**
  31896. * @class SuperMap.WebPrintingJobLayers
  31897. * @classdesc 将图例添加到布局的业务图层参数类。
  31898. * @version 10.1.0
  31899. * @category iServer WebPrintingJob
  31900. * @param {Object} option - 初始化参数。
  31901. * @param {string} [option.name] - 表示图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  31902. */
  31903. class WebPrintingJobLayers {
  31904. constructor(option) {
  31905. /**
  31906. * @member {string} SuperMap.WebPrintingJobLayers.prototype.name
  31907. * @description 图层 name。
  31908. */
  31909. this.name = null;
  31910. /**
  31911. * @member {string} SuperMap.WebPrintingJobLayers.prototype.layerType
  31912. * @description 图层 type。
  31913. */
  31914. this.layerType = null;
  31915. /**
  31916. * @member {string} SuperMap.WebPrintingJobLayers.prototype.url
  31917. * @description 图层 url。
  31918. */
  31919. this.url = null;
  31920. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  31921. Util.extend(this, option);
  31922. }
  31923. /**
  31924. * @function SuperMap.WebPrintingJobLayers.prototype.destroy
  31925. * @description 释放资源,将引用资源的属性置空。
  31926. */
  31927. destroy() {
  31928. this.name = null;
  31929. this.layerType = null;
  31930. this.url = null;
  31931. }
  31932. }
  31933. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  31934. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  31935. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31936. * This program are made available under the terms of the Apache License, Version 2.0
  31937. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31938. /**
  31939. * @class SuperMap.WebPrintingJobLegendOptions
  31940. * @classdesc Web 打印图例参数类。
  31941. * @version 10.1.0
  31942. * @category iServer WebPrintingJob
  31943. * @param {Object} option - 初始化参数。
  31944. * @param {string} [option.title] - 图例名称。
  31945. * @param {string} [option.picAsUrl] - 图例的图片 url 地址。
  31946. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  31947. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  31948. * @param {SuperMap.WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  31949. */
  31950. class WebPrintingJobLegendOptions {
  31951. constructor(option) {
  31952. /**
  31953. * @member {string} SuperMap.WebPrintingJobLegendOptions.prototype.title
  31954. * @description 图例名称。
  31955. */
  31956. this.title = null;
  31957. /**
  31958. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsUrl]
  31959. * @description 图例的图片 url 地址。
  31960. */
  31961. this.picAsUrl = null;
  31962. /**
  31963. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsBase64]
  31964. * @description 图例的 base64 位图片信息。
  31965. */
  31966. this.picAsBase64 = null;
  31967. /**
  31968. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLegendOptions.prototype.layers]
  31969. * @description 图例的布局业务图层参数类。
  31970. */
  31971. this.layers = null;
  31972. /**
  31973. * @member {SuperMap.WebPrintingJobCustomItems} [SuperMap.WebPrintingJobLegendOptions.prototype.customItems]
  31974. * @description 自定义图例元素参数类。
  31975. */
  31976. this.customItems = null;
  31977. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  31978. Util.extend(this, option);
  31979. }
  31980. /**
  31981. * @function SuperMap.WebPrintingJobLegendOptions.prototype.destroy
  31982. * @description 释放资源,将引用资源的属性置空。
  31983. */
  31984. destroy() {
  31985. this.title = null;
  31986. this.picAsUrl = null;
  31987. this.picAsBase64 = null;
  31988. if (this.layers instanceof WebPrintingJobLayers) {
  31989. this.layers.destroy();
  31990. this.layers = null;
  31991. }
  31992. if (this.customItems instanceof WebPrintingJobCustomItems) {
  31993. this.customItems.destroy();
  31994. this.customItems = null;
  31995. }
  31996. }
  31997. /**
  31998. * @function SuperMap.WebPrintingJobLegendOptions.prototype.toJSON
  31999. * @description 将 SuperMap.WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  32000. * @returns {string} 返回转换后的 JSON 字符串。
  32001. */
  32002. toJSON() {
  32003. var params = {
  32004. title: this.title || ""
  32005. };
  32006. if (this.picAsUrl) {
  32007. params.picAsUrl = this.picAsUrl;
  32008. } else if (this.picAsBase64) {
  32009. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  32010. } else if (this.customItems) {
  32011. params.customItems = this.customItems;
  32012. }
  32013. return Util.toJSON(params);
  32014. }
  32015. }
  32016. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  32017. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  32018. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32019. * This program are made available under the terms of the Apache License, Version 2.0
  32020. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32021. /**
  32022. * @class SuperMap.WebPrintingJobLittleMapOptions
  32023. * @classdesc Web 打印小地图参数类。
  32024. * @version 10.1.0
  32025. * @category iServer WebPrintingJob
  32026. * @param {Object} option - 初始化参数。
  32027. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  32028. * @param {number} [option.scale] - 小地图的比例尺。
  32029. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  32030. * @param {SuperMap.WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  32031. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  32032. */
  32033. class WebPrintingJobLittleMapOptions {
  32034. constructor(option) {
  32035. /**
  32036. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.WebPrintingJobLittleMapOptions.prototype.center
  32037. * @description 小地图的中心点。
  32038. */
  32039. this.center = null;
  32040. /**
  32041. * @member {number} [SuperMap.WebPrintingJobLittleMapOptions.prototype.scale]
  32042. * @description 小地图的比例尺。
  32043. */
  32044. this.scale = null;
  32045. /**
  32046. * @member {Array.<string>} SuperMap.WebPrintingJobLittleMapOptions.prototype.layerNames
  32047. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  32048. */
  32049. this.layerNames = null;
  32050. /**
  32051. * @member {SuperMap.WebPrintingJobImage} [SuperMap.WebPrintingJobLittleMapOptions.prototype.image]
  32052. * @description 表达小地图的静态图类。暂不支持
  32053. */
  32054. this.image = null;
  32055. /**
  32056. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLittleMapOptions.prototype.layers]
  32057. * @description 指定 WebMap 中的 layers 图层类。
  32058. */
  32059. this.layers = null;
  32060. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  32061. Util.extend(this, option);
  32062. }
  32063. /**
  32064. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.destroy
  32065. * @description 释放资源,将引用资源的属性置空。
  32066. */
  32067. destroy() {
  32068. this.center = null;
  32069. this.scale = null;
  32070. this.layerNames = null;
  32071. if (this.image instanceof WebPrintingJobImage) {
  32072. this.image.destroy();
  32073. this.image = null;
  32074. }
  32075. if (this.layers instanceof WebPrintingJobLayers) {
  32076. this.layers.destroy();
  32077. this.layers = null;
  32078. }
  32079. }
  32080. /**
  32081. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.toJSON
  32082. * @description 将 SuperMap.WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  32083. * @returns {string} 返回转换后的 JSON 字符串。
  32084. */
  32085. toJSON() {
  32086. var params = {
  32087. scale: this.scale,
  32088. center: this.center
  32089. };
  32090. if (this.layerNames) {
  32091. params.layerNames = this.layerNames;
  32092. } else if (this.layers) {
  32093. params.layers = this.layers;
  32094. }
  32095. if (this.image) {
  32096. params.image = this.image;
  32097. }
  32098. return Util.toJSON(params);
  32099. }
  32100. }
  32101. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  32102. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  32103. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32104. * This program are made available under the terms of the Apache License, Version 2.0
  32105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32106. /**
  32107. * @class SuperMap.WebPrintingJobNorthArrowOptions
  32108. * @classdesc Web 打印地图指北针参数类。
  32109. * @version 10.1.0
  32110. * @category iServer WebPrintingJob
  32111. * @param {Object} option - 初始化参数。
  32112. * @param {string} option.picAsUrl - 指北针的图片 url 地址。
  32113. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  32114. */
  32115. class WebPrintingJobNorthArrowOptions {
  32116. constructor(option) {
  32117. /**
  32118. * @member {string} SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  32119. * @description 指北针的图片 url 地址。
  32120. */
  32121. this.picAsUrl = null;
  32122. /**
  32123. * @member {string} [SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  32124. * @description 指北针的base64位图片信息。
  32125. */
  32126. this.picAsBase64 = null;
  32127. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  32128. Util.extend(this, option);
  32129. }
  32130. /**
  32131. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.destroy
  32132. * @description 释放资源,将引用资源的属性置空。
  32133. */
  32134. destroy() {
  32135. this.picAsUrl = null;
  32136. this.picAsBase64 = null;
  32137. }
  32138. /**
  32139. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.toJSON
  32140. * @description 将 SuperMap.WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  32141. * @returns {string} 返回转换后的 JSON 字符串。
  32142. */
  32143. toJSON() {
  32144. var params = {};
  32145. if (this.picAsUrl) {
  32146. params.picAsUrl = this.picAsUrl;
  32147. } else if (this.picAsBase64) {
  32148. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  32149. }
  32150. return Util.toJSON(params);
  32151. }
  32152. }
  32153. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  32154. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  32155. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32156. * This program are made available under the terms of the Apache License, Version 2.0
  32157. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32158. /**
  32159. * @class SuperMap.WebPrintingJobScaleBarOptions
  32160. * @classdesc Web 打印比例尺参数类。
  32161. * @category iServer WebPrintingJob
  32162. * @version 10.1.0
  32163. * @param {Object} option - 初始化参数。
  32164. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000
  32165. * @param {SuperMap.WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  32166. * @param {SuperMap.WebScaleType} [option.type] - 比例尺的样式。
  32167. * @param {number} [option.intervals] - 比例尺条的段数。
  32168. * @param {SuperMap.WebScaleUnit} [option.unit] - 比例尺的单位制。
  32169. */
  32170. class WebPrintingJobScaleBarOptions {
  32171. constructor(option) {
  32172. /**
  32173. * @member {string} SuperMap.WebPrintingJobScaleBarOptions.prototype.scaleText
  32174. * @description 比例尺文本信息。
  32175. */
  32176. this.scaleText = null;
  32177. /**
  32178. * @member {SuperMap.WebScaleOrientationType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.orientation]
  32179. * @description 比例尺的方位样式。
  32180. */
  32181. this.orientation = null;
  32182. /**
  32183. * @member {SuperMap.WebScaleType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.type]
  32184. * @description 比例尺的样式。
  32185. */
  32186. this.type = null;
  32187. /**
  32188. * @member {object} [SuperMap.WebPrintingJobScaleBarOptions.prototype.intervals]
  32189. * @description 比例尺条的段数。
  32190. */
  32191. this.intervals = null;
  32192. /**
  32193. * @member {SuperMap.WebScaleUnit} [SuperMap.WebPrintingJobScaleBarOptions.prototype.unit]
  32194. * @description 比例尺的单位制。
  32195. */
  32196. this.unit = null;
  32197. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  32198. Util.extend(this, option);
  32199. }
  32200. /**
  32201. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.destroy
  32202. * @description 释放资源,将引用资源的属性置空。
  32203. */
  32204. destroy() {
  32205. this.scaleText = null;
  32206. this.orientation = null;
  32207. this.type = null;
  32208. this.intervals = null;
  32209. this.unit = null;
  32210. }
  32211. /**
  32212. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.toJSON
  32213. * @description 将 SuperMap.WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  32214. * @returns {string} 返回转换后的 JSON 字符串。
  32215. */
  32216. toJSON() {
  32217. var params = {
  32218. scaleText: this.scaleText || "",
  32219. type: this.type || "BAR",
  32220. intervals: this.intervals || "",
  32221. unit: this.unit || "METER"
  32222. };
  32223. if (this.orientation) {
  32224. params.orientation = this.orientation;
  32225. }
  32226. return Util.toJSON(params);
  32227. }
  32228. }
  32229. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  32230. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  32231. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32232. * This program are made available under the terms of the Apache License, Version 2.0
  32233. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32234. /**
  32235. * @class SuperMap.WebPrintingJobContent
  32236. * @classdesc Web 打印内容参数类。
  32237. * @version 10.1.0
  32238. * @category iServer WebPrintingJob
  32239. * @param {Object} option - 初始化参数。
  32240. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP
  32241. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 url 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson
  32242. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  32243. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。如果已填了 url 参数,此参数可不传
  32244. */
  32245. class WebPrintingJobContent {
  32246. constructor(option) {
  32247. /**
  32248. * @member {string} SuperMap.WebPrintingJobContent.prototype.type
  32249. * @description Web 打印内容支持的类型。
  32250. */
  32251. this.type = null;
  32252. /**
  32253. * @member {string} [SuperMap.WebPrintingJobContent.prototype.url]
  32254. * @description 待打印的 SuperMap iPortal WebMap 的 url 地址。
  32255. */
  32256. this.url = null;
  32257. /**
  32258. * @member {string} [SuperMap.WebPrintingJobContent.prototype.token]
  32259. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  32260. */
  32261. this.token = null;
  32262. /**
  32263. * @member {WebMapSummaryObject} [SuperMap.WebPrintingJobContent.prototype.value]
  32264. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。
  32265. */
  32266. this.value = null;
  32267. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  32268. Util.extend(this, option);
  32269. }
  32270. /**
  32271. * @function SuperMap.WebPrintingJobContent.prototype.destroy
  32272. * @description 释放资源,将引用资源的属性置空。
  32273. */
  32274. destroy() {
  32275. this.type = false || "WEBMAP";
  32276. this.url = null;
  32277. this.token = null;
  32278. this.value = null;
  32279. }
  32280. /**
  32281. * @function SuperMap.WebPrintingJobContent.prototype.toJSON
  32282. * @description 将 SuperMap.WebPrintingJobContent 对象转化为 JSON 字符串。
  32283. * @returns {string} 返回转换后的 JSON 字符串。
  32284. */
  32285. toJSON() {
  32286. var params = {
  32287. type: this.type
  32288. };
  32289. if (this.token) {
  32290. params.token = this.token;
  32291. }
  32292. if (this.url) {
  32293. params.url = this.url;
  32294. } else if (this.value) {
  32295. params.value = this.value;
  32296. }
  32297. return Util.toJSON(params);
  32298. }
  32299. }
  32300. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  32301. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  32302. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32303. * This program are made available under the terms of the Apache License, Version 2.0
  32304. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32305. /**
  32306. * @class SuperMap.WebPrintingJobLayoutOptions
  32307. * @classdesc Web 打印的布局参数类。
  32308. * @version 10.1.0
  32309. * @category iServer WebPrintingJob
  32310. * @param {Object} option - 初始化参数。
  32311. * @param {string} option.templateName - 布局模板的名称。
  32312. * @param {string} option.title - 地图主标题名称。
  32313. * @param {string} option.subTitle - 地图副标题名称。
  32314. * @param {string} option.author - 地图作者名称。
  32315. * @param {string} option.copyright - 地图版权信息。
  32316. * @param {SuperMap.WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  32317. * @param {SuperMap.WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  32318. * @param {SuperMap.WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  32319. * @param {SuperMap.WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  32320. */
  32321. class WebPrintingJobLayoutOptions {
  32322. constructor(option) {
  32323. /**
  32324. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.templateName
  32325. * @description 布局模板的名称。
  32326. */
  32327. this.templateName = null;
  32328. /**
  32329. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.title
  32330. * @description 地图主标题名称。
  32331. */
  32332. this.title = null;
  32333. /**
  32334. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.subTitle
  32335. * @description 地图副标题名称。
  32336. */
  32337. this.subTitle = null;
  32338. /**
  32339. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.author
  32340. * @description 地图作者名称。
  32341. */
  32342. this.author = null;
  32343. /**
  32344. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.copyright
  32345. * @description 地图版权信息。
  32346. */
  32347. this.copyright = null;
  32348. /**
  32349. * @member {SuperMap.WebPrintingJobScaleBarOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  32350. * @description 地图比例尺参数类。
  32351. */
  32352. this.scaleBarOptions = null;
  32353. /**
  32354. * @member {SuperMap.WebPrintingJobNorthArrowOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  32355. * @description 地图指北针参数类。
  32356. */
  32357. this.northArrowOptions = null;
  32358. /**
  32359. * @member {SuperMap.WebPrintingJobLittleMapOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.littleMapOptions
  32360. * @description 小地图参数类。
  32361. */
  32362. this.littleMapOptions = null;
  32363. /**
  32364. * @member {SuperMap.WebPrintingJobLegendOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.legendOptions
  32365. * @description 图例参数类。
  32366. */
  32367. this.legendOptions = null;
  32368. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  32369. Util.extend(this, option);
  32370. }
  32371. /**
  32372. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.destroy
  32373. * @description 释放资源,将引用资源的属性置空。
  32374. */
  32375. destroy() {
  32376. this.templateName = null;
  32377. this.title = null;
  32378. this.subTitle = null;
  32379. this.author = null;
  32380. this.copyright = null;
  32381. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  32382. this.scaleBarOptions.destroy();
  32383. this.scaleBarOptions = null;
  32384. }
  32385. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  32386. this.northArrowOptions.destroy();
  32387. this.northArrowOptions = null;
  32388. }
  32389. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  32390. this.littleMapOptions.destroy();
  32391. this.littleMapOptions = null;
  32392. }
  32393. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  32394. this.legendOptions.destroy();
  32395. this.legendOptions = null;
  32396. }
  32397. }
  32398. /**
  32399. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.toJSON
  32400. * @description 将 SuperMap.WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  32401. * @returns {string} 返回转换后的 JSON 字符串。
  32402. */
  32403. toJSON() {
  32404. var params = {
  32405. templateName: this.templateName,
  32406. title: this.title,
  32407. subTitle: this.subTitle,
  32408. author: this.author,
  32409. copyright: this.copyright
  32410. };
  32411. if (this.scaleBarOptions) {
  32412. params.scaleBarOptions = this.scaleBarOptions;
  32413. }
  32414. if (this.northArrowOptions) {
  32415. params.northArrowOptions = this.northArrowOptions;
  32416. }
  32417. if (this.littleMapOptions) {
  32418. params.littleMapOptions = this.littleMapOptions;
  32419. }
  32420. if (this.legendOptions) {
  32421. params.legendOptions = this.legendOptions;
  32422. }
  32423. return Util.toJSON(params);
  32424. }
  32425. }
  32426. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  32427. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  32428. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32429. * This program are made available under the terms of the Apache License, Version 2.0
  32430. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32431. /**
  32432. * @class SuperMap.WebPrintingJobExportOptions
  32433. * @classdesc Web 打印的输出参数类。
  32434. * @version 10.1.0
  32435. * @category iServer WebPrintingJob
  32436. * @param {Object} option - 初始化参数。
  32437. * @param {SuperMap.WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  32438. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 dpi。
  32439. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  32440. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  32441. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  32442. */
  32443. class WebPrintingJobExportOptions {
  32444. constructor(option) {
  32445. /**
  32446. * @member {SuperMap.WebExportFormatType} SuperMap.WebPrintingJobExportOptions.prototype.format
  32447. * @description Web 打印输出的格式。
  32448. */
  32449. this.format = null;
  32450. /**
  32451. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.dpi=96]
  32452. * @description Web 打印输出的分辨率,单位为每英寸点数。
  32453. */
  32454. this.dpi = 96;
  32455. /**
  32456. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.scale]
  32457. * @description Web 打印输出的地图比例尺。
  32458. */
  32459. this.scale = null;
  32460. /**
  32461. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.rotation]
  32462. * @description Web 打印输出的地图角度。
  32463. */
  32464. this.rotation = null;
  32465. /**
  32466. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [SuperMap.WebPrintingJobExportOptions.prototype.center]
  32467. * @description Web 打印输出的地图中心点。
  32468. */
  32469. this.center = null;
  32470. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  32471. Util.extend(this, option);
  32472. }
  32473. /**
  32474. * @function SuperMap.WebPrintingJobExportOptions.prototype.destroy
  32475. * @description 释放资源,将引用资源的属性置空。
  32476. */
  32477. destroy() {
  32478. this.format = null;
  32479. this.dpi = null;
  32480. this.scale = null;
  32481. this.rotation = null;
  32482. this.center = null;
  32483. this.outputSize = null;
  32484. }
  32485. /**
  32486. * @function SuperMap.WebPrintingJobExportOptions.prototype.toJSON
  32487. * @description 将 SuperMap.WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  32488. * @returns {string} 返回转换后的 JSON 字符串。
  32489. */
  32490. toJSON() {
  32491. var params = {
  32492. format: this.format || "PDF",
  32493. dpi: this.dpi,
  32494. scale: this.scale,
  32495. center: this.center
  32496. };
  32497. if (this.rotation) {
  32498. params.rotation = this.rotation;
  32499. }
  32500. if (this.outputSize) {
  32501. params.outputSize = this.outputSize;
  32502. }
  32503. return Util.toJSON(params);
  32504. }
  32505. }
  32506. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  32507. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  32508. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32509. * This program are made available under the terms of the Apache License, Version 2.0
  32510. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32511. /**
  32512. * @class SuperMap.WebPrintingJobParameters
  32513. * @category iServer WebPrintingJob
  32514. * @version 10.1.0
  32515. * @classdesc Web 打印参数类
  32516. * @param {Object} options - 初始化参数。
  32517. * @param {SuperMap.WebPrintingJobContent} options.content - Web 打印的内容类。
  32518. * @param {SuperMap.WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  32519. * @param {SuperMap.WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  32520. */
  32521. class WebPrintingJobParameters {
  32522. constructor(options) {
  32523. if (!options) {
  32524. return;
  32525. }
  32526. /**
  32527. * @member {SuperMap.WebPrintingJobContent} SuperMap.WebPrintingJobParameters.prototype.content
  32528. * @description Web 打印的内容类。
  32529. */
  32530. this.content = null;
  32531. /**
  32532. * @member {SuperMap.WebPrintingJobLayoutOptions} SuperMap.WebPrintingJobParameters.prototype.layoutOptions
  32533. * @description Web 打印的布局类,包含各种布局元素的设置。
  32534. */
  32535. this.layoutOptions = null;
  32536. /**
  32537. * @member {SuperMap.WebPrintingJobExportOptions} SuperMap.WebPrintingJobParameters.prototype.exportOptions
  32538. * @description Web 打印的输出类,包含 DPI、页面大小等。
  32539. */
  32540. this.exportOptions = null;
  32541. Util.extend(this, options);
  32542. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  32543. }
  32544. /**
  32545. * @function SuperMap.WebPrintingJobParameters.prototype.destroy
  32546. * @description 释放资源,将引用资源的属性置空。
  32547. */
  32548. destroy() {
  32549. if (this.content instanceof WebPrintingJobContent) {
  32550. this.content.destroy();
  32551. this.content = null;
  32552. }
  32553. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  32554. this.layoutOptions.destroy();
  32555. this.layoutOptions = null;
  32556. }
  32557. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  32558. this.exportOptions.destroy();
  32559. this.exportOptions = null;
  32560. }
  32561. }
  32562. }
  32563. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  32564. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  32565. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32566. * This program are made available under the terms of the Apache License, Version 2.0
  32567. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32568. /**
  32569. * @class SuperMap.WebPrintingService
  32570. * @category iServer WebPrintingJob
  32571. * @version 10.1.0
  32572. * @classdesc 打印地图服务基类。
  32573. * @extends {SuperMap.CommonServiceBase}
  32574. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  32575. * @param {Object} options - 参数。
  32576. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  32577. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32578. * @param {Object} [options.headers] - 请求头。
  32579. */
  32580. class WebPrintingService extends CommonServiceBase {
  32581. /**
  32582. * @function SuperMap.WebPrintingService.prototype.constructor
  32583. * @description 打印地图服务基类。
  32584. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  32585. * @param {Object} options -参数。
  32586. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32587. */
  32588. constructor(url, options) {
  32589. super(url, options);
  32590. if (options) {
  32591. Util.extend(this, options);
  32592. }
  32593. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  32594. if (!this.url) {
  32595. return;
  32596. }
  32597. }
  32598. /**
  32599. * @function SuperMap.WebPrintingService.prototype.destroy
  32600. * @description 释放资源,将引用资源的属性置空。
  32601. */
  32602. destroy() {
  32603. super.destroy();
  32604. }
  32605. /**
  32606. * @function SuperMap.WebPrintingService.prototype.createWebPrintingJob
  32607. * @description 创建 Web 打印任务。
  32608. * @param {SuperMap.WebPrintingJobParameters} params - Web 打印的请求参数。
  32609. */
  32610. createWebPrintingJob(params) {
  32611. if (!params) {
  32612. return;
  32613. }
  32614. if (params.layoutOptions) {
  32615. if (params.layoutOptions.legendOptions) {
  32616. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  32617. params.layoutOptions.legendOptions.picAsBase64 =
  32618. params.layoutOptions.legendOptions.picAsBase64 &&
  32619. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  32620. if (
  32621. params.layoutOptions.legendOptions.customItems &&
  32622. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  32623. ) {
  32624. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  32625. /^data:.+;base64,/,
  32626. ''
  32627. );
  32628. }
  32629. }
  32630. }
  32631. var me = this;
  32632. me.request({
  32633. url: me._processUrl('jobs'),
  32634. method: 'POST',
  32635. data: Util.toJSON(params),
  32636. scope: me,
  32637. success: me.serviceProcessCompleted,
  32638. failure: me.serviceProcessFailed
  32639. });
  32640. }
  32641. /**
  32642. * @function SuperMap.WebPrintingService.prototype.getPrintingJob
  32643. * @description 获取 Web 打印输出文档任务。
  32644. * @param {String} jobId - Web 打印任务 ID
  32645. */
  32646. getPrintingJob(jobId) {
  32647. var me = this;
  32648. var url = me._processUrl(`jobs/${jobId}`);
  32649. me.request({
  32650. url,
  32651. method: 'GET',
  32652. scope: me,
  32653. success: function (result) {
  32654. me.rollingProcess(result, url);
  32655. },
  32656. failure: me.serviceProcessFailed
  32657. });
  32658. }
  32659. /**
  32660. * @function SuperMap.WebPrintingService.prototype.getPrintingJobResult
  32661. * @description 获取 Web 打印任务的输出文档。
  32662. * @param {String} jobId - Web 打印输入文档任务 ID。
  32663. */
  32664. getPrintingJobResult(jobId) {
  32665. var me = this;
  32666. me.request({
  32667. url: me._processUrl(`jobs/${jobId}/result`),
  32668. method: 'GET',
  32669. scope: me,
  32670. success: me.serviceProcessCompleted,
  32671. failure: me.serviceProcessFailed
  32672. });
  32673. }
  32674. /**
  32675. * @function SuperMap.WebPrintingService.prototype.getLayoutTemplates
  32676. * @description 查询 Web 打印服务所有可用的模板信息。
  32677. */
  32678. getLayoutTemplates() {
  32679. var me = this;
  32680. me.request({
  32681. url: me._processUrl('layouts'),
  32682. method: 'GET',
  32683. scope: me,
  32684. success: me.serviceProcessCompleted,
  32685. failure: me.serviceProcessFailed
  32686. });
  32687. }
  32688. /**
  32689. * @function SuperMap.WebPrintingService.prototype.rollingProcess
  32690. * @description 轮询查询 Web 打印任务。
  32691. * @param {Object} result - 服务器返回的结果对象。
  32692. */
  32693. rollingProcess(result, url) {
  32694. var me = this;
  32695. if (!result) {
  32696. return;
  32697. }
  32698. var id = setInterval(function () {
  32699. me.request({
  32700. url,
  32701. method: 'GET',
  32702. scope: me,
  32703. success: function (result) {
  32704. switch (result.status) {
  32705. case 'FINISHED':
  32706. clearInterval(id);
  32707. me.serviceProcessCompleted(result);
  32708. break;
  32709. case 'ERROR':
  32710. clearInterval(id);
  32711. me.serviceProcessFailed(result);
  32712. break;
  32713. case 'RUNNING':
  32714. me.events.triggerEvent('processRunning', result);
  32715. break;
  32716. }
  32717. },
  32718. failure: me.serviceProcessFailed
  32719. });
  32720. }, 1000);
  32721. }
  32722. _processUrl(appendContent) {
  32723. if (appendContent) {
  32724. return Util.urlPathAppend(this.url, appendContent);
  32725. }
  32726. return this.url;
  32727. }
  32728. }
  32729. SuperMap.WebPrintingService = WebPrintingService;
  32730. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  32731. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32732. * This program are made available under the terms of the Apache License, Version 2.0
  32733. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32734. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  32735. /* Copyright© 2000 - 2021 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. * @enum ServiceStatus
  32740. * @memberOf SuperMap
  32741. * @category iPortal/Online
  32742. * @description 服务发布状态。
  32743. */
  32744. var ServiceStatus = SuperMap.ServiceStatus = {
  32745. /** 不涉及,不可发布。 */
  32746. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  32747. /** 发布失败。 */
  32748. PUBLISH_FAILED: "PUBLISH_FAILED",
  32749. /** 已发布。 */
  32750. PUBLISHED: "PUBLISHED",
  32751. /** 正在发布。 */
  32752. PUBLISHING: "PUBLISHING",
  32753. /** 未发布。 */
  32754. UNPUBLISHED: "UNPUBLISHED",
  32755. /** 取消服务失败。 */
  32756. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  32757. };
  32758. /**
  32759. *
  32760. * @enum DataItemType
  32761. * @memberOf SuperMap
  32762. * @category iPortal/Online
  32763. * @description 数据项类型。
  32764. */
  32765. var OnlineResources_DataItemType = SuperMap.DataItemType = {
  32766. /** AUDIO */
  32767. AUDIO: "AUDIO",
  32768. /** COLOR */
  32769. COLOR: "COLOR",
  32770. /** COLORSCHEME */
  32771. COLORSCHEME: "COLORSCHEME",
  32772. /** CSV */
  32773. CSV: "CSV",
  32774. /** EXCEL */
  32775. EXCEL: "EXCEL",
  32776. /** FILLSYMBOL */
  32777. FILLSYMBOL: "FILLSYMBOL",
  32778. /** IMAGE */
  32779. IMAGE: "IMAGE",
  32780. /** LAYERTEMPLATE */
  32781. LAYERTEMPLATE: "LAYERTEMPLATE",
  32782. /** LAYOUTTEMPLATE */
  32783. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  32784. /** LINESYMBOL */
  32785. LINESYMBOL: "LINESYMBOL",
  32786. /** MAPTEMPLATE */
  32787. MAPTEMPLATE: "MAPTEMPLATE",
  32788. /** MARKERSYMBOL */
  32789. MARKERSYMBOL: "MARKERSYMBOL",
  32790. /** MBTILES */
  32791. MBTILES: "MBTILES",
  32792. /** PHOTOS */
  32793. PHOTOS: "PHOTOS",
  32794. /** SHP */
  32795. SHP: "SHP",
  32796. /** SMTILES */
  32797. SMTILES: "SMTILES",
  32798. /** SVTILES */
  32799. SVTILES: "SVTILES",
  32800. /** THEMETEMPLATE */
  32801. THEMETEMPLATE: "THEMETEMPLATE",
  32802. /** TPK */
  32803. TPK: "TPK",
  32804. /** UDB */
  32805. UDB: "UDB",
  32806. /** UGCV5 */
  32807. UGCV5: "UGCV5",
  32808. /** UNKNOWN */
  32809. UNKNOWN: "UNKNOWN",
  32810. /** VIDEO */
  32811. VIDEO: "VIDEO",
  32812. /** WORKENVIRONMENT */
  32813. WORKENVIRONMENT: "WORKENVIRONMENT",
  32814. /** WORKSPACE */
  32815. WORKSPACE: "WORKSPACE"
  32816. };
  32817. /**
  32818. * @enum DataItemOrderBy
  32819. * @memberOf SuperMap
  32820. * @category iPortal/Online
  32821. * @description 数据排序字段。
  32822. */
  32823. var DataItemOrderBy = SuperMap.DataItemOrderBy = {
  32824. /** FILENAME */
  32825. FILENAME: "FILENAME",
  32826. /** ID */
  32827. ID: "ID",
  32828. /** LASTMODIFIEDTIME */
  32829. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  32830. /** NICKNAME */
  32831. NICKNAME: "NICKNAME",
  32832. /** SERVICESTATUS */
  32833. SERVICESTATUS: "SERVICESTATUS",
  32834. /** SIZE */
  32835. SIZE: "SIZE",
  32836. /** STATUS */
  32837. STATUS: "STATUS",
  32838. /** TYPE */
  32839. TYPE: "TYPE",
  32840. /** UPDATETIME */
  32841. UPDATETIME: "UPDATETIME",
  32842. /** USERNAME */
  32843. USERNAME: "USERNAME"
  32844. };
  32845. /**
  32846. * @enum FilterField
  32847. * @memberOf SuperMap
  32848. * @category iPortal/Online
  32849. * @description 关键字查询时的过滤字段。
  32850. */
  32851. var FilterField = SuperMap.FilterField = {
  32852. /** LINKPAGE */
  32853. LINKPAGE: "LINKPAGE",
  32854. /** LINKPAGE */
  32855. MAPTITLE: "MAPTITLE",
  32856. /** LINKPAGE */
  32857. NICKNAME: "NICKNAME",
  32858. /** LINKPAGE */
  32859. RESTITLE: "RESTITLE",
  32860. /** LINKPAGE */
  32861. USERNAME: "USERNAME"
  32862. };
  32863. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  32864. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32865. * This program are made available under the terms of the Apache License, Version 2.0
  32866. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32867. // import {SecurityManager} from '../security/SecurityManager';
  32868. /**
  32869. * @class SuperMap.OnlineServiceBase
  32870. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  32871. * @category iPortal/Online
  32872. * @param {Object} options - 服务参数。
  32873. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32874. * @param {Object} [options.headers] - 请求头。
  32875. */
  32876. class OnlineServiceBase {
  32877. constructor(options) {
  32878. options = options || {};
  32879. Util.extend(this, options);
  32880. this.serverType = ServerType.ONLINE;
  32881. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  32882. }
  32883. /**
  32884. * @function SuperMap.OnlineServiceBase.prototype.request
  32885. * @description 请求 online 服务
  32886. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  32887. * @param {string} url - 服务地址。
  32888. * @param {Object} param - URL 查询参数。
  32889. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  32890. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  32891. */
  32892. request(method, url, param, requestOptions = {}) {
  32893. url = this.createCredentialUrl(url);
  32894. requestOptions['crossOrigin'] = this.options.crossOrigin;
  32895. requestOptions['headers'] = this.options.headers;
  32896. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  32897. return response.json();
  32898. });
  32899. }
  32900. /**
  32901. * @function SuperMap.OnlineServiceBase.prototype.createCredentialUrl
  32902. * @description 追加授权信息。
  32903. * @param {string} url - 对接的 online 服务地址。
  32904. */
  32905. createCredentialUrl(url) {
  32906. var newUrl = url,
  32907. key = this.getCredential();
  32908. if (key) {
  32909. var paramStr = "key=" + key;
  32910. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  32911. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  32912. newUrl += paramStr;
  32913. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  32914. newUrl += "&" + paramStr;
  32915. } else {
  32916. newUrl += "?" + paramStr;
  32917. }
  32918. }
  32919. return newUrl;
  32920. }
  32921. //其子类需要重写该方法,修改其中获取key的字段
  32922. //存储key可能是服务id字段,可能是url,或者是WebAPI类型
  32923. getCredential() {
  32924. //return SecurityManager.getKey(this.id);
  32925. //或
  32926. //return SecurityManager.getKey(this.serviceUrl);
  32927. }
  32928. }
  32929. SuperMap.OnlineServiceBase = OnlineServiceBase;
  32930. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  32931. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32932. * This program are made available under the terms of the Apache License, Version 2.0
  32933. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32934. /**
  32935. * @class SuperMap.OnlineData
  32936. * @classdesc Online myData 服务。
  32937. * @category iPortal/Online
  32938. * @param {string} serviceRootUrl - 服务根地址。
  32939. * @param {Object} options - 服务相关参数。
  32940. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32941. * @param {Object} [options.headers] - 请求头。
  32942. */
  32943. class OnlineData extends OnlineServiceBase {
  32944. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  32945. constructor(serviceRootUrl, options) {
  32946. super(serviceRootUrl);
  32947. options = options || {};
  32948. //MD5
  32949. this.MD5 = null;
  32950. //文件类型。
  32951. this.type = null;
  32952. //数据上传者名称。
  32953. this.userName = null;
  32954. //文件名称。
  32955. this.fileName = null;
  32956. //文件大小,单位为 B 。
  32957. this.size = null;
  32958. //服务发布状态。
  32959. this.serviceStatus = null;
  32960. //服务 id 。
  32961. this.serviceId = null;
  32962. //数据项 id 。
  32963. this.id = null;
  32964. //最后修改时间。
  32965. this.lastModfiedTime = null;
  32966. //文件状态。
  32967. this.status = null;
  32968. //数据文件存储 id 。
  32969. this.storageId = null;
  32970. //数据的发布信息。
  32971. this.publishInfo = null;
  32972. //数据的权限信息。
  32973. this.authorizeSetting = null;
  32974. //用户的昵称。
  32975. this.nickname = null;
  32976. //数据的标签。
  32977. this.tags = [];
  32978. //数据的描述信息。
  32979. this.description = null;
  32980. //数据发布的服务信息集合。
  32981. this.dataItemServices = null;
  32982. //数据坐标类型。
  32983. this.coordType = null;
  32984. //数据审核信息
  32985. this.dataCheckResult = null;
  32986. //数据元数据信息
  32987. this.dataMetaInfo = null;
  32988. //数据的缩略图路径。
  32989. this.thumbnail = null;
  32990. Util.extend(this, options);
  32991. if (this.id) {
  32992. this.serviceUrl = serviceRootUrl + "/" + this.id;
  32993. }
  32994. this.CLASS_NAME = "SuperMap.OnlineData";
  32995. }
  32996. /**
  32997. * @function SuperMap.OnlineData.prototype.load
  32998. * @description 通过 URL 请求获取该服务完整信息。
  32999. * @returns {Promise} 返回不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  33000. */
  33001. load() {
  33002. if (!this.serviceUrl) {
  33003. return;
  33004. }
  33005. var me = this;
  33006. return me.request("GET", this.serviceUrl).then(function (result) {
  33007. Util.extend(me, result);
  33008. });
  33009. }
  33010. /**
  33011. * @function SuperMap.OnlineData.prototype.getPublishedServices
  33012. * @description 获取数据发布的所有服务。
  33013. * @returns {Object} 数据发布的所有服务。
  33014. */
  33015. getPublishedServices() {
  33016. return this.dataItemServices;
  33017. }
  33018. /**
  33019. * @function SuperMap.OnlineData.prototype.getAuthorizeSetting
  33020. * @description 获取数据的权限信息。
  33021. * @returns {Object} 权限信息。
  33022. */
  33023. getAuthorizeSetting() {
  33024. return this.authorizeSetting;
  33025. }
  33026. }
  33027. SuperMap.OnlineData = OnlineData;
  33028. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  33029. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33030. * This program are made available under the terms of the Apache License, Version 2.0
  33031. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33032. /**
  33033. * @class SuperMap.Online
  33034. * @classdesc 对接 SuperMap Online 所有基础服务。
  33035. * @category iPortal/Online
  33036. * @example
  33037. * var online=new SuperMap.Online();
  33038. * var services = online.queryDatas(param);
  33039. * service.then(function(services){
  33040. * var service= services[0];
  33041. * service.updateDataInfo();
  33042. * })
  33043. */
  33044. class Online {
  33045. //TODO 目前并没有对接Online的所有操作,需要补充完整
  33046. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  33047. constructor() {
  33048. this.rootUrl = "https://www.supermapol.com";
  33049. this.webUrl = this.rootUrl + "/web";
  33050. var mContentUrl = this.webUrl + "/mycontent";
  33051. this.mDatasUrl = mContentUrl + "/datas";
  33052. this.CLASS_NAME = "SuperMap.Online";
  33053. }
  33054. /**
  33055. * @function SuperMap.Online.prototype.load
  33056. * @description 加载 online,验证 online 是否可用。
  33057. * @returns {Promise} 返回包含网络请求结果的 Promise 对象。
  33058. */
  33059. load() {
  33060. return FetchRequest.get(this.rootUrl).then(function (response) {
  33061. return response;
  33062. });
  33063. }
  33064. /**
  33065. * @function SuperMap.Online.prototype.login
  33066. * @description 登录Online
  33067. */
  33068. login() {
  33069. SecurityManager.loginOnline(this.rootUrl, true);
  33070. }
  33071. /**
  33072. * @function SuperMap.Online.prototype.queryDatas
  33073. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  33074. * @param {SuperMap.OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  33075. * @returns {Promise} 返回包含所有数据服务信息的 Promise 对象。
  33076. */
  33077. queryDatas(parameter) {
  33078. var me = this, url = me.mDatasUrl;
  33079. if (parameter) {
  33080. parameter = parameter.toJSON();
  33081. }
  33082. return FetchRequest.get(url, parameter).then(function (json) {
  33083. if (!json || !json.content || json.content.length < 1) {
  33084. return;
  33085. }
  33086. var services = [], contents = json.content, len = contents.length;
  33087. for (var i = 0; i < len; i++) {
  33088. var content = contents[i];
  33089. var service = new OnlineData(me.mDatasUrl, content);
  33090. services.push(service);
  33091. }
  33092. return services;
  33093. });
  33094. }
  33095. }
  33096. SuperMap.Online = Online;
  33097. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  33098. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33099. * This program are made available under the terms of the Apache License, Version 2.0
  33100. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33101. /**
  33102. * @class SuperMap.OnlineQueryDatasParameter
  33103. * @classdesc myDatas 服务资源查询参数。
  33104. * @category iPortal/Online
  33105. * @param {Object} options - 查询参数。
  33106. */
  33107. class OnlineQueryDatasParameter {
  33108. constructor(options) {
  33109. options = options || {};
  33110. /**
  33111. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.userNames
  33112. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  33113. */
  33114. this.userNames = null;
  33115. /**
  33116. * @member {Array.<Object>} SuperMap.OnlineQueryDatasParameter.prototype.types
  33117. * @description 数据类型。
  33118. */
  33119. this.types = null;
  33120. /**
  33121. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.fileName
  33122. * @description 文件名称。
  33123. */
  33124. this.fileName = null;
  33125. /**
  33126. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceStatuses
  33127. * @description 服务发布状态。
  33128. */
  33129. this.serviceStatuses = null;
  33130. /**
  33131. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceId
  33132. * @description 服务 ID。
  33133. */
  33134. this.serviceId = null;
  33135. /**
  33136. * @member {Array.<integer>} SuperMap.OnlineQueryDatasParameter.prototype.ids
  33137. * @description 由数据项 ID 组成的整型数组。
  33138. */
  33139. this.ids = null;
  33140. /**
  33141. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.keywords
  33142. * @description 关键字。
  33143. */
  33144. this.keywords = null;
  33145. /**
  33146. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.orderBy
  33147. * @description 排序字段。
  33148. */
  33149. this.orderBy = null;
  33150. /**
  33151. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.tags
  33152. * @description 数据的标签。
  33153. */
  33154. this.tags = null;
  33155. /**
  33156. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.filterFields
  33157. * @description 用于关键字查询时的过滤字段。
  33158. */
  33159. this.filterFields = null;
  33160. Util.extend(this, options)
  33161. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  33162. }
  33163. /**
  33164. * @function SuperMap.OnlineQueryDatasParameter.prototype.toJSON
  33165. * @description 返回对应的 JSON 对象。
  33166. * @returns {Object} 对应的 JSON 对象。
  33167. */
  33168. toJSON() {
  33169. var me = this;
  33170. var jsonObj = {
  33171. "types": me.types,
  33172. "fileName": me.fileName,
  33173. "serviceStatuses": me.serviceStatuses,
  33174. "serviceId": me.serviceId,
  33175. "ids": me.ids,
  33176. "keywords": me.keywords,
  33177. "orderBy": me.orderBy,
  33178. "tags": me.tags,
  33179. "filterFields": me.filterFields
  33180. };
  33181. for (var key in jsonObj) {
  33182. if (jsonObj[key] == null) {
  33183. delete jsonObj[key]
  33184. }
  33185. }
  33186. return jsonObj;
  33187. }
  33188. }
  33189. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  33190. ;// CONCATENATED MODULE: ./src/common/online/index.js
  33191. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33192. * This program are made available under the terms of the Apache License, Version 2.0
  33193. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33194. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  33195. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33196. * This program are made available under the terms of the Apache License, Version 2.0
  33197. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33198. /**
  33199. * @class SuperMap.KeyServiceParameter
  33200. * @classdesc key申请参数
  33201. * @category Security
  33202. * @param {Object} options - 参数。
  33203. * @param {string} options.name - 申请服务名称。
  33204. * @param {number} options.serviceIds - 服务 ID。
  33205. * @param {SuperMap.ClientType} [options.clientType=SuperMap.ClientType.SERVER] - 服务端类型。
  33206. * @param {number} options.limitation - 有效期
  33207. */
  33208. class KeyServiceParameter {
  33209. constructor(options) {
  33210. this.name = null;
  33211. this.serviceIds = null;
  33212. this.clientType = ClientType.SERVER;
  33213. this.limitation = null;
  33214. Util.extend(this, options);
  33215. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  33216. }
  33217. /**
  33218. * @function SuperMap.KeyServiceParameter.prototype.toJSON
  33219. * @description 转换成 JSON 对象
  33220. * @returns {Object} 参数的 JSON 对象
  33221. */
  33222. toJSON() {
  33223. return {
  33224. name: this.name,
  33225. serviceIds: this.serviceIds,
  33226. clientType: this.clientType,
  33227. limitation: this.limitation
  33228. }
  33229. }
  33230. }
  33231. SuperMap.KeyServiceParameter = KeyServiceParameter;
  33232. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  33233. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33234. * This program are made available under the terms of the Apache License, Version 2.0
  33235. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33236. /**
  33237. * @class SuperMap.ServerInfo
  33238. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等
  33239. * @category Security
  33240. * @param {string} type - 服务器类型
  33241. * @param {Object} options - 服务器信息相关可选参数。
  33242. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver
  33243. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  33244. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  33245. */
  33246. class ServerInfo {
  33247. constructor(type, options) {
  33248. /**
  33249. * @member {SuperMap.ServerType} SuperMap.ServerInfo.prototype.type
  33250. * @description 服务器类型
  33251. */
  33252. this.type = type;
  33253. /**
  33254. * @member {string} SuperMap.ServerInfo.prototype.server
  33255. * @description 服务器地址
  33256. */
  33257. this.server = null;
  33258. /**
  33259. * @member {string} [SuperMap.ServerInfo.prototype.tokenServiceUrl]
  33260. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  33261. */
  33262. this.tokenServiceUrl = null;
  33263. /**
  33264. * @member {string} [SuperMap.ServerInfo.prototype.keyServiceUrl]
  33265. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  33266. */
  33267. this.keyServiceUrl = null;
  33268. Util.extend(this, options);
  33269. this.CLASS_NAME = "SuperMap.ServerInfo";
  33270. this.type = this.type || ServerType.ISERVER;
  33271. if (!this.server) {
  33272. console.error('server url require is not undefined')
  33273. }
  33274. // var patten = /http:\/\/([^\/]+)/i;
  33275. //this.server = this.server.match(patten)[0];
  33276. var tokenServiceSuffix = "/services/security/tokens";
  33277. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  33278. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  33279. }
  33280. if (!this.tokenServiceUrl) {
  33281. this.tokenServiceUrl = Util.urlPathAppend(this.server, tokenServiceSuffix);
  33282. }
  33283. if (!this.keyServiceUrl) {
  33284. if (this.type === ServerType.IPORTAL) {
  33285. this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  33286. } else if (this.type === ServerType.ONLINE) {
  33287. this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys");
  33288. }
  33289. }
  33290. }
  33291. }
  33292. SuperMap.ServerInfo = ServerInfo;
  33293. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  33294. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33295. * This program are made available under the terms of the Apache License, Version 2.0
  33296. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33297. /**
  33298. * @class SuperMap.TokenServiceParameter
  33299. * @classdesc token 申请参数。
  33300. * @category Security
  33301. * @param {Object} options - token 申请参数。
  33302. * @param {string} options.username - 用户名。
  33303. * @param {string} options.password - 密码。
  33304. * @param {SuperMap.ClientType} [options.clientType='SuperMap.ClientType.NONE'] - token 申请的客户端标识类型。
  33305. * @param {string} [options.ip] - clientType=IP 时,必选。
  33306. * @param {string} [options.referer] -clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  33307. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  33308. *
  33309. *
  33310. */
  33311. class TokenServiceParameter {
  33312. constructor(options) {
  33313. /**
  33314. * @member {string} SuperMap.TokenServiceParameter.prototype.userName
  33315. * @description 用户名。
  33316. */
  33317. this.userName = null;
  33318. /**
  33319. * @member {string} SuperMap.TokenServiceParameter.prototype.password
  33320. * @description 密码。
  33321. */
  33322. this.password = null;
  33323. /**
  33324. * @member {SuperMap.ClientType} SuperMap.TokenServiceParameter.prototype.clientType
  33325. * @description token 申请的客户端标识类型。
  33326. */
  33327. this.clientType = ClientType.NONE;
  33328. /**
  33329. * @member {string} [SuperMap.TokenServiceParameter.prototype.ip]
  33330. * @description clientType=IP 时,必选。
  33331. */
  33332. this.ip = null;
  33333. /**
  33334. * @member {string} [SuperMap.TokenServiceParameter.prototype.referer]
  33335. * @description clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  33336. */
  33337. this.referer = null;
  33338. /**
  33339. * @member {number} SuperMap.TokenServiceParameter.prototype.expiration
  33340. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  33341. */
  33342. this.expiration = 60;
  33343. Util.extend(this, options);
  33344. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  33345. }
  33346. /**
  33347. * @function SuperMap.TokenServiceParameter.prototype.toJSON
  33348. * @description 将所有信息转成 JSON 字符串
  33349. * @returns {string} 参数的 JSON 字符串
  33350. */
  33351. toJSON() {
  33352. return {
  33353. userName: this.userName,
  33354. password: this.password,
  33355. clientType: this.clientType,
  33356. ip: this.ip,
  33357. referer: this.referer,
  33358. expiration: this.expiration
  33359. }
  33360. }
  33361. }
  33362. SuperMap.TokenServiceParameter = TokenServiceParameter;
  33363. ;// CONCATENATED MODULE: ./src/common/security/index.js
  33364. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33365. * This program are made available under the terms of the Apache License, Version 2.0
  33366. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33367. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  33368. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  33369. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  33370. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  33371. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33372. * This program are made available under the terms of the Apache License, Version 2.0
  33373. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33374. /**
  33375. * @class SuperMap.ElasticSearch
  33376. * @classdesc ElasticSearch服务类。
  33377. * @category ElasticSearch
  33378. * @param {string} url - ElasticSearch服务地址。
  33379. * @param {Object} options - 参数。
  33380. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  33381. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  33382. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  33383. * @param {Object} [options.geoFence] - 地理围栏。
  33384. */
  33385. class ElasticSearch {
  33386. constructor(url, options) {
  33387. options = options || {};
  33388. /**
  33389. * @member {string} SuperMap.ElasticSearch.prototype.url
  33390. * @description ElasticSearch服务地址
  33391. */
  33392. this.url = url;
  33393. /**
  33394. * @member {Object} SuperMap.ElasticSearch.prototype.client
  33395. * @description client ES客户端
  33396. */
  33397. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  33398. host: this.url
  33399. });
  33400. /**
  33401. * @deprecated
  33402. * @member {function} [SuperMap.ElasticSearch.prototype.change]
  33403. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  33404. */
  33405. this.change = null;
  33406. /**
  33407. * @member {boolean} [SuperMap.ElasticSearch.prototype.openGeoFence=false]
  33408. * @description 是否开启地理围栏验证,默认为不开启。
  33409. */
  33410. this.openGeoFence = false;
  33411. /**
  33412. * @member {function} [SuperMap.ElasticSearch.prototype.outOfGeoFence]
  33413. * @description 数据超出地理围栏后执行的函数
  33414. */
  33415. this.outOfGeoFence = null;
  33416. /**
  33417. * @member {Object} [SuperMap.ElasticSearch.prototype.geoFence]
  33418. * @description 地理围栏
  33419. * @example {
  33420. * radius: 1000,//单位是m
  33421. * center: [104.40, 30.43],
  33422. * unit: 'meter|degree'
  33423. * }
  33424. */
  33425. this.geoFence = null;
  33426. /*
  33427. * Constant: EVENT_TYPES
  33428. * {Array.<String>}
  33429. * 此类支持的事件类型。
  33430. *
  33431. */
  33432. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  33433. /**
  33434. * @member {SuperMap.Events} SuperMap.ElasticSearch.prototype.events
  33435. * @description 事件
  33436. */
  33437. this.events = new Events(this, null, this.EVENT_TYPES);
  33438. /**
  33439. * @member {Object} SuperMap.ElasticSearch.prototype.eventListeners
  33440. * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  33441. * 相当于调用 SuperMap.Events.on(eventListeners)。
  33442. */
  33443. this.eventListeners = null;
  33444. Util.extend(this, options);
  33445. if (this.eventListeners instanceof Object) {
  33446. this.events.on(this.eventListeners);
  33447. }
  33448. }
  33449. /**
  33450. * @function SuperMap.ElasticSearch.prototype.setGeoFence
  33451. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  33452. * @param {SuperMap.Geometry} geoFence - 地理围栏。
  33453. */
  33454. setGeoFence(geoFence) {
  33455. this.geoFence = geoFence;
  33456. }
  33457. /**
  33458. * @function SuperMap.ElasticSearch.prototype.bulk
  33459. * @description 批量操作API,允许执行多个索引/删除操作。
  33460. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  33461. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  33462. * @param {Object} params - 参数。
  33463. * @param {function} callback - 回调函数。
  33464. */
  33465. bulk(params, callback) {
  33466. return this.client.bulk(params, callback);
  33467. }
  33468. /**
  33469. * @function SuperMap.ElasticSearch.prototype.clearScroll
  33470. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  33471. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  33472. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  33473. * @param {Object} params - 参数。
  33474. * @param {function} callback - 回调函数。
  33475. */
  33476. clearScroll(params, callback) {
  33477. return this.client.clearScroll(params, callback);
  33478. }
  33479. /**
  33480. * @function SuperMap.ElasticSearch.prototype.count
  33481. * @description 获取集群、索引、类型或查询的文档个数。
  33482. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  33483. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  33484. * @param {Object} params - 参数。
  33485. * @param {function} callback - 回调函数。
  33486. */
  33487. count(params, callback) {
  33488. return this.client.count(params, callback);
  33489. }
  33490. /**
  33491. * @function SuperMap.ElasticSearch.prototype.count
  33492. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
  33493. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  33494. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  33495. * @param {Object} params - 参数。
  33496. * @param {function} callback - 回调函数。
  33497. */
  33498. create(params, callback) {
  33499. return this.client.create(params, callback);
  33500. }
  33501. /**
  33502. * @function SuperMap.ElasticSearch.prototype.delete
  33503. * @description 根据其ID从特定索引中删除键入的JSON文档。
  33504. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  33505. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  33506. * @param {Object} params - 参数。
  33507. * @param {function} callback - 回调函数。
  33508. */
  33509. delete(params, callback) {
  33510. return this.client.delete(params, callback);
  33511. }
  33512. /**
  33513. * @function SuperMap.ElasticSearch.prototype.delete
  33514. * @description 根据其ID从特定索引中删除键入的JSON文档。
  33515. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  33516. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  33517. * @param {Object} params - 参数。
  33518. * @param {function} callback - 回调函数。
  33519. */
  33520. deleteByQuery(params, callback) {
  33521. return this.client.deleteByQuery(params, callback);
  33522. }
  33523. /**
  33524. * @function SuperMap.ElasticSearch.prototype.delete
  33525. * @description 根据其ID删除脚本。</br>
  33526. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  33527. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  33528. * @param {Object} params - 参数。
  33529. * @param {function} callback - 回调函数。
  33530. */
  33531. deleteScript(params, callback) {
  33532. return this.client.deleteScript(params, callback);
  33533. }
  33534. /**
  33535. * @function SuperMap.ElasticSearch.prototype.deleteTemplate
  33536. * @description 根据其ID删除模板。</br>
  33537. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  33538. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  33539. * @param {Object} params - 参数。
  33540. * @param {function} callback - 回调函数。
  33541. */
  33542. deleteTemplate(params, callback) {
  33543. return this.client.deleteTemplate(params, callback);
  33544. }
  33545. /**
  33546. * @function SuperMap.ElasticSearch.prototype.exists
  33547. * @description 检查给定文档是否存在。</br>
  33548. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  33549. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  33550. * @param {Object} params - 参数。
  33551. * @param {function} callback - 回调函数。
  33552. */
  33553. exists(params, callback) {
  33554. return this.client.exists(params, callback);
  33555. }
  33556. /**
  33557. * @function SuperMap.ElasticSearch.prototype.existsSource
  33558. * @description 检查资源是否存在。</br>
  33559. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  33560. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  33561. * @param {Object} params - 参数。
  33562. * @param {function} callback - 回调函数。
  33563. */
  33564. existsSource(params, callback) {
  33565. return this.client.existsSource(params, callback);
  33566. }
  33567. /**
  33568. * @function SuperMap.ElasticSearch.prototype.explain
  33569. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  33570. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  33571. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  33572. * @param {Object} params - 参数。
  33573. * @param {function} callback - 回调函数。
  33574. */
  33575. explain(params, callback) {
  33576. return this.client.explain(params, callback);
  33577. }
  33578. /**
  33579. * @function SuperMap.ElasticSearch.prototype.fieldCaps
  33580. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  33581. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  33582. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  33583. * @param {Object} params - 参数。
  33584. * @param {function} callback - 回调函数。
  33585. */
  33586. fieldCaps(params, callback) {
  33587. return this.client.fieldCaps(params, callback);
  33588. }
  33589. /**
  33590. * @function SuperMap.ElasticSearch.prototype.get
  33591. * @description 从索引获取一个基于其id的类型的JSON文档。</br>
  33592. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  33593. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  33594. * @param {Object} params - 参数。
  33595. * @param {function} callback - 回调函数。
  33596. */
  33597. get(params, callback) {
  33598. return this.client.get(params, callback);
  33599. }
  33600. /**
  33601. * @function SuperMap.ElasticSearch.prototype.getScript
  33602. * @description 获取脚本。</br>
  33603. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  33604. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  33605. * @param {Object} params - 参数。
  33606. * @param {function} callback - 回调函数。
  33607. */
  33608. getScript(params, callback) {
  33609. return this.client.getScript(params, callback);
  33610. }
  33611. /**
  33612. * @function SuperMap.ElasticSearch.prototype.getSource
  33613. * @description 通过索引,类型和ID获取文档的源。</br>
  33614. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  33615. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  33616. * @param {Object} params - 参数。
  33617. * @param {function} callback - 回调函数。
  33618. */
  33619. getSource(params, callback) {
  33620. return this.client.getSource(params, callback);
  33621. }
  33622. /**
  33623. * @function SuperMap.ElasticSearch.prototype.getTemplate
  33624. * @description 获取模板。</br>
  33625. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  33626. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  33627. * @param {Object} params - 参数。
  33628. * @param {function} callback - 回调函数。
  33629. */
  33630. getTemplate(params, callback) {
  33631. return this.client.getTemplate(params, callback);
  33632. }
  33633. /**
  33634. * @function SuperMap.ElasticSearch.prototype.index
  33635. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  33636. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  33637. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  33638. * @param {Object} params - 参数。
  33639. * @param {function} callback - 回调函数。
  33640. */
  33641. index(params, callback) {
  33642. return this.client.index(params, callback);
  33643. }
  33644. /**
  33645. * @function SuperMap.ElasticSearch.prototype.info
  33646. * @description 从当前集群获取基本信息。</br>
  33647. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  33648. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  33649. * @param {Object} params - 参数。
  33650. * @param {function} callback - 回调函数。
  33651. */
  33652. info(params, callback) {
  33653. return this.client.info(params, callback);
  33654. }
  33655. /**
  33656. * @function SuperMap.ElasticSearch.prototype.mget
  33657. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  33658. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  33659. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  33660. * @param {Object} params - 参数。
  33661. * @param {function} callback - 回调函数。
  33662. */
  33663. mget(params, callback) {
  33664. return this.client.mget(params, callback);
  33665. }
  33666. /**
  33667. * @function SuperMap.ElasticSearch.prototype.msearch
  33668. * @description 在同一请求中执行多个搜索请求。</br>
  33669. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  33670. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  33671. * @param {Object} params - 参数。
  33672. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  33673. * 回调参数:error,response。结果存储在response.responses中
  33674. */
  33675. msearch(params, callback) {
  33676. let me = this;
  33677. return me.client.msearch(params)
  33678. .then(function (resp) {
  33679. me._update(resp.responses, callback);
  33680. return resp;
  33681. }, function (err) {
  33682. callback(err);
  33683. me.events.triggerEvent('error', {error: err});
  33684. return err;
  33685. });
  33686. }
  33687. /**
  33688. * @function SuperMap.ElasticSearch.prototype.msearchTemplate
  33689. * @description 在同一请求中执行多个搜索模板请求。</br>
  33690. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  33691. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  33692. * @param {Object} params - 参数。
  33693. * @param {function} callback - 回调函数。
  33694. */
  33695. msearchTemplate(params, callback) {
  33696. return this.client.msearchTemplate(params, callback);
  33697. }
  33698. /**
  33699. * @function SuperMap.ElasticSearch.prototype.mtermvectors
  33700. * @description 多termvectors API允许一次获得多个termvectors。</br>
  33701. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  33702. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  33703. * @param {Object} params - 参数。
  33704. * @param {function} callback - 回调函数。
  33705. */
  33706. mtermvectors(params, callback) {
  33707. return this.client.mtermvectors(params, callback);
  33708. }
  33709. /**
  33710. * @function SuperMap.ElasticSearch.prototype.ping
  33711. * @description 测试连接。</br>
  33712. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  33713. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  33714. * @param {Object} params - 参数。
  33715. * @param {function} callback - 回调函数。
  33716. */
  33717. ping(params, callback) {
  33718. return this.client.ping(params, callback);
  33719. }
  33720. /**
  33721. * @function SuperMap.ElasticSearch.prototype.putScript
  33722. * @description 添加脚本。</br>
  33723. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  33724. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  33725. * @param {Object} params - 参数。
  33726. * @param {function} callback - 回调函数。
  33727. */
  33728. putScript(params, callback) {
  33729. return this.client.putScript(params, callback);
  33730. }
  33731. /**
  33732. * @function SuperMap.ElasticSearch.prototype.putTemplate
  33733. * @description 添加模板。</br>
  33734. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  33735. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  33736. * @param {Object} params - 参数。
  33737. * @param {function} callback - 回调函数。
  33738. */
  33739. putTemplate(params, callback) {
  33740. return this.client.putTemplate(params, callback);
  33741. }
  33742. /**
  33743. * @function SuperMap.ElasticSearch.prototype.reindex
  33744. * @description 重新索引。</br>
  33745. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  33746. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  33747. * @param {Object} params - 参数。
  33748. * @param {function} callback - 回调函数。
  33749. */
  33750. reindex(params, callback) {
  33751. return this.client.reindex(params, callback);
  33752. }
  33753. /**
  33754. * @function SuperMap.ElasticSearch.prototype.reindexRessrottle
  33755. * @description 重新索引。</br>
  33756. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  33757. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  33758. * @param {Object} params - 参数。
  33759. * @param {function} callback - 回调函数。
  33760. */
  33761. reindexRessrottle(params, callback) {
  33762. return this.client.reindexRessrottle(params, callback);
  33763. }
  33764. /**
  33765. * @function SuperMap.ElasticSearch.prototype.renderSearchTemplate
  33766. * @description 搜索模板。</br>
  33767. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  33768. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  33769. * @param {Object} params - 参数。
  33770. * @param {function} callback - 回调函数。
  33771. */
  33772. renderSearchTemplate(params, callback) {
  33773. return this.client.renderSearchTemplate(params, callback);
  33774. }
  33775. /**
  33776. * @function SuperMap.ElasticSearch.prototype.scroll
  33777. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  33778. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  33779. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  33780. * @param {Object} params - 参数。
  33781. * @param {function} callback - 回调函数。
  33782. */
  33783. scroll(params, callback) {
  33784. return this.client.scroll(params, callback);
  33785. }
  33786. /**
  33787. * @function SuperMap.ElasticSearch.prototype.search
  33788. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  33789. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  33790. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  33791. * @param {Object} params - 参数。
  33792. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  33793. * 回调参数:error,response,结果存储在response.responses中
  33794. */
  33795. search(params, callback) {
  33796. let me = this;
  33797. return me.client.search(params)
  33798. .then(function (resp) {
  33799. me._update(resp.responses, callback);
  33800. return resp;
  33801. }, function (err) {
  33802. callback(err);
  33803. me.events.triggerEvent('error', {error: err});
  33804. return err;
  33805. });
  33806. }
  33807. /**
  33808. * @function SuperMap.ElasticSearch.prototype.searchShards
  33809. * @description 返回要执行搜索请求的索引和分片。
  33810. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  33811. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  33812. * @param {Object} params - 参数。
  33813. * @param {function} callback - 回调函数。
  33814. */
  33815. searchShards(params, callback) {
  33816. return this.client.searchShards(params, callback);
  33817. }
  33818. /**
  33819. * @function SuperMap.ElasticSearch.prototype.searchTemplate
  33820. * @description 搜索模板。
  33821. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  33822. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  33823. * @param {Object} params - 参数。
  33824. * @param {function} callback - 回调函数。
  33825. */
  33826. searchTemplate(params, callback) {
  33827. return this.client.searchTemplate(params, callback);
  33828. }
  33829. /**
  33830. * @function SuperMap.ElasticSearch.prototype.suggest
  33831. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  33832. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  33833. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  33834. * @param {Object} params - 参数。
  33835. * @param {function} callback - 回调函数。
  33836. */
  33837. suggest(params, callback) {
  33838. return this.client.suggest(params, callback);
  33839. }
  33840. /**
  33841. * @function SuperMap.ElasticSearch.prototype.termvectors
  33842. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  33843. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  33844. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  33845. * @param {Object} params - 参数。
  33846. * @param {function} callback - 回调函数。
  33847. */
  33848. termvectors(params, callback) {
  33849. return this.client.termvectors(params, callback);
  33850. }
  33851. /**
  33852. * @function SuperMap.ElasticSearch.prototype.update
  33853. * @description 更新文档的部分。
  33854. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  33855. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  33856. * @param {Object} params - 参数。
  33857. * @param {function} callback - 回调函数。
  33858. */
  33859. update(params, callback) {
  33860. return this.client.update(params, callback);
  33861. }
  33862. /**
  33863. * @function SuperMap.ElasticSearch.prototype.update
  33864. * @description 通过查询API来更新文档。
  33865. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  33866. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  33867. * @param {Object} params - 参数。
  33868. * @param {function} callback - 回调函数。
  33869. */
  33870. updateByQuery(params, callback) {
  33871. return this.client.updateByQuery(params, callback);
  33872. }
  33873. _update(data, callback) {
  33874. let me = this;
  33875. if (!data) {
  33876. return;
  33877. }
  33878. me.data = data;
  33879. if (me.openGeoFence && me.geoFence) {
  33880. me._validateDatas(data);
  33881. }
  33882. me.events.triggerEvent('change', {data: me.data});
  33883. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  33884. if (me.change) {
  33885. me.change && me.change(data);
  33886. } else {
  33887. //加responses是为了保持跟原来es自身的数据结构一致
  33888. callback && callback(undefined, {responses: data});
  33889. }
  33890. }
  33891. _validateDatas(datas) {
  33892. if (!datas) {
  33893. return;
  33894. }
  33895. if (!(datas instanceof Array)) {
  33896. datas = [datas];
  33897. }
  33898. var i, len = datas.length;
  33899. for (i = 0; i < len; i++) {
  33900. this._validateData(datas[i]);
  33901. }
  33902. }
  33903. _validateData(data) {
  33904. let me = this;
  33905. data.hits.hits.map(function (source) {
  33906. let content = source._source;
  33907. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  33908. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  33909. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  33910. let contentX = content.x * meterUnit;
  33911. let contentY = content.y * meterUnit;
  33912. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  33913. let radius = me.geoFence.radius;
  33914. if (distance > radius) {
  33915. me.outOfGeoFence && me.outOfGeoFence(data);
  33916. me.events.triggerEvent('outOfGeoFence', {data: data});
  33917. }
  33918. return source;
  33919. });
  33920. }
  33921. _distance(x1, y1, x2, y2) {
  33922. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  33923. }
  33924. _getMeterPerMapUnit(mapUnit) {
  33925. let earchRadiusInMeters = 6378137;
  33926. let meterPerMapUnit;
  33927. if (mapUnit === 'meter') {
  33928. meterPerMapUnit = 1;
  33929. } else if (mapUnit === 'degree') {
  33930. // 每度表示多少米。
  33931. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  33932. }
  33933. return meterPerMapUnit;
  33934. }
  33935. }
  33936. SuperMap.ElasticSearch = ElasticSearch;
  33937. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  33938. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33939. * This program are made available under the terms of the Apache License, Version 2.0
  33940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33941. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  33942. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33943. * This program are made available under the terms of the Apache License, Version 2.0
  33944. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33945. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  33946. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33947. * This program are made available under the terms of the Apache License, Version 2.0
  33948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33949. /**
  33950. * @private
  33951. * @class SuperMap.LevelRenderer.Tool.Util
  33952. * @category Visualization Theme
  33953. * LevelRenderer 基础工具类
  33954. *
  33955. */
  33956. class Util_Util {
  33957. /**
  33958. * @function SuperMap.LevelRenderer.Tool.Util.constructor
  33959. * @description 构造函数。
  33960. *
  33961. */
  33962. constructor() {
  33963. /**
  33964. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  33965. * @description 用于处理merge时无法遍历Date等对象的问题
  33966. */
  33967. this.BUILTIN_OBJECT = {
  33968. '[object Function]': 1,
  33969. '[object RegExp]': 1,
  33970. '[object Date]': 1,
  33971. '[object Error]': 1,
  33972. '[object CanvasGradient]': 1
  33973. };
  33974. /**
  33975. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype._ctx
  33976. */
  33977. this._ctx = null;
  33978. /**
  33979. * Property: _canvas
  33980. * {Object}
  33981. */
  33982. this._canvas = null;
  33983. /**
  33984. * Property: _pixelCtx
  33985. * {Object}
  33986. */
  33987. this._pixelCtx = null;
  33988. /**
  33989. * Property: _width
  33990. * {Object}
  33991. */
  33992. this._width = null;
  33993. /**
  33994. * Property: _height
  33995. * {Object}
  33996. */
  33997. this._height = null;
  33998. /**
  33999. * Property: _offsetX
  34000. * {Object}
  34001. */
  34002. this._offsetX = 0;
  34003. /**
  34004. * Property: _offsetY
  34005. * {Object}
  34006. */
  34007. this._offsetY = 0;
  34008. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  34009. }
  34010. /**
  34011. * @function SuperMap.LevelRenderer.Tool.Util.prototype.clone
  34012. * @description 对一个object进行深度拷贝。
  34013. *
  34014. * @param {Object} source - 需要进行拷贝的对象。
  34015. * @return {Object} 拷贝后的新对象。
  34016. */
  34017. clone(source) {
  34018. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  34019. if (typeof source == 'object' && source !== null) {
  34020. var result = source;
  34021. if (source instanceof Array) {
  34022. result = [];
  34023. for (var i = 0, len = source.length; i < len; i++) {
  34024. result[i] = this.clone(source[i]);
  34025. }
  34026. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  34027. result = {};
  34028. for (var key in source) {
  34029. if (source.hasOwnProperty(key)) {
  34030. result[key] = this.clone(source[key]);
  34031. }
  34032. }
  34033. }
  34034. return result;
  34035. }
  34036. return source;
  34037. }
  34038. /**
  34039. * @function SuperMap.LevelRenderer.Tool.Util.prototype.mergeItem
  34040. * @description 合并源对象的单个属性到目标对象。
  34041. *
  34042. * @param {Object} target - 目标对象。
  34043. * @param {Object} source - 源对象。
  34044. * @param {string} key - 键。
  34045. * @param {boolean} overwrite - 是否覆盖。
  34046. * @return {Object} 目标对象
  34047. */
  34048. mergeItem(target, source, key, overwrite) {
  34049. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  34050. if (source.hasOwnProperty(key)) {
  34051. if (typeof target[key] == 'object'
  34052. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  34053. ) {
  34054. // 如果需要递归覆盖,就递归调用merge
  34055. this.merge(
  34056. target[key],
  34057. source[key],
  34058. overwrite
  34059. );
  34060. } else if (overwrite || !(key in target)) {
  34061. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  34062. target[key] = source[key];
  34063. }
  34064. }
  34065. }
  34066. /**
  34067. * @function SuperMap.LevelRenderer.Tool.Util.prototype.merge
  34068. * @description 合并源对象的属性到目标对象。
  34069. *
  34070. * @param {Object} target - 目标对象。
  34071. * @param {Object} source - 源对象。
  34072. * @param {boolean} overwrite - 是否覆盖。
  34073. * @return {Object} 目标对象。
  34074. */
  34075. merge(target, source, overwrite) {
  34076. for (var i in source) {
  34077. this.mergeItem(target, source, i, overwrite);
  34078. }
  34079. return target;
  34080. }
  34081. /**
  34082. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getContext
  34083. * @description 获取 Canvas 上下文。
  34084. * @return {Object} 上下文。
  34085. */
  34086. getContext() {
  34087. if (!this._ctx) {
  34088. this._ctx = document.createElement('canvas').getContext('2d');
  34089. }
  34090. return this._ctx;
  34091. }
  34092. /**
  34093. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelContext
  34094. * @description 获取像素拾取专用的上下文。
  34095. * @return {Object} 像素拾取专用的上下文。
  34096. */
  34097. getPixelContext() {
  34098. if (!this._pixelCtx) {
  34099. this._canvas = document.createElement('canvas');
  34100. this._width = this._canvas.width;
  34101. this._height = this._canvas.height;
  34102. this._pixelCtx = this._canvas.getContext('2d');
  34103. }
  34104. return this._pixelCtx;
  34105. }
  34106. /**
  34107. * @function SuperMap.LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  34108. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  34109. *
  34110. * @param {number} x - 横坐标。
  34111. * @param {number} y - 纵坐标。
  34112. *
  34113. */
  34114. adjustCanvasSize(x, y) {
  34115. var _canvas = this._canvas;
  34116. var _pixelCtx = this._pixelCtx;
  34117. var _width = this._width;
  34118. var _height = this._height;
  34119. var _offsetX = this._offsetX;
  34120. var _offsetY = this._offsetY;
  34121. // 每次加的长度
  34122. var _v = 100;
  34123. var _flag;
  34124. if (x + _offsetX > _width) {
  34125. _width = x + _offsetX + _v;
  34126. _canvas.width = _width;
  34127. _flag = true;
  34128. }
  34129. if (y + _offsetY > _height) {
  34130. _height = y + _offsetY + _v;
  34131. _canvas.height = _height;
  34132. _flag = true;
  34133. }
  34134. if (x < -_offsetX) {
  34135. _offsetX = Math.ceil(-x / _v) * _v;
  34136. _width += _offsetX;
  34137. _canvas.width = _width;
  34138. _flag = true;
  34139. }
  34140. if (y < -_offsetY) {
  34141. _offsetY = Math.ceil(-y / _v) * _v;
  34142. _height += _offsetY;
  34143. _canvas.height = _height;
  34144. _flag = true;
  34145. }
  34146. if (_flag) {
  34147. _pixelCtx.translate(_offsetX, _offsetY);
  34148. }
  34149. }
  34150. /**
  34151. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelOffset
  34152. * @description 获取像素canvas的偏移量。
  34153. * @return {Object} 偏移量。
  34154. */
  34155. getPixelOffset() {
  34156. return {
  34157. x: this._offsetX,
  34158. y: this._offsetY
  34159. };
  34160. }
  34161. /**
  34162. * @function SuperMap.LevelRenderer.Tool.Util.prototype.indexOf
  34163. * @description 查询数组中元素的index
  34164. * @return {Object} 偏移量。
  34165. */
  34166. indexOf(array, value) {
  34167. if (array.indexOf) {
  34168. return array.indexOf(value);
  34169. }
  34170. for (var i = 0, len = array.length; i < len; i++) {
  34171. if (array[i] === value) {
  34172. return i;
  34173. }
  34174. }
  34175. return -1;
  34176. }
  34177. /**
  34178. * @function SuperMap.LevelRenderer.Tool.Util.prototype.inherits
  34179. * @description 构造类继承关系
  34180. *
  34181. * @param {Function} clazz - 源类。
  34182. * @param {Function} baseClazz - 基类。
  34183. * @return {Object} 偏移量。
  34184. */
  34185. inherits(clazz, baseClazz) {
  34186. var clazzPrototype = clazz.prototype;
  34187. function F() {
  34188. }
  34189. F.prototype = baseClazz.prototype;
  34190. clazz.prototype = new F();
  34191. for (var prop in clazzPrototype) {
  34192. clazz.prototype[prop] = clazzPrototype[prop];
  34193. }
  34194. clazz.constructor = clazz;
  34195. }
  34196. }
  34197. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  34198. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34199. * This program are made available under the terms of the Apache License, Version 2.0
  34200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34201. /**
  34202. * @class SuperMap.LevelRenderer.Tool.Color
  34203. * @category Visualization Theme
  34204. * @classdesc LevelRenderer 工具-颜色辅助类
  34205. * @private
  34206. */
  34207. class Color {
  34208. constructor() {
  34209. /**
  34210. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Color.prototype.util
  34211. * @description LevelRenderer 基础工具对象。
  34212. */
  34213. this.util = new Util_Util();
  34214. /**
  34215. * @member {Object} SuperMap.LevelRenderer.Tool.Color.prototype._ctx
  34216. * @description _ctx。
  34217. */
  34218. this._ctx = null;
  34219. /**
  34220. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype.palette
  34221. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  34222. */
  34223. this.palette = [
  34224. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  34225. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  34226. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  34227. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  34228. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  34229. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  34230. ];
  34231. /**
  34232. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype._palette
  34233. * @description 复位色板,用于复位 palette
  34234. */
  34235. this._palette = this.palette;
  34236. /**
  34237. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.highlightColor
  34238. * @description 高亮色
  34239. */
  34240. this.highlightColor = 'rgba(0,0,255,1)';
  34241. /**
  34242. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._highlightColor
  34243. * @description 复位高亮色
  34244. */
  34245. this._highlightColor = this.highlightColor;
  34246. /**
  34247. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.colorRegExp
  34248. * @description 颜色格式,正则表达式。
  34249. */
  34250. 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;
  34251. /**
  34252. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._nameColors
  34253. * @description 颜色名。
  34254. */
  34255. this._nameColors = {
  34256. aliceblue: '#f0f8ff',
  34257. antiquewhite: '#faebd7',
  34258. aqua: '#0ff',
  34259. aquamarine: '#7fffd4',
  34260. azure: '#f0ffff',
  34261. beige: '#f5f5dc',
  34262. bisque: '#ffe4c4',
  34263. black: '#000',
  34264. blanchedalmond: '#ffebcd',
  34265. blue: '#00f',
  34266. blueviolet: '#8a2be2',
  34267. brown: '#a52a2a',
  34268. burlywood: '#deb887',
  34269. cadetblue: '#5f9ea0',
  34270. chartreuse: '#7fff00',
  34271. chocolate: '#d2691e',
  34272. coral: '#ff7f50',
  34273. cornflowerblue: '#6495ed',
  34274. cornsilk: '#fff8dc',
  34275. crimson: '#dc143c',
  34276. cyan: '#0ff',
  34277. darkblue: '#00008b',
  34278. darkcyan: '#008b8b',
  34279. darkgoldenrod: '#b8860b',
  34280. darkgray: '#a9a9a9',
  34281. darkgrey: '#a9a9a9',
  34282. darkgreen: '#006400',
  34283. darkkhaki: '#bdb76b',
  34284. darkmagenta: '#8b008b',
  34285. darkolivegreen: '#556b2f',
  34286. darkorange: '#ff8c00',
  34287. darkorchid: '#9932cc',
  34288. darkred: '#8b0000',
  34289. darksalmon: '#e9967a',
  34290. darkseagreen: '#8fbc8f',
  34291. darkslateblue: '#483d8b',
  34292. darkslategray: '#2f4f4f',
  34293. darkslategrey: '#2f4f4f',
  34294. darkturquoise: '#00ced1',
  34295. darkviolet: '#9400d3',
  34296. deeppink: '#ff1493',
  34297. deepskyblue: '#00bfff',
  34298. dimgray: '#696969',
  34299. dimgrey: '#696969',
  34300. dodgerblue: '#1e90ff',
  34301. firebrick: '#b22222',
  34302. floralwhite: '#fffaf0',
  34303. forestgreen: '#228b22',
  34304. fuchsia: '#f0f',
  34305. gainsboro: '#dcdcdc',
  34306. ghostwhite: '#f8f8ff',
  34307. gold: '#ffd700',
  34308. goldenrod: '#daa520',
  34309. gray: '#808080',
  34310. grey: '#808080',
  34311. green: '#008000',
  34312. greenyellow: '#adff2f',
  34313. honeydew: '#f0fff0',
  34314. hotpink: '#ff69b4',
  34315. indianred: '#cd5c5c',
  34316. indigo: '#4b0082',
  34317. ivory: '#fffff0',
  34318. khaki: '#f0e68c',
  34319. lavender: '#e6e6fa',
  34320. lavenderblush: '#fff0f5',
  34321. lawngreen: '#7cfc00',
  34322. lemonchiffon: '#fffacd',
  34323. lightblue: '#add8e6',
  34324. lightcoral: '#f08080',
  34325. lightcyan: '#e0ffff',
  34326. lightgoldenrodyellow: '#fafad2',
  34327. lightgray: '#d3d3d3',
  34328. lightgrey: '#d3d3d3',
  34329. lightgreen: '#90ee90',
  34330. lightpink: '#ffb6c1',
  34331. lightsalmon: '#ffa07a',
  34332. lightseagreen: '#20b2aa',
  34333. lightskyblue: '#87cefa',
  34334. lightslategray: '#789',
  34335. lightslategrey: '#789',
  34336. lightsteelblue: '#b0c4de',
  34337. lightyellow: '#ffffe0',
  34338. lime: '#0f0',
  34339. limegreen: '#32cd32',
  34340. linen: '#faf0e6',
  34341. magenta: '#f0f',
  34342. maroon: '#800000',
  34343. mediumaquamarine: '#66cdaa',
  34344. mediumblue: '#0000cd',
  34345. mediumorchid: '#ba55d3',
  34346. mediumpurple: '#9370d8',
  34347. mediumseagreen: '#3cb371',
  34348. mediumslateblue: '#7b68ee',
  34349. mediumspringgreen: '#00fa9a',
  34350. mediumturquoise: '#48d1cc',
  34351. mediumvioletred: '#c71585',
  34352. midnightblue: '#191970',
  34353. mintcream: '#f5fffa',
  34354. mistyrose: '#ffe4e1',
  34355. moccasin: '#ffe4b5',
  34356. navajowhite: '#ffdead',
  34357. navy: '#000080',
  34358. oldlace: '#fdf5e6',
  34359. olive: '#808000',
  34360. olivedrab: '#6b8e23',
  34361. orange: '#ffa500',
  34362. orangered: '#ff4500',
  34363. orchid: '#da70d6',
  34364. palegoldenrod: '#eee8aa',
  34365. palegreen: '#98fb98',
  34366. paleturquoise: '#afeeee',
  34367. palevioletred: '#d87093',
  34368. papayawhip: '#ffefd5',
  34369. peachpuff: '#ffdab9',
  34370. peru: '#cd853f',
  34371. pink: '#ffc0cb',
  34372. plum: '#dda0dd',
  34373. powderblue: '#b0e0e6',
  34374. purple: '#800080',
  34375. red: '#f00',
  34376. rosybrown: '#bc8f8f',
  34377. royalblue: '#4169e1',
  34378. saddlebrown: '#8b4513',
  34379. salmon: '#fa8072',
  34380. sandybrown: '#f4a460',
  34381. seagreen: '#2e8b57',
  34382. seashell: '#fff5ee',
  34383. sienna: '#a0522d',
  34384. silver: '#c0c0c0',
  34385. skyblue: '#87ceeb',
  34386. slateblue: '#6a5acd',
  34387. slategray: '#708090',
  34388. slategrey: '#708090',
  34389. snow: '#fffafa',
  34390. springgreen: '#00ff7f',
  34391. steelblue: '#4682b4',
  34392. tan: '#d2b48c',
  34393. teal: '#008080',
  34394. thistle: '#d8bfd8',
  34395. tomato: '#ff6347',
  34396. turquoise: '#40e0d0',
  34397. violet: '#ee82ee',
  34398. wheat: '#f5deb3',
  34399. white: '#fff',
  34400. whitesmoke: '#f5f5f5',
  34401. yellow: '#ff0',
  34402. yellowgreen: '#9acd32'
  34403. };
  34404. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  34405. }
  34406. /**
  34407. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customPalette
  34408. * @description 自定义调色板。
  34409. * @param {Array} userPalete - 颜色板。
  34410. */
  34411. customPalette(userPalete) {
  34412. this.palette = userPalete;
  34413. }
  34414. /**
  34415. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetPalette
  34416. * @description 复位默认色板。
  34417. */
  34418. resetPalette() {
  34419. this.palette = this._palette;
  34420. }
  34421. /**
  34422. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getColor
  34423. * @description 获取色板颜色。
  34424. * @param {number} idx - 色板位置。
  34425. * @param {Array} userPalete - 色板。
  34426. * @returns {string} 颜色值。
  34427. */
  34428. getColor(idx, userPalete) {
  34429. idx = idx | 0;
  34430. userPalete = userPalete || this.palette;
  34431. return userPalete[idx % userPalete.length];
  34432. }
  34433. /**
  34434. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customHighlight
  34435. * @description 自定义默认高亮颜色。
  34436. * @param {string} userHighlightColor - 自定义高亮色。
  34437. */
  34438. customHighlight(userHighlightColor) {
  34439. this.highlightColor = userHighlightColor;
  34440. }
  34441. /**
  34442. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetHighlight
  34443. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  34444. */
  34445. resetHighlight() {
  34446. this.highlightColor = this._highlightColor;
  34447. }
  34448. /**
  34449. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getHighlightColor
  34450. * @description 获取默认高亮颜色
  34451. * @returns {string} 颜色值。
  34452. */
  34453. getHighlightColor() {
  34454. return this.highlightColor;
  34455. }
  34456. /**
  34457. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getRadialGradient
  34458. * @description 径向渐变。
  34459. * @param {number} x0 - 渐变起点横坐标。
  34460. * @param {number} y0 - 渐变起点纵坐标。
  34461. * @param {number} r0 - 半径
  34462. * @param {number} x1 - 渐变终点横坐标。
  34463. * @param {number} y1 - 渐变终点纵坐标。
  34464. * @param {number} r1 - 半径
  34465. * @param {Array} colorList - 颜色列表。
  34466. * @returns {CanvasGradient} Cavans 渐变颜色。
  34467. */
  34468. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  34469. var util = this.util;
  34470. if (!this._ctx) {
  34471. this._ctx = util.getContext();
  34472. }
  34473. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  34474. for (var i = 0, l = colorList.length; i < l; i++) {
  34475. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  34476. }
  34477. gradient.__nonRecursion = true;
  34478. return gradient;
  34479. }
  34480. /**
  34481. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getLinearGradient
  34482. * @description 线性渐变。
  34483. * @param {number} x0 - 渐变起点横坐标。
  34484. * @param {number} y0 - 渐变起点纵坐标。
  34485. * @param {number} x1 - 渐变终点横坐标。
  34486. * @param {number} y1 - 渐变终点纵坐标。
  34487. * @param {Array} colorList - 颜色列表。
  34488. * @returns {CanvasGradient} Cavans 渐变颜色。
  34489. */
  34490. getLinearGradient(x0, y0, x1, y1, colorList) {
  34491. var util = this.util;
  34492. if (!this._ctx) {
  34493. this._ctx = util.getContext();
  34494. }
  34495. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  34496. for (var i = 0, l = colorList.length; i < l; i++) {
  34497. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  34498. }
  34499. gradient.__nonRecursion = true;
  34500. return gradient;
  34501. }
  34502. /**
  34503. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getStepColors
  34504. * @description 获取两种颜色之间渐变颜色数组。
  34505. * @param {Object} start - 起始颜色对象。
  34506. * @param {Object} end - 结束颜色对象。
  34507. * @param {number} step - 渐变级数。
  34508. * @returns {Array} 颜色数组。
  34509. */
  34510. getStepColors(start, end, step) {
  34511. start = this.toRGBA(start);
  34512. end = this.toRGBA(end);
  34513. start = this.getData(start);
  34514. end = this.getData(end);
  34515. var colors = [];
  34516. var stepR = (end[0] - start[0]) / step;
  34517. var stepG = (end[1] - start[1]) / step;
  34518. var stepB = (end[2] - start[2]) / step;
  34519. var stepA = (end[3] - start[3]) / step;
  34520. // 生成颜色集合
  34521. // fix by linfeng 颜色堆积
  34522. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  34523. colors[i] = this.toColor([
  34524. this.adjust(Math.floor(r), [0, 255]),
  34525. this.adjust(Math.floor(g), [0, 255]),
  34526. this.adjust(Math.floor(b), [0, 255]),
  34527. a.toFixed(4) - 0
  34528. ], 'rgba');
  34529. r += stepR;
  34530. g += stepG;
  34531. b += stepB;
  34532. a += stepA;
  34533. }
  34534. r = end[0];
  34535. g = end[1];
  34536. b = end[2];
  34537. a = end[3];
  34538. colors[i] = this.toColor([r, g, b, a], 'rgba');
  34539. return colors;
  34540. }
  34541. /**
  34542. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getGradientColors
  34543. * @description 获取指定级数的渐变颜色数组。
  34544. * @param {Array.<string>} colors - 颜色数组。
  34545. * @param {number} [step=20] - 渐变级数。
  34546. * @returns {Array.<string>} 颜色数组。
  34547. */
  34548. getGradientColors(colors, step) {
  34549. var ret = [];
  34550. var len = colors.length;
  34551. if (step === undefined) {
  34552. step = 20;
  34553. }
  34554. if (len === 1) {
  34555. ret = this.getStepColors(colors[0], colors[0], step);
  34556. } else if (len > 1) {
  34557. for (var i = 0, n = len - 1; i < n; i++) {
  34558. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  34559. if (i < n - 1) {
  34560. steps.pop();
  34561. }
  34562. ret = ret.concat(steps);
  34563. }
  34564. }
  34565. return ret;
  34566. }
  34567. /**
  34568. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toColor
  34569. * @description 颜色值数组转为指定格式颜色。
  34570. * @param {Array} data - 颜色值数组。
  34571. * @param {string} format - 格式,默认'rgb'
  34572. * @returns {string} 颜色。
  34573. */
  34574. toColor(data, format) {
  34575. format = format || 'rgb';
  34576. if (data && (data.length === 3 || data.length === 4)) {
  34577. data = this.map(data,
  34578. function (c) {
  34579. return c > 1 ? Math.ceil(c) : c;
  34580. }
  34581. );
  34582. if (format.indexOf('hex') > -1) {
  34583. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  34584. } else if (format.indexOf('hs') > -1) {
  34585. var sx = this.map(data.slice(1, 3),
  34586. function (c) {
  34587. return c + '%';
  34588. }
  34589. );
  34590. data[1] = sx[0];
  34591. data[2] = sx[1];
  34592. }
  34593. if (format.indexOf('a') > -1) {
  34594. if (data.length === 3) {
  34595. data.push(1);
  34596. }
  34597. data[3] = this.adjust(data[3], [0, 1]);
  34598. return format + '(' + data.slice(0, 4).join(',') + ')';
  34599. }
  34600. return format + '(' + data.slice(0, 3).join(',') + ')';
  34601. }
  34602. }
  34603. /**
  34604. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toArray
  34605. * @description 颜色字符串转换为rgba数组。
  34606. * @param {string} color - 颜色。
  34607. * @returns {Array.<number>} 颜色值数组。
  34608. */
  34609. toArray(color) {
  34610. color = this.trim(color);
  34611. if (color.indexOf('rgba') < 0) {
  34612. color = this.toRGBA(color);
  34613. }
  34614. var data = [];
  34615. var i = 0;
  34616. color.replace(/[\d.]+/g, function (n) {
  34617. if (i < 3) {
  34618. n = n | 0;
  34619. } else {
  34620. // Alpha
  34621. n = +n;
  34622. }
  34623. data[i++] = n;
  34624. });
  34625. return data;
  34626. }
  34627. /**
  34628. * @function SuperMap.LevelRenderer.Tool.Color.prototype.convert
  34629. * @description 颜色格式转化。
  34630. * @param {Array} data - 颜色值数组。
  34631. * @param {string} format - 格式,默认'rgb'
  34632. * @returns {string} 颜色。
  34633. */
  34634. convert(color, format) {
  34635. if (!this.isCalculableColor(color)) {
  34636. return color;
  34637. }
  34638. var data = this.getData(color);
  34639. var alpha = data[3];
  34640. if (typeof alpha === 'undefined') {
  34641. alpha = 1;
  34642. }
  34643. if (color.indexOf('hsb') > -1) {
  34644. data = this._HSV_2_RGB(data);
  34645. } else if (color.indexOf('hsl') > -1) {
  34646. data = this._HSL_2_RGB(data);
  34647. }
  34648. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  34649. data = this._RGB_2_HSB(data);
  34650. } else if (format.indexOf('hsl') > -1) {
  34651. data = this._RGB_2_HSL(data);
  34652. }
  34653. data[3] = alpha;
  34654. return this.toColor(data, format);
  34655. }
  34656. /**
  34657. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGBA
  34658. * @description 转换为rgba格式的颜色。
  34659. * @param {string} color - 颜色。
  34660. * @returns {string} 颜色。
  34661. */
  34662. toRGBA(color) {
  34663. return this.convert(color, 'rgba');
  34664. }
  34665. /**
  34666. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGB
  34667. * @description 转换为rgb数字格式的颜色。
  34668. * @param {string} color - 颜色。
  34669. * @returns {string} 颜色。
  34670. */
  34671. toRGB(color) {
  34672. return this.convert(color, 'rgb');
  34673. }
  34674. /**
  34675. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHex
  34676. * @description 转换为16进制颜色。
  34677. * @param {string} color - 颜色。
  34678. * @returns {string} 16进制颜色,#rrggbb格式
  34679. */
  34680. toHex(color) {
  34681. return this.convert(color, 'hex');
  34682. }
  34683. /**
  34684. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSVA
  34685. * @description 转换为HSV颜色。
  34686. * @param {string} color - 颜色。
  34687. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  34688. */
  34689. toHSVA(color) {
  34690. return this.convert(color, 'hsva');
  34691. }
  34692. /**
  34693. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSV
  34694. * @description 转换为HSV颜色。
  34695. * @param {string} color - 颜色。
  34696. * @returns {string} HSV颜色,hsv(h,s,v)
  34697. */
  34698. toHSV(color) {
  34699. return this.convert(color, 'hsv');
  34700. }
  34701. /**
  34702. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSBA
  34703. * @description 转换为HSBA颜色。
  34704. * @param {string} color - 颜色。
  34705. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  34706. */
  34707. toHSBA(color) {
  34708. return this.convert(color, 'hsba');
  34709. }
  34710. /**
  34711. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSB
  34712. * @description 转换为HSB颜色。
  34713. * @param {string} color - 颜色。
  34714. * @returns {string} HSB颜色,hsb(h,s,b)
  34715. */
  34716. toHSB(color) {
  34717. return this.convert(color, 'hsb');
  34718. }
  34719. /**
  34720. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSLA
  34721. * @description 转换为HSLA颜色。
  34722. * @param {string} color - 颜色。
  34723. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  34724. */
  34725. toHSLA(color) {
  34726. return this.convert(color, 'hsla');
  34727. }
  34728. /**
  34729. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSL
  34730. * @description 转换为HSL颜色。
  34731. * @param {string} color - 颜色。
  34732. * @returns {string} HSL颜色,hsl(h,s,l)
  34733. */
  34734. toHSL(color) {
  34735. return this.convert(color, 'hsl');
  34736. }
  34737. /**
  34738. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toName
  34739. * @description 转换颜色名。
  34740. * @param {string} color - 颜色。
  34741. * @returns {string} 颜色名
  34742. */
  34743. toName(color) {
  34744. for (var key in this._nameColors) {
  34745. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  34746. return key;
  34747. }
  34748. }
  34749. return null;
  34750. }
  34751. /**
  34752. * @function SuperMap.LevelRenderer.Tool.Color.prototype.trim
  34753. * @description 移除颜色中多余空格。
  34754. * @param {string} color - 颜色。
  34755. * @returns {string} 无空格颜色
  34756. */
  34757. trim(color) {
  34758. return String(color).replace(/\s+/g, '');
  34759. }
  34760. /**
  34761. * @function SuperMap.LevelRenderer.Tool.Color.prototype.normalize
  34762. * @description 颜色规范化。
  34763. * @param {string} color - 颜色。
  34764. * @returns {string} 规范化后的颜色
  34765. */
  34766. normalize(color) {
  34767. // 颜色名
  34768. if (this._nameColors[color]) {
  34769. color = this._nameColors[color];
  34770. }
  34771. // 去掉空格
  34772. color = this.trim(color);
  34773. // hsv与hsb等价
  34774. color = color.replace(/hsv/i, 'hsb');
  34775. // rgb转为rrggbb
  34776. if (/^#[\da-f]{3}$/i.test(color)) {
  34777. color = parseInt(color.slice(1), 16);
  34778. var r = (color & 0xf00) << 8;
  34779. var g = (color & 0xf0) << 4;
  34780. var b = color & 0xf;
  34781. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  34782. }
  34783. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  34784. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  34785. return color;
  34786. }
  34787. /**
  34788. * @function SuperMap.LevelRenderer.Tool.Color.prototype.lift
  34789. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  34790. * @param {string} color - 颜色。
  34791. * @param {number} level - 升降程度,取值区间[-1,1]。
  34792. * @returns {string} 加深或减淡后颜色值
  34793. */
  34794. lift(color, level) {
  34795. if (!this.isCalculableColor(color)) {
  34796. return color;
  34797. }
  34798. var direct = level > 0 ? 1 : -1;
  34799. if (typeof level === 'undefined') {
  34800. level = 0;
  34801. }
  34802. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  34803. color = this.toRGB(color);
  34804. var data = this.getData(color);
  34805. for (var i = 0; i < 3; i++) {
  34806. if (direct === 1) {
  34807. data[i] = data[i] * (1 - level) | 0;
  34808. } else {
  34809. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  34810. }
  34811. }
  34812. return 'rgb(' + data.join(',') + ')';
  34813. }
  34814. /**
  34815. * @function SuperMap.LevelRenderer.Tool.Color.prototype.reverse
  34816. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  34817. * @param {string} color - 颜色。
  34818. * @returns {string} 翻转颜色
  34819. */
  34820. reverse(color) {
  34821. if (!this.isCalculableColor(color)) {
  34822. return color;
  34823. }
  34824. var data = this.getData(this.toRGBA(color));
  34825. data = this.map(data,
  34826. function (c) {
  34827. return 255 - c;
  34828. }
  34829. );
  34830. return this.toColor(data, 'rgb');
  34831. }
  34832. /**
  34833. * @function SuperMap.LevelRenderer.Tool.Color.prototype.mix
  34834. * @description 简单两种颜色混合
  34835. * @param {string} color1 - 第一种颜色。
  34836. * @param {string} color2 - 第二种颜色。
  34837. * @param {number} weight - 混合权重[0-1]。
  34838. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  34839. */
  34840. mix(color1, color2, weight) {
  34841. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  34842. return color1;
  34843. }
  34844. if (typeof weight === 'undefined') {
  34845. weight = 0.5;
  34846. }
  34847. weight = 1 - this.adjust(weight, [0, 1]);
  34848. var w = weight * 2 - 1;
  34849. var data1 = this.getData(this.toRGBA(color1));
  34850. var data2 = this.getData(this.toRGBA(color2));
  34851. var d = data1[3] - data2[3];
  34852. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  34853. var weight2 = 1 - weight1;
  34854. var data = [];
  34855. for (var i = 0; i < 3; i++) {
  34856. data[i] = data1[i] * weight1 + data2[i] * weight2;
  34857. }
  34858. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  34859. alpha = Math.max(0, Math.min(1, alpha));
  34860. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  34861. return this.toColor(data, 'rgb');
  34862. }
  34863. data[3] = alpha;
  34864. return this.toColor(data, 'rgba');
  34865. }
  34866. /**
  34867. * @function SuperMap.LevelRenderer.Tool.Color.prototype.random
  34868. * @description 随机颜色
  34869. * @returns {string} 颜色值,#rrggbb格式
  34870. */
  34871. random() {
  34872. return '#' + Math.random().toString(16).slice(2, 8);
  34873. }
  34874. /**
  34875. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getData
  34876. * @description 获取颜色值数组,返回值范围。
  34877. * RGB 范围[0-255]
  34878. * HSL/HSV/HSB 范围[0-1]
  34879. * A透明度范围[0-1]
  34880. * 支持格式:
  34881. * #rgb
  34882. * #rrggbb
  34883. * rgb(r,g,b)
  34884. * rgb(r%,g%,b%)
  34885. * rgba(r,g,b,a)
  34886. * hsb(h,s,b) // hsv与hsb等价
  34887. * hsb(h%,s%,b%)
  34888. * hsba(h,s,b,a)
  34889. * hsl(h,s,l)
  34890. * hsl(h%,s%,l%)
  34891. * hsla(h,s,l,a)
  34892. * @param {string} color - 颜色。
  34893. * @returns {Array.<number>} 颜色值数组或null
  34894. */
  34895. getData(color) {
  34896. color = this.normalize(color);
  34897. var r = color.match(this.colorRegExp);
  34898. if (r === null) {
  34899. throw new Error('The color format error'); // 颜色格式错误
  34900. }
  34901. var d;
  34902. var a;
  34903. var data = [];
  34904. var rgb;
  34905. if (r[2]) {
  34906. // #rrggbb
  34907. d = r[2].replace('#', '').split('');
  34908. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  34909. data = this.map(rgb,
  34910. function (c) {
  34911. return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  34912. }
  34913. );
  34914. } else if (r[4]) {
  34915. // rgb rgba
  34916. var rgba = (r[4]).split(',');
  34917. a = rgba[3];
  34918. rgb = rgba.slice(0, 3);
  34919. data = this.map(
  34920. rgb,
  34921. function (c) {
  34922. c = Math.floor(
  34923. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  34924. );
  34925. return Color.prototype.adjust.call(this, c, [0, 255]);
  34926. }
  34927. );
  34928. if (typeof a !== 'undefined') {
  34929. data.push(this.adjust(parseFloat(a), [0, 1]));
  34930. }
  34931. } else if (r[5] || r[6]) {
  34932. // hsb hsba hsl hsla
  34933. var hsxa = (r[5] || r[6]).split(',');
  34934. var h = parseInt(hsxa[0], 0) / 360;
  34935. var s = hsxa[1];
  34936. var x = hsxa[2];
  34937. a = hsxa[3];
  34938. data = this.map([s, x],
  34939. function (c) {
  34940. return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  34941. }
  34942. );
  34943. data.unshift(h);
  34944. if (typeof a !== 'undefined') {
  34945. data.push(this.adjust(parseFloat(a), [0, 1]));
  34946. }
  34947. }
  34948. return data;
  34949. }
  34950. /**
  34951. * @function SuperMap.LevelRenderer.Tool.Color.prototype.alpha
  34952. * @description 设置颜色透明度
  34953. * @param {string} color - 颜色。
  34954. * @param {number} a - 透明度,区间[0,1]。
  34955. * @returns {string} rgba颜色值
  34956. */
  34957. alpha(color, a) {
  34958. if (!this.isCalculableColor(color)) {
  34959. return color;
  34960. }
  34961. if (a === null) {
  34962. a = 1;
  34963. }
  34964. var data = this.getData(this.toRGBA(color));
  34965. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  34966. return this.toColor(data, 'rgba');
  34967. }
  34968. /**
  34969. * @function SuperMap.LevelRenderer.Tool.Color.prototype.map
  34970. * @description 数组映射
  34971. * @param {Array} array - 数组。
  34972. * @param {function} fun - 函数。
  34973. * @returns {string} 数组映射结果
  34974. */
  34975. map(array, fun) {
  34976. if (typeof fun !== 'function') {
  34977. throw new TypeError();
  34978. }
  34979. var len = array ? array.length : 0;
  34980. for (var i = 0; i < len; i++) {
  34981. array[i] = fun(array[i]);
  34982. }
  34983. return array;
  34984. }
  34985. /**
  34986. * @function SuperMap.LevelRenderer.Tool.Color.prototype.adjust
  34987. * @description 调整值区间
  34988. * @param {Array.<number>} value - 数组。
  34989. * @param {Array.<number>} region - 区间。
  34990. * @returns {number} 调整后的值
  34991. */
  34992. adjust(value, region) {
  34993. // < to <= & > to >=
  34994. // modify by linzhifeng 2014-05-25 because -0 == 0
  34995. if (value <= region[0]) {
  34996. value = region[0];
  34997. } else if (value >= region[1]) {
  34998. value = region[1];
  34999. }
  35000. return value;
  35001. }
  35002. /**
  35003. * @function SuperMap.LevelRenderer.Tool.Color.prototype.isCalculableColor
  35004. * @description 判断是否是可计算的颜色
  35005. * @param {string} color - 颜色。
  35006. * @returns {boolean} 是否是可计算的颜色
  35007. */
  35008. isCalculableColor(color) {
  35009. return color instanceof Array || typeof color === 'string';
  35010. }
  35011. /**
  35012. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35013. */
  35014. _HSV_2_RGB(data) {
  35015. var H = data[0];
  35016. var S = data[1];
  35017. var V = data[2];
  35018. // HSV from 0 to 1
  35019. var R;
  35020. var G;
  35021. var B;
  35022. if (S === 0) {
  35023. R = V * 255;
  35024. G = V * 255;
  35025. B = V * 255;
  35026. } else {
  35027. var h = H * 6;
  35028. if (h === 6) {
  35029. h = 0;
  35030. }
  35031. var i = h | 0;
  35032. var v1 = V * (1 - S);
  35033. var v2 = V * (1 - S * (h - i));
  35034. var v3 = V * (1 - S * (1 - (h - i)));
  35035. var r = 0;
  35036. var g = 0;
  35037. var b = 0;
  35038. if (i === 0) {
  35039. r = V;
  35040. g = v3;
  35041. b = v1;
  35042. } else if (i === 1) {
  35043. r = v2;
  35044. g = V;
  35045. b = v1;
  35046. } else if (i === 2) {
  35047. r = v1;
  35048. g = V;
  35049. b = v3;
  35050. } else if (i === 3) {
  35051. r = v1;
  35052. g = v2;
  35053. b = V;
  35054. } else if (i === 4) {
  35055. r = v3;
  35056. g = v1;
  35057. b = V;
  35058. } else {
  35059. r = V;
  35060. g = v1;
  35061. b = v2;
  35062. }
  35063. // RGB results from 0 to 255
  35064. R = r * 255;
  35065. G = g * 255;
  35066. B = b * 255;
  35067. }
  35068. return [R, G, B];
  35069. }
  35070. /**
  35071. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35072. */
  35073. _HSL_2_RGB(data) {
  35074. var H = data[0];
  35075. var S = data[1];
  35076. var L = data[2];
  35077. // HSL from 0 to 1
  35078. var R;
  35079. var G;
  35080. var B;
  35081. if (S === 0) {
  35082. R = L * 255;
  35083. G = L * 255;
  35084. B = L * 255;
  35085. } else {
  35086. var v2;
  35087. if (L < 0.5) {
  35088. v2 = L * (1 + S);
  35089. } else {
  35090. v2 = (L + S) - (S * L);
  35091. }
  35092. var v1 = 2 * L - v2;
  35093. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  35094. G = 255 * this._HUE_2_RGB(v1, v2, H);
  35095. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  35096. }
  35097. return [R, G, B];
  35098. }
  35099. /**
  35100. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35101. */
  35102. _HUE_2_RGB(v1, v2, vH) {
  35103. if (vH < 0) {
  35104. vH += 1;
  35105. }
  35106. if (vH > 1) {
  35107. vH -= 1;
  35108. }
  35109. if ((6 * vH) < 1) {
  35110. return (v1 + (v2 - v1) * 6 * vH);
  35111. }
  35112. if ((2 * vH) < 1) {
  35113. return (v2);
  35114. }
  35115. if ((3 * vH) < 2) {
  35116. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  35117. }
  35118. return v1;
  35119. }
  35120. /**
  35121. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35122. */
  35123. _RGB_2_HSB(data) {
  35124. // RGB from 0 to 255
  35125. var R = (data[0] / 255);
  35126. var G = (data[1] / 255);
  35127. var B = (data[2] / 255);
  35128. var vMin = Math.min(R, G, B); // Min. value of RGB
  35129. var vMax = Math.max(R, G, B); // Max. value of RGB
  35130. var delta = vMax - vMin; // Delta RGB value
  35131. var V = vMax;
  35132. var H;
  35133. var S;
  35134. // HSV results from 0 to 1
  35135. if (delta === 0) {
  35136. H = 0;
  35137. S = 0;
  35138. } else {
  35139. S = delta / vMax;
  35140. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  35141. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  35142. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  35143. if (R === vMax) {
  35144. H = deltaB - deltaG;
  35145. } else if (G === vMax) {
  35146. H = (1 / 3) + deltaR - deltaB;
  35147. } else if (B === vMax) {
  35148. H = (2 / 3) + deltaG - deltaR;
  35149. }
  35150. if (H < 0) {
  35151. H += 1;
  35152. }
  35153. if (H > 1) {
  35154. H -= 1;
  35155. }
  35156. }
  35157. H = H * 360;
  35158. S = S * 100;
  35159. V = V * 100;
  35160. return [H, S, V];
  35161. }
  35162. /**
  35163. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  35164. */
  35165. _RGB_2_HSL(data) {
  35166. // RGB from 0 to 255
  35167. var R = (data[0] / 255);
  35168. var G = (data[1] / 255);
  35169. var B = (data[2] / 255);
  35170. var vMin = Math.min(R, G, B); // Min. value of RGB
  35171. var vMax = Math.max(R, G, B); // Max. value of RGB
  35172. var delta = vMax - vMin; // Delta RGB value
  35173. var L = (vMax + vMin) / 2;
  35174. var H;
  35175. var S;
  35176. // HSL results from 0 to 1
  35177. if (delta === 0) {
  35178. H = 0;
  35179. S = 0;
  35180. } else {
  35181. if (L < 0.5) {
  35182. S = delta / (vMax + vMin);
  35183. } else {
  35184. S = delta / (2 - vMax - vMin);
  35185. }
  35186. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  35187. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  35188. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  35189. if (R === vMax) {
  35190. H = deltaB - deltaG;
  35191. } else if (G === vMax) {
  35192. H = (1 / 3) + deltaR - deltaB;
  35193. } else if (B === vMax) {
  35194. H = (2 / 3) + deltaG - deltaR;
  35195. }
  35196. if (H < 0) {
  35197. H += 1;
  35198. }
  35199. if (H > 1) {
  35200. H -= 1;
  35201. }
  35202. }
  35203. H = H * 360;
  35204. S = S * 100;
  35205. L = L * 100;
  35206. return [H, S, L];
  35207. }
  35208. }
  35209. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  35210. var ColorRender = new Color();
  35211. // let "http://www.qzu.zj.cn": "#bd10e0"
  35212. // "www.qzct.net": "#7ed321" = new SuperMap.LevelRenderer.Tool.Color();
  35213. /**
  35214. * Created by yzy on 2016/11/9.
  35215. * 色带选择器工具类 用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色
  35216. *
  35217. */
  35218. class ColorsPickerUtil {
  35219. /**
  35220. * 创建DOM canvas
  35221. * @param height canvas 高度
  35222. * @param width canvas 宽度
  35223. *
  35224. */
  35225. static createCanvas (height, width){
  35226. var canvas = document.createElement("canvas");
  35227. canvas.height = height;
  35228. canvas.width = width;
  35229. return canvas.getContext("2d");
  35230. }
  35231. /**
  35232. * 线性渐变。
  35233. * Parameters:
  35234. * x0 - {Number} 渐变起点。
  35235. * y0 - {Number}
  35236. * x1 - {Number} 渐变终点。
  35237. * y1 - {Number}
  35238. * colorList - {Array} 颜色列表。
  35239. *
  35240. * Returns:
  35241. * {CanvasGradient} Cavans 渐变颜色。
  35242. */
  35243. static getLinearGradient (x0, y0, x1, y1, colorList){
  35244. if (!this._ctx) {
  35245. this._ctx = this.getContext();
  35246. }
  35247. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  35248. var leng = colorList.length;
  35249. var add = 1/(leng -1);
  35250. var offset = 0;
  35251. for (var i = 0; i < leng; i++) {
  35252. gradient.addColorStop(offset, colorList[i]);
  35253. offset += add;
  35254. }
  35255. gradient.__nonRecursion = true;
  35256. return gradient;
  35257. }
  35258. /**
  35259. * 获取 Cavans 上下文
  35260. *
  35261. * Returns:
  35262. * {Object} Cavans 上下文。
  35263. */
  35264. static getContext () {
  35265. if (!this._ctx) {
  35266. this._ctx = document.createElement('canvas').getContext('2d');
  35267. }
  35268. return this._ctx;
  35269. }
  35270. /**
  35271. * 获取两种颜色之间渐变颜色数组。
  35272. *
  35273. * Parameters:
  35274. * start - {color} 起始颜色。
  35275. * end - {color} 结束颜色。
  35276. * step - {Number} 渐变级数。
  35277. * colorList - {Array} 颜色列表。
  35278. *
  35279. * Returns:
  35280. * {Array} 颜色数组。
  35281. */
  35282. static getStepColors (start, end, step){
  35283. start = ColorRender.toRGBA(start);
  35284. end = ColorRender.toRGBA(end);
  35285. start = ColorRender.getData(start);
  35286. end = ColorRender.getData(end);
  35287. var colors = [];
  35288. var stepR = (end[0] - start[0]) / step;
  35289. var stepG = (end[1] - start[1]) / step;
  35290. var stepB = (end[2] - start[2]) / step;
  35291. var stepA = (end[3] - start[3]) / step;
  35292. // 生成颜色集合
  35293. // fix by linfeng 颜色堆积
  35294. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  35295. colors[i] = ColorRender.toColor([
  35296. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  35297. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  35298. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  35299. a.toFixed(4) - 0
  35300. ],'hex');
  35301. r += stepR;
  35302. g += stepG;
  35303. b += stepB;
  35304. a += stepA;
  35305. }
  35306. r = end[0];
  35307. g = end[1];
  35308. b = end[2];
  35309. a = end[3];
  35310. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  35311. return colors;
  35312. }
  35313. /**
  35314. * APIMethod: getGradientColors
  35315. * 获取指定级数的渐变颜色数组。
  35316. *
  35317. * Parameters:
  35318. * colors - {Array{String}} 颜色组。
  35319. * total - {Number} 颜色总数。
  35320. * total - {String} 专题类型
  35321. *
  35322. * Returns:
  35323. * {Array{String}} 颜色数组。
  35324. */
  35325. static getGradientColors (colors, total, themeType){
  35326. var ret = [], step;
  35327. var i, n, len = colors.length;
  35328. if (total === undefined) {
  35329. return;
  35330. }
  35331. if(len >= total){
  35332. if(themeType === 'RANGE'){
  35333. for(i = 0; i<total; i++){
  35334. ret.push(colors[i]);
  35335. }
  35336. }else {
  35337. //1/2前后取色
  35338. for(i = 0; i<total; i++){
  35339. let ii = Math.floor(i/2);
  35340. if(i%2 === 0){
  35341. ret.push(colors[ii]);
  35342. }else {
  35343. let index = colors.length -1 - ii;
  35344. ret.push(colors[index]);
  35345. }
  35346. }
  35347. }
  35348. } else {
  35349. step = Math.ceil(total/(len-1));
  35350. for (i = 0, n = len - 1; i < n; i++) {
  35351. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  35352. if (i < n - 1) {
  35353. steps.pop();
  35354. }
  35355. ret = ret.concat(steps);
  35356. }
  35357. //删除多余元素
  35358. var nouse = ret.length - total;
  35359. for(var j = 0, index = 0; j< nouse; j++){
  35360. ret.splice(index+2,1);
  35361. }
  35362. }
  35363. return ret;
  35364. }
  35365. }
  35366. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  35367. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  35368. class ArrayStatistic {
  35369. // geostatsInstance: null,
  35370. /**
  35371. * 初始化插件实例
  35372. */
  35373. static newInstance() {
  35374. // if(!this.geostatsInstance) {
  35375. // // this.geostatsInstance = new geostats();
  35376. // // }
  35377. // window.dataList = [];
  35378. if(!this.geostatsInstance) {
  35379. this.geostatsInstance = new window.geostats();
  35380. }
  35381. return this.geostatsInstance;
  35382. }
  35383. /**
  35384. * 设置需要被处理的数组
  35385. *
  35386. * @param array
  35387. */
  35388. static getInstance(array) {
  35389. let instance = this.newInstance();
  35390. instance.setSerie(array);
  35391. return instance;
  35392. }
  35393. /**
  35394. * 获取数组统计的值
  35395. *
  35396. * @param array 需要统计的数组
  35397. * @param type 统计方法
  35398. */
  35399. static getArrayStatistic(array, type){
  35400. if(!array.length) {
  35401. return 0;
  35402. }
  35403. if(type === "Sum" || type === "求和"){
  35404. return this.getSum(array);
  35405. } else if(type === "Maximum" || type === "最大值"){
  35406. return this.getMax(array);
  35407. } else if(type === "Minimum" || type === "最小值"){
  35408. return this.getMin(array);
  35409. } else if(type === "Average" || type === "平均值"){
  35410. return this.getMean(array);
  35411. } else if(type === "Median" || type === "中位数"){
  35412. return this.getMedian(array);
  35413. } else if(type === "times" || type === "计数"){
  35414. return this.getTimes(array);
  35415. }
  35416. }
  35417. /**
  35418. * 获取数组分段后的数值
  35419. *
  35420. * @param array 需要分段的数组
  35421. * @param type 分段方法
  35422. * @param segNum 分段个数
  35423. */
  35424. static getArraySegments(array, type, segNum) {
  35425. if(type === "offset") {
  35426. return this.getEqInterval(array, segNum);
  35427. } else if(type === "jenks") {
  35428. return this.getJenks(array, segNum);
  35429. } else if(type === "square") {
  35430. // 数据都必须 >= 0
  35431. let minValue = this.getMin(array);
  35432. if(minValue >= 0){
  35433. return this.getSqrtInterval(array, segNum);
  35434. }else {
  35435. //console.log('数据都必须 >= 0');
  35436. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  35437. return false;
  35438. }
  35439. } else if(type === "logarithm") {
  35440. // 数据都必须 > 0
  35441. let minValue = this.getMin(array);
  35442. if(minValue > 0){
  35443. return this.getGeometricProgression(array, segNum);
  35444. }else {
  35445. //console.log('数据都必须 > 0');
  35446. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  35447. return false;
  35448. }
  35449. }
  35450. }
  35451. /**
  35452. * 求和
  35453. * @param array
  35454. * @returns {number}
  35455. */
  35456. static getSum(array){
  35457. return this.getInstance(array).sum();
  35458. }
  35459. /**
  35460. * 最小值
  35461. * @param array
  35462. * @returns {*}
  35463. */
  35464. static getMax(array){
  35465. return this.getInstance(array).max();
  35466. }
  35467. /**
  35468. * 最大值
  35469. * @param array
  35470. * @returns {*}
  35471. */
  35472. static getMin(array){
  35473. return this.getInstance(array).min();
  35474. }
  35475. /**
  35476. * 求平均
  35477. * @param array
  35478. * @returns {number}
  35479. */
  35480. static getMean(array){
  35481. return this.getInstance(array).mean();
  35482. }
  35483. /**
  35484. * 求中位数
  35485. *
  35486. * @param array
  35487. * @returns {number}
  35488. */
  35489. static getMedian(array) {
  35490. return this.getInstance(array).median();
  35491. }
  35492. /**
  35493. * 计数
  35494. *
  35495. * @param array
  35496. * @returns {number}
  35497. */
  35498. static getTimes(array) {
  35499. return array.length;
  35500. }
  35501. /**
  35502. * 等距分段法
  35503. *
  35504. * @param array
  35505. * @param segNum
  35506. */
  35507. static getEqInterval(array, segNum) {
  35508. return this.getInstance(array).getClassEqInterval(segNum);
  35509. }
  35510. /**
  35511. * 自然断裂法
  35512. *
  35513. * @param array
  35514. * @param segNum
  35515. */
  35516. static getJenks(array, segNum) {
  35517. return this.getInstance(array).getClassJenks(segNum);
  35518. }
  35519. /**
  35520. * 平方根分段法
  35521. *
  35522. * @param array
  35523. * @param segNum
  35524. */
  35525. static getSqrtInterval(array, segNum) {
  35526. array = array.map(function(value) {
  35527. return Math.sqrt(value);
  35528. });
  35529. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  35530. return (
  35531. breaks.map(function(value) {
  35532. return value * value;
  35533. })
  35534. )
  35535. }
  35536. /**
  35537. * 对数分段法
  35538. *
  35539. * @param array
  35540. * @param segNum
  35541. */
  35542. static getGeometricProgression(array, segNum) {
  35543. return this.getInstance(array).getClassGeometricProgression(segNum);
  35544. }
  35545. }
  35546. SuperMap.ArrayStatistic = ArrayStatistic;
  35547. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  35548. var getMeterPerMapUnit = function(mapUnit) {
  35549. var earchRadiusInMeters = 6378137;
  35550. var meterPerMapUnit;
  35551. if (mapUnit === Unit.METER) {
  35552. meterPerMapUnit = 1;
  35553. } else if (mapUnit === Unit.DEGREE) {
  35554. // 每度表示多少米。
  35555. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  35556. } else if (mapUnit === Unit.KILOMETER) {
  35557. meterPerMapUnit = 1.0e-3;
  35558. } else if (mapUnit === Unit.INCH) {
  35559. meterPerMapUnit = 1 / 2.5399999918e-2;
  35560. } else if (mapUnit === Unit.FOOT) {
  35561. meterPerMapUnit = 0.3048;
  35562. } else {
  35563. return meterPerMapUnit;
  35564. }
  35565. return meterPerMapUnit;
  35566. };
  35567. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  35568. var max = range[1],
  35569. min = range[0],
  35570. d = max - min;
  35571. if (x === max && includeMax) {
  35572. return x;
  35573. }
  35574. if (x === min && includeMin) {
  35575. return x;
  35576. }
  35577. var tmp = (((x - min) % d) + d) % d;
  35578. if (tmp === 0 && includeMax) {
  35579. return max;
  35580. }
  35581. return ((((x - min) % d) + d) % d) + min;
  35582. }
  35583. function conversionDegree(degrees) {
  35584. const degree = parseInt(degrees);
  35585. let fraction = parseInt((degrees - degree) * 60);
  35586. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  35587. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  35588. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  35589. return `${degree}°${fraction}'${second}`;
  35590. }
  35591. ;// CONCATENATED MODULE: ./src/common/util/index.js
  35592. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35593. * This program are made available under the terms of the Apache License, Version 2.0
  35594. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35595. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  35596. var lodash_topairs = __webpack_require__(52);
  35597. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  35598. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  35599. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35600. * This program are made available under the terms of the Apache License, Version 2.0
  35601. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35602. /**
  35603. * @class SuperMap.CartoCSS
  35604. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  35605. * @category BaseTypes Style
  35606. * @param {string} cartoStr - CartoCSS 样式表字符串
  35607. * @example
  35608. * var cartocss = "@provinceLineColor:#ddd;
  35609. * #China_Provinces_L___China400{
  35610. * line-dasharray:10,10;
  35611. * line-color:@provinceLineColor;
  35612. * line-width:1;
  35613. * }";
  35614. * new SuperMap.CartoCSS(cartocss);
  35615. */
  35616. /*eslint no-useless-escape: "off"*/
  35617. class CartoCSS {
  35618. constructor(cartoStr) {
  35619. this.env = null;
  35620. /**
  35621. * @member SuperMap.CartoCSS.prototype.parser
  35622. * @description 解析器
  35623. */
  35624. this.parser = null;
  35625. /**
  35626. * @member SuperMap.CartoCSS.prototype.ruleSet
  35627. * @description CartoCSS 规则对象
  35628. */
  35629. this.ruleSet = null;
  35630. /**
  35631. * @member SuperMap.CartoCSS.prototype.cartoStr
  35632. * @description CartoCSS 样式表字符串
  35633. */
  35634. this.cartoStr = "";
  35635. /**
  35636. * @member SuperMap.CartoCSS.prototype.shaders
  35637. * @description Carto 着色器集
  35638. */
  35639. this.shaders = null;
  35640. if (typeof cartoStr === "string") {
  35641. this.cartoStr = cartoStr;
  35642. this.env = {
  35643. frames: [],
  35644. errors: [],
  35645. error: function (obj) {
  35646. this.errors.push(obj);
  35647. }
  35648. };
  35649. this.parser = this.getParser(this.env);
  35650. this.parse(cartoStr);
  35651. this.shaders = this.toShaders();
  35652. }
  35653. }
  35654. /**
  35655. * @function SuperMap.CartoCSS.prototype.getParser
  35656. * @description 获取 CartoCSS 解析器
  35657. */
  35658. getParser(env) {
  35659. var input, // LeSS input string
  35660. i, // current index in `input`
  35661. j, // current chunk
  35662. temp, // temporarily holds a chunk's state, for backtracking
  35663. memo, // temporarily holds `i`, when backtracking
  35664. furthest, // furthest index the parser has gone to
  35665. chunks, // chunkified input
  35666. current, // index of current chunk, in `input`
  35667. parser;
  35668. var that = this;
  35669. // This function is called after all files
  35670. // have been imported through `@import`.
  35671. var finish = function () {//NOSONAR
  35672. //所有文件导入完成之后调用
  35673. };
  35674. function save() {
  35675. temp = chunks[j];
  35676. memo = i;
  35677. current = i;
  35678. }
  35679. function restore() {
  35680. chunks[j] = temp;
  35681. i = memo;
  35682. current = i;
  35683. }
  35684. function sync() {
  35685. if (i > current) {
  35686. chunks[j] = chunks[j].slice(i - current);
  35687. current = i;
  35688. }
  35689. }
  35690. //
  35691. // Parse from a token, regexp or string, and move forward if match
  35692. //
  35693. function _match(tok) {
  35694. var match, length, c, endIndex;
  35695. // Non-terminal
  35696. if (tok instanceof Function) {
  35697. return tok.call(parser.parsers);
  35698. // Terminal
  35699. // Either match a single character in the input,
  35700. // or match a regexp in the current chunk (chunk[j]).
  35701. } else if (typeof(tok) === 'string') {
  35702. match = input.charAt(i) === tok ? tok : null;
  35703. length = 1;
  35704. sync();
  35705. } else {
  35706. sync();
  35707. match = tok.exec(chunks[j]);
  35708. if (match) {
  35709. length = match[0].length;
  35710. } else {
  35711. return null;
  35712. }
  35713. }
  35714. // The match is confirmed, add the match length to `i`,
  35715. // and consume any extra white-space characters (' ' || '\n')
  35716. // which come after that. The reason for this is that LeSS's
  35717. // grammar is mostly white-space insensitive.
  35718. if (match) {
  35719. var mem = i += length;
  35720. endIndex = i + chunks[j].length - length;
  35721. while (i < endIndex) {
  35722. c = input.charCodeAt(i);
  35723. if (!(c === 32 || c === 10 || c === 9)) {
  35724. break;
  35725. }
  35726. i++;
  35727. }
  35728. chunks[j] = chunks[j].slice(length + (i - mem));
  35729. current = i;
  35730. if (chunks[j].length === 0 && j < chunks.length - 1) {
  35731. j++;
  35732. }
  35733. if (typeof(match) === 'string') {
  35734. return match;
  35735. } else {
  35736. return match.length === 1 ? match[0] : match;
  35737. }
  35738. }
  35739. }
  35740. // Same as _match(), but don't change the state of the parser,
  35741. // just return the match.
  35742. function peek(tok) {
  35743. if (typeof(tok) === 'string') {
  35744. return input.charAt(i) === tok;
  35745. } else {
  35746. return !!tok.test(chunks[j]);
  35747. }
  35748. }
  35749. // Make an error object from a passed set of properties.
  35750. // Accepted properties:
  35751. // - `message`: Text of the error message.
  35752. // - `filename`: Filename where the error occurred.
  35753. // - `index`: Char. index where the error occurred.
  35754. function makeError(err) {
  35755. var einput;
  35756. var defautls = {
  35757. index: furthest,
  35758. filename: env.filename,
  35759. message: 'Parse error.',
  35760. line: 0,
  35761. column: -1
  35762. };
  35763. for (var prop in defautls) {
  35764. if (err[prop] === 0) {
  35765. err[prop] = defautls[prop];
  35766. }
  35767. }
  35768. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  35769. einput = that.env.inputs[err.filename];
  35770. } else {
  35771. einput = input;
  35772. }
  35773. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  35774. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  35775. err.column++;
  35776. }
  35777. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  35778. }
  35779. this.env = env = env || {};
  35780. this.env.filename = this.env.filename || null;
  35781. this.env.inputs = this.env.inputs || {};
  35782. // The Parser
  35783. parser = {
  35784. // Parse an input string into an abstract syntax tree.
  35785. // Throws an error on parse errors.
  35786. parse: function (str) {
  35787. var root, error = null;
  35788. i = j = current = furthest = 0;
  35789. chunks = [];
  35790. input = str.replace(/\r\n/g, '\n');
  35791. if (env.filename) {
  35792. that.env.inputs[env.filename] = input;
  35793. }
  35794. // Split the input into chunks.
  35795. chunks = (function (chunks) {
  35796. var j = 0,
  35797. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  35798. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  35799. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  35800. level = 0,
  35801. match,
  35802. chunk = chunks[0],
  35803. inParam;
  35804. for (var i = 0, c, cc; i < input.length;) {
  35805. skip.lastIndex = i;
  35806. if (match = skip.exec(input)) {
  35807. if (match.index === i) {
  35808. i += match[0].length;
  35809. chunk.push(match[0]);
  35810. }
  35811. }
  35812. c = input.charAt(i);
  35813. comment.lastIndex = string.lastIndex = i;
  35814. if (match = string.exec(input)) {
  35815. if (match.index === i) {
  35816. i += match[0].length;
  35817. chunk.push(match[0]);
  35818. continue;
  35819. }
  35820. }
  35821. if (!inParam && c === '/') {
  35822. cc = input.charAt(i + 1);
  35823. if (cc === '/' || cc === '*') {
  35824. if (match = comment.exec(input)) {
  35825. if (match.index === i) {
  35826. i += match[0].length;
  35827. chunk.push(match[0]);
  35828. continue;
  35829. }
  35830. }
  35831. }
  35832. }
  35833. switch (c) {
  35834. case '{'://NOSONAR
  35835. if (!inParam) {
  35836. level++;
  35837. chunk.push(c);
  35838. break;
  35839. }
  35840. case '}'://NOSONAR
  35841. if (!inParam) {
  35842. level--;
  35843. chunk.push(c);
  35844. chunks[++j] = chunk = [];
  35845. break;
  35846. }
  35847. case '('://NOSONAR
  35848. if (!inParam) {
  35849. inParam = true;
  35850. chunk.push(c);
  35851. break;
  35852. }
  35853. case ')'://NOSONAR
  35854. if (inParam) {
  35855. inParam = false;
  35856. chunk.push(c);
  35857. break;
  35858. }
  35859. default:
  35860. chunk.push(c);
  35861. break;
  35862. }
  35863. i++;
  35864. }
  35865. if (level !== 0) {
  35866. error = {
  35867. index: i - 1,
  35868. type: 'Parse',
  35869. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  35870. };
  35871. }
  35872. return chunks.map(function (c) {
  35873. return c.join('');
  35874. });
  35875. })([[]]);
  35876. if (error) {
  35877. throw makeError(error);
  35878. }
  35879. // Sort rules by specificity: this function expects selectors to be
  35880. // split already.
  35881. //
  35882. // Written to be used as a .sort(Function);
  35883. // argument.
  35884. //
  35885. // [1, 0, 0, 467] > [0, 0, 1, 520]
  35886. var specificitySort = function (a, b) {
  35887. var as = a.specificity;
  35888. var bs = b.specificity;
  35889. if (as[0] != bs[0]) {return bs[0] - as[0];}
  35890. if (as[1] != bs[1]) {return bs[1] - as[1];}
  35891. if (as[2] != bs[2]) {return bs[2] - as[2];}
  35892. return bs[3] - as[3];
  35893. };
  35894. // Start with the primary rule.
  35895. // The whole syntax tree is held under a Ruleset node,
  35896. // with the `root` property set to true, so no `{}` are
  35897. // output.
  35898. root = new SuperMap.CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  35899. root.root = true;
  35900. // Get an array of Ruleset objects, flattened
  35901. // and sorted according to specificitySort
  35902. root.toList = (function () {
  35903. return function (env) {
  35904. env.error = function (e) {
  35905. if (!env.errors) {env.errors = new Error('');}
  35906. if (env.errors.message) {
  35907. env.errors.message += '\n' + makeError(e).message;
  35908. } else {
  35909. env.errors.message = makeError(e).message;
  35910. }
  35911. };
  35912. env.frames = env.frames || [];
  35913. // call populates Invalid-caused errors
  35914. var definitions = this.flatten([], [], env);
  35915. definitions.sort(specificitySort);
  35916. return definitions;
  35917. };
  35918. })();
  35919. return root;
  35920. },
  35921. // Here in, the parsing rules/functions
  35922. //
  35923. // The basic structure of the syntax tree generated is as follows:
  35924. //
  35925. // Ruleset -> Rule -> Value -> Expression -> Entity
  35926. //
  35927. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  35928. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  35929. // first, before parsing, that's when we use `peek()`.
  35930. parsers: {
  35931. // The `primary` rule is the *entry* and *exit* point of the parser.
  35932. // The rules here can appear at any level of the parse tree.
  35933. //
  35934. // The recursive nature of the grammar is an interplay between the `block`
  35935. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  35936. // as represented by this simplified grammar:
  35937. //
  35938. // primary → (ruleset | rule)+
  35939. // ruleset → selector+ block
  35940. // block → '{' primary '}'
  35941. //
  35942. // Only at one point is the primary rule not called from the
  35943. // block rule: at the root level.
  35944. primary: function () {
  35945. var node, root = [];
  35946. while ((node = _match(this.rule) || _match(this.ruleset) ||
  35947. _match(this.comment)) ||
  35948. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  35949. if (node) {root.push(node);}
  35950. }
  35951. return root;
  35952. },
  35953. invalid: function () {
  35954. var chunk = _match(/^[^;\n]*[;\n]/);
  35955. // To fail gracefully, match everything until a semicolon or linebreak.
  35956. if (chunk) {
  35957. return new SuperMap.CartoCSS.Tree.Invalid(chunk, memo);
  35958. }
  35959. },
  35960. // We create a Comment node for CSS comments `/* */`,
  35961. // but keep the LeSS comments `//` silent, by just skipping
  35962. // over them.
  35963. comment: function () {
  35964. var comment;
  35965. if (input.charAt(i) !== '/') {return;}
  35966. if (input.charAt(i + 1) === '/') {
  35967. return new SuperMap.CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  35968. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  35969. return new SuperMap.CartoCSS.Tree.Comment(comment);
  35970. }
  35971. },
  35972. // Entities are tokens which can be found inside an Expression
  35973. entities: {
  35974. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  35975. quoted: function () {
  35976. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  35977. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  35978. if (str) {
  35979. return new SuperMap.CartoCSS.Tree.Quoted(str[1] || str[2]);
  35980. }
  35981. },
  35982. // A reference to a Mapnik field, like [NAME]
  35983. // Behind the scenes, this has the same representation, but Carto
  35984. // needs to be careful to warn when unsupported operations are used.
  35985. field: function () {
  35986. var l = '[', r = ']';
  35987. if (!_match(l)) {return;}
  35988. var field_name = _match(/(^[^\]]+)/);
  35989. if (!_match(r)) {return;}
  35990. if (field_name) {return new SuperMap.CartoCSS.Tree.Field(field_name[1]);}
  35991. },
  35992. // This is a comparison operator
  35993. comparison: function () {
  35994. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  35995. if (str) {
  35996. return str;
  35997. }
  35998. },
  35999. // A catch-all word, such as: hard-light
  36000. // These can start with either a letter or a dash (-),
  36001. // and then contain numbers, underscores, and letters.
  36002. keyword: function () {
  36003. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  36004. if (k) {
  36005. return new SuperMap.CartoCSS.Tree.Keyword(k);
  36006. }
  36007. },
  36008. // A function call like rgb(255, 0, 255)
  36009. // The arguments are parsed with the `entities.arguments` parser.
  36010. call: function () {
  36011. var name, args;
  36012. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  36013. name = name[1];
  36014. if (name === 'url') {
  36015. // url() is handled by the url parser instead
  36016. return null;
  36017. } else {
  36018. i += name.length;
  36019. }
  36020. var l = '(', r = ')';
  36021. _match(l); // Parse the '(' and consume whitespace.
  36022. args = _match(this.entities['arguments']);
  36023. if (!_match(r)) {return;}
  36024. if (name) {
  36025. return new SuperMap.CartoCSS.Tree.Call(name, args, i);
  36026. }
  36027. },
  36028. // Arguments are comma-separated expressions
  36029. 'arguments': function () {
  36030. var args = [], arg;
  36031. while (arg = _match(this.expression)) {
  36032. args.push(arg);
  36033. var q = ',';
  36034. if (!_match(q)) {
  36035. break;
  36036. }
  36037. }
  36038. return args;
  36039. },
  36040. literal: function () {
  36041. return _match(this.entities.dimension) ||
  36042. _match(this.entities.keywordcolor) ||
  36043. _match(this.entities.hexcolor) ||
  36044. _match(this.entities.quoted);
  36045. },
  36046. // Parse url() tokens
  36047. //
  36048. // We use a specific rule for urls, because they don't really behave like
  36049. // standard function calls. The difference is that the argument doesn't have
  36050. // to be enclosed within a string, so it can't be parsed as an Expression.
  36051. url: function () {
  36052. var value;
  36053. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  36054. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  36055. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  36056. var r = ')';
  36057. if (!_match(r)) {
  36058. return new SuperMap.CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  36059. } else {
  36060. return new SuperMap.CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  36061. value instanceof SuperMap.CartoCSS.Tree.Variable) ?
  36062. value : new SuperMap.CartoCSS.Tree.Quoted(value));
  36063. }
  36064. },
  36065. // A Variable entity, such as `@fink`, in
  36066. //
  36067. // width: @fink + 2px
  36068. //
  36069. // We use a different parser for variable definitions,
  36070. // see `parsers.variable`.
  36071. variable: function () {
  36072. var name, index = i;
  36073. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  36074. return new SuperMap.CartoCSS.Tree.Variable(name, index, env.filename);
  36075. }
  36076. },
  36077. hexcolor: function () {
  36078. var rgb;
  36079. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  36080. return new SuperMap.CartoCSS.Tree.Color(rgb[1]);
  36081. }
  36082. },
  36083. keywordcolor: function () {
  36084. var rgb = chunks[j].match(/^[a-z]+/);
  36085. if (rgb && rgb[0] in SuperMap.CartoCSS.Tree.Reference.data.colors) {
  36086. return new SuperMap.CartoCSS.Tree.Color(SuperMap.CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  36087. }
  36088. },
  36089. // A Dimension, that is, a number and a unit. The only
  36090. // unit that has an effect is %
  36091. dimension: function () {
  36092. var c = input.charCodeAt(i);
  36093. if ((c > 57 || c < 45) || c === 47) {return;}
  36094. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  36095. if (value) {
  36096. return new SuperMap.CartoCSS.Tree.Dimension(value[1], value[2], memo);
  36097. }
  36098. }
  36099. },
  36100. // The variable part of a variable definition.
  36101. // Used in the `rule` parser. Like @fink:
  36102. variable: function () {
  36103. var name;
  36104. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  36105. return name[1];
  36106. }
  36107. },
  36108. // Entities are the smallest recognized token,
  36109. // and can be found inside a rule's value.
  36110. entity: function () {
  36111. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  36112. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  36113. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  36114. return property1 || property2 || property3;
  36115. },
  36116. // A Rule terminator. Note that we use `peek()` to check for '}',
  36117. // because the `block` rule will be expecting it, but we still need to make sure
  36118. // it's there, if ';' was ommitted.
  36119. end: function () {
  36120. var q = ';';
  36121. return _match(q) || peek('}');
  36122. },
  36123. // Elements are the building blocks for Selectors. They consist of
  36124. // an element name, such as a tag a class, or `*`.
  36125. //增加对中文的支持,[\u4e00-\u9fa5]
  36126. element: function () {
  36127. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  36128. if (e) {return new SuperMap.CartoCSS.Tree.Element(e);}
  36129. },
  36130. // Attachments allow adding multiple lines, polygons etc. to an
  36131. // object. There can only be one attachment per selector.
  36132. attachment: function () {
  36133. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  36134. if (s) {return s[1];}
  36135. },
  36136. // Selectors are made out of one or more Elements, see above.
  36137. selector: function () {
  36138. var a, attachment,
  36139. e, elements = [],
  36140. f, filters = new SuperMap.CartoCSS.Tree.Filterset(),
  36141. z, zooms = [],
  36142. segments = 0, conditions = 0;
  36143. while (
  36144. (e = _match(this.element)) ||
  36145. (z = _match(this.zoom)) ||
  36146. (f = _match(this.filter)) ||
  36147. (a = _match(this.attachment))
  36148. ) {
  36149. segments++;
  36150. if (e) {
  36151. elements.push(e);
  36152. } else if (z) {
  36153. zooms.push(z);
  36154. conditions++;
  36155. } else if (f) {
  36156. var err = filters.add(f);
  36157. if (err) {
  36158. throw makeError({
  36159. message: err,
  36160. index: i - 1
  36161. });
  36162. }
  36163. conditions++;
  36164. } else if (attachment) {
  36165. throw makeError({
  36166. message: 'Encountered second attachment name.',
  36167. index: i - 1
  36168. });
  36169. } else {
  36170. attachment = a;
  36171. }
  36172. var c = input.charAt(i);
  36173. if (c === '{' || c === '}' || c === ';' || c === ',') {
  36174. break;
  36175. }
  36176. }
  36177. if (segments) {
  36178. return new SuperMap.CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  36179. }
  36180. },
  36181. filter: function () {
  36182. save();
  36183. var key, op, val, l = '[', r = ']';
  36184. if (!_match(l)) {return;}
  36185. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  36186. _match(this.entities.quoted) ||
  36187. _match(this.entities.variable) ||
  36188. _match(this.entities.keyword) ||
  36189. _match(this.entities.field)) {
  36190. if (key instanceof SuperMap.CartoCSS.Tree.Quoted) {
  36191. key = new SuperMap.CartoCSS.Tree.Field(key.toString());
  36192. }
  36193. if ((op = _match(this.entities.comparison)) &&
  36194. (val = _match(this.entities.quoted) ||
  36195. _match(this.entities.variable) ||
  36196. _match(this.entities.dimension) ||
  36197. _match(this.entities.keyword) ||
  36198. _match(this.entities.field))) {
  36199. if (!_match(r)) {
  36200. throw makeError({
  36201. message: 'Missing closing ] of filter.',
  36202. index: memo - 1
  36203. });
  36204. }
  36205. if (!key.is) {key = new SuperMap.CartoCSS.Tree.Field(key);}
  36206. return new SuperMap.CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  36207. }
  36208. }
  36209. },
  36210. zoom: function () {
  36211. save();
  36212. var op, val, r = ']';
  36213. if (_match(/^\[\s*zoom/g) &&
  36214. (op = _match(this.entities.comparison)) &&
  36215. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  36216. return new SuperMap.CartoCSS.Tree.Zoom(op, val, memo);
  36217. } else {
  36218. // backtrack
  36219. restore();
  36220. }
  36221. },
  36222. // The `block` rule is used by `ruleset`
  36223. // It's a wrapper around the `primary` rule, with added `{}`.
  36224. block: function () {
  36225. var content, l = '{', r = '}';
  36226. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  36227. return content;
  36228. }
  36229. },
  36230. // div, .class, body > p {...}
  36231. ruleset: function () {
  36232. var selectors = [], s, rules, q = ',';
  36233. save();
  36234. while (s = _match(this.selector)) {
  36235. selectors.push(s);
  36236. while (_match(this.comment)) {//NOSONAR
  36237. }
  36238. if (!_match(q)) {
  36239. break;
  36240. }
  36241. while (_match(this.comment)) {//NOSONAR
  36242. }
  36243. }
  36244. if (s) {
  36245. while (_match(this.comment)) {//NOSONAR
  36246. }
  36247. }
  36248. if (selectors.length > 0 && (rules = _match(this.block))) {
  36249. if (selectors.length === 1 &&
  36250. selectors[0].elements.length &&
  36251. selectors[0].elements[0].value === 'Map') {
  36252. var rs = new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  36253. rs.isMap = true;
  36254. return rs;
  36255. }
  36256. return new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  36257. } else {
  36258. // Backtrack
  36259. restore();
  36260. }
  36261. },
  36262. rule: function () {
  36263. var name, value, c = input.charAt(i);
  36264. save();
  36265. if (c === '.' || c === '#') {
  36266. return;
  36267. }
  36268. if (name = _match(this.variable) || _match(this.property)) {
  36269. value = _match(this.value);
  36270. if (value && _match(this.end)) {
  36271. return new SuperMap.CartoCSS.Tree.Rule(name, value, memo, env.filename);
  36272. } else {
  36273. furthest = i;
  36274. restore();
  36275. }
  36276. }
  36277. },
  36278. font: function () {
  36279. var value = [], expression = [], e, q = ',';
  36280. while (e = _match(this.entity)) {
  36281. expression.push(e);
  36282. }
  36283. value.push(new SuperMap.CartoCSS.Tree.Expression(expression));
  36284. if (_match(q)) {
  36285. while (e = _match(this.expression)) {
  36286. value.push(e);
  36287. if (!_match(q)) {
  36288. break;
  36289. }
  36290. }
  36291. }
  36292. return new SuperMap.CartoCSS.Tree.Value(value);
  36293. },
  36294. // A Value is a comma-delimited list of Expressions
  36295. // In a Rule, a Value represents everything after the `:`,
  36296. // and before the `;`.
  36297. value: function () {
  36298. var e, expressions = [], q = ',';
  36299. while (e = _match(this.expression)) {
  36300. expressions.push(e);
  36301. if (!_match(q)) {
  36302. break;
  36303. }
  36304. }
  36305. if (expressions.length > 1) {
  36306. return new SuperMap.CartoCSS.Tree.Value(expressions.map(function (e) {
  36307. return e.value[0];
  36308. }));
  36309. } else if (expressions.length === 1) {
  36310. return new SuperMap.CartoCSS.Tree.Value(expressions);
  36311. }
  36312. },
  36313. // A sub-expression, contained by parenthensis
  36314. sub: function () {
  36315. var e, l = '(', r = ")";
  36316. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  36317. return e;
  36318. }
  36319. },
  36320. // This is a misnomer because it actually handles multiplication
  36321. // and division.
  36322. multiplication: function () {
  36323. var m, a, op, operation, q = '/';
  36324. if (m = _match(this.operand)) {
  36325. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  36326. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  36327. }
  36328. return operation || m;
  36329. }
  36330. },
  36331. addition: function () {
  36332. var m, a, op, operation, plus = '+';
  36333. if (m = _match(this.multiplication)) {
  36334. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  36335. (a = _match(this.multiplication))) {
  36336. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  36337. }
  36338. return operation || m;
  36339. }
  36340. },
  36341. // An operand is anything that can be part of an operation,
  36342. // such as a Color, or a Variable
  36343. operand: function () {
  36344. return _match(this.sub) || _match(this.entity);
  36345. },
  36346. // Expressions either represent mathematical operations,
  36347. // or white-space delimited Entities. @var * 2
  36348. expression: function () {
  36349. var e, entities = [];
  36350. while (e = _match(this.addition) || _match(this.entity)) {
  36351. entities.push(e);
  36352. }
  36353. if (entities.length > 0) {
  36354. return new SuperMap.CartoCSS.Tree.Expression(entities);
  36355. }
  36356. },
  36357. property: function () {
  36358. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  36359. if (name) {return name[1];}
  36360. }
  36361. }
  36362. };
  36363. return parser;
  36364. }
  36365. /**
  36366. * @function SuperMap.CartoCSS.prototype.parse
  36367. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集
  36368. * @returns {Object} CartoCSS规则集
  36369. */
  36370. parse(str) {
  36371. var parser = this.parser;
  36372. var ruleSet = this.ruleSet = parser.parse(str);
  36373. return ruleSet;
  36374. }
  36375. /**
  36376. * @function SuperMap.CartoCSS.prototype.toShaders
  36377. * @description 将CartoCSS规则集转化为着色器
  36378. * @returns {Array} CartoCSS着色器集
  36379. */
  36380. toShaders() {
  36381. if (this.ruleSet) {
  36382. var ruleset = this.ruleSet;
  36383. if (ruleset) {
  36384. var defs = ruleset.toList(this.env);
  36385. defs.reverse();
  36386. var shaders = {};
  36387. var keys = [];
  36388. this._toShaders(shaders,keys,defs);
  36389. var ordered_shaders = [];
  36390. var done = {};
  36391. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  36392. var def = defs[i];
  36393. var k = def.attachment;
  36394. var shader = shaders[keys[i]];
  36395. var shaderArray = [];
  36396. if (!done[k]) {
  36397. var j = 0;
  36398. for (var prop in shader) {
  36399. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  36400. //对layer-index作特殊处理以实现图层的控制
  36401. if (prop === "layer-index") {
  36402. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  36403. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  36404. var _value = null;
  36405. shader[prop].join('\n');
  36406. return _value;
  36407. };
  36408. var layerIndex = getLayerIndex();
  36409. Object.defineProperty(shaderArray, "layerIndex", {
  36410. configurable: true,
  36411. enumerable: false,
  36412. value: layerIndex
  36413. });
  36414. } else {
  36415. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  36416. if (!Array.isArray(ops)) {
  36417. return ops;
  36418. }
  36419. var body = ops.join('\n');
  36420. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  36421. var index = body.indexOf(myKeyword);
  36422. if (index >= 0) {
  36423. //对featureID作一些特殊处理,以将featureID提取出来
  36424. if (!shaderArray.featureFilter) {
  36425. var featureFilterStart = index + myKeyword.length;
  36426. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  36427. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  36428. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  36429. var featureFilter = function (featureId) {
  36430. if (featureFilterStr) {
  36431. return true;
  36432. }
  36433. return false;
  36434. }
  36435. Object.defineProperty(shaderArray, "featureFilter", {
  36436. configurable: true,
  36437. enumerable: false,
  36438. value: featureFilter
  36439. });
  36440. }
  36441. return {
  36442. "property": prop,
  36443. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  36444. };
  36445. } else {
  36446. return {
  36447. "property": prop,
  36448. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  36449. };
  36450. }
  36451. }(shader[prop], shaderArray);
  36452. }
  36453. }
  36454. }
  36455. Object.defineProperty(shaderArray, "attachment", {
  36456. configurable: true,
  36457. enumerable: false,
  36458. value: k
  36459. });
  36460. Object.defineProperty(shaderArray, "elements", {
  36461. configurable: true,
  36462. enumerable: false,
  36463. value: def.elements
  36464. });
  36465. ordered_shaders.push(shaderArray);
  36466. done[keys[i]] = true;
  36467. }
  36468. Object.defineProperty(shaderArray, "zoom", {
  36469. configurable: true,
  36470. enumerable: false,
  36471. value: def.zoom
  36472. });
  36473. //shader.frames.push(def.frame_offset);
  36474. }
  36475. return ordered_shaders;
  36476. }
  36477. }
  36478. return null;
  36479. }
  36480. _toShaders(shaders, keys,defs) {
  36481. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  36482. let def = defs[i];
  36483. let element_str = [];
  36484. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  36485. element_str.push(def.elements[j]);
  36486. }
  36487. let filters = def.filters.filters;
  36488. let filterStr = [];
  36489. for (let attr in filters) {
  36490. filterStr.push(filters[attr].id);
  36491. }
  36492. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  36493. keys.push(key);
  36494. let shader = shaders[key] = (shaders[key] || {});
  36495. //shader.frames = [];
  36496. shader.zoom = SuperMap.CartoCSS.Tree.Zoom.all;
  36497. let props = def.toJS(this.env);
  36498. for (let v in props) {
  36499. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  36500. }
  36501. }
  36502. }
  36503. /**
  36504. * @function SuperMap.CartoCSS.prototype.getShaders
  36505. * @description 获取CartoCSS着色器
  36506. * @returns {Array} 着色器集
  36507. * @example
  36508. * //shaders的结构大概如下:
  36509. * var shaders=[
  36510. * {
  36511. * attachment:"one",
  36512. * elements:[],
  36513. * zoom:23,
  36514. * length:2,
  36515. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  36516. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  36517. * },
  36518. * {
  36519. * attachment:"two",
  36520. * elements:[],
  36521. * zoom:23,
  36522. * length:2,
  36523. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  36524. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  36525. * }
  36526. * ];
  36527. */
  36528. getShaders() {
  36529. return this.shaders;
  36530. }
  36531. /**
  36532. * @function SuperMap.CartoCSS.prototype.destroy
  36533. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象
  36534. */
  36535. destroy() {
  36536. this.cartoStr = null;
  36537. this.env = null;
  36538. this.ruleSet = null;
  36539. this.parser = null;
  36540. this.shaders = null;
  36541. }
  36542. }
  36543. SuperMap._mapnik_reference_latest = {
  36544. "version": "2.1.1",
  36545. "style": {
  36546. "filter-mode": {
  36547. "type": [
  36548. "all",
  36549. "first"
  36550. ],
  36551. "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)",
  36552. "default-value": "all",
  36553. "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."
  36554. },
  36555. "image-filters": {
  36556. "css": "image-filters",
  36557. "default-value": "none",
  36558. "default-meaning": "no filters",
  36559. "type": "functions",
  36560. "functions": [
  36561. ["agg-stack-blur", 2],
  36562. ["emboss", 0],
  36563. ["blur", 0],
  36564. ["gray", 0],
  36565. ["sobel", 0],
  36566. ["edge-detect", 0],
  36567. ["x-gradient", 0],
  36568. ["y-gradient", 0],
  36569. ["invert", 0],
  36570. ["sharpen", 0]
  36571. ],
  36572. "doc": "A list of image filters."
  36573. },
  36574. "comp-op": {
  36575. "css": "comp-op",
  36576. "default-value": "src-over",
  36577. "default-meaning": "add the current layer on top of other layers",
  36578. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  36579. "type": ["clear",
  36580. "src",
  36581. "dst",
  36582. "src-over",
  36583. "dst-over",
  36584. "src-in",
  36585. "dst-in",
  36586. "src-out",
  36587. "dst-out",
  36588. "src-atop",
  36589. "dst-atop",
  36590. "xor",
  36591. "plus",
  36592. "minus",
  36593. "multiply",
  36594. "screen",
  36595. "overlay",
  36596. "darken",
  36597. "lighten",
  36598. "color-dodge",
  36599. "color-burn",
  36600. "hard-light",
  36601. "soft-light",
  36602. "difference",
  36603. "exclusion",
  36604. "contrast",
  36605. "invert",
  36606. "invert-rgb",
  36607. "grain-merge",
  36608. "grain-extract",
  36609. "hue",
  36610. "saturation",
  36611. "color",
  36612. "value"
  36613. ]
  36614. },
  36615. "opacity": {
  36616. "css": "opacity",
  36617. "type": "float",
  36618. "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)",
  36619. "default-value": 1,
  36620. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  36621. }
  36622. },
  36623. "layer": {
  36624. "name": {
  36625. "default-value": "",
  36626. "type": "string",
  36627. "required": true,
  36628. "default-meaning": "No layer name has been provided",
  36629. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  36630. },
  36631. "srs": {
  36632. "default-value": "",
  36633. "type": "string",
  36634. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  36635. "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'"
  36636. },
  36637. "status": {
  36638. "default-value": true,
  36639. "type": "boolean",
  36640. "default-meaning": "This layer will be marked as active and available for processing",
  36641. "doc": "A property that can be set to false to disable this layer from being processed"
  36642. },
  36643. "minzoom": {
  36644. "default-value": "0",
  36645. "type": "float",
  36646. "default-meaning": "The layer will be visible at the minimum possible scale",
  36647. "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"
  36648. },
  36649. "maxzoom": {
  36650. "default-value": "1.79769e+308",
  36651. "type": "float",
  36652. "default-meaning": "The layer will be visible at the maximum possible scale",
  36653. "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"
  36654. },
  36655. "queryable": {
  36656. "default-value": false,
  36657. "type": "boolean",
  36658. "default-meaning": "The layer will not be available for the direct querying of data values",
  36659. "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"
  36660. },
  36661. "clear-label-cache": {
  36662. "default-value": false,
  36663. "type": "boolean",
  36664. "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",
  36665. "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"
  36666. },
  36667. "group-by": {
  36668. "default-value": "",
  36669. "type": "string",
  36670. "default-meaning": "No special layer grouping will be used during rendering",
  36671. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  36672. },
  36673. "buffer-size": {
  36674. "default-value": "0",
  36675. "type": "float",
  36676. "default-meaning": "No buffer will be used",
  36677. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  36678. },
  36679. "maximum-extent": {
  36680. "default-value": "none",
  36681. "type": "bbox",
  36682. "default-meaning": "No clipping extent will be used",
  36683. "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."
  36684. }
  36685. },
  36686. "symbolizers": {
  36687. "*": {
  36688. "image-filters": {
  36689. "css": "image-filters",
  36690. "default-value": "none",
  36691. "default-meaning": "no filters",
  36692. "type": "functions",
  36693. "functions": [
  36694. ["agg-stack-blur", 2],
  36695. ["emboss", 0],
  36696. ["blur", 0],
  36697. ["gray", 0],
  36698. ["sobel", 0],
  36699. ["edge-detect", 0],
  36700. ["x-gradient", 0],
  36701. ["y-gradient", 0],
  36702. ["invert", 0],
  36703. ["sharpen", 0]
  36704. ],
  36705. "doc": "A list of image filters."
  36706. },
  36707. "comp-op": {
  36708. "css": "comp-op",
  36709. "default-value": "src-over",
  36710. "default-meaning": "add the current layer on top of other layers",
  36711. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  36712. "type": ["clear",
  36713. "src",
  36714. "dst",
  36715. "src-over",
  36716. "dst-over",
  36717. "src-in",
  36718. "dst-in",
  36719. "src-out",
  36720. "dst-out",
  36721. "src-atop",
  36722. "dst-atop",
  36723. "xor",
  36724. "plus",
  36725. "minus",
  36726. "multiply",
  36727. "screen",
  36728. "overlay",
  36729. "darken",
  36730. "lighten",
  36731. "color-dodge",
  36732. "color-burn",
  36733. "hard-light",
  36734. "soft-light",
  36735. "difference",
  36736. "exclusion",
  36737. "contrast",
  36738. "invert",
  36739. "invert-rgb",
  36740. "grain-merge",
  36741. "grain-extract",
  36742. "hue",
  36743. "saturation",
  36744. "color",
  36745. "value"
  36746. ]
  36747. },
  36748. "opacity": {
  36749. "css": "opacity",
  36750. "type": "float",
  36751. "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)",
  36752. "default-value": 1,
  36753. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  36754. }
  36755. },
  36756. "map": {
  36757. "background-color": {
  36758. "css": "background-color",
  36759. "default-value": "none",
  36760. "default-meaning": "transparent",
  36761. "type": "color",
  36762. "doc": "Map Background color"
  36763. },
  36764. "background-image": {
  36765. "css": "background-image",
  36766. "type": "uri",
  36767. "default-value": "",
  36768. "default-meaning": "transparent",
  36769. "doc": "An image that is repeated below all features on a map as a background.",
  36770. "description": "Map Background image"
  36771. },
  36772. "srs": {
  36773. "css": "srs",
  36774. "type": "string",
  36775. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  36776. "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",
  36777. "doc": "Map spatial reference (proj4 string)"
  36778. },
  36779. "buffer-size": {
  36780. "css": "buffer-size",
  36781. "default-value": "0",
  36782. "type": "float",
  36783. "default-meaning": "No buffer will be used",
  36784. "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\"."
  36785. },
  36786. "maximum-extent": {
  36787. "css": "",
  36788. "default-value": "none",
  36789. "type": "bbox",
  36790. "default-meaning": "No clipping extent will be used",
  36791. "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."
  36792. },
  36793. "base": {
  36794. "css": "base",
  36795. "default-value": "",
  36796. "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.",
  36797. "type": "string",
  36798. "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."
  36799. },
  36800. "paths-from-xml": {
  36801. "css": "",
  36802. "default-value": true,
  36803. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  36804. "type": "boolean",
  36805. "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()"
  36806. },
  36807. "minimum-version": {
  36808. "css": "",
  36809. "default-value": "none",
  36810. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  36811. "type": "string",
  36812. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  36813. },
  36814. "font-directory": {
  36815. "css": "font-directory",
  36816. "type": "uri",
  36817. "default-value": "none",
  36818. "default-meaning": "No map-specific fonts will be registered",
  36819. "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)."
  36820. }
  36821. },
  36822. "polygon": {
  36823. "fill": {
  36824. "css": "polygon-fill",
  36825. "type": "color",
  36826. "default-value": "rgba(128,128,128,1)",
  36827. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  36828. "doc": "Fill color to assign to a polygon"
  36829. },
  36830. "fill-opacity": {
  36831. "css": "polygon-opacity",
  36832. "type": "float",
  36833. "doc": "The opacity of the polygon",
  36834. "default-value": 1,
  36835. "default-meaning": "opaque"
  36836. },
  36837. "gamma": {
  36838. "css": "polygon-gamma",
  36839. "type": "float",
  36840. "default-value": 1,
  36841. "default-meaning": "fully antialiased",
  36842. "range": "0-1",
  36843. "doc": "Level of antialiasing of polygon edges"
  36844. },
  36845. "gamma-method": {
  36846. "css": "polygon-gamma-method",
  36847. "type": [
  36848. "power",
  36849. "linear",
  36850. "none",
  36851. "threshold",
  36852. "multiply"
  36853. ],
  36854. "default-value": "power",
  36855. "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",
  36856. "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"
  36857. },
  36858. "clip": {
  36859. "css": "polygon-clip",
  36860. "type": "boolean",
  36861. "default-value": true,
  36862. "default-meaning": "geometry will be clipped to map bounds before rendering",
  36863. "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."
  36864. },
  36865. "smooth": {
  36866. "css": "polygon-smooth",
  36867. "type": "float",
  36868. "default-value": 0,
  36869. "default-meaning": "no smoothing",
  36870. "range": "0-1",
  36871. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  36872. },
  36873. "geometry-transform": {
  36874. "css": "polygon-geometry-transform",
  36875. "type": "functions",
  36876. "default-value": "none",
  36877. "default-meaning": "geometry will not be transformed",
  36878. "doc": "Allows transformation functions to be applied to the geometry.",
  36879. "functions": [
  36880. ["matrix", 6],
  36881. ["translate", 2],
  36882. ["scale", 2],
  36883. ["rotate", 3],
  36884. ["skewX", 1],
  36885. ["skewY", 1]
  36886. ]
  36887. },
  36888. "comp-op": {
  36889. "css": "polygon-comp-op",
  36890. "default-value": "src-over",
  36891. "default-meaning": "add the current symbolizer on top of other symbolizer",
  36892. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  36893. "type": ["clear",
  36894. "src",
  36895. "dst",
  36896. "src-over",
  36897. "dst-over",
  36898. "src-in",
  36899. "dst-in",
  36900. "src-out",
  36901. "dst-out",
  36902. "src-atop",
  36903. "dst-atop",
  36904. "xor",
  36905. "plus",
  36906. "minus",
  36907. "multiply",
  36908. "screen",
  36909. "overlay",
  36910. "darken",
  36911. "lighten",
  36912. "color-dodge",
  36913. "color-burn",
  36914. "hard-light",
  36915. "soft-light",
  36916. "difference",
  36917. "exclusion",
  36918. "contrast",
  36919. "invert",
  36920. "invert-rgb",
  36921. "grain-merge",
  36922. "grain-extract",
  36923. "hue",
  36924. "saturation",
  36925. "color",
  36926. "value"
  36927. ]
  36928. }
  36929. },
  36930. "line": {
  36931. "stroke": {
  36932. "css": "line-color",
  36933. "default-value": "rgba(0,0,0,1)",
  36934. "type": "color",
  36935. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  36936. "doc": "The color of a drawn line"
  36937. },
  36938. "stroke-width": {
  36939. "css": "line-width",
  36940. "default-value": 1,
  36941. "type": "float",
  36942. "doc": "The width of a line in pixels"
  36943. },
  36944. "stroke-opacity": {
  36945. "css": "line-opacity",
  36946. "default-value": 1,
  36947. "type": "float",
  36948. "default-meaning": "opaque",
  36949. "doc": "The opacity of a line"
  36950. },
  36951. "stroke-linejoin": {
  36952. "css": "line-join",
  36953. "default-value": "miter",
  36954. "type": [
  36955. "miter",
  36956. "round",
  36957. "bevel"
  36958. ],
  36959. "doc": "The behavior of lines when joining"
  36960. },
  36961. "stroke-linecap": {
  36962. "css": "line-cap",
  36963. "default-value": "butt",
  36964. "type": [
  36965. "butt",
  36966. "round",
  36967. "square"
  36968. ],
  36969. "doc": "The display of line endings"
  36970. },
  36971. "stroke-gamma": {
  36972. "css": "line-gamma",
  36973. "type": "float",
  36974. "default-value": 1,
  36975. "default-meaning": "fully antialiased",
  36976. "range": "0-1",
  36977. "doc": "Level of antialiasing of stroke line"
  36978. },
  36979. "stroke-gamma-method": {
  36980. "css": "line-gamma-method",
  36981. "type": [
  36982. "power",
  36983. "linear",
  36984. "none",
  36985. "threshold",
  36986. "multiply"
  36987. ],
  36988. "default-value": "power",
  36989. "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",
  36990. "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"
  36991. },
  36992. "stroke-dasharray": {
  36993. "css": "line-dasharray",
  36994. "type": "numbers",
  36995. "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.",
  36996. "default-value": "none",
  36997. "default-meaning": "solid line"
  36998. },
  36999. "stroke-dashoffset": {
  37000. "css": "line-dash-offset",
  37001. "type": "numbers",
  37002. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  37003. "default-value": "none",
  37004. "default-meaning": "solid line"
  37005. },
  37006. "stroke-miterlimit": {
  37007. "css": "line-miterlimit",
  37008. "type": "float",
  37009. "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.",
  37010. "default-value": 4.0,
  37011. "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 )'"
  37012. },
  37013. "clip": {
  37014. "css": "line-clip",
  37015. "type": "boolean",
  37016. "default-value": true,
  37017. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37018. "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."
  37019. },
  37020. "smooth": {
  37021. "css": "line-smooth",
  37022. "type": "float",
  37023. "default-value": 0,
  37024. "default-meaning": "no smoothing",
  37025. "range": "0-1",
  37026. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  37027. },
  37028. "offset": {
  37029. "css": "line-offset",
  37030. "type": "float",
  37031. "default-value": 0,
  37032. "default-meaning": "no offset",
  37033. "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)."
  37034. },
  37035. "rasterizer": {
  37036. "css": "line-rasterizer",
  37037. "type": [
  37038. "full",
  37039. "fast"
  37040. ],
  37041. "default-value": "full",
  37042. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  37043. },
  37044. "geometry-transform": {
  37045. "css": "line-geometry-transform",
  37046. "type": "functions",
  37047. "default-value": "none",
  37048. "default-meaning": "geometry will not be transformed",
  37049. "doc": "Allows transformation functions to be applied to the geometry.",
  37050. "functions": [
  37051. ["matrix", 6],
  37052. ["translate", 2],
  37053. ["scale", 2],
  37054. ["rotate", 3],
  37055. ["skewX", 1],
  37056. ["skewY", 1]
  37057. ]
  37058. },
  37059. "comp-op": {
  37060. "css": "line-comp-op",
  37061. "default-value": "src-over",
  37062. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37063. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37064. "type": ["clear",
  37065. "src",
  37066. "dst",
  37067. "src-over",
  37068. "dst-over",
  37069. "src-in",
  37070. "dst-in",
  37071. "src-out",
  37072. "dst-out",
  37073. "src-atop",
  37074. "dst-atop",
  37075. "xor",
  37076. "plus",
  37077. "minus",
  37078. "multiply",
  37079. "screen",
  37080. "overlay",
  37081. "darken",
  37082. "lighten",
  37083. "color-dodge",
  37084. "color-burn",
  37085. "hard-light",
  37086. "soft-light",
  37087. "difference",
  37088. "exclusion",
  37089. "contrast",
  37090. "invert",
  37091. "invert-rgb",
  37092. "grain-merge",
  37093. "grain-extract",
  37094. "hue",
  37095. "saturation",
  37096. "color",
  37097. "value"
  37098. ]
  37099. }
  37100. },
  37101. "markers": {
  37102. "file": {
  37103. "css": "marker-file",
  37104. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  37105. "default-value": "",
  37106. "default-meaning": "An ellipse or circle, if width equals height",
  37107. "type": "uri"
  37108. },
  37109. "opacity": {
  37110. "css": "marker-opacity",
  37111. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  37112. "default-value": 1,
  37113. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  37114. "type": "float"
  37115. },
  37116. "fill-opacity": {
  37117. "css": "marker-fill-opacity",
  37118. "doc": "The fill opacity of the marker",
  37119. "default-value": 1,
  37120. "default-meaning": "opaque",
  37121. "type": "float"
  37122. },
  37123. "stroke": {
  37124. "css": "marker-line-color",
  37125. "doc": "The color of the stroke around a marker shape.",
  37126. "default-value": "black",
  37127. "type": "color"
  37128. },
  37129. "stroke-width": {
  37130. "css": "marker-line-width",
  37131. "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.",
  37132. "type": "float"
  37133. },
  37134. "stroke-opacity": {
  37135. "css": "marker-line-opacity",
  37136. "default-value": 1,
  37137. "default-meaning": "opaque",
  37138. "doc": "The opacity of a line",
  37139. "type": "float"
  37140. },
  37141. "placement": {
  37142. "css": "marker-placement",
  37143. "type": [
  37144. "point",
  37145. "line",
  37146. "interior"
  37147. ],
  37148. "default-value": "point",
  37149. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  37150. "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"
  37151. },
  37152. "multi-policy": {
  37153. "css": "marker-multi-policy",
  37154. "type": [
  37155. "each",
  37156. "whole",
  37157. "largest"
  37158. ],
  37159. "default-value": "each",
  37160. "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",
  37161. "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)."
  37162. },
  37163. "marker-type": {
  37164. "css": "marker-type",
  37165. "type": [
  37166. "arrow",
  37167. "ellipse"
  37168. ],
  37169. "default-value": "ellipse",
  37170. "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)"
  37171. },
  37172. "width": {
  37173. "css": "marker-width",
  37174. "default-value": 10,
  37175. "doc": "The width of the marker, if using one of the default types.",
  37176. "type": "expression"
  37177. },
  37178. "height": {
  37179. "css": "marker-height",
  37180. "default-value": 10,
  37181. "doc": "The height of the marker, if using one of the default types.",
  37182. "type": "expression"
  37183. },
  37184. "fill": {
  37185. "css": "marker-fill",
  37186. "default-value": "blue",
  37187. "doc": "The color of the area of the marker.",
  37188. "type": "color"
  37189. },
  37190. "allow-overlap": {
  37191. "css": "marker-allow-overlap",
  37192. "type": "boolean",
  37193. "default-value": false,
  37194. "doc": "Control whether overlapping markers are shown or hidden.",
  37195. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  37196. },
  37197. "ignore-placement": {
  37198. "css": "marker-ignore-placement",
  37199. "type": "boolean",
  37200. "default-value": false,
  37201. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  37202. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  37203. },
  37204. "spacing": {
  37205. "css": "marker-spacing",
  37206. "doc": "Space between repeated labels",
  37207. "default-value": 100,
  37208. "type": "float"
  37209. },
  37210. "max-error": {
  37211. "css": "marker-max-error",
  37212. "type": "float",
  37213. "default-value": 0.2,
  37214. "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."
  37215. },
  37216. "transform": {
  37217. "css": "marker-transform",
  37218. "type": "functions",
  37219. "functions": [
  37220. ["matrix", 6],
  37221. ["translate", 2],
  37222. ["scale", 2],
  37223. ["rotate", 3],
  37224. ["skewX", 1],
  37225. ["skewY", 1]
  37226. ],
  37227. "default-value": "",
  37228. "default-meaning": "No transformation",
  37229. "doc": "SVG transformation definition"
  37230. },
  37231. "clip": {
  37232. "css": "marker-clip",
  37233. "type": "boolean",
  37234. "default-value": true,
  37235. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37236. "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."
  37237. },
  37238. "smooth": {
  37239. "css": "marker-smooth",
  37240. "type": "float",
  37241. "default-value": 0,
  37242. "default-meaning": "no smoothing",
  37243. "range": "0-1",
  37244. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  37245. },
  37246. "geometry-transform": {
  37247. "css": "marker-geometry-transform",
  37248. "type": "functions",
  37249. "default-value": "none",
  37250. "default-meaning": "geometry will not be transformed",
  37251. "doc": "Allows transformation functions to be applied to the geometry.",
  37252. "functions": [
  37253. ["matrix", 6],
  37254. ["translate", 2],
  37255. ["scale", 2],
  37256. ["rotate", 3],
  37257. ["skewX", 1],
  37258. ["skewY", 1]
  37259. ]
  37260. },
  37261. "comp-op": {
  37262. "css": "marker-comp-op",
  37263. "default-value": "src-over",
  37264. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37265. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37266. "type": ["clear",
  37267. "src",
  37268. "dst",
  37269. "src-over",
  37270. "dst-over",
  37271. "src-in",
  37272. "dst-in",
  37273. "src-out",
  37274. "dst-out",
  37275. "src-atop",
  37276. "dst-atop",
  37277. "xor",
  37278. "plus",
  37279. "minus",
  37280. "multiply",
  37281. "screen",
  37282. "overlay",
  37283. "darken",
  37284. "lighten",
  37285. "color-dodge",
  37286. "color-burn",
  37287. "hard-light",
  37288. "soft-light",
  37289. "difference",
  37290. "exclusion",
  37291. "contrast",
  37292. "invert",
  37293. "invert-rgb",
  37294. "grain-merge",
  37295. "grain-extract",
  37296. "hue",
  37297. "saturation",
  37298. "color",
  37299. "value"
  37300. ]
  37301. }
  37302. },
  37303. "shield": {
  37304. "name": {
  37305. "css": "shield-name",
  37306. "type": "expression",
  37307. "serialization": "content",
  37308. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  37309. },
  37310. "file": {
  37311. "css": "shield-file",
  37312. "required": true,
  37313. "type": "uri",
  37314. "default-value": "none",
  37315. "doc": "Image file to render behind the shield text"
  37316. },
  37317. "face-name": {
  37318. "css": "shield-face-name",
  37319. "type": "string",
  37320. "validate": "font",
  37321. "doc": "Font name and style to use for the shield text",
  37322. "default-value": "",
  37323. "required": true
  37324. },
  37325. "unlock-image": {
  37326. "css": "shield-unlock-image",
  37327. "type": "boolean",
  37328. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  37329. "default-value": false,
  37330. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  37331. },
  37332. "size": {
  37333. "css": "shield-size",
  37334. "type": "float",
  37335. "doc": "The size of the shield text in pixels"
  37336. },
  37337. "fill": {
  37338. "css": "shield-fill",
  37339. "type": "color",
  37340. "doc": "The color of the shield text"
  37341. },
  37342. "placement": {
  37343. "css": "shield-placement",
  37344. "type": [
  37345. "point",
  37346. "line",
  37347. "vertex",
  37348. "interior"
  37349. ],
  37350. "default-value": "point",
  37351. "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."
  37352. },
  37353. "avoid-edges": {
  37354. "css": "shield-avoid-edges",
  37355. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  37356. "type": "boolean",
  37357. "default-value": false
  37358. },
  37359. "allow-overlap": {
  37360. "css": "shield-allow-overlap",
  37361. "type": "boolean",
  37362. "default-value": false,
  37363. "doc": "Control whether overlapping shields are shown or hidden.",
  37364. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  37365. },
  37366. "minimum-distance": {
  37367. "css": "shield-min-distance",
  37368. "type": "float",
  37369. "default-value": 0,
  37370. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  37371. },
  37372. "spacing": {
  37373. "css": "shield-spacing",
  37374. "type": "float",
  37375. "default-value": 0,
  37376. "doc": "The spacing between repeated occurrences of the same shield on a line"
  37377. },
  37378. "minimum-padding": {
  37379. "css": "shield-min-padding",
  37380. "default-value": 0,
  37381. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  37382. "type": "float"
  37383. },
  37384. "wrap-width": {
  37385. "css": "shield-wrap-width",
  37386. "type": "unsigned",
  37387. "default-value": 0,
  37388. "doc": "Length of a chunk of text in characters before wrapping text"
  37389. },
  37390. "wrap-before": {
  37391. "css": "shield-wrap-before",
  37392. "type": "boolean",
  37393. "default-value": false,
  37394. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  37395. },
  37396. "wrap-character": {
  37397. "css": "shield-wrap-character",
  37398. "type": "string",
  37399. "default-value": " ",
  37400. "doc": "Use this character instead of a space to wrap long names."
  37401. },
  37402. "halo-fill": {
  37403. "css": "shield-halo-fill",
  37404. "type": "color",
  37405. "default-value": "#FFFFFF",
  37406. "default-meaning": "white",
  37407. "doc": "Specifies the color of the halo around the text."
  37408. },
  37409. "halo-radius": {
  37410. "css": "shield-halo-radius",
  37411. "doc": "Specify the radius of the halo in pixels",
  37412. "default-value": 0,
  37413. "default-meaning": "no halo",
  37414. "type": "float"
  37415. },
  37416. "character-spacing": {
  37417. "css": "shield-character-spacing",
  37418. "type": "unsigned",
  37419. "default-value": 0,
  37420. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  37421. },
  37422. "line-spacing": {
  37423. "css": "shield-line-spacing",
  37424. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  37425. "type": "unsigned"
  37426. },
  37427. "dx": {
  37428. "css": "shield-text-dx",
  37429. "type": "float",
  37430. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  37431. "default-value": 0
  37432. },
  37433. "dy": {
  37434. "css": "shield-text-dy",
  37435. "type": "float",
  37436. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  37437. "default-value": 0
  37438. },
  37439. "shield-dx": {
  37440. "css": "shield-dx",
  37441. "type": "float",
  37442. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  37443. "default-value": 0
  37444. },
  37445. "shield-dy": {
  37446. "css": "shield-dy",
  37447. "type": "float",
  37448. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  37449. "default-value": 0
  37450. },
  37451. "opacity": {
  37452. "css": "shield-opacity",
  37453. "type": "float",
  37454. "doc": "(Default 1.0) - opacity of the image used for the shield",
  37455. "default-value": 1
  37456. },
  37457. "text-opacity": {
  37458. "css": "shield-text-opacity",
  37459. "type": "float",
  37460. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  37461. "default-value": 1
  37462. },
  37463. "horizontal-alignment": {
  37464. "css": "shield-horizontal-alignment",
  37465. "type": [
  37466. "left",
  37467. "middle",
  37468. "right",
  37469. "auto"
  37470. ],
  37471. "doc": "The shield's horizontal alignment from its centerpoint",
  37472. "default-value": "auto"
  37473. },
  37474. "vertical-alignment": {
  37475. "css": "shield-vertical-alignment",
  37476. "type": [
  37477. "top",
  37478. "middle",
  37479. "bottom",
  37480. "auto"
  37481. ],
  37482. "doc": "The shield's vertical alignment from its centerpoint",
  37483. "default-value": "middle"
  37484. },
  37485. "text-transform": {
  37486. "css": "shield-text-transform",
  37487. "type": [
  37488. "none",
  37489. "uppercase",
  37490. "lowercase",
  37491. "capitalize"
  37492. ],
  37493. "doc": "Transform the case of the characters",
  37494. "default-value": "none"
  37495. },
  37496. "justify-alignment": {
  37497. "css": "shield-justify-alignment",
  37498. "type": [
  37499. "left",
  37500. "center",
  37501. "right",
  37502. "auto"
  37503. ],
  37504. "doc": "Define how text in a shield's label is justified",
  37505. "default-value": "auto"
  37506. },
  37507. "clip": {
  37508. "css": "shield-clip",
  37509. "type": "boolean",
  37510. "default-value": true,
  37511. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37512. "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."
  37513. },
  37514. "comp-op": {
  37515. "css": "shield-comp-op",
  37516. "default-value": "src-over",
  37517. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37518. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37519. "type": ["clear",
  37520. "src",
  37521. "dst",
  37522. "src-over",
  37523. "dst-over",
  37524. "src-in",
  37525. "dst-in",
  37526. "src-out",
  37527. "dst-out",
  37528. "src-atop",
  37529. "dst-atop",
  37530. "xor",
  37531. "plus",
  37532. "minus",
  37533. "multiply",
  37534. "screen",
  37535. "overlay",
  37536. "darken",
  37537. "lighten",
  37538. "color-dodge",
  37539. "color-burn",
  37540. "hard-light",
  37541. "soft-light",
  37542. "difference",
  37543. "exclusion",
  37544. "contrast",
  37545. "invert",
  37546. "invert-rgb",
  37547. "grain-merge",
  37548. "grain-extract",
  37549. "hue",
  37550. "saturation",
  37551. "color",
  37552. "value"
  37553. ]
  37554. }
  37555. },
  37556. "line-pattern": {
  37557. "file": {
  37558. "css": "line-pattern-file",
  37559. "type": "uri",
  37560. "default-value": "none",
  37561. "required": true,
  37562. "doc": "An image file to be repeated and warped along a line"
  37563. },
  37564. "clip": {
  37565. "css": "line-pattern-clip",
  37566. "type": "boolean",
  37567. "default-value": true,
  37568. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37569. "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."
  37570. },
  37571. "smooth": {
  37572. "css": "line-pattern-smooth",
  37573. "type": "float",
  37574. "default-value": 0,
  37575. "default-meaning": "no smoothing",
  37576. "range": "0-1",
  37577. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  37578. },
  37579. "geometry-transform": {
  37580. "css": "line-pattern-geometry-transform",
  37581. "type": "functions",
  37582. "default-value": "none",
  37583. "default-meaning": "geometry will not be transformed",
  37584. "doc": "Allows transformation functions to be applied to the geometry.",
  37585. "functions": [
  37586. ["matrix", 6],
  37587. ["translate", 2],
  37588. ["scale", 2],
  37589. ["rotate", 3],
  37590. ["skewX", 1],
  37591. ["skewY", 1]
  37592. ]
  37593. },
  37594. "comp-op": {
  37595. "css": "line-pattern-comp-op",
  37596. "default-value": "src-over",
  37597. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37598. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37599. "type": ["clear",
  37600. "src",
  37601. "dst",
  37602. "src-over",
  37603. "dst-over",
  37604. "src-in",
  37605. "dst-in",
  37606. "src-out",
  37607. "dst-out",
  37608. "src-atop",
  37609. "dst-atop",
  37610. "xor",
  37611. "plus",
  37612. "minus",
  37613. "multiply",
  37614. "screen",
  37615. "overlay",
  37616. "darken",
  37617. "lighten",
  37618. "color-dodge",
  37619. "color-burn",
  37620. "hard-light",
  37621. "soft-light",
  37622. "difference",
  37623. "exclusion",
  37624. "contrast",
  37625. "invert",
  37626. "invert-rgb",
  37627. "grain-merge",
  37628. "grain-extract",
  37629. "hue",
  37630. "saturation",
  37631. "color",
  37632. "value"
  37633. ]
  37634. }
  37635. },
  37636. "polygon-pattern": {
  37637. "file": {
  37638. "css": "polygon-pattern-file",
  37639. "type": "uri",
  37640. "default-value": "none",
  37641. "required": true,
  37642. "doc": "Image to use as a repeated pattern fill within a polygon"
  37643. },
  37644. "alignment": {
  37645. "css": "polygon-pattern-alignment",
  37646. "type": [
  37647. "local",
  37648. "global"
  37649. ],
  37650. "default-value": "local",
  37651. "doc": "Specify whether to align pattern fills to the layer or to the map."
  37652. },
  37653. "gamma": {
  37654. "css": "polygon-pattern-gamma",
  37655. "type": "float",
  37656. "default-value": 1,
  37657. "default-meaning": "fully antialiased",
  37658. "range": "0-1",
  37659. "doc": "Level of antialiasing of polygon pattern edges"
  37660. },
  37661. "opacity": {
  37662. "css": "polygon-pattern-opacity",
  37663. "type": "float",
  37664. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  37665. "default-value": 1,
  37666. "default-meaning": "The image is rendered without modifications"
  37667. },
  37668. "clip": {
  37669. "css": "polygon-pattern-clip",
  37670. "type": "boolean",
  37671. "default-value": true,
  37672. "default-meaning": "geometry will be clipped to map bounds before rendering",
  37673. "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."
  37674. },
  37675. "smooth": {
  37676. "css": "polygon-pattern-smooth",
  37677. "type": "float",
  37678. "default-value": 0,
  37679. "default-meaning": "no smoothing",
  37680. "range": "0-1",
  37681. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  37682. },
  37683. "geometry-transform": {
  37684. "css": "polygon-pattern-geometry-transform",
  37685. "type": "functions",
  37686. "default-value": "none",
  37687. "default-meaning": "geometry will not be transformed",
  37688. "doc": "Allows transformation functions to be applied to the geometry.",
  37689. "functions": [
  37690. ["matrix", 6],
  37691. ["translate", 2],
  37692. ["scale", 2],
  37693. ["rotate", 3],
  37694. ["skewX", 1],
  37695. ["skewY", 1]
  37696. ]
  37697. },
  37698. "comp-op": {
  37699. "css": "polygon-pattern-comp-op",
  37700. "default-value": "src-over",
  37701. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37702. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37703. "type": ["clear",
  37704. "src",
  37705. "dst",
  37706. "src-over",
  37707. "dst-over",
  37708. "src-in",
  37709. "dst-in",
  37710. "src-out",
  37711. "dst-out",
  37712. "src-atop",
  37713. "dst-atop",
  37714. "xor",
  37715. "plus",
  37716. "minus",
  37717. "multiply",
  37718. "screen",
  37719. "overlay",
  37720. "darken",
  37721. "lighten",
  37722. "color-dodge",
  37723. "color-burn",
  37724. "hard-light",
  37725. "soft-light",
  37726. "difference",
  37727. "exclusion",
  37728. "contrast",
  37729. "invert",
  37730. "invert-rgb",
  37731. "grain-merge",
  37732. "grain-extract",
  37733. "hue",
  37734. "saturation",
  37735. "color",
  37736. "value"
  37737. ]
  37738. }
  37739. },
  37740. "raster": {
  37741. "opacity": {
  37742. "css": "raster-opacity",
  37743. "default-value": 1,
  37744. "default-meaning": "opaque",
  37745. "type": "float",
  37746. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  37747. },
  37748. "filter-factor": {
  37749. "css": "raster-filter-factor",
  37750. "default-value": -1,
  37751. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  37752. "type": "float",
  37753. "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."
  37754. },
  37755. "scaling": {
  37756. "css": "raster-scaling",
  37757. "type": [
  37758. "near",
  37759. "fast",
  37760. "bilinear",
  37761. "bilinear8",
  37762. "bicubic",
  37763. "spline16",
  37764. "spline36",
  37765. "hanning",
  37766. "hamming",
  37767. "hermite",
  37768. "kaiser",
  37769. "quadric",
  37770. "catrom",
  37771. "gaussian",
  37772. "bessel",
  37773. "mitchell",
  37774. "sinc",
  37775. "lanczos",
  37776. "blackman"
  37777. ],
  37778. "default-value": "near",
  37779. "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."
  37780. },
  37781. "mesh-size": {
  37782. "css": "raster-mesh-size",
  37783. "default-value": 16,
  37784. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  37785. "type": "unsigned",
  37786. "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."
  37787. },
  37788. "comp-op": {
  37789. "css": "raster-comp-op",
  37790. "default-value": "src-over",
  37791. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37792. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37793. "type": ["clear",
  37794. "src",
  37795. "dst",
  37796. "src-over",
  37797. "dst-over",
  37798. "src-in",
  37799. "dst-in",
  37800. "src-out",
  37801. "dst-out",
  37802. "src-atop",
  37803. "dst-atop",
  37804. "xor",
  37805. "plus",
  37806. "minus",
  37807. "multiply",
  37808. "screen",
  37809. "overlay",
  37810. "darken",
  37811. "lighten",
  37812. "color-dodge",
  37813. "color-burn",
  37814. "hard-light",
  37815. "soft-light",
  37816. "difference",
  37817. "exclusion",
  37818. "contrast",
  37819. "invert",
  37820. "invert-rgb",
  37821. "grain-merge",
  37822. "grain-extract",
  37823. "hue",
  37824. "saturation",
  37825. "color",
  37826. "value"
  37827. ]
  37828. }
  37829. },
  37830. "point": {
  37831. "file": {
  37832. "css": "point-file",
  37833. "type": "uri",
  37834. "required": false,
  37835. "default-value": "none",
  37836. "doc": "Image file to represent a point"
  37837. },
  37838. "allow-overlap": {
  37839. "css": "point-allow-overlap",
  37840. "type": "boolean",
  37841. "default-value": false,
  37842. "doc": "Control whether overlapping points are shown or hidden.",
  37843. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  37844. },
  37845. "ignore-placement": {
  37846. "css": "point-ignore-placement",
  37847. "type": "boolean",
  37848. "default-value": false,
  37849. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  37850. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  37851. },
  37852. "opacity": {
  37853. "css": "point-opacity",
  37854. "type": "float",
  37855. "default-value": 1.0,
  37856. "default-meaning": "Fully opaque",
  37857. "doc": "A value from 0 to 1 to control the opacity of the point"
  37858. },
  37859. "placement": {
  37860. "css": "point-placement",
  37861. "type": [
  37862. "centroid",
  37863. "interior"
  37864. ],
  37865. "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.",
  37866. "default-value": "centroid"
  37867. },
  37868. "transform": {
  37869. "css": "point-transform",
  37870. "type": "functions",
  37871. "functions": [
  37872. ["matrix", 6],
  37873. ["translate", 2],
  37874. ["scale", 2],
  37875. ["rotate", 3],
  37876. ["skewX", 1],
  37877. ["skewY", 1]
  37878. ],
  37879. "default-value": "",
  37880. "default-meaning": "No transformation",
  37881. "doc": "SVG transformation definition"
  37882. },
  37883. "comp-op": {
  37884. "css": "point-comp-op",
  37885. "default-value": "src-over",
  37886. "default-meaning": "add the current symbolizer on top of other symbolizer",
  37887. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  37888. "type": ["clear",
  37889. "src",
  37890. "dst",
  37891. "src-over",
  37892. "dst-over",
  37893. "src-in",
  37894. "dst-in",
  37895. "src-out",
  37896. "dst-out",
  37897. "src-atop",
  37898. "dst-atop",
  37899. "xor",
  37900. "plus",
  37901. "minus",
  37902. "multiply",
  37903. "screen",
  37904. "overlay",
  37905. "darken",
  37906. "lighten",
  37907. "color-dodge",
  37908. "color-burn",
  37909. "hard-light",
  37910. "soft-light",
  37911. "difference",
  37912. "exclusion",
  37913. "contrast",
  37914. "invert",
  37915. "invert-rgb",
  37916. "grain-merge",
  37917. "grain-extract",
  37918. "hue",
  37919. "saturation",
  37920. "color",
  37921. "value"
  37922. ]
  37923. }
  37924. },
  37925. "text": {
  37926. "name": {
  37927. "css": "text-name",
  37928. "type": "expression",
  37929. "required": true,
  37930. "default-value": "",
  37931. "serialization": "content",
  37932. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  37933. },
  37934. "face-name": {
  37935. "css": "text-face-name",
  37936. "type": "string",
  37937. "validate": "font",
  37938. "doc": "Font name and style to render a label in",
  37939. "required": true
  37940. },
  37941. "size": {
  37942. "css": "text-size",
  37943. "type": "float",
  37944. "default-value": 10,
  37945. "doc": "Text size in pixels"
  37946. },
  37947. "text-ratio": {
  37948. "css": "text-ratio",
  37949. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  37950. "default-value": 0,
  37951. "type": "unsigned"
  37952. },
  37953. "wrap-width": {
  37954. "css": "text-wrap-width",
  37955. "doc": "Length of a chunk of text in characters before wrapping text",
  37956. "default-value": 0,
  37957. "type": "unsigned"
  37958. },
  37959. "wrap-before": {
  37960. "css": "text-wrap-before",
  37961. "type": "boolean",
  37962. "default-value": false,
  37963. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  37964. },
  37965. "wrap-character": {
  37966. "css": "text-wrap-character",
  37967. "type": "string",
  37968. "default-value": " ",
  37969. "doc": "Use this character instead of a space to wrap long text."
  37970. },
  37971. "spacing": {
  37972. "css": "text-spacing",
  37973. "type": "unsigned",
  37974. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  37975. },
  37976. "character-spacing": {
  37977. "css": "text-character-spacing",
  37978. "type": "float",
  37979. "default-value": 0,
  37980. "doc": "Horizontal spacing adjustment between characters in pixels"
  37981. },
  37982. "line-spacing": {
  37983. "css": "text-line-spacing",
  37984. "default-value": 0,
  37985. "type": "unsigned",
  37986. "doc": "Vertical spacing adjustment between lines in pixels"
  37987. },
  37988. "label-position-tolerance": {
  37989. "css": "text-label-position-tolerance",
  37990. "default-value": 0,
  37991. "type": "unsigned",
  37992. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  37993. },
  37994. "max-char-angle-delta": {
  37995. "css": "text-max-char-angle-delta",
  37996. "type": "float",
  37997. "default-value": "22.5",
  37998. "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."
  37999. },
  38000. "fill": {
  38001. "css": "text-fill",
  38002. "doc": "Specifies the color for the text",
  38003. "default-value": "#000000",
  38004. "type": "color"
  38005. },
  38006. "opacity": {
  38007. "css": "text-opacity",
  38008. "doc": "A number from 0 to 1 specifying the opacity for the text",
  38009. "default-value": 1.0,
  38010. "default-meaning": "Fully opaque",
  38011. "type": "float"
  38012. },
  38013. "halo-fill": {
  38014. "css": "text-halo-fill",
  38015. "type": "color",
  38016. "default-value": "#FFFFFF",
  38017. "default-meaning": "white",
  38018. "doc": "Specifies the color of the halo around the text."
  38019. },
  38020. "halo-radius": {
  38021. "css": "text-halo-radius",
  38022. "doc": "Specify the radius of the halo in pixels",
  38023. "default-value": 0,
  38024. "default-meaning": "no halo",
  38025. "type": "float"
  38026. },
  38027. "dx": {
  38028. "css": "text-dx",
  38029. "type": "float",
  38030. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  38031. "default-value": 0
  38032. },
  38033. "dy": {
  38034. "css": "text-dy",
  38035. "type": "float",
  38036. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  38037. "default-value": 0
  38038. },
  38039. "vertical-alignment": {
  38040. "css": "text-vertical-alignment",
  38041. "type": [
  38042. "top",
  38043. "middle",
  38044. "bottom",
  38045. "auto"
  38046. ],
  38047. "doc": "Position of label relative to point position.",
  38048. "default-value": "auto",
  38049. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  38050. },
  38051. "avoid-edges": {
  38052. "css": "text-avoid-edges",
  38053. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  38054. "default-value": false,
  38055. "type": "boolean"
  38056. },
  38057. "minimum-distance": {
  38058. "css": "text-min-distance",
  38059. "doc": "Minimum permitted distance to the next text symbolizer.",
  38060. "type": "float"
  38061. },
  38062. "minimum-padding": {
  38063. "css": "text-min-padding",
  38064. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  38065. "type": "float"
  38066. },
  38067. "minimum-path-length": {
  38068. "css": "text-min-path-length",
  38069. "type": "float",
  38070. "default-value": 0,
  38071. "default-meaning": "place labels on all paths",
  38072. "doc": "Place labels only on paths longer than this value."
  38073. },
  38074. "allow-overlap": {
  38075. "css": "text-allow-overlap",
  38076. "type": "boolean",
  38077. "default-value": false,
  38078. "doc": "Control whether overlapping text is shown or hidden.",
  38079. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  38080. },
  38081. "orientation": {
  38082. "css": "text-orientation",
  38083. "type": "expression",
  38084. "doc": "Rotate the text."
  38085. },
  38086. "placement": {
  38087. "css": "text-placement",
  38088. "type": [
  38089. "point",
  38090. "line",
  38091. "vertex",
  38092. "interior"
  38093. ],
  38094. "default-value": "point",
  38095. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  38096. },
  38097. "placement-type": {
  38098. "css": "text-placement-type",
  38099. "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.",
  38100. "type": [
  38101. "dummy",
  38102. "simple"
  38103. ],
  38104. "default-value": "dummy"
  38105. },
  38106. "placements": {
  38107. "css": "text-placements",
  38108. "type": "string",
  38109. "default-value": "",
  38110. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  38111. },
  38112. "text-transform": {
  38113. "css": "text-transform",
  38114. "type": [
  38115. "none",
  38116. "uppercase",
  38117. "lowercase",
  38118. "capitalize"
  38119. ],
  38120. "doc": "Transform the case of the characters",
  38121. "default-value": "none"
  38122. },
  38123. "horizontal-alignment": {
  38124. "css": "text-horizontal-alignment",
  38125. "type": [
  38126. "left",
  38127. "middle",
  38128. "right",
  38129. "auto"
  38130. ],
  38131. "doc": "The text's horizontal alignment from its centerpoint",
  38132. "default-value": "auto"
  38133. },
  38134. "justify-alignment": {
  38135. "css": "text-align",
  38136. "type": [
  38137. "left",
  38138. "right",
  38139. "center",
  38140. "auto"
  38141. ],
  38142. "doc": "Define how text is justified",
  38143. "default-value": "auto",
  38144. "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"
  38145. },
  38146. "clip": {
  38147. "css": "text-clip",
  38148. "type": "boolean",
  38149. "default-value": true,
  38150. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38151. "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."
  38152. },
  38153. "comp-op": {
  38154. "css": "text-comp-op",
  38155. "default-value": "src-over",
  38156. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38157. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38158. "type": ["clear",
  38159. "src",
  38160. "dst",
  38161. "src-over",
  38162. "dst-over",
  38163. "src-in",
  38164. "dst-in",
  38165. "src-out",
  38166. "dst-out",
  38167. "src-atop",
  38168. "dst-atop",
  38169. "xor",
  38170. "plus",
  38171. "minus",
  38172. "multiply",
  38173. "screen",
  38174. "overlay",
  38175. "darken",
  38176. "lighten",
  38177. "color-dodge",
  38178. "color-burn",
  38179. "hard-light",
  38180. "soft-light",
  38181. "difference",
  38182. "exclusion",
  38183. "contrast",
  38184. "invert",
  38185. "invert-rgb",
  38186. "grain-merge",
  38187. "grain-extract",
  38188. "hue",
  38189. "saturation",
  38190. "color",
  38191. "value"
  38192. ]
  38193. }
  38194. },
  38195. "building": {
  38196. "fill": {
  38197. "css": "building-fill",
  38198. "default-value": "#FFFFFF",
  38199. "doc": "The color of the buildings walls.",
  38200. "type": "color"
  38201. },
  38202. "fill-opacity": {
  38203. "css": "building-fill-opacity",
  38204. "type": "float",
  38205. "doc": "The opacity of the building as a whole, including all walls.",
  38206. "default-value": 1
  38207. },
  38208. "height": {
  38209. "css": "building-height",
  38210. "doc": "The height of the building in pixels.",
  38211. "type": "expression",
  38212. "default-value": "0"
  38213. }
  38214. }
  38215. },
  38216. "colors": {
  38217. "aliceblue": [240, 248, 255],
  38218. "antiquewhite": [250, 235, 215],
  38219. "aqua": [0, 255, 255],
  38220. "aquamarine": [127, 255, 212],
  38221. "azure": [240, 255, 255],
  38222. "beige": [245, 245, 220],
  38223. "bisque": [255, 228, 196],
  38224. "black": [0, 0, 0],
  38225. "blanchedalmond": [255, 235, 205],
  38226. "blue": [0, 0, 255],
  38227. "blueviolet": [138, 43, 226],
  38228. "brown": [165, 42, 42],
  38229. "burlywood": [222, 184, 135],
  38230. "cadetblue": [95, 158, 160],
  38231. "chartreuse": [127, 255, 0],
  38232. "chocolate": [210, 105, 30],
  38233. "coral": [255, 127, 80],
  38234. "cornflowerblue": [100, 149, 237],
  38235. "cornsilk": [255, 248, 220],
  38236. "crimson": [220, 20, 60],
  38237. "cyan": [0, 255, 255],
  38238. "darkblue": [0, 0, 139],
  38239. "darkcyan": [0, 139, 139],
  38240. "darkgoldenrod": [184, 134, 11],
  38241. "darkgray": [169, 169, 169],
  38242. "darkgreen": [0, 100, 0],
  38243. "darkgrey": [169, 169, 169],
  38244. "darkkhaki": [189, 183, 107],
  38245. "darkmagenta": [139, 0, 139],
  38246. "darkolivegreen": [85, 107, 47],
  38247. "darkorange": [255, 140, 0],
  38248. "darkorchid": [153, 50, 204],
  38249. "darkred": [139, 0, 0],
  38250. "darksalmon": [233, 150, 122],
  38251. "darkseagreen": [143, 188, 143],
  38252. "darkslateblue": [72, 61, 139],
  38253. "darkslategrey": [47, 79, 79],
  38254. "darkturquoise": [0, 206, 209],
  38255. "darkviolet": [148, 0, 211],
  38256. "deeppink": [255, 20, 147],
  38257. "deepskyblue": [0, 191, 255],
  38258. "dimgray": [105, 105, 105],
  38259. "dimgrey": [105, 105, 105],
  38260. "dodgerblue": [30, 144, 255],
  38261. "firebrick": [178, 34, 34],
  38262. "floralwhite": [255, 250, 240],
  38263. "forestgreen": [34, 139, 34],
  38264. "fuchsia": [255, 0, 255],
  38265. "gainsboro": [220, 220, 220],
  38266. "ghostwhite": [248, 248, 255],
  38267. "gold": [255, 215, 0],
  38268. "goldenrod": [218, 165, 32],
  38269. "gray": [128, 128, 128],
  38270. "grey": [128, 128, 128],
  38271. "green": [0, 128, 0],
  38272. "greenyellow": [173, 255, 47],
  38273. "honeydew": [240, 255, 240],
  38274. "hotpink": [255, 105, 180],
  38275. "indianred": [205, 92, 92],
  38276. "indigo": [75, 0, 130],
  38277. "ivory": [255, 255, 240],
  38278. "khaki": [240, 230, 140],
  38279. "lavender": [230, 230, 250],
  38280. "lavenderblush": [255, 240, 245],
  38281. "lawngreen": [124, 252, 0],
  38282. "lemonchiffon": [255, 250, 205],
  38283. "lightblue": [173, 216, 230],
  38284. "lightcoral": [240, 128, 128],
  38285. "lightcyan": [224, 255, 255],
  38286. "lightgoldenrodyellow": [250, 250, 210],
  38287. "lightgray": [211, 211, 211],
  38288. "lightgreen": [144, 238, 144],
  38289. "lightgrey": [211, 211, 211],
  38290. "lightpink": [255, 182, 193],
  38291. "lightsalmon": [255, 160, 122],
  38292. "lightseagreen": [32, 178, 170],
  38293. "lightskyblue": [135, 206, 250],
  38294. "lightslategray": [119, 136, 153],
  38295. "lightslategrey": [119, 136, 153],
  38296. "lightsteelblue": [176, 196, 222],
  38297. "lightyellow": [255, 255, 224],
  38298. "lime": [0, 255, 0],
  38299. "limegreen": [50, 205, 50],
  38300. "linen": [250, 240, 230],
  38301. "magenta": [255, 0, 255],
  38302. "maroon": [128, 0, 0],
  38303. "mediumaquamarine": [102, 205, 170],
  38304. "mediumblue": [0, 0, 205],
  38305. "mediumorchid": [186, 85, 211],
  38306. "mediumpurple": [147, 112, 219],
  38307. "mediumseagreen": [60, 179, 113],
  38308. "mediumslateblue": [123, 104, 238],
  38309. "mediumspringgreen": [0, 250, 154],
  38310. "mediumturquoise": [72, 209, 204],
  38311. "mediumvioletred": [199, 21, 133],
  38312. "midnightblue": [25, 25, 112],
  38313. "mintcream": [245, 255, 250],
  38314. "mistyrose": [255, 228, 225],
  38315. "moccasin": [255, 228, 181],
  38316. "navajowhite": [255, 222, 173],
  38317. "navy": [0, 0, 128],
  38318. "oldlace": [253, 245, 230],
  38319. "olive": [128, 128, 0],
  38320. "olivedrab": [107, 142, 35],
  38321. "orange": [255, 165, 0],
  38322. "orangered": [255, 69, 0],
  38323. "orchid": [218, 112, 214],
  38324. "palegoldenrod": [238, 232, 170],
  38325. "palegreen": [152, 251, 152],
  38326. "paleturquoise": [175, 238, 238],
  38327. "palevioletred": [219, 112, 147],
  38328. "papayawhip": [255, 239, 213],
  38329. "peachpuff": [255, 218, 185],
  38330. "peru": [205, 133, 63],
  38331. "pink": [255, 192, 203],
  38332. "plum": [221, 160, 221],
  38333. "powderblue": [176, 224, 230],
  38334. "purple": [128, 0, 128],
  38335. "red": [255, 0, 0],
  38336. "rosybrown": [188, 143, 143],
  38337. "royalblue": [65, 105, 225],
  38338. "saddlebrown": [139, 69, 19],
  38339. "salmon": [250, 128, 114],
  38340. "sandybrown": [244, 164, 96],
  38341. "seagreen": [46, 139, 87],
  38342. "seashell": [255, 245, 238],
  38343. "sienna": [160, 82, 45],
  38344. "silver": [192, 192, 192],
  38345. "skyblue": [135, 206, 235],
  38346. "slateblue": [106, 90, 205],
  38347. "slategray": [112, 128, 144],
  38348. "slategrey": [112, 128, 144],
  38349. "snow": [255, 250, 250],
  38350. "springgreen": [0, 255, 127],
  38351. "steelblue": [70, 130, 180],
  38352. "tan": [210, 180, 140],
  38353. "teal": [0, 128, 128],
  38354. "thistle": [216, 191, 216],
  38355. "tomato": [255, 99, 71],
  38356. "turquoise": [64, 224, 208],
  38357. "violet": [238, 130, 238],
  38358. "wheat": [245, 222, 179],
  38359. "white": [255, 255, 255],
  38360. "whitesmoke": [245, 245, 245],
  38361. "yellow": [255, 255, 0],
  38362. "yellowgreen": [154, 205, 50],
  38363. "transparent": [0, 0, 0, 0]
  38364. },
  38365. "filter": {
  38366. "value": [
  38367. "true",
  38368. "false",
  38369. "null",
  38370. "point",
  38371. "linestring",
  38372. "polygon",
  38373. "collection"
  38374. ]
  38375. }
  38376. };
  38377. CartoCSS['mapnik_reference'] = {
  38378. version: {
  38379. latest: SuperMap._mapnik_reference_latest,
  38380. '2.1.1': SuperMap._mapnik_reference_latest
  38381. }
  38382. };
  38383. SuperMap.CartoCSS = CartoCSS;
  38384. SuperMap.CartoCSS.Tree = {};
  38385. SuperMap.CartoCSS.Tree.operate = function(op, a, b) {
  38386. switch (op) {
  38387. case '+': return a + b;
  38388. case '-': return a - b;
  38389. case '*': return a * b;
  38390. case '%': return a % b;
  38391. case '/': return a / b;
  38392. }
  38393. };
  38394. SuperMap.CartoCSS.Tree.functions = {
  38395. rgb: function (r, g, b) {
  38396. return this.rgba(r, g, b, 1.0);
  38397. },
  38398. rgba: function (r, g, b, a) {
  38399. var me = this;
  38400. var rgb = [r, g, b].map(function (c) {
  38401. return me.number(c);
  38402. });
  38403. a = me.number(a);
  38404. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  38405. return new SuperMap.CartoCSS.Tree.Color(rgb, a);
  38406. },
  38407. // Only require val
  38408. stop: function (val) {
  38409. var color, mode;
  38410. if (arguments.length > 1) {color = arguments[1];}
  38411. if (arguments.length > 2) {mode = arguments[2];}
  38412. return {
  38413. is: 'tag',
  38414. val: val,
  38415. color: color,
  38416. mode: mode,
  38417. toString(env) {
  38418. return '\n\t<stop value="' + val.ev(env) + '"' +
  38419. (color ? ' color="' + color.ev(env) + '" ' : '') +
  38420. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  38421. '/>';
  38422. }
  38423. };
  38424. },
  38425. hsl: function (h, s, l) {
  38426. return this.hsla(h, s, l, 1.0);
  38427. },
  38428. hsla: function (h, s, l, a) {
  38429. h = (this.number(h) % 360) / 360;
  38430. s = this.number(s);
  38431. l = this.number(l);
  38432. a = this.number(a);
  38433. if ([h, s, l, a].some(isNaN)) {return null;}
  38434. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  38435. m1 = l * 2 - m2;
  38436. return this.rgba(hue(h + 1 / 3) * 255,
  38437. hue(h) * 255,
  38438. hue(h - 1 / 3) * 255,
  38439. a);
  38440. function hue(h) {
  38441. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  38442. 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;}
  38443. }
  38444. },
  38445. hue: function (color) {
  38446. if (!('toHSL' in color)) {return null;}
  38447. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  38448. },
  38449. saturation: function (color) {
  38450. if (!('toHSL' in color)) {return null;}
  38451. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  38452. },
  38453. lightness: function (color) {
  38454. if (!('toHSL' in color)) {return null;}
  38455. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  38456. },
  38457. alpha: function (color) {
  38458. if (!('toHSL' in color)) {return null;}
  38459. return new SuperMap.CartoCSS.Tree.Dimension(color.toHSL().a);
  38460. },
  38461. saturate: function (color, amount) {
  38462. if (!('toHSL' in color)) {return null;}
  38463. var hsl = color.toHSL();
  38464. hsl.s += amount.value / 100;
  38465. hsl.s = this.clamp(hsl.s);
  38466. return this.hsla_simple(hsl);
  38467. },
  38468. desaturate: function (color, amount) {
  38469. if (!('toHSL' in color)) {return null;}
  38470. var hsl = color.toHSL();
  38471. hsl.s -= amount.value / 100;
  38472. hsl.s = this.clamp(hsl.s);
  38473. return this.hsla_simple(hsl);
  38474. },
  38475. lighten: function (color, amount) {
  38476. if (!('toHSL' in color)) {return null;}
  38477. var hsl = color.toHSL();
  38478. hsl.l += amount.value / 100;
  38479. hsl.l = this.clamp(hsl.l);
  38480. return this.hsla_simple(hsl);
  38481. },
  38482. darken: function (color, amount) {
  38483. if (!('toHSL' in color)) {return null;}
  38484. var hsl = color.toHSL();
  38485. hsl.l -= amount.value / 100;
  38486. hsl.l = this.clamp(hsl.l);
  38487. return this.hsla_simple(hsl);
  38488. },
  38489. fadein: function (color, amount) {
  38490. if (!('toHSL' in color)) {return null;}
  38491. var hsl = color.toHSL();
  38492. hsl.a += amount.value / 100;
  38493. hsl.a = this.clamp(hsl.a);
  38494. return this.hsla_simple(hsl);
  38495. },
  38496. fadeout: function (color, amount) {
  38497. if (!('toHSL' in color)) {return null;}
  38498. var hsl = color.toHSL();
  38499. hsl.a -= amount.value / 100;
  38500. hsl.a = this.clamp(hsl.a);
  38501. return this.hsla_simple(hsl);
  38502. },
  38503. spin: function (color, amount) {
  38504. if (!('toHSL' in color)) {return null;}
  38505. var hsl = color.toHSL();
  38506. var hue = (hsl.h + amount.value) % 360;
  38507. hsl.h = hue < 0 ? 360 + hue : hue;
  38508. return this.hsla_simple(hsl);
  38509. },
  38510. replace: function (entity, a, b) {
  38511. if (entity.is === 'field') {
  38512. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  38513. } else {
  38514. return entity.replace(a, b);
  38515. }
  38516. },
  38517. //
  38518. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  38519. // http://sass-lang.com
  38520. //
  38521. mix: function (color1, color2, weight) {
  38522. var p = weight.value / 100.0;
  38523. var w = p * 2 - 1;
  38524. var a = color1.toHSL().a - color2.toHSL().a;
  38525. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  38526. var w2 = 1 - w1;
  38527. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  38528. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  38529. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  38530. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  38531. return new SuperMap.CartoCSS.Tree.Color(rgb, alpha);
  38532. },
  38533. greyscale: function (color) {
  38534. return this.desaturate(color, new SuperMap.CartoCSS.Tree.Dimension(100));
  38535. },
  38536. '%': function (quoted /* arg, arg, ...*/) {
  38537. var args = Array.prototype.slice.call(arguments, 1),
  38538. str = quoted.value;
  38539. for (var i = 0; i < args.length; i++) {
  38540. str = str.replace(/%s/, args[i].value)
  38541. .replace(/%[da]/, args[i].toString());
  38542. }
  38543. str = str.replace(/%%/g, '%');
  38544. return new SuperMap.CartoCSS.Tree.Quoted(str);
  38545. },
  38546. hsla_simple: function (h) {
  38547. return this.hsla(h.h, h.s, h.l, h.a);
  38548. },
  38549. number: function (n) {
  38550. if (n instanceof SuperMap.CartoCSS.Tree.Dimension) {
  38551. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  38552. } else if (typeof(n) === 'number') {
  38553. return n;
  38554. } else {
  38555. return NaN;
  38556. }
  38557. },
  38558. clamp: function (val) {
  38559. return Math.min(1, Math.max(0, val));
  38560. }
  38561. };
  38562. SuperMap.CartoCSS.Tree.Call = class Call {
  38563. constructor(name, args, index) {
  38564. this.is = 'call';
  38565. this.name = name;
  38566. this.args = args;
  38567. this.index = index;
  38568. }
  38569. // When evuating a function call,
  38570. // we either find the function in `tree.functions` [1],
  38571. // in which case we call it, passing the evaluated arguments,
  38572. // or we simply print it out as it appeared originally [2].
  38573. // The *functions.js* file contains the built-in functions.
  38574. // The reason why we evaluate the arguments, is in the case where
  38575. // we try to pass a variable to a function, like: `saturate(@color)`.
  38576. // The function should receive the value, not the variable.
  38577. 'ev'(env) {
  38578. var args = this.args.map(function (a) {
  38579. return a.ev(env);
  38580. });
  38581. for (var i = 0; i < args.length; i++) {
  38582. if (args[i].is === 'undefined') {
  38583. return {
  38584. is: 'undefined',
  38585. value: 'undefined'
  38586. };
  38587. }
  38588. }
  38589. if (this.name in SuperMap.CartoCSS.Tree.functions) {
  38590. if (SuperMap.CartoCSS.Tree.functions[this.name].length <= args.length) {
  38591. var val = SuperMap.CartoCSS.Tree.functions[this.name].apply(SuperMap.CartoCSS.Tree.functions, args);
  38592. if (val === null) {
  38593. env.error({
  38594. message: 'incorrect arguments given to ' + this.name + '()',
  38595. index: this.index,
  38596. type: 'runtime',
  38597. filename: this.filename
  38598. });
  38599. return {is: 'undefined', value: 'undefined'};
  38600. }
  38601. return val;
  38602. } else {
  38603. env.error({
  38604. message: 'incorrect number of arguments for ' + this.name +
  38605. '(). ' + SuperMap.CartoCSS.Tree.functions[this.name].length + ' expected.',
  38606. index: this.index,
  38607. type: 'runtime',
  38608. filename: this.filename
  38609. });
  38610. return {
  38611. is: 'undefined',
  38612. value: 'undefined'
  38613. };
  38614. }
  38615. } else {
  38616. var fn = SuperMap.CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  38617. if (fn === undefined) {
  38618. var functions = lodash_topairs_default()(SuperMap.CartoCSS.Tree.Reference.mapnikFunctions);
  38619. // cheap closest, needs improvement.
  38620. var name = this.name;
  38621. var mean = functions.map(function (f) {
  38622. return [f[0], SuperMap.CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  38623. }).sort(function (a, b) {
  38624. return a[1] - b[1];
  38625. });
  38626. env.error({
  38627. message: 'unknown function ' + this.name + '(), did you mean ' +
  38628. mean[0][0] + '(' + mean[0][2] + ')',
  38629. index: this.index,
  38630. type: 'runtime',
  38631. filename: this.filename
  38632. });
  38633. return {
  38634. is: 'undefined',
  38635. value: 'undefined'
  38636. };
  38637. }
  38638. if (fn !== args.length &&
  38639. // support variable-arg functions like `colorize-alpha`
  38640. fn !== -1) {
  38641. env.error({
  38642. message: 'function ' + this.name + '() takes ' +
  38643. fn + ' arguments and was given ' + args.length,
  38644. index: this.index,
  38645. type: 'runtime',
  38646. filename: this.filename
  38647. });
  38648. return {
  38649. is: 'undefined',
  38650. value: 'undefined'
  38651. };
  38652. } else {
  38653. // Save the evaluated versions of arguments
  38654. this.args = args;
  38655. return this;
  38656. }
  38657. }
  38658. }
  38659. toString(env, format) {
  38660. if (this.args.length) {
  38661. return this.name + '(' + this.args.join(',') + ')';
  38662. } else {
  38663. return this.name;
  38664. }
  38665. }
  38666. };
  38667. SuperMap.CartoCSS.Tree.Color = class Color {
  38668. constructor(rgb, a) {
  38669. this.is = 'color';
  38670. // The end goal here, is to parse the arguments
  38671. // into an integer triplet, such as `128, 255, 0`
  38672. //
  38673. // This facilitates operations and conversions.
  38674. if (Array.isArray(rgb)) {
  38675. this.rgb = rgb.slice(0, 3);
  38676. } else if (rgb.length == 6) {
  38677. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  38678. return parseInt(c, 16);
  38679. });
  38680. } else {
  38681. this.rgb = rgb.split('').map(function (c) {
  38682. return parseInt(c + c, 16);
  38683. });
  38684. }
  38685. if (typeof(a) === 'number') {
  38686. this.alpha = a;
  38687. } else if (rgb.length === 4) {
  38688. this.alpha = rgb[3];
  38689. } else {
  38690. this.alpha = 1;
  38691. }
  38692. }
  38693. 'ev'() {
  38694. return this;
  38695. }
  38696. // If we have some transparency, the only way to represent it
  38697. // is via `rgba`. Otherwise, we use the hex representation,
  38698. // which has better compatibility with older browsers.
  38699. // Values are capped between `0` and `255`, rounded and zero-padded.
  38700. toString() {
  38701. /* if (this.alpha < 1.0) {*/
  38702. return 'rgba(' + this.rgb.map(function (c) {
  38703. return Math.round(c);
  38704. }).concat(this.alpha).join(', ') + ')';
  38705. /*} else {
  38706. return '#' + this.rgb.map(function(i) {
  38707. i = Math.round(i);
  38708. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  38709. return i.length === 1 ? '0' + i : i;
  38710. }).join('');
  38711. }*/
  38712. }
  38713. // Operations have to be done per-channel, if not,
  38714. // channels will spill onto each other. Once we have
  38715. // our result, in the form of an integer triplet,
  38716. // we create a new Color node to hold the result.
  38717. operate(env, op, other) {
  38718. var result = [];
  38719. if (!(other instanceof SuperMap.CartoCSS.Tree.Color)) {
  38720. other = other.toColor();
  38721. }
  38722. for (var c = 0; c < 3; c++) {
  38723. result[c] = SuperMap.CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  38724. }
  38725. return new SuperMap.CartoCSS.Tree.Color(result);
  38726. }
  38727. toHSL() {
  38728. var r = this.rgb[0] / 255,
  38729. g = this.rgb[1] / 255,
  38730. b = this.rgb[2] / 255,
  38731. a = this.alpha;
  38732. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  38733. var h, s, l = (max + min) / 2, d = max - min;
  38734. if (max === min) {
  38735. h = s = 0;
  38736. } else {
  38737. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  38738. switch (max) {
  38739. case r:
  38740. h = (g - b) / d + (g < b ? 6 : 0);
  38741. break;
  38742. case g:
  38743. h = (b - r) / d + 2;
  38744. break;
  38745. case b:
  38746. h = (r - g) / d + 4;
  38747. break;
  38748. default:
  38749. break;
  38750. }
  38751. h /= 6;
  38752. }
  38753. return {h: h * 360, s: s, l: l, a: a};
  38754. }
  38755. };
  38756. SuperMap.CartoCSS.Tree.Comment = class Comment {
  38757. constructor(value, silent) {
  38758. this.value = value;
  38759. this.silent = !!silent;
  38760. }
  38761. toString(env) {
  38762. return '<!--' + this.value + '-->';
  38763. }
  38764. 'ev'() {
  38765. return this;
  38766. }
  38767. };
  38768. SuperMap.CartoCSS.Tree.Definition = class Definition {
  38769. constructor(selector, rules) {
  38770. this.elements = selector.elements;
  38771. //assert.ok(selector.filters instanceof SuperMap.CartoCSS.Tree.Filterset);
  38772. this.rules = rules;
  38773. this.ruleIndex = {};
  38774. for (var i = 0; i < this.rules.length; i++) {
  38775. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  38776. this.rules[i].zoom = selector.zoom;
  38777. this.ruleIndex[this.rules[i].updateID()] = true;
  38778. }
  38779. this.filters = selector.filters;
  38780. this.zoom = selector.zoom;
  38781. this.attachment = selector.attachment || '__default__';
  38782. this.specificity = selector.specificity();
  38783. }
  38784. toString() {
  38785. var str = this.filters.toString();
  38786. for (var i = 0; i < this.rules.length; i++) {
  38787. str += '\n ' + this.rules[i];
  38788. }
  38789. return str;
  38790. }
  38791. toJS(env) {
  38792. var shaderAttrs = {};
  38793. // merge conditions from filters with zoom condition of the
  38794. // definition
  38795. var zoom = this.zoom;
  38796. //var frame_offset = this.frame_offset;
  38797. var _if = this.filters.toJS(env);
  38798. var filters = [zoom];
  38799. if (_if) {filters.push(_if);}
  38800. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  38801. _if = filters.join(" && ");
  38802. function eachRule(rule) {
  38803. if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  38804. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  38805. if (_if) {
  38806. shaderAttrs[rule.name].push(
  38807. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  38808. );
  38809. } else {
  38810. shaderAttrs[rule.name].push(rule.value.toJS(env));
  38811. }
  38812. } else {
  38813. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  38814. var sh = rule.toJS(env);
  38815. for (var v in sh) {
  38816. shaderAttrs[v] = shaderAttrs[v] || [];
  38817. for (var attr in sh[v]) {
  38818. shaderAttrs[v].push(sh[v][attr]);
  38819. }
  38820. }
  38821. }
  38822. }
  38823. }
  38824. for (var id in this.rules) {
  38825. eachRule(this.rules[id]);
  38826. }
  38827. return shaderAttrs;
  38828. }
  38829. };
  38830. SuperMap.CartoCSS.Tree.Dimension = class Dimension {
  38831. constructor(value, unit, index) {
  38832. this.is = 'float';
  38833. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  38834. this.screen_units = ['px', '%'];
  38835. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  38836. this.densities = {
  38837. m: 0.0254,
  38838. mm: 25.4,
  38839. cm: 2.54,
  38840. pt: 72,
  38841. pc: 6
  38842. };
  38843. this.value = parseFloat(value);
  38844. this.unit = unit || null;
  38845. this.index = index;
  38846. }
  38847. ev(env) {
  38848. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  38849. env.error({
  38850. message: "Invalid unit: '" + this.unit + "'",
  38851. index: this.index
  38852. });
  38853. return {is: 'undefined', value: 'undefined'};
  38854. }
  38855. // normalize units which are not px or %
  38856. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  38857. if (!env.ppi) {
  38858. env.error({
  38859. message: "ppi is not set, so metric units can't be used",
  38860. index: this.index
  38861. });
  38862. return {is: 'undefined', value: 'undefined'};
  38863. }
  38864. // convert all units to inch
  38865. // convert inch to px using ppi
  38866. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  38867. this.unit = 'px';
  38868. }
  38869. return this;
  38870. }
  38871. toColor() {
  38872. return new SuperMap.CartoCSS.Tree.Color([this.value, this.value, this.value]);
  38873. }
  38874. round() {
  38875. this.value = Math.round(this.value);
  38876. return this;
  38877. }
  38878. toString() {
  38879. return this.value.toString();
  38880. }
  38881. operate(env, op, other) {
  38882. if (this.unit === '%' && other.unit !== '%') {
  38883. env.error({
  38884. message: 'If two operands differ, the first must not be %',
  38885. index: this.index
  38886. });
  38887. return {
  38888. is: 'undefined',
  38889. value: 'undefined'
  38890. };
  38891. }
  38892. if (this.unit !== '%' && other.unit === '%') {
  38893. if (op === '*' || op === '/' || op === '%') {
  38894. env.error({
  38895. message: 'Percent values can only be added or subtracted from other values',
  38896. index: this.index
  38897. });
  38898. return {
  38899. is: 'undefined',
  38900. value: 'undefined'
  38901. };
  38902. }
  38903. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op,
  38904. this.value, this.value * other.value * 0.01),
  38905. this.unit);
  38906. }
  38907. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  38908. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op, this.value, other.value),
  38909. this.unit || other.unit);
  38910. }
  38911. };
  38912. SuperMap.CartoCSS.Tree.Element = class Element {
  38913. constructor(value) {
  38914. this.value = value.trim();
  38915. if (this.value[0] === '#') {
  38916. this.type = 'id';
  38917. this.clean = this.value.replace(/^#/, '');
  38918. }
  38919. if (this.value[0] === '.') {
  38920. this.type = 'class';
  38921. this.clean = this.value.replace(/^\./, '');
  38922. }
  38923. if (this.value.indexOf('*') !== -1) {
  38924. this.type = 'wildcard';
  38925. }
  38926. }
  38927. specificity() {
  38928. return [
  38929. (this.type === 'id') ? 1 : 0, // a
  38930. (this.type === 'class') ? 1 : 0 // b
  38931. ];
  38932. }
  38933. toString() {
  38934. return this.value;
  38935. }
  38936. };
  38937. SuperMap.CartoCSS.Tree.Expression = class Expression {
  38938. constructor(value) {
  38939. this.is = 'expression';
  38940. this.value = value;
  38941. }
  38942. ev(env) {
  38943. if (this.value.length > 1) {
  38944. return new SuperMap.CartoCSS.Tree.Expression(this.value.map(function (e) {
  38945. return e.ev(env);
  38946. }));
  38947. } else {
  38948. return this.value[0].ev(env);
  38949. }
  38950. }
  38951. toString(env) {
  38952. return this.value.map(function (e) {
  38953. return e.toString(env);
  38954. }).join(' ');
  38955. }
  38956. };
  38957. SuperMap.CartoCSS.Tree.Field = class Field {
  38958. constructor(content) {
  38959. this.is = 'field';
  38960. this.value = content || '';
  38961. }
  38962. toString() {
  38963. return '["' + this.value.toUpperCase() + '"]';
  38964. }
  38965. 'ev'() {
  38966. return this;
  38967. }
  38968. };
  38969. SuperMap.CartoCSS.Tree.Filter = class Filter {
  38970. constructor(key, op, val, index, filename) {
  38971. this.ops = {
  38972. '<': [' &lt; ', 'numeric'],
  38973. '>': [' &gt; ', 'numeric'],
  38974. '=': [' = ', 'both'],
  38975. '!=': [' != ', 'both'],
  38976. '<=': [' &lt;= ', 'numeric'],
  38977. '>=': [' &gt;= ', 'numeric'],
  38978. '=~': ['.match(', 'string', ')']
  38979. };
  38980. this.key = key;
  38981. this.op = op;
  38982. this.val = val;
  38983. this.index = index;
  38984. this.filename = filename;
  38985. this.id = this.key + this.op + this.val;
  38986. }
  38987. ev(env) {
  38988. this.key = this.key.ev(env);
  38989. this.val = this.val.ev(env);
  38990. return this;
  38991. }
  38992. toString() {
  38993. return '[' + this.id + ']';
  38994. }
  38995. };
  38996. SuperMap.CartoCSS.Tree.Filterset = class Filterset {
  38997. constructor() {
  38998. this.filters = {};
  38999. }
  39000. toJS(env) {
  39001. function eachFilter(filter) {
  39002. var op = filter.op;
  39003. if (op === "=") {
  39004. op = "==";
  39005. }
  39006. var val = filter.val;
  39007. if (filter._val !== undefined) {
  39008. val = filter._val.toString(true);
  39009. }
  39010. //对scale进行特殊处理,将值转换成数值
  39011. if (filter.key && filter.key.value === 'scale') {
  39012. val = +val;
  39013. } else if (typeof val === 'string' || typeof val === 'object') {
  39014. val = "'" + val + "'";
  39015. }
  39016. var attrs = "attributes";
  39017. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  39018. }
  39019. var results = [];
  39020. for (var id in this.filters) {
  39021. results.push(eachFilter(this.filters[id]));
  39022. }
  39023. return results.join(' && ');
  39024. }
  39025. toString() {
  39026. var arr = [];
  39027. for (var id in this.filters) {arr.push(this.filters[id].id);}
  39028. return arr.sort().join('\t');
  39029. }
  39030. ev(env) {
  39031. for (var i in this.filters) {
  39032. this.filters[i].ev(env);
  39033. }
  39034. return this;
  39035. }
  39036. clone() {
  39037. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  39038. for (var id in this.filters) {
  39039. clone.filters[id] = this.filters[id];
  39040. }
  39041. return clone;
  39042. }
  39043. cloneWith(other) {
  39044. var additions = [];
  39045. for (var id in other.filters) {
  39046. var status = this.addable(other.filters[id]);
  39047. // status is true, false or null. if it's null we don't fail this
  39048. // clone nor do we add the filter.
  39049. if (status === false) {
  39050. return false;
  39051. }
  39052. if (status === true) {
  39053. // Adding the filter will override another value.
  39054. additions.push(other.filters[id]);
  39055. }
  39056. }
  39057. // Adding the other filters doesn't make this filterset invalid, but it
  39058. // doesn't add anything to it either.
  39059. if (!additions.length) {
  39060. return null;
  39061. }
  39062. // We can successfully add all filters. Now clone the filterset and add the
  39063. // new rules.
  39064. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  39065. // We can add the rules that are already present without going through the
  39066. // add function as a Filterset is always in it's simplest canonical form.
  39067. for (id in this.filters) {
  39068. clone.filters[id] = this.filters[id];
  39069. }
  39070. // Only add new filters that actually change the filter.
  39071. while (id = additions.shift()) {
  39072. clone.add(id);
  39073. }
  39074. return clone;
  39075. }
  39076. addable(filter) {
  39077. var key = filter.key.toString(),
  39078. value = filter.val.toString();
  39079. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  39080. switch (filter.op) {
  39081. case '=':
  39082. // if there is already foo= and we're adding foo=
  39083. if (this.filters[key + '='] !== undefined) {
  39084. if (this.filters[key + '='].val.toString() != value) {
  39085. return false;
  39086. } else {
  39087. return null;
  39088. }
  39089. }
  39090. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  39091. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  39092. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  39093. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  39094. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  39095. return true;
  39096. case '=~':
  39097. return true;
  39098. case '!=':
  39099. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  39100. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  39101. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  39102. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  39103. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  39104. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  39105. return true;
  39106. case '>':
  39107. if (key + '=' in this.filters) {
  39108. if (this.filters[key + '='].val <= value) {
  39109. return false;
  39110. } else {
  39111. return null;
  39112. }
  39113. }
  39114. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  39115. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  39116. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  39117. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  39118. return true;
  39119. case '>=':
  39120. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  39121. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  39122. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  39123. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  39124. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  39125. return true;
  39126. case '<':
  39127. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  39128. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  39129. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  39130. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  39131. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  39132. return true;
  39133. case '<=':
  39134. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  39135. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  39136. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  39137. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  39138. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  39139. return true;
  39140. default:
  39141. break;
  39142. }
  39143. }
  39144. conflict(filter) {
  39145. var key = filter.key.toString(),
  39146. value = filter.val.toString();
  39147. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  39148. // if (a=b) && (a=c)
  39149. // if (a=b) && (a!=b)
  39150. // or (a!=b) && (a=b)
  39151. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  39152. value != this.filters[key + '='].val.toString()) ||
  39153. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  39154. value == this.filters[key + '='].val.toString()) ||
  39155. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  39156. value === this.filters[key + '!='].val.toString())) {
  39157. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  39158. }
  39159. return false;
  39160. }
  39161. add(filter, env) {
  39162. var key = filter.key.toString(),
  39163. op = filter.op,
  39164. conflict = this.conflict(filter),
  39165. numval;
  39166. if (conflict) {return conflict;}
  39167. if (op === '=') {
  39168. for (var i in this.filters) {
  39169. if (this.filters[i].key === key) {delete this.filters[i];}
  39170. }
  39171. this.filters[key + '='] = filter;
  39172. } else if (op === '!=') {
  39173. this.filters[key + '!=' + filter.val] = filter;
  39174. } else if (op === '=~') {
  39175. this.filters[key + '=~' + filter.val] = filter;
  39176. } else if (op === '>') {
  39177. // If there are other filters that are also >
  39178. // but are less than this one, they don't matter, so
  39179. // remove them.
  39180. for (var j in this.filters) {
  39181. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  39182. delete this.filters[j];
  39183. }
  39184. }
  39185. this.filters[key + '>'] = filter;
  39186. } else if (op === '>=') {
  39187. for (var k in this.filters) {
  39188. numval = (+this.filters[k].val.toString());
  39189. if (this.filters[k].key === key && numval < filter.val) {
  39190. delete this.filters[k];
  39191. }
  39192. }
  39193. if (this.filters[key + '!=' + filter.val] !== undefined) {
  39194. delete this.filters[key + '!=' + filter.val];
  39195. filter.op = '>';
  39196. this.filters[key + '>'] = filter;
  39197. } else {
  39198. this.filters[key + '>='] = filter;
  39199. }
  39200. } else if (op === '<') {
  39201. for (var l in this.filters) {
  39202. numval = (+this.filters[l].val.toString());
  39203. if (this.filters[l].key === key && numval >= filter.val) {
  39204. delete this.filters[l];
  39205. }
  39206. }
  39207. this.filters[key + '<'] = filter;
  39208. } else if (op === '<=') {
  39209. for (var m in this.filters) {
  39210. numval = (+this.filters[m].val.toString());
  39211. if (this.filters[m].key === key && numval > filter.val) {
  39212. delete this.filters[m];
  39213. }
  39214. }
  39215. if (this.filters[key + '!=' + filter.val] !== undefined) {
  39216. delete this.filters[key + '!=' + filter.val];
  39217. filter.op = '<';
  39218. this.filters[key + '<'] = filter;
  39219. } else {
  39220. this.filters[key + '<='] = filter;
  39221. }
  39222. }
  39223. }
  39224. };
  39225. SuperMap.CartoCSS.Tree.Fontset = class Fontset {
  39226. constructor(env, fonts) {
  39227. this.fonts = fonts;
  39228. this.name = 'fontset-' + env.effects.length;
  39229. }
  39230. };
  39231. SuperMap.CartoCSS.Tree.Invalid = class Invalid {
  39232. constructor(chunk, index, message) {
  39233. this.is = 'invalid';
  39234. this.chunk = chunk;
  39235. this.index = index;
  39236. this.type = 'syntax';
  39237. this.message = message || "Invalid code: " + this.chunk;
  39238. }
  39239. ev(env) {
  39240. env.error({
  39241. chunk: this.chunk,
  39242. index: this.index,
  39243. type: 'syntax',
  39244. message: this.message || "Invalid code: " + this.chunk
  39245. });
  39246. return {
  39247. is: 'undefined'
  39248. };
  39249. }
  39250. };
  39251. SuperMap.CartoCSS.Tree.Keyword = class Keyword {
  39252. ev() {
  39253. return this;
  39254. }
  39255. constructor(value) {
  39256. this.value = value;
  39257. var special = {
  39258. 'transparent': 'color',
  39259. 'true': 'boolean',
  39260. 'false': 'boolean'
  39261. };
  39262. this.is = special[value] ? special[value] : 'keyword';
  39263. }
  39264. toString() {
  39265. return this.value;
  39266. }
  39267. };
  39268. /*Layer:class Invalid ),*/
  39269. SuperMap.CartoCSS.Tree.Literal = class Literal {
  39270. constructor(content) {
  39271. this.value = content || '';
  39272. this.is = 'field';
  39273. }
  39274. toString() {
  39275. return this.value;
  39276. }
  39277. 'ev'() {
  39278. return this;
  39279. }
  39280. };
  39281. SuperMap.CartoCSS.Tree.Operation = class Operation {
  39282. constructor(op, operands, index) {
  39283. this.is = 'operation';
  39284. this.op = op.trim();
  39285. this.operands = operands;
  39286. this.index = index;
  39287. }
  39288. ev(env) {
  39289. var a = this.operands[0].ev(env),
  39290. b = this.operands[1].ev(env),
  39291. temp;
  39292. if (a.is === 'undefined' || b.is === 'undefined') {
  39293. return {
  39294. is: 'undefined',
  39295. value: 'undefined'
  39296. };
  39297. }
  39298. if (a instanceof SuperMap.CartoCSS.Tree.Dimension && b instanceof SuperMap.CartoCSS.Tree.Color) {
  39299. if (this.op === '*' || this.op === '+') {
  39300. temp = b;
  39301. b = a;
  39302. a = temp;
  39303. } else {
  39304. env.error({
  39305. name: "OperationError",
  39306. message: "Can't substract or divide a color from a number",
  39307. index: this.index
  39308. });
  39309. }
  39310. }
  39311. // Only concatenate plain strings, because this is easily
  39312. // pre-processed
  39313. if (a instanceof SuperMap.CartoCSS.Tree.Quoted && b instanceof SuperMap.CartoCSS.Tree.Quoted && this.op !== '+') {
  39314. env.error({
  39315. message: "Can't subtract, divide, or multiply strings.",
  39316. index: this.index,
  39317. type: 'runtime',
  39318. filename: this.filename
  39319. });
  39320. return {
  39321. is: 'undefined',
  39322. value: 'undefined'
  39323. };
  39324. }
  39325. // Fields, literals, dimensions, and quoted strings can be combined.
  39326. if (a instanceof SuperMap.CartoCSS.Tree.Field || b instanceof SuperMap.CartoCSS.Tree.Field ||
  39327. a instanceof SuperMap.CartoCSS.Tree.Literal || b instanceof SuperMap.CartoCSS.Tree.Literal) {
  39328. if (a.is === 'color' || b.is === 'color') {
  39329. env.error({
  39330. message: "Can't subtract, divide, or multiply colors in expressions.",
  39331. index: this.index,
  39332. type: 'runtime',
  39333. filename: this.filename
  39334. });
  39335. return {
  39336. is: 'undefined',
  39337. value: 'undefined'
  39338. };
  39339. } else {
  39340. return new SuperMap.CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  39341. }
  39342. }
  39343. if (a.operate === undefined) {
  39344. env.error({
  39345. message: 'Cannot do math with type ' + a.is + '.',
  39346. index: this.index,
  39347. type: 'runtime',
  39348. filename: this.filename
  39349. });
  39350. return {
  39351. is: 'undefined',
  39352. value: 'undefined'
  39353. };
  39354. }
  39355. return a.operate(env, this.op, b);
  39356. }
  39357. };
  39358. SuperMap.CartoCSS.Tree.Quoted = class Quoted {
  39359. constructor(content) {
  39360. this.is = 'string';
  39361. this.value = content || '';
  39362. }
  39363. toString(quotes) {
  39364. var escapedValue = this.value
  39365. .replace(/&/g, '&amp;')
  39366. var xmlvalue = escapedValue
  39367. .replace(/\'/g, '\\\'')
  39368. .replace(/\"/g, '&quot;')
  39369. .replace(/</g, '&lt;')
  39370. .replace(/\>/g, '&gt;');
  39371. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  39372. }
  39373. ev() {
  39374. return this;
  39375. }
  39376. operate(env, op, other) {
  39377. return new SuperMap.CartoCSS.Tree.Quoted(SuperMap.CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  39378. }
  39379. };
  39380. SuperMap.CartoCSS.Tree.Reference = {
  39381. _validateValue: {
  39382. 'font': function (env, value) {
  39383. if (env.validation_data && env.validation_data.fonts) {
  39384. return env.validation_data.fonts.indexOf(value) != -1;
  39385. } else {
  39386. return true;
  39387. }
  39388. }
  39389. },
  39390. setData: function (data) {
  39391. this.data = data;
  39392. this.selector_cache = generateSelectorCache(data);
  39393. this.mapnikFunctions = generateMapnikFunctions(data);
  39394. this.required_cache = generateRequiredProperties(data);
  39395. function generateSelectorCache(data) {
  39396. var index = {};
  39397. for (var i in data.symbolizers) {
  39398. for (var j in data.symbolizers[i]) {
  39399. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  39400. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  39401. }
  39402. }
  39403. }
  39404. return index;
  39405. }
  39406. function generateMapnikFunctions(data) {
  39407. var functions = {};
  39408. for (var i in data.symbolizers) {
  39409. for (var j in data.symbolizers[i]) {
  39410. if (data.symbolizers[i][j].type === 'functions') {
  39411. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  39412. var fn = data.symbolizers[i][j].functions[k];
  39413. functions[fn[0]] = fn[1];
  39414. }
  39415. }
  39416. }
  39417. }
  39418. return functions;
  39419. }
  39420. function generateRequiredProperties(data) {
  39421. var cache = {};
  39422. for (var symbolizer_name in data.symbolizers) {
  39423. cache[symbolizer_name] = [];
  39424. for (var j in data.symbolizers[symbolizer_name]) {
  39425. if (data.symbolizers[symbolizer_name][j].required) {
  39426. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  39427. }
  39428. }
  39429. }
  39430. return cache;
  39431. }
  39432. },
  39433. setVersion: function (version) {
  39434. if (SuperMap.CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  39435. this.setData(SuperMap.CartoCSS.mapnik_reference.version[version]);
  39436. return true;
  39437. }
  39438. return false;
  39439. },
  39440. selectorData: function (selector, i) {
  39441. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  39442. },
  39443. validSelector: function (selector) {
  39444. return !!this.selector_cache[selector];
  39445. },
  39446. selectorName: function (selector) {
  39447. return this.selectorData(selector, 2);
  39448. },
  39449. selector: function (selector) {
  39450. return this.selectorData(selector, 0);
  39451. },
  39452. symbolizer: function (selector) {
  39453. return this.selectorData(selector, 1);
  39454. },
  39455. requiredProperties: function (symbolizer_name, rules) {
  39456. var req = this.required_cache[symbolizer_name];
  39457. for (var i in req) {
  39458. if (!(req[i] in rules)) {
  39459. return 'Property ' + req[i] + ' required for defining ' +
  39460. symbolizer_name + ' styles.';
  39461. }
  39462. }
  39463. },
  39464. isFont: function (selector) {
  39465. return this.selector(selector).validate === 'font';
  39466. },
  39467. editDistance: function (a, b) {
  39468. if (a.length === 0) {return b.length;}
  39469. if (b.length === 0) {return a.length;}
  39470. var matrix = [];
  39471. for (var i = 0; i <= b.length; i++) {
  39472. matrix[i] = [i];
  39473. }
  39474. for (var j = 0; j <= a.length; j++) {
  39475. matrix[0][j] = j;
  39476. }
  39477. for (i = 1; i <= b.length; i++) {
  39478. for (j = 1; j <= a.length; j++) {
  39479. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  39480. matrix[i][j] = matrix[i - 1][j - 1];
  39481. } else {
  39482. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  39483. Math.min(matrix[i][j - 1] + 1, // insertion
  39484. matrix[i - 1][j] + 1)); // deletion
  39485. }
  39486. }
  39487. }
  39488. return matrix[b.length][a.length];
  39489. },
  39490. validValue: function (env, selector, value) {
  39491. function validateFunctions(value, selector) {
  39492. if (value.value[0].is === 'string') {return true;}
  39493. for (var i in value.value) {
  39494. for (var j in value.value[i].value) {
  39495. if (value.value[i].value[j].is !== 'call') {return false;}
  39496. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  39497. return x[0] === value.value[i].value[j].name;
  39498. });
  39499. if (!(f && f[1] === -1)) {
  39500. // This filter is unknown or given an incorrect number of arguments
  39501. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  39502. }
  39503. }
  39504. }
  39505. return true;
  39506. }
  39507. function validateKeyword(value, selector) {
  39508. if (typeof this.selector(selector).type === 'object') {
  39509. return this.selector(selector).type
  39510. .indexOf(value.value[0].value) !== -1;
  39511. } else {
  39512. // allow unquoted keywords as strings
  39513. return this.selector(selector).type === 'string';
  39514. }
  39515. }
  39516. var i;
  39517. if (!this.selector(selector)) {
  39518. return false;
  39519. } else if (value.value[0].is === 'keyword') {
  39520. return validateKeyword(value, selector);
  39521. } else if (value.value[0].is === 'undefined') {
  39522. // caught earlier in the chain - ignore here so that
  39523. // error is not overridden
  39524. return true;
  39525. } else if (this.selector(selector).type === 'numbers') {
  39526. for (i in value.value) {
  39527. if (value.value[i].is !== 'float') {
  39528. return false;
  39529. }
  39530. }
  39531. return true;
  39532. } else if (this.selector(selector).type === 'tags') {
  39533. if (!value.value) {return false;}
  39534. if (!value.value[0].value) {
  39535. return value.value[0].is === 'tag';
  39536. }
  39537. for (i = 0; i < value.value[0].value.length; i++) {
  39538. if (value.value[0].value[i].is !== 'tag') {return false;}
  39539. }
  39540. return true;
  39541. } else if (this.selector(selector).type == 'functions') {
  39542. // For backwards compatibility, you can specify a string for `functions`-compatible
  39543. // values, though they will not be validated.
  39544. return validateFunctions(value, selector);
  39545. } else if (this.selector(selector).type === 'expression') {
  39546. return true;
  39547. } else if (this.selector(selector).type === 'unsigned') {
  39548. if (value.value[0].is === 'float') {
  39549. value.value[0].round();
  39550. return true;
  39551. } else {
  39552. return false;
  39553. }
  39554. } else {
  39555. if (this.selector(selector).validate) {
  39556. var valid = false;
  39557. for (i = 0; i < value.value.length; i++) {
  39558. if (this.selector(selector).type === value.value[i].is &&
  39559. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  39560. return true;
  39561. }
  39562. }
  39563. return valid;
  39564. } else {
  39565. return this.selector(selector).type === value.value[0].is;
  39566. }
  39567. }
  39568. }
  39569. };
  39570. SuperMap.CartoCSS.Tree.Reference.setVersion("latest");
  39571. SuperMap.CartoCSS.Tree.Rule = class Rule {
  39572. constructor(name, value, index, filename) {
  39573. this.is = 'rule';
  39574. var parts = name.split('/');
  39575. this.name = parts.pop();
  39576. this.instance = parts.length ? parts[0] : '__default__';
  39577. this.value = (value instanceof SuperMap.CartoCSS.Tree.Value) ?
  39578. value : new SuperMap.CartoCSS.Tree.Value([value]);
  39579. this.index = index;
  39580. this.symbolizer = SuperMap.CartoCSS.Tree.Reference.symbolizer(this.name);
  39581. this.filename = filename;
  39582. this.variable = (name.charAt(0) === '@');
  39583. }
  39584. clone() {
  39585. var clone = Object.create(SuperMap.CartoCSS.Tree.Rule.prototype);
  39586. clone.name = this.name;
  39587. clone.value = this.value;
  39588. clone.index = this.index;
  39589. clone.instance = this.instance;
  39590. clone.symbolizer = this.symbolizer;
  39591. clone.filename = this.filename;
  39592. clone.variable = this.variable;
  39593. return clone;
  39594. }
  39595. updateID() {
  39596. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  39597. }
  39598. toString() {
  39599. return '[' + SuperMap.CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  39600. }
  39601. ev(context) {
  39602. return new SuperMap.CartoCSS.Tree.Rule(this.name,
  39603. this.value.ev(context),
  39604. this.index,
  39605. this.filename);
  39606. }
  39607. };
  39608. SuperMap.CartoCSS.Tree.Ruleset = class Ruleset {
  39609. constructor(selectors, rules) {
  39610. this.is = 'ruleset';
  39611. this.selectors = selectors;
  39612. this.rules = rules;
  39613. // static cache of find() function
  39614. this._lookups = {};
  39615. }
  39616. ev(env) {
  39617. var i,
  39618. rule,
  39619. ruleset = new SuperMap.CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  39620. ruleset.root = this.root;
  39621. // push the current ruleset to the frames stack
  39622. env.frames.unshift(ruleset);
  39623. // Evaluate everything else
  39624. for (i = 0, rule; i < ruleset.rules.length; i++) {
  39625. rule = ruleset.rules[i];
  39626. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  39627. }
  39628. // Pop the stack
  39629. env.frames.shift();
  39630. return ruleset;
  39631. }
  39632. match(args) {
  39633. return !args || args.length === 0;
  39634. }
  39635. variables() {
  39636. if (this._variables) {
  39637. return this._variables;
  39638. } else {
  39639. return this._variables = this.rules.reduce(function (hash, r) {
  39640. if (r instanceof SuperMap.CartoCSS.Tree.Rule && r.variable === true) {
  39641. hash[r.name] = r;
  39642. }
  39643. return hash;
  39644. }, {});
  39645. }
  39646. }
  39647. variable(name) {
  39648. return this.variables()[name];
  39649. }
  39650. rulesets() {
  39651. if (this._rulesets) {
  39652. return this._rulesets;
  39653. } else {
  39654. return this._rulesets = this.rules.filter(function (r) {
  39655. return (r instanceof SuperMap.CartoCSS.Tree.Ruleset);
  39656. });
  39657. }
  39658. }
  39659. find(selector, self) {
  39660. self = self || this;
  39661. var rules = [], match,
  39662. key = selector.toString();
  39663. if (key in this._lookups) {
  39664. return this._lookups[key];
  39665. }
  39666. this.rulesets().forEach(function (rule) {
  39667. if (rule !== self) {
  39668. for (var j = 0; j < rule.selectors.length; j++) {
  39669. match = selector.match(rule.selectors[j]);
  39670. if (match) {
  39671. if (selector.elements.length > 1) {
  39672. Array.prototype.push.apply(rules, rule.find(
  39673. new SuperMap.CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  39674. } else {
  39675. rules.push(rule);
  39676. }
  39677. break;
  39678. }
  39679. }
  39680. }
  39681. });
  39682. return this._lookups[key] = rules;
  39683. }
  39684. // Zooms can use variables. This replaces SuperMap.CartoCSS.Tree.Zoom objects on selectors
  39685. // with simple bit-arrays that we can compare easily.
  39686. evZooms(env) {
  39687. for (var i = 0; i < this.selectors.length; i++) {
  39688. var zval = SuperMap.CartoCSS.Tree.Zoom.all;
  39689. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  39690. zval = this.selectors[i].zoom[z].ev(env).zoom;
  39691. }
  39692. this.selectors[i].zoom = zval;
  39693. }
  39694. }
  39695. flatten(result, parents, env) {
  39696. var selectors = [], i, j;
  39697. if (this.selectors.length === 0) {
  39698. env.frames = env.frames.concat(this.rules);
  39699. }
  39700. // evaluate zoom variables on this object.
  39701. this.evZooms(env);
  39702. for (i = 0; i < this.selectors.length; i++) {
  39703. var child = this.selectors[i];
  39704. if (!child.filters) {
  39705. // This is an invalid filterset.
  39706. continue;
  39707. }
  39708. if (parents.length) {
  39709. for (j = 0; j < parents.length; j++) {
  39710. var parent = parents[j];
  39711. var mergedFilters = parent.filters.cloneWith(child.filters);
  39712. if (mergedFilters === null) {
  39713. // Filters could be added, but they didn't change the
  39714. // filters. This means that we only have to clone when
  39715. // the zoom levels or the attachment is different too.
  39716. if (parent.zoom === child.zoom &&
  39717. parent.attachment === child.attachment &&
  39718. parent.elements.join() === child.elements.join()) {
  39719. selectors.push(parent);
  39720. continue;
  39721. } else {
  39722. mergedFilters = parent.filters;
  39723. }
  39724. } else if (!mergedFilters) {
  39725. // The merged filters are invalid, that means we don't
  39726. // have to clone.
  39727. continue;
  39728. }
  39729. var clone = Object.create(SuperMap.CartoCSS.Tree.Selector.prototype);
  39730. clone.filters = mergedFilters;
  39731. clone.zoom = child.zoom;
  39732. clone.elements = parent.elements.concat(child.elements);
  39733. if (parent.attachment && child.attachment) {
  39734. clone.attachment = parent.attachment + '/' + child.attachment;
  39735. } else {clone.attachment = child.attachment || parent.attachment;}
  39736. clone.conditions = parent.conditions + child.conditions;
  39737. clone.index = child.index;
  39738. selectors.push(clone);
  39739. }
  39740. } else {
  39741. selectors.push(child);
  39742. }
  39743. }
  39744. var rules = [];
  39745. for (i = 0; i < this.rules.length; i++) {
  39746. var rule = this.rules[i];
  39747. // Recursively flatten any nested rulesets
  39748. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  39749. rule.flatten(result, selectors, env);
  39750. } else if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  39751. rules.push(rule);
  39752. } else if (rule instanceof SuperMap.CartoCSS.Tree.Invalid) {
  39753. env.error(rule);
  39754. }
  39755. }
  39756. var index = rules.length ? rules[0].index : false;
  39757. for (i = 0; i < selectors.length; i++) {
  39758. // For specificity sort, use the position of the first rule to allow
  39759. // defining attachments that are under current element as a descendant
  39760. // selector.
  39761. if (index !== false) {
  39762. selectors[i].index = index;
  39763. }
  39764. result.push(new SuperMap.CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  39765. }
  39766. return result;
  39767. }
  39768. };
  39769. SuperMap.CartoCSS.Tree.Selector = class Selector {
  39770. constructor(filters, zoom, elements, attachment, conditions, index) {
  39771. this.elements = elements || [];
  39772. this.attachment = attachment;
  39773. this.filters = filters || {};
  39774. this.zoom = typeof zoom !== 'undefined' ? zoom : SuperMap.CartoCSS.Tree.Zoom.all;
  39775. this.conditions = conditions;
  39776. this.index = index;
  39777. }
  39778. specificity() {
  39779. return this.elements.reduce(function (memo, e) {
  39780. var spec = e.specificity();
  39781. memo[0] += spec[0];
  39782. memo[1] += spec[1];
  39783. return memo;
  39784. }, [0, 0, this.conditions, this.index]);
  39785. }
  39786. };
  39787. /*style:class Invalid ),*/
  39788. SuperMap.CartoCSS.Tree.URL = class URL {
  39789. constructor(val, paths) {
  39790. this.is = 'uri';
  39791. this.value = val;
  39792. this.paths = paths;
  39793. }
  39794. toString() {
  39795. return this.value.toString();
  39796. }
  39797. ev(ctx) {
  39798. return new SuperMap.CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  39799. }
  39800. };
  39801. SuperMap.CartoCSS.Tree.Value = class Value {
  39802. constructor(value) {
  39803. this.is = 'value';
  39804. this.value = value;
  39805. }
  39806. ev(env) {
  39807. if (this.value.length === 1) {
  39808. return this.value[0].ev(env);
  39809. } else {
  39810. return new SuperMap.CartoCSS.Tree.Value(this.value.map(function (v) {
  39811. return v.ev(env);
  39812. }));
  39813. }
  39814. }
  39815. toJS(env) {
  39816. //var v = this.value[0].value[0];
  39817. var val = this.ev(env);
  39818. var v = val.toString();
  39819. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  39820. v = "'" + v + "'";
  39821. } else if (val.is === 'field') {
  39822. // replace [varuable] by ctx['variable']
  39823. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  39824. } else if (val.value && typeof val.value === "object") {
  39825. v = "[" + v + "]";
  39826. }
  39827. return "_value = " + v + ";";
  39828. }
  39829. toString(env, selector, sep, format) {
  39830. return this.value.map(function (e) {
  39831. return e.toString(env, format);
  39832. }).join(sep || ', ');
  39833. }
  39834. clone() {
  39835. var obj = Object.create(SuperMap.CartoCSS.Tree.Value.prototype);
  39836. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  39837. obj.is = this.is;
  39838. return obj;
  39839. }
  39840. };
  39841. SuperMap.CartoCSS.Tree.Variable = class Variable {
  39842. constructor(name, index, filename) {
  39843. this.is = 'variable';
  39844. this.name = name;
  39845. this.index = index;
  39846. this.filename = filename;
  39847. }
  39848. toString() {
  39849. return this.name;
  39850. }
  39851. ev(env) {
  39852. if (this._css) {return this._css;}
  39853. var thisframe = env.frames.filter(function (f) {
  39854. return f.name === this.name;
  39855. }.bind(this));
  39856. if (thisframe.length) {
  39857. return thisframe[0].value.ev(env);
  39858. } else {
  39859. env.error({
  39860. message: 'variable ' + this.name + ' is undefined',
  39861. index: this.index,
  39862. type: 'runtime',
  39863. filename: this.filename
  39864. });
  39865. return {
  39866. is: 'undefined',
  39867. value: 'undefined'
  39868. };
  39869. }
  39870. }
  39871. };
  39872. SuperMap.CartoCSS.Tree.Zoom = class Zoom {
  39873. constructor(op, value, index) {
  39874. this.op = op;
  39875. this.value = value;
  39876. this.index = index;
  39877. }
  39878. setZoom(zoom) {
  39879. this.zoom = zoom;
  39880. return this;
  39881. }
  39882. ev(env) {
  39883. var value = parseInt(this.value.ev(env).toString(), 10);
  39884. if (value > SuperMap.CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  39885. env.error({
  39886. message: 'Only zoom levels between 0 and ' +
  39887. SuperMap.CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  39888. index: this.index
  39889. });
  39890. }
  39891. switch (this.op) {
  39892. case '=':
  39893. this.zoom = "zoom && zoom === " + value;
  39894. return this;
  39895. case '>':
  39896. this.zoom = "zoom && zoom > " + value;
  39897. break;
  39898. case '>=':
  39899. this.zoom = "zoom && zoom >= " + value;
  39900. break;
  39901. case '<':
  39902. this.zoom = "zoom && zoom < " + value;
  39903. break;
  39904. case '<=':
  39905. this.zoom = "zoom && zoom <= " + value;
  39906. break;
  39907. default:
  39908. return this;
  39909. break;
  39910. }
  39911. /*
  39912. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  39913. if (i >= start && i <= end) {
  39914. zoom |= (1 << i);
  39915. }
  39916. }
  39917. this.zoom = zoom;
  39918. this.zoom=value+this.op+"zoom";*/
  39919. return this;
  39920. }
  39921. toString() {
  39922. var str = '';
  39923. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  39924. str += (this.zoom & (1 << i)) ? 'X' : '.';
  39925. }
  39926. return str;
  39927. }
  39928. };
  39929. // Covers all zoomlevels from 0 to 22
  39930. SuperMap.CartoCSS.Tree.Zoom.all = 23;
  39931. SuperMap.CartoCSS.Tree.Zoom.maxZoom = 22;
  39932. SuperMap.CartoCSS.Tree.Zoom.ranges = {
  39933. 0: 1000000000,
  39934. 1: 500000000,
  39935. 2: 200000000,
  39936. 3: 100000000,
  39937. 4: 50000000,
  39938. 5: 25000000,
  39939. 6: 12500000,
  39940. 7: 6500000,
  39941. 8: 3000000,
  39942. 9: 1500000,
  39943. 10: 750000,
  39944. 11: 400000,
  39945. 12: 200000,
  39946. 13: 100000,
  39947. 14: 50000,
  39948. 15: 25000,
  39949. 16: 12500,
  39950. 17: 5000,
  39951. 18: 2500,
  39952. 19: 1500,
  39953. 20: 750,
  39954. 21: 500,
  39955. 22: 250,
  39956. 23: 100
  39957. };
  39958. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  39959. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  39960. * This program are made available under the terms of the Apache License, Version 2.0
  39961. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39962. /**
  39963. * @class SuperMap.ThemeStyle
  39964. * @classdesc 客户端专题图风格类。
  39965. * @category Visualization Theme
  39966. * @param {Object} options - 可选参数。
  39967. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  39968. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  39969. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  39970. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  39971. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  39972. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  39973. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  39974. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  39975. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  39976. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  39977. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  39978. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效;)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  39979. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  39980. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  39981. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  39982. * @param {string} options.label - 专题要素附加文本标签内容。
  39983. * @param {string} [options.fontColor] - 附加文本字体颜色。
  39984. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  39985. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  39986. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  39987. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  39988. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  39989. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  39990. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  39991. * @param {string} [options.labelPosition='top'] - 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  39992. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  39993. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle' 。
  39994. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  39995. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  39996. */
  39997. class ThemeStyle {
  39998. constructor(options) {
  39999. options = options || {};
  40000. /**
  40001. * @member {boolean} [SuperMap.ThemeStyle.prototype.fill=true]
  40002. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  40003. */
  40004. this.fill = true;
  40005. /**
  40006. * @member {string} [SuperMap.ThemeStyle.prototype.fillColor="#000000"]
  40007. * @description 十六进制填充颜色。
  40008. */
  40009. this.fillColor = "#000000";
  40010. /**
  40011. * @member {number} [SuperMap.ThemeStyle.prototype.fillOpacity=1]
  40012. * @description 填充不透明度。取值范围[0, 1]。
  40013. */
  40014. this.fillOpacity = 1;
  40015. /**
  40016. * @member {boolean} [SuperMap.ThemeStyle.prototype.stroke=false]
  40017. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  40018. */
  40019. this.stroke = false;
  40020. /**
  40021. * @member {string} [SuperMap.ThemeStyle.prototype.strokeColor="#000000"]
  40022. * @description 十六进制描边颜色。
  40023. */
  40024. this.strokeColor = "#000000";
  40025. /**
  40026. * @member {number} [SuperMap.ThemeStyle.prototype.strokeOpacity=1]
  40027. * @description 描边的不透明度。取值范围[0, 1]。
  40028. */
  40029. this.strokeOpacity = 1;
  40030. /**
  40031. * @member {number} [SuperMap.ThemeStyle.prototype.strokeWidth=1]
  40032. * @description 线宽度/描边宽度。
  40033. */
  40034. this.strokeWidth = 1;
  40035. /**
  40036. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLinecap="butt"]
  40037. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  40038. */
  40039. this.strokeLinecap = "butt";
  40040. /**
  40041. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLineJoin="miter"]
  40042. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  40043. */
  40044. this.strokeLineJoin = "miter";
  40045. /**
  40046. * @member {string} [SuperMap.ThemeStyle.prototype.strokeDashstyle="solid"]
  40047. * @description 虚线类型; strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  40048. * solid 表示实线。
  40049. */
  40050. this.strokeDashstyle = "solid";
  40051. /**
  40052. * @member {number} [SuperMap.ThemeStyle.prototype.pointRadius=6]
  40053. * @description 点半径。单位为像素。
  40054. */
  40055. this.pointRadius = 6;
  40056. /**
  40057. * @member {number} [SuperMap.ThemeStyle.prototype.shadowBlur=0]
  40058. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  40059. */
  40060. this.shadowBlur = 0;
  40061. /**
  40062. * @member {string} [SuperMap.ThemeStyle.prototype.shadowColor='#000000']
  40063. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  40064. */
  40065. this.shadowColor = "#000000";
  40066. /**
  40067. * @member {number} [SuperMap.ThemeStyle.prototype.shadowOffsetX=0]
  40068. * @description 阴影 X 方向偏移值。
  40069. */
  40070. this.shadowOffsetX = 0;
  40071. /**
  40072. * @member {number} SuperMap.ThemeStyle.prototype.shadowOffsetY
  40073. * @description Y 方向偏移值。
  40074. */
  40075. this.shadowOffsetY = 0;
  40076. /**
  40077. * @member {string} [SuperMap.ThemeStyle.prototype.label]
  40078. * @description 专题要素附加文本标签内容。
  40079. */
  40080. this.label = "";
  40081. /**
  40082. * @member {boolean} [SuperMap.ThemeStyle.prototype.labelRect=false]
  40083. * @description 是否显示文本标签矩形背景。
  40084. */
  40085. this.labelRect = false;
  40086. /**
  40087. * @member {string} [SuperMap.ThemeStyle.prototype.fontColor]
  40088. * @description 附加文本字体颜色。
  40089. */
  40090. this.fontColor = "";
  40091. /**
  40092. * @member {number} [SuperMap.ThemeStyle.prototype.fontSize=12]
  40093. * @description 附加文本字体大小,单位是像素。
  40094. */
  40095. this.fontSize = 12;
  40096. /**
  40097. * @member {string} [SuperMap.ThemeStyle.prototype.fontStyle="normal"]
  40098. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  40099. */
  40100. this.fontStyle = "normal";
  40101. /**
  40102. * @member {string} [SuperMap.ThemeStyle.prototype.fontVariant="normal"]
  40103. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  40104. */
  40105. this.fontVariant = "normal";
  40106. /**
  40107. * @member {string} [SuperMap.ThemeStyle.prototype.fontWeight="normal"]
  40108. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  40109. */
  40110. this.fontWeight = "normal";
  40111. /**
  40112. * @member {string} [SuperMap.ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  40113. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  40114. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  40115. */
  40116. this.fontFamily = "arial,sans-serif";
  40117. /**
  40118. * @member {string} [SuperMap.ThemeStyle.prototype.labelPosition='top']
  40119. * @description 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  40120. */
  40121. this.labelPosition = "top";
  40122. /**
  40123. * @member {string} [SuperMap.ThemeStyle.prototype.labelAlign='center']
  40124. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  40125. */
  40126. this.labelAlign = "center";
  40127. /**
  40128. * @member {string} [SuperMap.ThemeStyle.prototype.labelBaseline='middle']
  40129. * @description 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle'。
  40130. */
  40131. this.labelBaseline = "middle";
  40132. /**
  40133. * @member {number} [SuperMap.ThemeStyle.prototype.labelXOffset=0]
  40134. * @description 附加文本在 X 轴方向的偏移量。
  40135. */
  40136. this.labelXOffset = 0;
  40137. /**
  40138. * @member {number} [SuperMap.ThemeStyle.prototype.labelYOffset=0]
  40139. * @description 附加文本在 Y 轴方向的偏移量。
  40140. */
  40141. this.labelYOffset = 0;
  40142. Util.extend(this, options);
  40143. }
  40144. }
  40145. SuperMap.ThemeStyle = ThemeStyle;
  40146. ;// CONCATENATED MODULE: ./src/common/style/index.js
  40147. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40148. * This program are made available under the terms of the Apache License, Version 2.0
  40149. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40150. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  40151. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40152. * This program are made available under the terms of the Apache License, Version 2.0
  40153. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40154. /**
  40155. * @class SuperMap.Feature.ShapeParameters
  40156. * @category Visualization Theme
  40157. * @classdesc 图形参数基类,此类不可实例化
  40158. */
  40159. class ShapeParameters {
  40160. /**
  40161. * @function SuperMap.Feature.ShapeParameters.prototype.constructor
  40162. * @description 图形参数对象。
  40163. * @returns {SuperMap.Feature.ShapeParameters} 图形参数对象。
  40164. */
  40165. constructor() {
  40166. /**
  40167. * @member {Array} [SuperMap.Feature.ShapeParameters.prototype.refOriginalPosition=[0,0]]
  40168. * @description 图形参考原点位置,图形的参考中心位置。
  40169. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  40170. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  40171. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  40172. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  40173. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  40174. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  40175. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  40176. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  40177. */
  40178. this.refOriginalPosition = [0, 0];
  40179. /**
  40180. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataID
  40181. * @description 图形所关联数据的 ID(<{@link SuperMap.Feature.Vector}> 的 id)。
  40182. */
  40183. this.refDataID = null;
  40184. /**
  40185. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.isHoverByRefDataID
  40186. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  40187. */
  40188. this.isHoverByRefDataID = false;
  40189. /**
  40190. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataHoverGroup
  40191. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  40192. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  40193. */
  40194. this.refDataHoverGroup = null;
  40195. /**
  40196. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.dataInfo
  40197. * @description 图形携带的附加数据。
  40198. */
  40199. this.dataInfo = null;
  40200. /**
  40201. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.clickable
  40202. * @description 是否可点击。
  40203. */
  40204. this.clickable = true;
  40205. /**
  40206. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.hoverable
  40207. * @description 是否可点击。
  40208. */
  40209. this.hoverable = true;
  40210. /**
  40211. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.style
  40212. * @description 图形样式对象,可设样式属性在子类中确定。
  40213. */
  40214. this.style = null;
  40215. /**
  40216. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.highlightStyle
  40217. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  40218. */
  40219. this.highlightStyle = {};
  40220. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  40221. }
  40222. /**
  40223. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  40224. * @description 销毁对象。
  40225. */
  40226. destroy() {
  40227. this.refOriginalPosition = null;
  40228. this.refDataID = null;
  40229. this.isHoverByRefDataID = null;
  40230. this.refDataHoverGroup = null;
  40231. this.dataInfo = null;
  40232. this.clickable = null;
  40233. this.hoverable = null;
  40234. this.style = null;
  40235. this.highlightStyle = null;
  40236. }
  40237. }
  40238. SuperMap.Feature = SuperMap.Feature || {};
  40239. SuperMap.Feature.ShapeParameters = ShapeParameters;
  40240. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  40241. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40242. * This program are made available under the terms of the Apache License, Version 2.0
  40243. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40244. /**
  40245. * @class SuperMap.Feature.ShapeParameters.Point
  40246. * @category Visualization Theme
  40247. * @classdesc 点参数对象。
  40248. * @extends {SuperMap.Feature.ShapeParameters}
  40249. */
  40250. class Point_Point extends ShapeParameters {
  40251. /**
  40252. * @function SuperMap.Feature.ShapeParameters.Point.prototype.constructor
  40253. * @description 创建一个图形点参数对象。
  40254. * @param {number} x - 点 x 坐标,必设参数。
  40255. * @param {number} y - 点 y 坐标,必设参数。
  40256. * @returns {SuperMap.Feature.ShapeParameters.Point} 标签参数对象。
  40257. */
  40258. constructor(x, y) {
  40259. super(x, y);
  40260. /**
  40261. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.x
  40262. * @description 点 x 坐标。
  40263. */
  40264. this.x = !isNaN(x) ? x : 0;
  40265. /**
  40266. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.y
  40267. * @description 点 y 坐标。
  40268. */
  40269. this.y = !isNaN(y) ? y : 0;
  40270. /**
  40271. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.r
  40272. * @description 点的半径。
  40273. */
  40274. this.r = 6;
  40275. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  40276. }
  40277. /**
  40278. * @function SuperMap.Feature.ShapeParameters.Point.prototype.destroy
  40279. * @description 销毁对象。
  40280. */
  40281. destroy() {
  40282. this.x = null;
  40283. this.y = null;
  40284. this.r = null;
  40285. super.destroy();
  40286. }
  40287. }
  40288. /**
  40289. * @typedef {Object} SuperMap.Feature.ShapeParameters.Point.style
  40290. * @property {number} pointRadius - 点的半径,默认值:6。
  40291. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40292. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  40293. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  40294. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40295. * @property {string} strokeColor - 十六进制描边颜色。
  40296. * @property {number} strokeWidth - 描边宽度,默认值 1。
  40297. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  40298. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  40299. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  40300. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  40301. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  40302. */
  40303. SuperMap.Feature = SuperMap.Feature || {};
  40304. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  40305. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  40306. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40307. * This program are made available under the terms of the Apache License, Version 2.0
  40308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40309. /**
  40310. * @class SuperMap.Feature.ShapeParameters.Line
  40311. * @category Visualization Theme
  40312. * @classdesc 线参数对象。
  40313. * @extends {SuperMap.Feature.ShapeParameters}
  40314. */
  40315. class Line_Line extends ShapeParameters {
  40316. /**
  40317. * @function SuperMap.Feature.ShapeParameters.Line.prototype.constructor
  40318. * @description 创建一个图形线参数对象。
  40319. * @param {Array} pointList - 线要素节点数组,二维数组,必设参数。
  40320. * @returns {SuperMap.Feature.ShapeParameters.Line} 圆形参数对象。
  40321. */
  40322. constructor(pointList) {
  40323. super(pointList);
  40324. /**
  40325. * @member {Array} SuperMap.Feature.ShapeParameters.Line.prototype.pointList
  40326. * @description 线要素节点数组,二维数组。
  40327. * 数组形如:
  40328. * (start code)
  40329. * [
  40330. * [10, 20], //节点
  40331. * [30, 40],
  40332. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  40333. * ]
  40334. * (end)
  40335. */
  40336. this.pointList = pointList;
  40337. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  40338. }
  40339. /**
  40340. * @function SuperMap.Feature.ShapeParameters.Line.prototype.destroy
  40341. * @description 销毁对象。
  40342. */
  40343. destroy() {
  40344. this.pointList = null;
  40345. super.destroy();
  40346. }
  40347. }
  40348. /**
  40349. * @typedef {Object} SuperMap.Feature.ShapeParameters.Line.style
  40350. * @property {string} strokeColor - 十六进制线颜色。
  40351. * @property {number} strokeWidth - 线宽度,默认值 1。
  40352. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  40353. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  40354. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  40355. * @property {number} strokeOpacity - 线的不透明度。取值范围[0, 1],默认值 1。
  40356. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  40357. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  40358. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  40359. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  40360. */
  40361. SuperMap.Feature = SuperMap.Feature || {};
  40362. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  40363. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  40364. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40365. * This program are made available under the terms of the Apache License, Version 2.0
  40366. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40367. /**
  40368. * @class SuperMap.Feature.ShapeParameters.Polygon
  40369. * @category Visualization Theme
  40370. * @classdesc 面参数对象。
  40371. * @extends {SuperMap.Feature.ShapeParameters}
  40372. */
  40373. class Polygon_Polygon extends ShapeParameters {
  40374. /**
  40375. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.constructor
  40376. * @description 创建一个图形面参数对象。
  40377. * @param {Array} pointList - 横坐标,必设参数。
  40378. * @returns {SuperMap.Feature.ShapeParameters.Polygon} 标签参数对象。
  40379. */
  40380. constructor(pointList) {
  40381. super(pointList);
  40382. /**
  40383. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.pointList
  40384. * @description 面要素节点数组,二维数组。
  40385. * 数组形如:
  40386. * (start code)
  40387. * [
  40388. * [10, 20], //节点
  40389. * [30, 40],
  40390. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  40391. * ]
  40392. * (end)
  40393. */
  40394. this.pointList = pointList;
  40395. /**
  40396. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.holePolygonPointLists
  40397. * @description 岛洞面多边形顶点数组(三维数组)
  40398. */
  40399. this.holePolygonPointLists = null;
  40400. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  40401. }
  40402. /**
  40403. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.destroy
  40404. * @description 销毁对象。
  40405. */
  40406. destroy() {
  40407. this.pointList = null;
  40408. this.holePolygonPointLists = null;
  40409. super.destroy();
  40410. }
  40411. }
  40412. /**
  40413. * @typedef {Object} SuperMap.Feature.ShapeParameters.Polygon.style
  40414. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40415. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  40416. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  40417. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40418. * @property {string} strokeColor - 十六进制描边颜色。
  40419. * @property {number} strokeWidth - 描边宽度,默认值 1。
  40420. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  40421. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  40422. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  40423. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  40424. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  40425. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  40426. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  40427. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  40428. */
  40429. SuperMap.Feature = SuperMap.Feature || {};
  40430. SuperMap.Feature.ShapeParameters.Polygon = Polygon_Polygon;
  40431. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  40432. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40433. * This program are made available under the terms of the Apache License, Version 2.0
  40434. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40435. /**
  40436. * @class SuperMap.Feature.ShapeParameters.Rectangle
  40437. * @category Visualization Theme
  40438. * @classdesc 矩形参数对象。
  40439. * @extends {SuperMap.Feature.ShapeParameters}
  40440. */
  40441. class Rectangle_Rectangle extends ShapeParameters {
  40442. /**
  40443. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.constructor
  40444. * @description 创建一个图形矩形参数对象。
  40445. * @param {number} x - 矩形 x 坐标,必设参数。
  40446. * @param {number} y - 矩形 y 坐标,必设参数。
  40447. * @param {number} width - 矩形 width 坐标,必设参数。
  40448. * @param {number} height - 矩形 height 坐标,必设参数。
  40449. * @returns {SuperMap.Feature.ShapeParameters.Rectangle} 图形矩形参数对象。
  40450. */
  40451. constructor(x, y, width, height) {
  40452. super(x, y, width, height);
  40453. /**
  40454. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.x
  40455. * @description 左上角 x 坐标。
  40456. */
  40457. this.x = !isNaN(x) ? x : 0;
  40458. /**
  40459. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.y
  40460. * @description 左上角 y 坐标。
  40461. */
  40462. this.y = !isNaN(x) ? y : 0;
  40463. /**
  40464. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.width
  40465. * @description 宽度。
  40466. */
  40467. this.width = !isNaN(width) ? width : 0;
  40468. /**
  40469. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.height
  40470. * @description 高度。
  40471. */
  40472. this.height = !isNaN(height) ? height : 0;
  40473. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  40474. }
  40475. /**
  40476. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.destroy
  40477. * @description 销毁对象。
  40478. */
  40479. destroy() {
  40480. this.x = null;
  40481. this.y = null;
  40482. this.width = null;
  40483. this.height = null;
  40484. super.destroy();
  40485. }
  40486. }
  40487. /**
  40488. * @typedef {Object} SuperMap.Feature.ShapeParameters.Rectangle.style
  40489. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40490. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  40491. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  40492. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40493. * @property {string} strokeColor - 十六进制描边颜色。
  40494. * @property {number} strokeWidth - 描边宽度,默认值 1。
  40495. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  40496. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  40497. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  40498. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  40499. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  40500. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  40501. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  40502. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  40503. */
  40504. SuperMap.Feature = SuperMap.Feature || {};
  40505. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  40506. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  40507. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40508. * This program are made available under the terms of the Apache License, Version 2.0
  40509. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40510. /**
  40511. * @class SuperMap.Feature.ShapeParameters.Sector
  40512. * @category Visualization Theme
  40513. * @classdesc 扇形参数对象。
  40514. * @extends {SuperMap.Feature.ShapeParameters}
  40515. */
  40516. class Sector extends ShapeParameters {
  40517. /**
  40518. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.constructor
  40519. * @description 创建一个扇形参数对象。
  40520. * @param {number} x - 圆心 x 坐标,必设参数。
  40521. * @param {number} y - 圆心 y 坐标,必设参数。
  40522. * @param {number} r - 外圆半径,必设参数。
  40523. * @param {number} startAngle - 起始角度,必设参数。取值范围[0, 360)。
  40524. * @param {number} endAngle - 结束角度,必设参数。取值范围(0, 360]。
  40525. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  40526. * @returns {SuperMap.Feature.ShapeParameters.Sector} 扇形参数对象。
  40527. */
  40528. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  40529. super(x, y, r, startAngle, endAngle, r0, clockWise);
  40530. /**
  40531. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.x
  40532. * @description 圆心 x 坐标。
  40533. */
  40534. this.x = !isNaN(x) ? x : 0;
  40535. /**
  40536. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.Y
  40537. * @description 圆心 Y 坐标。
  40538. */
  40539. this.y = !isNaN(y) ? y : 0;
  40540. /**
  40541. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.r
  40542. * @description 外圆半径。
  40543. */
  40544. this.r = !isNaN(r) ? r : 0;
  40545. /**
  40546. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.startAngle
  40547. * @description 起始角度。取值范围[0, 360),默认值:null。
  40548. */
  40549. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  40550. /**
  40551. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.endAngle
  40552. * @description 结束角度。取值范围(0, 360],默认值:null。
  40553. */
  40554. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  40555. /**
  40556. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.r0=0]
  40557. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  40558. */
  40559. this.r0 = !isNaN(r0) ? r0 : 0;
  40560. /**
  40561. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.clockWise=false]
  40562. * @description 是否是顺时针。默认值:false。
  40563. */
  40564. this.clockWise = clockWise;
  40565. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  40566. }
  40567. /**
  40568. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.destroy
  40569. * @description 销毁对象。
  40570. */
  40571. destroy() {
  40572. this.x = null;
  40573. this.y = null;
  40574. this.r = null;
  40575. this.startAngle = null;
  40576. this.endAngle = null;
  40577. this.r0 = null;
  40578. this.clockWise = null;
  40579. super.destroy();
  40580. }
  40581. }
  40582. /**
  40583. * @typedef {Object} SuperMap.Feature.ShapeParameters.Sector.style
  40584. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40585. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  40586. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  40587. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40588. * @property {string} strokeColor - 十六进制描边颜色。
  40589. * @property {number} strokeWidth - 描边宽度,默认值 1。
  40590. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  40591. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  40592. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  40593. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  40594. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  40595. */
  40596. SuperMap.Feature = SuperMap.Feature || {};
  40597. SuperMap.Feature.ShapeParameters.Sector = Sector;
  40598. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  40599. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40600. * This program are made available under the terms of the Apache License, Version 2.0
  40601. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40602. /**
  40603. * @class SuperMap.Feature.ShapeParameters.Label
  40604. * @category Visualization Theme
  40605. * @classdesc 标签参数对象。
  40606. * @extent {SuperMap.Feature.ShapeParameters}
  40607. */
  40608. class Label extends ShapeParameters {
  40609. /**
  40610. * @function SuperMap.Feature.ShapeParameters.Label.prototype.constructor
  40611. * @description 创建一个标签参数对象。
  40612. * @param {number} x - 横坐标,必设参数。
  40613. * @param {number} y - 纵坐标,必设参数。
  40614. * @param {string} text - 图形中的附加文本,必设参数。
  40615. * @returns {SuperMap.Feature.ShapeParameters.Label} 标签参数对象。
  40616. */
  40617. constructor(x, y, text) {
  40618. super(x, y, text);
  40619. /**
  40620. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.x
  40621. * @description 标签 x 坐标。
  40622. */
  40623. this.x = x;
  40624. /**
  40625. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.y
  40626. * @description 标签 y 坐标。
  40627. */
  40628. this.y = y;
  40629. /**
  40630. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.text
  40631. * @description 标签的文本内容。
  40632. */
  40633. this.text = text;
  40634. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  40635. }
  40636. /**
  40637. * @function SuperMap.Feature.ShapeParameters.Label.prototype.destroy
  40638. * @description 销毁对象。
  40639. */
  40640. destroy() {
  40641. this.x = null;
  40642. this.y = null;
  40643. this.text = null;
  40644. super.destroy();
  40645. }
  40646. }
  40647. /**
  40648. * @typedef {Object} SuperMap.Feature.ShapeParameters.Label.style
  40649. * @property {boolean} fill - 是否填充,不需要填充则设置为 false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40650. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  40651. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  40652. * @property {boolean} stroke - 是否描边,不需要描边则设置为false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  40653. * @property {string} strokeColor - 十六进制描边颜色。
  40654. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  40655. * @property {number} strokeWidth -描边宽度,默认值 1。
  40656. * @property {number} maxWidth - 最大宽度限制。默认值:null。
  40657. * @property {number} fontSize - 标签文本字体大小。默认值 12,单位是像素。
  40658. * @property {string} fontStyle - 标签文本字体样式。可设值:"normal", "italic", "oblique"; 默认值:"normal" 。
  40659. * @property {string} fontVariant - 标签文本字体变体。可设值:"normal", "small-caps"; 默认值:"normal" 。
  40660. * @property {string} fontWeight - 标签文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"; 默认值:"normal" 。
  40661. * @property {string} fontFamily - 标签文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个值。
  40662. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。默认值:"arial,sans-serif".
  40663. * @property {string} labelBaseline - 标签文本垂直对齐, 可以是 'top', 'bottom', 'middle',默认值 'middle'。
  40664. * @property {string} labelAlign - 标签文本水平对齐。可以是 'left', 'right', 'center'; 默认值 'center'。
  40665. * @property {number} shadowBlur - 阴影模糊度,大于 0 有效。默认值:0。
  40666. * @property {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  40667. * @property {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  40668. * @property {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  40669. */
  40670. SuperMap.Feature = SuperMap.Feature || {};
  40671. SuperMap.Feature.ShapeParameters.Label = Label;
  40672. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  40673. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40674. * This program are made available under the terms of the Apache License, Version 2.0
  40675. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40676. /**
  40677. * @class SuperMap.Feature.ShapeParameters.Image
  40678. * @category Visualization Theme
  40679. * @classdesc 图片参数对象。
  40680. * @extends {SuperMap.Feature.ShapeParameters}
  40681. */
  40682. class Image_Image extends ShapeParameters {
  40683. /**
  40684. * @function SuperMap.Feature.ShapeParameters.Image.prototype.constructor
  40685. * @description 创建一个图片参数对象。
  40686. * @param {number} x - 左上角横坐标,必设参数。
  40687. * @param {number} y - 左上角纵坐标,必设参数。
  40688. * @param {(string|Object)} image - 图片地址或Cavans对象,必设参数。
  40689. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  40690. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  40691. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  40692. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  40693. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  40694. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  40695. * @returns {SuperMap.Feature.ShapeParameters.Image} 圆形参数对象。
  40696. */
  40697. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  40698. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  40699. /**
  40700. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.x
  40701. * @description 左上角横坐标,必设参数。
  40702. */
  40703. this.x = x;
  40704. /**
  40705. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.y
  40706. * @description 左上角纵坐标,必设参数。
  40707. */
  40708. this.y = y;
  40709. /**
  40710. * @member {(string|Object)} SuperMap.Feature.ShapeParameters.Image.prototype.image
  40711. * @description 图片地址。
  40712. */
  40713. this.image = image;
  40714. /**
  40715. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.width
  40716. * @description 绘制到画布上的宽度,默认为图片高度。
  40717. */
  40718. this.width = width;
  40719. /**
  40720. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.height
  40721. * @description 绘制到画布上的高度,默认为图片高度。
  40722. */
  40723. this.height = height;
  40724. /**
  40725. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sx
  40726. * @description 从图片中裁剪的左上角横坐标。
  40727. */
  40728. this.sx = sx;
  40729. /**
  40730. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sy
  40731. * @description 从图片中裁剪的左上角纵坐标。
  40732. */
  40733. this.sy = sy;
  40734. /**
  40735. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sWidth
  40736. * @description 从图片中裁剪的宽度,默认为图片高度。
  40737. */
  40738. this.sWidth = sWidth;
  40739. /**
  40740. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sHeight
  40741. * @description 绘制到画布上的高度,默认为图片高度。
  40742. */
  40743. this.sHeight = sHeight;
  40744. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  40745. }
  40746. /**
  40747. * @function SuperMap.Feature.ShapeParameters.Image.prototype.destroy
  40748. * @description 销毁对象。
  40749. */
  40750. destroy() {
  40751. this.x = null;
  40752. this.y = null;
  40753. this.image = null;
  40754. this.width = null;
  40755. this.height = null;
  40756. this.sx = null;
  40757. this.sy = null;
  40758. this.sWidth = null;
  40759. this.sHeight = null;
  40760. super.destroy();
  40761. }
  40762. }
  40763. SuperMap.Feature = SuperMap.Feature || {};
  40764. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  40765. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  40766. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40767. * This program are made available under the terms of the Apache License, Version 2.0
  40768. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40769. /**
  40770. * @class SuperMap.Feature.ShapeParameters.Circle
  40771. * @classdesc 圆形参数对象。
  40772. * @category Visualization Theme
  40773. * @extends {SuperMap.Feature.ShapeParameters}
  40774. */
  40775. class Circle_Circle extends ShapeParameters {
  40776. /**
  40777. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.constructor
  40778. * @description 创建一个圆形参数对象。
  40779. * @param {number} x - 圆心 x 坐标,必设参数。
  40780. * @param {number} y - 圆心 y 坐标,必设参数。
  40781. * @param {number} r - 圆半径,必设参数。
  40782. * @returns {SuperMap.Feature.ShapeParameters.Circle} 圆形参数对象。
  40783. */
  40784. constructor(x, y, r) {
  40785. super(x, y, r);
  40786. /**
  40787. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.x
  40788. * @description 圆心 x 坐标。
  40789. */
  40790. this.x = !isNaN(x) ? x : 0;
  40791. /**
  40792. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.y
  40793. * @description 圆心 y 坐标。
  40794. */
  40795. this.y = !isNaN(y) ? y : 0;
  40796. /**
  40797. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.r
  40798. * @description 圆半径。
  40799. */
  40800. this.r = !isNaN(r) ? r : 0;
  40801. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  40802. }
  40803. /**
  40804. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.destroy
  40805. * @description 销毁对象。
  40806. */
  40807. destroy() {
  40808. this.x = null;
  40809. this.y = null;
  40810. this.r = null;
  40811. super.destroy();
  40812. }
  40813. }
  40814. SuperMap.Feature = SuperMap.Feature || {};
  40815. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  40816. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  40817. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  40818. * This program are made available under the terms of the Apache License, Version 2.0
  40819. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40820. /**
  40821. * @class SuperMap.LevelRenderer.Eventful
  40822. * @category Visualization Theme
  40823. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  40824. * 此类不可实例化。
  40825. * @private
  40826. */
  40827. class Eventful {
  40828. /**
  40829. * @function SuperMap.LevelRenderer.Eventful.prototype.constructor
  40830. * @description 构造函数。对象可以通过 onxxxx 绑定事件。
  40831. * 支持的事件:
  40832. * Symbolizer properties:
  40833. * onclick - {function} 默认值:null。
  40834. * onmouseover - {function} 默认值:null。
  40835. * onmouseout - {function} 默认值:null。
  40836. * onmousemove - {function} 默认值:null。
  40837. * onmousewheel - {function} 默认值:null。
  40838. * onmousedown - {function} 默认值:null。
  40839. * onmouseup - {function} 默认值:null。
  40840. * ondragstart - {function} 默认值:null。
  40841. * ondragend - {function} 默认值:null。
  40842. * ondragenter - {function} 默认值:null。
  40843. * ondragleave - {function} 默认值:null。
  40844. * ondragover - {function} 默认值:null。
  40845. * ondrop - {function} 默认值:null。
  40846. */
  40847. constructor() {
  40848. /**
  40849. * @member {Object} SuperMap.LevelRenderer.Eventful.prototype._handlers
  40850. * @description 事件处理对象(事件分发器)。
  40851. */
  40852. this._handlers = {};
  40853. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  40854. }
  40855. /**
  40856. * @function {Object} SuperMap.LevelRenderer.Eventful.prototype.destroy
  40857. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  40858. */
  40859. destroy() {
  40860. this._handlers = null;
  40861. }
  40862. /**
  40863. * @function SuperMap.LevelRenderer.Eventful.prototype.one
  40864. * @description 单次触发绑定,dispatch后销毁。
  40865. * @param {string} event - 事件名。
  40866. * @param {boolean} handler - 响应函数。
  40867. * @param {Object} context - context。
  40868. * @returns {SuperMap.LevelRenderer.Eventful} this
  40869. */
  40870. one(event, handler, context) {
  40871. var _h = this._handlers;
  40872. if (!handler || !event) {
  40873. return this;
  40874. }
  40875. if (!_h[event]) {
  40876. _h[event] = [];
  40877. }
  40878. _h[event].push({
  40879. h: handler,
  40880. one: true,
  40881. ctx: context || this
  40882. });
  40883. return this;
  40884. }
  40885. /**
  40886. * @function SuperMap.LevelRenderer.Eventful.prototype.bind
  40887. * @description 绑定事件。
  40888. * @param {string} event - 事件名。
  40889. * @param {boolean} handler - 响应函数。
  40890. * @param {Object} context - context。
  40891. * @returns {SuperMap.LevelRenderer.Eventful} this
  40892. */
  40893. bind(event, handler, context) {
  40894. var _h = this._handlers;
  40895. if (!handler || !event) {
  40896. return this;
  40897. }
  40898. if (!_h[event]) {
  40899. _h[event] = [];
  40900. }
  40901. _h[event].push({
  40902. h: handler,
  40903. one: false,
  40904. ctx: context || this
  40905. });
  40906. return this;
  40907. }
  40908. /**
  40909. * @function SuperMap.LevelRenderer.Eventful.prototype.unbind
  40910. * @description 解绑事件。
  40911. * @param {string} event - 事件名。
  40912. * @param {boolean} handler - 响应函数。
  40913. * @returns {SuperMap.LevelRenderer.Eventful} this
  40914. */
  40915. unbind(event, handler) {
  40916. var _h = this._handlers;
  40917. if (!event) {
  40918. this._handlers = {};
  40919. return this;
  40920. }
  40921. if (handler) {
  40922. if (_h[event]) {
  40923. var newList = [];
  40924. for (var i = 0, l = _h[event].length; i < l; i++) {
  40925. if (_h[event][i]['h'] != handler) {
  40926. newList.push(_h[event][i]);
  40927. }
  40928. }
  40929. _h[event] = newList;
  40930. }
  40931. if (_h[event] && _h[event].length === 0) {
  40932. delete _h[event];
  40933. }
  40934. } else {
  40935. delete _h[event];
  40936. }
  40937. return this;
  40938. }
  40939. /**
  40940. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatch
  40941. * @description 事件分发。
  40942. * @param {string} type - 事件类型。
  40943. * @returns {SuperMap.LevelRenderer.Eventful} this
  40944. */
  40945. dispatch(type) {
  40946. if (this._handlers[type]) {
  40947. var args = arguments;
  40948. var argLen = args.length;
  40949. if (argLen > 3) {
  40950. args = Array.prototype.slice.call(args, 1);
  40951. }
  40952. var _h = this._handlers[type];
  40953. var len = _h.length;
  40954. for (var i = 0; i < len;) {
  40955. // Optimize advise from backbone
  40956. switch (argLen) {
  40957. case 1:
  40958. _h[i]['h'].call(_h[i]['ctx']);
  40959. break;
  40960. case 2:
  40961. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  40962. break;
  40963. case 3:
  40964. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  40965. break;
  40966. default:
  40967. // have more than 2 given arguments
  40968. _h[i]['h'].apply(_h[i]['ctx'], args);
  40969. break;
  40970. }
  40971. if (_h[i]['one']) {
  40972. _h.splice(i, 1);
  40973. len--;
  40974. } else {
  40975. i++;
  40976. }
  40977. }
  40978. }
  40979. return this;
  40980. }
  40981. /**
  40982. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatchWithContext
  40983. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  40984. * @param {string} type - 事件类型。
  40985. * @returns {SuperMap.LevelRenderer.Eventful} this
  40986. */
  40987. dispatchWithContext(type) {
  40988. if (this._handlers[type]) {
  40989. var args = arguments;
  40990. var argLen = args.length;
  40991. if (argLen > 4) {
  40992. args = Array.prototype.slice.call(args, 1, args.length - 1);
  40993. }
  40994. var ctx = args[args.length - 1];
  40995. var _h = this._handlers[type];
  40996. var len = _h.length;
  40997. for (var i = 0; i < len;) {
  40998. // Optimize advise from backbone
  40999. switch (argLen) {
  41000. case 1:
  41001. _h[i]['h'].call(ctx);
  41002. break;
  41003. case 2:
  41004. _h[i]['h'].call(ctx, args[1]);
  41005. break;
  41006. case 3:
  41007. _h[i]['h'].call(ctx, args[1], args[2]);
  41008. break;
  41009. default:
  41010. // have more than 2 given arguments
  41011. _h[i]['h'].apply(ctx, args);
  41012. break;
  41013. }
  41014. if (_h[i]['one']) {
  41015. _h.splice(i, 1);
  41016. len--;
  41017. } else {
  41018. i++;
  41019. }
  41020. }
  41021. }
  41022. return this;
  41023. }
  41024. }
  41025. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  41026. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41027. * This program are made available under the terms of the Apache License, Version 2.0
  41028. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41029. /**
  41030. * @private
  41031. * @class SuperMap.LevelRenderer.Tool.Vector
  41032. * @category Visualization Theme
  41033. * @classdesc LevelRenderer 二维向量类
  41034. *
  41035. */
  41036. class levelRenderer_Vector_Vector {
  41037. /**
  41038. * @function SuperMap.LevelRenderer.Tool.Vector.constructor
  41039. * @description 构造函数
  41040. */
  41041. constructor() {
  41042. this.ArrayCtor = typeof Float32Array === 'undefined'
  41043. ? Array
  41044. : Float32Array;
  41045. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  41046. }
  41047. /**
  41048. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.create
  41049. * @description 创建一个向量。
  41050. *
  41051. * @param {number} x - x坐标
  41052. * @param {number} y - Y坐标
  41053. * @return {Vector2} 向量。
  41054. */
  41055. create(x, y) {
  41056. var ArrayCtor = this.ArrayCtor;
  41057. var out = new ArrayCtor(2);
  41058. out[0] = x || 0;
  41059. out[1] = y || 0;
  41060. return out;
  41061. }
  41062. /**
  41063. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.copy
  41064. * @description 复制一个向量。
  41065. *
  41066. * @param {Vector2} out - 基础向量。
  41067. * @param {Vector2} v - 向量。
  41068. * @return {Vector2} 克隆向量。
  41069. */
  41070. copy(out, v) {
  41071. out[0] = v[0];
  41072. out[1] = v[1];
  41073. return out;
  41074. }
  41075. /**
  41076. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.set
  41077. * @description 设置向量的两个项。
  41078. *
  41079. * @param {Vector2} out - 基础向量。
  41080. * @param {number} a - 项 a。
  41081. * @param {number} b - 项 b。
  41082. * @return {Vector2} 结果。
  41083. */
  41084. set(out, a, b) {
  41085. out[0] = a;
  41086. out[1] = b;
  41087. return out;
  41088. }
  41089. /**
  41090. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.add
  41091. * @description 向量相加。
  41092. *
  41093. * @param {Vector2} out - 基础向量。
  41094. * @param {Vector2} v1 - 向量 v1。
  41095. * @param {Vector2} v2 - 向量 v2。
  41096. * @return {Vector2} 结果。
  41097. */
  41098. add(out, v1, v2) {
  41099. out[0] = v1[0] + v2[0];
  41100. out[1] = v1[1] + v2[1];
  41101. return out;
  41102. }
  41103. /**
  41104. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  41105. * @description 向量缩放后相加。
  41106. * @param {Vector2} out - 基础向量。
  41107. * @param {Vector2} v1 - 向量 v1。
  41108. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  41109. * @param {number} a - 缩放参数。
  41110. * @return {Vector2} 结果。
  41111. */
  41112. scaleAndAdd(out, v1, v2, a) {
  41113. out[0] = v1[0] + v2[0] * a;
  41114. out[1] = v1[1] + v2[1] * a;
  41115. return out;
  41116. }
  41117. /**
  41118. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.sub
  41119. * @description 向量相减。
  41120. * @param {Vector2} out - 基础向量。
  41121. * @param {Vector2} v1 - 向量 v1。
  41122. * @param {Vector2} v2 - 向量 v2。
  41123. * @return {Vector2} 结果。
  41124. */
  41125. sub(out, v1, v2) {
  41126. out[0] = v1[0] - v2[0];
  41127. out[1] = v1[1] - v2[1];
  41128. return out;
  41129. }
  41130. /**
  41131. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.len
  41132. * @description 向量长度。
  41133. * @param {Vector2} v - 向量。
  41134. * @return {number} 向量长度。
  41135. */
  41136. len(v) {
  41137. return Math.sqrt(this.lenSquare(v));
  41138. }
  41139. /**
  41140. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lenSquare
  41141. * @description 向量长度平方。
  41142. * @param {Vector2} v - 向量。
  41143. * @return {number} 向量长度平方。
  41144. */
  41145. lenSquare(v) {
  41146. return v[0] * v[0] + v[1] * v[1];
  41147. }
  41148. /**
  41149. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.mul
  41150. * @description 向量乘法。
  41151. * @param {Vector2} out - 基础向量。
  41152. * @param {Vector2} v1 - 向量 v1。
  41153. * @param {Vector2} v2 - 向量 v2。
  41154. * @return {Vector2} 结果。
  41155. */
  41156. mul(out, v1, v2) {
  41157. out[0] = v1[0] * v2[0];
  41158. out[1] = v1[1] * v2[1];
  41159. return out;
  41160. }
  41161. /**
  41162. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.div
  41163. * @description 向量除法。
  41164. *
  41165. * @param {Vector2} out - 基础向量。
  41166. * @param {Vector2} v1 - 向量 v1。
  41167. * @param {Vector2} v2 - 向量 v2。
  41168. * @return {Vector2} 结果。
  41169. */
  41170. div(out, v1, v2) {
  41171. out[0] = v1[0] / v2[0];
  41172. out[1] = v1[1] / v2[1];
  41173. return out;
  41174. }
  41175. /**
  41176. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dot
  41177. * @description 向量点乘。
  41178. *
  41179. * @param {Vector2} v1 - 向量 v1。
  41180. * @param {Vector2} v2 - 向量 v2。
  41181. * @return {number} 向量点乘。
  41182. */
  41183. dot(v1, v2) {
  41184. return v1[0] * v2[0] + v1[1] * v2[1];
  41185. }
  41186. /**
  41187. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scale
  41188. * @description 向量缩放。
  41189. *
  41190. * @param {Vector2} out - 基础向量。
  41191. * @param {Vector2} v - 向量v。
  41192. * @param {number} s -缩放参数。
  41193. * @return {Vector2} 结果。
  41194. */
  41195. scale(out, v, s) {
  41196. out[0] = v[0] * s;
  41197. out[1] = v[1] * s;
  41198. return out;
  41199. }
  41200. /**
  41201. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.normalize
  41202. * @description 向量归一化。
  41203. *
  41204. * @param {Vector2} out - 基础向量。
  41205. * @param {Vector2} v - 向量 v。
  41206. * @return {Vector2} 结果。
  41207. */
  41208. normalize(out, v) {
  41209. var d = this.len(v);
  41210. if (d === 0) {
  41211. out[0] = 0;
  41212. out[1] = 0;
  41213. } else {
  41214. out[0] = v[0] / d;
  41215. out[1] = v[1] / d;
  41216. }
  41217. return out;
  41218. }
  41219. /**
  41220. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distance
  41221. * @description 计算向量间距离。
  41222. *
  41223. * @param {Vector2} v1 - 向量 v1。
  41224. * @param {Vector2} v2 - 向量 v2。
  41225. * @return {number} 向量间距离。
  41226. */
  41227. distance(v1, v2) {
  41228. return Math.sqrt(
  41229. (v1[0] - v2[0]) * (v1[0] - v2[0])
  41230. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  41231. );
  41232. }
  41233. /**
  41234. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distanceSquare
  41235. * @description 向量距离平方。
  41236. *
  41237. * @param {Vector2} v1 - 向量 v1。
  41238. * @param {Vector2} v2 - 向量 v2。
  41239. * @return {number} 向量距离平方。
  41240. */
  41241. distanceSquare(v1, v2) {
  41242. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  41243. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  41244. }
  41245. /**
  41246. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.negate
  41247. * @description 求负向量。
  41248. *
  41249. * @param {Vector2} out - 基础向量。
  41250. * @param {Vector2} v - 向量 v。
  41251. * @return {Vector2} 负向量。
  41252. */
  41253. negate(out, v) {
  41254. out[0] = -v[0];
  41255. out[1] = -v[1];
  41256. return out;
  41257. }
  41258. /**
  41259. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lerp
  41260. * @description 两点之间线性插值。
  41261. *
  41262. * @param {Vector2} out - 基础向量。
  41263. * @param {Vector2} v1 - 向量 v1。
  41264. * @param {Vector2} v2 - 向量 v2。
  41265. * @param {number} t
  41266. * @return {Vector2} 结果。
  41267. */
  41268. lerp(out, v1, v2, t) {
  41269. out[0] = v1[0] + t * (v2[0] - v1[0]);
  41270. out[1] = v1[1] + t * (v2[1] - v1[1]);
  41271. return out;
  41272. }
  41273. /**
  41274. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.applyTransform
  41275. * @description 矩阵左乘向量。
  41276. *
  41277. * @param {Vector2} out - 基础向量。
  41278. * @param {Vector2} v1 - 向量 v1。
  41279. * @param {Vector2} v2 - 向量 v2。
  41280. * @return {Vector2} 结果。
  41281. */
  41282. applyTransform(out, v, m) {
  41283. var x = v[0];
  41284. var y = v[1];
  41285. out[0] = m[0] * x + m[2] * y + m[4];
  41286. out[1] = m[1] * x + m[3] * y + m[5];
  41287. return out;
  41288. }
  41289. /**
  41290. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.min
  41291. * @description 求两个向量最小值。
  41292. * @param {Vector2} out - 基础向量。
  41293. * @param {Vector2} v1 - 向量 v1。
  41294. * @param {Vector2} v2 - 向量 v2。
  41295. * @return {Vector2} 结果。
  41296. */
  41297. min(out, v1, v2) {
  41298. out[0] = Math.min(v1[0], v2[0]);
  41299. out[1] = Math.min(v1[1], v2[1]);
  41300. return out;
  41301. }
  41302. /**
  41303. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.max
  41304. * @description 求两个向量最大值。
  41305. *
  41306. * @param {Vector2} out - 基础向量。
  41307. * @param {Vector2} v1 - 向量 v1。
  41308. * @param {Vector2} v2 - 向量 v2。
  41309. * @return {Vector2} 结果。
  41310. */
  41311. max(out, v1, v2) {
  41312. out[0] = Math.max(v1[0], v2[0]);
  41313. out[1] = Math.max(v1[1], v2[1]);
  41314. return out;
  41315. }
  41316. /**
  41317. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.length
  41318. * @description 向量长度。
  41319. *
  41320. * @param {Vector2} v - 向量。
  41321. * @return {number} 向量长度。
  41322. */
  41323. length(v) {
  41324. return this.len(v);
  41325. }
  41326. /**
  41327. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lengthSquare
  41328. * @description 向量长度平方。
  41329. *
  41330. * @param {Vector2} v - 向量。
  41331. * @return {number} 向量长度平方。
  41332. */
  41333. lengthSquare(v) {
  41334. return this.lenSquare(v);
  41335. }
  41336. /**
  41337. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dist
  41338. * @description 计算向量间距离。
  41339. *
  41340. * @param {Vector2} v1 - 向量 v1。
  41341. * @param {Vector2} v2 - 向量 v2。
  41342. * @return {number} 向量间距离。
  41343. */
  41344. dist(v1, v2) {
  41345. return this.distance(v1, v2);
  41346. }
  41347. /**
  41348. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distSquare
  41349. * @description 向量距离平方。
  41350. *
  41351. * @param {Vector2} v1 - 向量 v1。
  41352. * @param {Vector2} v2 - 向量 v2。
  41353. * @return {number} 向量距离平方
  41354. */
  41355. distSquare(v1, v2) {
  41356. return this.distanceSquare(v1, v2);
  41357. }
  41358. }
  41359. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  41360. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41361. * This program are made available under the terms of the Apache License, Version 2.0
  41362. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41363. /**
  41364. * @class SuperMap.LevelRenderer.Tool.Curve
  41365. * @category Visualization Theme
  41366. * @classdesc LevelRenderer 工具-曲线
  41367. * @private
  41368. */
  41369. class Curve_Curve {
  41370. /**
  41371. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.constructor
  41372. * @description 构造函数。
  41373. */
  41374. constructor() {
  41375. /**
  41376. * @member {SuperMap.LevelRenderer.Tool.Vector} SuperMap.LevelRenderer.Tool.Curve.prototype.vector
  41377. * @description 矢量工具。
  41378. */
  41379. this.vector = new levelRenderer_Vector_Vector();
  41380. /**
  41381. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.EPSILON
  41382. * @description e。
  41383. */
  41384. this.EPSILON = 1e-4;
  41385. /**
  41386. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  41387. * @description 3 的平方根。
  41388. */
  41389. this.THREE_SQRT = Math.sqrt(3);
  41390. /**
  41391. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  41392. * @description 1/3。
  41393. */
  41394. this.ONE_THIRD = 1 / 3;
  41395. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  41396. }
  41397. /*
  41398. * Method: evalCubicCoeff
  41399. *
  41400. * Parameters:
  41401. * a - {number} 值。
  41402. * b - {number} 值。
  41403. * c - {number} 值。
  41404. * d - {number} 值。
  41405. * t - {number} 值。
  41406. *
  41407. * Returns:
  41408. * {number}
  41409. */
  41410. /*
  41411. evalCubicCoeff: function(a, b, c, d, t){
  41412. return ((a * t + b) * t + c) * t + d;
  41413. },
  41414. */
  41415. /**
  41416. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isAroundZero
  41417. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  41418. * @param {number} val - 值。
  41419. * @returns {boolean} 值是否趋于0。
  41420. */
  41421. isAroundZero(val) {
  41422. return val > -this.EPSILON && val < this.EPSILON;
  41423. }
  41424. /**
  41425. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  41426. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  41427. * @param {number} val - 值。
  41428. * @returns {boolean} 值是否不趋于0。
  41429. */
  41430. isNotAroundZero(val) {
  41431. return val > this.EPSILON || val < -this.EPSILON;
  41432. }
  41433. /**
  41434. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicAt
  41435. * @description 计算三次贝塞尔值
  41436. * @param {number} p0 - 点p0。
  41437. * @param {number} p1 - 点p1。
  41438. * @param {number} p2 - 点p2。
  41439. * @param {number} p3 - 点p3。
  41440. * @param {number} t - t值。
  41441. * @returns {number} 三次贝塞尔值。
  41442. */
  41443. cubicAt(p0, p1, p2, p3, t) {
  41444. var onet = 1 - t;
  41445. return onet * onet * (onet * p0 + 3 * t * p1)
  41446. + t * t * (t * p3 + 3 * onet * p2);
  41447. }
  41448. /**
  41449. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  41450. * @description 计算三次贝塞尔导数值
  41451. * @param {number} p0 - 点p0。
  41452. * @param {number} p1 - 点p1。
  41453. * @param {number} p2 - 点p2。
  41454. * @param {number} p3 - 点p3。
  41455. * @param {number} t - t值。
  41456. * @returns {number} 三次贝塞尔导数值。
  41457. */
  41458. cubicDerivativeAt(p0, p1, p2, p3, t) {
  41459. var onet = 1 - t;
  41460. return 3 * (
  41461. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  41462. + (p3 - p2) * t * t
  41463. );
  41464. }
  41465. /**
  41466. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  41467. * @description 计算三次贝塞尔方程根,使用盛金公式
  41468. * @param {number} p0 - 点p0。
  41469. * @param {number} p1 - 点p1。
  41470. * @param {number} p2 - 点p2。
  41471. * @param {number} p3 - 点p3。
  41472. * @param {number} val - 值。
  41473. * @param {Array.<number>} roots - 有效根数目。
  41474. * @returns {number} 有效根。
  41475. */
  41476. cubicRootAt(p0, p1, p2, p3, val, roots) {
  41477. // Evaluate roots of cubic functions
  41478. var a = p3 + 3 * (p1 - p2) - p0;
  41479. var b = 3 * (p2 - p1 * 2 + p0);
  41480. var c = 3 * (p1 - p0);
  41481. var d = p0 - val;
  41482. var A = b * b - 3 * a * c;
  41483. var B = b * c - 9 * a * d;
  41484. var C = c * c - 3 * b * d;
  41485. var n = 0;
  41486. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  41487. if (this.isAroundZero(b)) {
  41488. roots[0] = 0;
  41489. } else {
  41490. let t1 = -c / b; //t1, t2, t3, b is not zero
  41491. if (t1 >= 0 && t1 <= 1) {
  41492. roots[n++] = t1;
  41493. }
  41494. }
  41495. } else {
  41496. var disc = B * B - 4 * A * C;
  41497. if (this.isAroundZero(disc)) {
  41498. var K = B / A;
  41499. let t1 = -b / a + K; // t1, a is not zero
  41500. let t2 = -K / 2; // t2, t3
  41501. if (t1 >= 0 && t1 <= 1) {
  41502. roots[n++] = t1;
  41503. }
  41504. if (t2 >= 0 && t2 <= 1) {
  41505. roots[n++] = t2;
  41506. }
  41507. } else if (disc > 0) {
  41508. let discSqrt = Math.sqrt(disc);
  41509. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  41510. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  41511. if (Y1 < 0) {
  41512. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  41513. } else {
  41514. Y1 = Math.pow(Y1, this.ONE_THIRD);
  41515. }
  41516. if (Y2 < 0) {
  41517. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  41518. } else {
  41519. Y2 = Math.pow(Y2, this.ONE_THIRD);
  41520. }
  41521. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  41522. if (t1 >= 0 && t1 <= 1) {
  41523. roots[n++] = t1;
  41524. }
  41525. } else {
  41526. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  41527. var theta = Math.acos(T) / 3;
  41528. var ASqrt = Math.sqrt(A);
  41529. var tmp = Math.cos(theta);
  41530. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  41531. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  41532. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  41533. if (t1 >= 0 && t1 <= 1) {
  41534. roots[n++] = t1;
  41535. }
  41536. if (t2 >= 0 && t2 <= 1) {
  41537. roots[n++] = t2;
  41538. }
  41539. if (t3 >= 0 && t3 <= 1) {
  41540. roots[n++] = t3;
  41541. }
  41542. }
  41543. }
  41544. return n;
  41545. }
  41546. /**
  41547. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  41548. * @description 计算三次贝塞尔方程极限值的位置
  41549. * @param {number} p0 - 点p0。
  41550. * @param {number} p1 - 点p1。
  41551. * @param {number} p2 - 点p2。
  41552. * @param {number} p3 - 点p3。
  41553. * @param {Array.<number>} extrema - 值。
  41554. * @returns {number} 有效数目。
  41555. */
  41556. cubicExtrema(p0, p1, p2, p3, extrema) {
  41557. var b = 6 * p2 - 12 * p1 + 6 * p0;
  41558. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  41559. var c = 3 * p1 - 3 * p0;
  41560. var n = 0;
  41561. if (this.isAroundZero(a)) {
  41562. if (this.isNotAroundZero(b)) {
  41563. let t1 = -c / b;
  41564. if (t1 >= 0 && t1 <= 1) {
  41565. extrema[n++] = t1;
  41566. }
  41567. }
  41568. } else {
  41569. var disc = b * b - 4 * a * c;
  41570. if (this.isAroundZero(disc)) {
  41571. extrema[0] = -b / (2 * a);
  41572. } else if (disc > 0) {
  41573. let discSqrt = Math.sqrt(disc);
  41574. let t1 = (-b + discSqrt) / (2 * a);
  41575. let t2 = (-b - discSqrt) / (2 * a);
  41576. if (t1 >= 0 && t1 <= 1) {
  41577. extrema[n++] = t1;
  41578. }
  41579. if (t2 >= 0 && t2 <= 1) {
  41580. extrema[n++] = t2;
  41581. }
  41582. }
  41583. }
  41584. return n;
  41585. }
  41586. /**
  41587. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  41588. * @description 细分三次贝塞尔曲线
  41589. * @param {number} p0 - 点p0。
  41590. * @param {number} p1 - 点p1。
  41591. * @param {number} p2 - 点p2。
  41592. * @param {number} p3 - 点p3。
  41593. * @param {number} t - t值。
  41594. * @param {Array.<number>} out - 投射点。
  41595. * @returns {number} 投射点。
  41596. */
  41597. cubicSubdivide(p0, p1, p2, p3, t, out) {
  41598. var p01 = (p1 - p0) * t + p0;
  41599. var p12 = (p2 - p1) * t + p1;
  41600. var p23 = (p3 - p2) * t + p2;
  41601. var p012 = (p12 - p01) * t + p01;
  41602. var p123 = (p23 - p12) * t + p12;
  41603. var p0123 = (p123 - p012) * t + p012;
  41604. // Seg0
  41605. out[0] = p0;
  41606. out[1] = p01;
  41607. out[2] = p012;
  41608. out[3] = p0123;
  41609. // Seg1
  41610. out[4] = p0123;
  41611. out[5] = p123;
  41612. out[6] = p23;
  41613. out[7] = p3;
  41614. }
  41615. /**
  41616. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  41617. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  41618. * @param {number} x0 - 点p0横坐标。
  41619. * @param {number} y0 - 点p0纵坐标。
  41620. * @param {number} x1 - 点p1横坐标。
  41621. * @param {number} y1 - 点p1纵坐标。
  41622. * @param {number} x2 - 点p2横坐标。
  41623. * @param {number} y2 - 点p2纵坐标。
  41624. * @param {number} x3 - 点p3横坐标。
  41625. * @param {number} y3 - 点p3纵坐标。
  41626. * @param {number} x - 点p横坐标。
  41627. * @param {number} y - 点p纵坐标。
  41628. * @param {Array.<number>} out - 投射点。
  41629. * @returns {number} 投射点。
  41630. */
  41631. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  41632. // 临时变量
  41633. var _v0 = this.vector.create();
  41634. var _v1 = this.vector.create();
  41635. var _v2 = this.vector.create();
  41636. // var _v3 = vector.create();
  41637. // http://pomax.github.io/bezierinfo/#projections
  41638. var t;
  41639. var interval = 0.005;
  41640. var d = Infinity;
  41641. _v0[0] = x;
  41642. _v0[1] = y;
  41643. // 先粗略估计一下可能的最小距离的 t 值
  41644. // PENDING
  41645. for (let _t = 0; _t < 1; _t += 0.05) {
  41646. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  41647. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  41648. let d1 = this.vector.distSquare(_v0, _v1);
  41649. if (d1 < d) {
  41650. t = _t;
  41651. d = d1;
  41652. }
  41653. }
  41654. d = Infinity;
  41655. // At most 32 iteration
  41656. for (let i = 0; i < 32; i++) {
  41657. if (interval < this.EPSILON) {
  41658. break;
  41659. }
  41660. let prev = t - interval;
  41661. let next = t + interval;
  41662. // t - interval
  41663. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  41664. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  41665. let d1 = this.vector.distSquare(_v1, _v0);
  41666. if (prev >= 0 && d1 < d) {
  41667. t = prev;
  41668. d = d1;
  41669. } else {
  41670. // t + interval
  41671. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  41672. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  41673. let d2 = this.vector.distSquare(_v2, _v0);
  41674. if (next <= 1 && d2 < d) {
  41675. t = next;
  41676. d = d2;
  41677. } else {
  41678. interval *= 0.5;
  41679. }
  41680. }
  41681. }
  41682. // t
  41683. if (out) {
  41684. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  41685. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  41686. }
  41687. // console.log(interval, i);
  41688. return Math.sqrt(d);
  41689. }
  41690. /**
  41691. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  41692. * @description 计算二次方贝塞尔值。
  41693. * @param {number} p0 - 点p0。
  41694. * @param {number} p1 - 点p1。
  41695. * @param {number} p2 - 点p2。
  41696. * @param {number} t - t值。
  41697. * @returns {number} 二次方贝塞尔值。
  41698. */
  41699. quadraticAt(p0, p1, p2, t) {
  41700. var onet = 1 - t;
  41701. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  41702. }
  41703. /**
  41704. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  41705. * @description 计算二次方贝塞尔导数值。
  41706. * @param {number} p0 - 点p0。
  41707. * @param {number} p1 - 点p1。
  41708. * @param {number} p2 - 点p2。
  41709. * @param {number} t - t值。
  41710. * @returns {number} 二次方贝塞尔导数值。
  41711. */
  41712. quadraticDerivativeAt(p0, p1, p2, t) {
  41713. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  41714. }
  41715. /**
  41716. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  41717. * @description 计算二次方贝塞尔方程根
  41718. * @param {number} p0 - 点p0。
  41719. * @param {number} p1 - 点p1。
  41720. * @param {number} p2 - 点p2。
  41721. * @param {number} val - 值。
  41722. * @param {Array.<number>} roots - 有效根数目。
  41723. * @returns {number} 有效根数目。
  41724. */
  41725. quadraticRootAt(p0, p1, p2, val, roots) {
  41726. var a = p0 - 2 * p1 + p2;
  41727. var b = 2 * (p1 - p0);
  41728. var c = p0 - val;
  41729. var n = 0;
  41730. if (this.isAroundZero(a)) {
  41731. if (this.isNotAroundZero(b)) {
  41732. var t1 = -c / b;
  41733. if (t1 >= 0 && t1 <= 1) {
  41734. roots[n++] = t1;
  41735. }
  41736. }
  41737. } else {
  41738. var disc = b * b - 4 * a * c;
  41739. if (this.isAroundZero(disc)) {
  41740. let t1 = -b / (2 * a);
  41741. if (t1 >= 0 && t1 <= 1) {
  41742. roots[n++] = t1;
  41743. }
  41744. } else if (disc > 0) {
  41745. let discSqrt = Math.sqrt(disc);
  41746. let t1 = (-b + discSqrt) / (2 * a);
  41747. let t2 = (-b - discSqrt) / (2 * a);
  41748. if (t1 >= 0 && t1 <= 1) {
  41749. roots[n++] = t1;
  41750. }
  41751. if (t2 >= 0 && t2 <= 1) {
  41752. roots[n++] = t2;
  41753. }
  41754. }
  41755. }
  41756. return n;
  41757. }
  41758. /**
  41759. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  41760. * @description 计算二次贝塞尔方程极限值
  41761. * @param {number} p0 - 点p0。
  41762. * @param {number} p1 - 点p1。
  41763. * @param {number} p2 - 点p2。
  41764. * @returns {number} 二次贝塞尔方程极限值。
  41765. */
  41766. quadraticExtremum(p0, p1, p2) {
  41767. var divider = p0 + p2 - 2 * p1;
  41768. if (divider === 0) {
  41769. // p1 is center of p0 and p2
  41770. return 0.5;
  41771. } else {
  41772. return (p0 - p1) / divider;
  41773. }
  41774. }
  41775. /**
  41776. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  41777. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  41778. * @param {number} x0 - 点p0横坐标。
  41779. * @param {number} y0 - 点p0纵坐标。
  41780. * @param {number} x1 - 点p1横坐标。
  41781. * @param {number} y1 - 点p1纵坐标。
  41782. * @param {number} x2 - 点p2横坐标。
  41783. * @param {number} y2 - 点p2纵坐标。
  41784. * @param {number} x - 点p横坐标。
  41785. * @param {number} y - 点p纵坐标。
  41786. * @param {Array.<number>} out - 投射点。
  41787. * @returns {number} 投射距离。
  41788. */
  41789. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  41790. // 临时变量
  41791. var _v0 = this.vector.create();
  41792. var _v1 = this.vector.create();
  41793. var _v2 = this.vector.create();
  41794. // http://pomax.github.io/bezierinfo/#projections
  41795. var t;
  41796. var interval = 0.005;
  41797. var d = Infinity;
  41798. _v0[0] = x;
  41799. _v0[1] = y;
  41800. // 先粗略估计一下可能的最小距离的 t 值
  41801. // PENDING
  41802. for (let _t = 0; _t < 1; _t += 0.05) {
  41803. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  41804. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  41805. let d1 = this.vector.distSquare(_v0, _v1);
  41806. if (d1 < d) {
  41807. t = _t;
  41808. d = d1;
  41809. }
  41810. }
  41811. d = Infinity;
  41812. // At most 32 iteration
  41813. for (let i = 0; i < 32; i++) {
  41814. if (interval < this.EPSILON) {
  41815. break;
  41816. }
  41817. let prev = t - interval;
  41818. let next = t + interval;
  41819. // t - interval
  41820. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  41821. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  41822. let d1 = this.vector.distSquare(_v1, _v0);
  41823. if (prev >= 0 && d1 < d) {
  41824. t = prev;
  41825. d = d1;
  41826. } else {
  41827. // t + interval
  41828. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  41829. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  41830. let d2 = this.vector.distSquare(_v2, _v0);
  41831. if (next <= 1 && d2 < d) {
  41832. t = next;
  41833. d = d2;
  41834. } else {
  41835. interval *= 0.5;
  41836. }
  41837. }
  41838. }
  41839. // t
  41840. if (out) {
  41841. out[0] = this.quadraticAt(x0, x1, x2, t);
  41842. out[1] = this.quadraticAt(y0, y1, y2, t);
  41843. }
  41844. // console.log(interval, i);
  41845. return Math.sqrt(d);
  41846. }
  41847. }
  41848. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  41849. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41850. * This program are made available under the terms of the Apache License, Version 2.0
  41851. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41852. /**
  41853. * @class SuperMap.LevelRenderer.Tool.Area
  41854. * @category Visualization Theme
  41855. * @classdesc LevelRenderer 工具-图形范围判断
  41856. * @private
  41857. */
  41858. class Area {
  41859. /**
  41860. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.constructor
  41861. * @description 构造函数。
  41862. */
  41863. constructor() {
  41864. /**
  41865. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Areal.prototype.util
  41866. * @description 基础工具对象。
  41867. */
  41868. this.util = new Util_Util();
  41869. /**
  41870. * @member {SuperMap.LevelRenderer.Tool.Curve} SuperMap.LevelRenderer.Tool.Areal.prototype.curve
  41871. * @description 曲线工具对象
  41872. */
  41873. this.curve = new Curve_Curve();
  41874. /**
  41875. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._ctx
  41876. * @description Cavans2D 渲染上下文
  41877. */
  41878. this._ctx = null;
  41879. /**
  41880. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCache
  41881. * @description 文本宽度缓存
  41882. */
  41883. this._textWidthCache = {};
  41884. /**
  41885. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCache
  41886. * @description 文本高度缓存
  41887. */
  41888. this._textHeightCache = {};
  41889. /**
  41890. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  41891. * @description 文本宽度缓存数量
  41892. */
  41893. this._textWidthCacheCounter = 0;
  41894. /**
  41895. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  41896. * @description 文本高度缓存数量
  41897. */
  41898. this._textHeightCacheCounter = 0;
  41899. /**
  41900. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  41901. * @description 文本最大缓存数量
  41902. */
  41903. this.TEXT_CACHE_MAX = 5000;
  41904. /**
  41905. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.PI2
  41906. * @description 2*PI 的值
  41907. */
  41908. this.PI2 = Math.PI * 2;
  41909. /**
  41910. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.roots
  41911. * @description 临时数组
  41912. */
  41913. this.roots = [-1, -1, -1];
  41914. /**
  41915. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.extrema
  41916. * @description 临时数组
  41917. */
  41918. this.extrema = [-1, -1];
  41919. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  41920. }
  41921. /**
  41922. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.normalizeRadian
  41923. * @description 弧度标准化函数。
  41924. * @param {number} angle - 弧度值。
  41925. * @returns {number} 标准化后的弧度值。
  41926. */
  41927. normalizeRadian(angle) {
  41928. angle %= this.PI2;
  41929. if (angle < 0) {
  41930. angle += this.PI2;
  41931. }
  41932. return angle;
  41933. }
  41934. /**
  41935. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInside
  41936. * @description 包含判断。
  41937. * @param {Object} shape - 图形。
  41938. * @param {number} area - 目标区域。
  41939. * @param {number} x - 横坐标。
  41940. * @param {number} y - 纵坐标。
  41941. * @returns {boolean} 图形是否包含鼠标位置。
  41942. */
  41943. isInside(shape, area, x, y) {
  41944. if (!area || !shape) {
  41945. // 无参数或不支持类型
  41946. return false;
  41947. }
  41948. var zoneType = shape.type;
  41949. this._ctx = this._ctx || this.util.getContext();
  41950. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  41951. var _mathReturn = this._mathMethod(shape, area, x, y);
  41952. if (typeof _mathReturn != 'undefined') {
  41953. return _mathReturn;
  41954. }
  41955. if (shape.buildPath && this._ctx.isPointInPath) {
  41956. return this._buildPathMethod(shape, this._ctx, area, x, y);
  41957. }
  41958. // 上面的方法都行不通时
  41959. switch (zoneType) {
  41960. case 'ellipse': // Todo,不精确
  41961. case 'smicellipse': // Todo,不精确
  41962. return true;
  41963. // 旋轮曲线 不准确
  41964. case 'trochoid':
  41965. var _r = area.location == 'out'
  41966. ? area.r1 + area.r2 + area.d
  41967. : area.r1 - area.r2 + area.d;
  41968. return this.isInsideCircle(area, x, y, _r);
  41969. // 玫瑰线 不准确
  41970. case 'rose' :
  41971. return this.isInsideCircle(area, x, y, area.maxr);
  41972. // 路径,椭圆,曲线等-----------------13
  41973. default:
  41974. return false; // Todo,暂不支持
  41975. }
  41976. }
  41977. /**
  41978. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._mathMethod
  41979. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  41980. * @param {Object} shape - 图形。
  41981. * @param {number} area - 目标区域。
  41982. * @param {number} x - 横坐标。
  41983. * @param {number} y - 纵坐标。
  41984. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  41985. */
  41986. _mathMethod(shape, area, x, y) {
  41987. var zoneType = shape.type;
  41988. // 在矩形内则部分图形需要进一步判断
  41989. switch (zoneType) {
  41990. // 贝塞尔曲线
  41991. case 'bezier-curve':
  41992. if (typeof(area.cpX2) === 'undefined') {
  41993. return this.isInsideQuadraticStroke(
  41994. area.xStart, area.yStart,
  41995. area.cpX1, area.cpY1,
  41996. area.xEnd, area.yEnd,
  41997. area.lineWidth, x, y
  41998. );
  41999. }
  42000. return this.isInsideCubicStroke(
  42001. area.xStart, area.yStart,
  42002. area.cpX1, area.cpY1,
  42003. area.cpX2, area.cpY2,
  42004. area.xEnd, area.yEnd,
  42005. area.lineWidth, x, y
  42006. );
  42007. // 线
  42008. case 'line':
  42009. return this.isInsideLine(
  42010. area.xStart, area.yStart,
  42011. area.xEnd, area.yEnd,
  42012. area.lineWidth, x, y
  42013. );
  42014. // 折线
  42015. case 'broken-line':
  42016. return this.isInsideBrokenLine(
  42017. area.pointList, area.lineWidth, x, y
  42018. );
  42019. // 扩展折线
  42020. case 'smicbroken-line': {
  42021. // SMIC-修改 - start
  42022. let icX = x;
  42023. let icY = y;
  42024. if (shape.refOriginalPosition) {
  42025. icX = x - shape.refOriginalPosition[0];
  42026. icY = y - shape.refOriginalPosition[1];
  42027. }
  42028. return this.isInsideBrokenLine(
  42029. area.pointList, area.lineWidth, icX, icY
  42030. );
  42031. }
  42032. //初始代码:
  42033. // return isInsideBrokenLine(
  42034. // area.pointList, area.lineWidth, x, y
  42035. // );
  42036. // SMIC-修改 - end
  42037. // 圆环
  42038. case 'ring':
  42039. return this.isInsideRing(
  42040. area.x, area.y, area.r0, area.r, x, y
  42041. );
  42042. case 'smicring': {
  42043. let areaX = area.x;
  42044. let areaY = area.y;
  42045. if (shape.refOriginalPosition) {
  42046. areaX = area.x + shape.refOriginalPosition[0];
  42047. areaY = area.y + shape.refOriginalPosition[1];
  42048. }
  42049. return this.isInsideRing(
  42050. areaX, areaY, area.r0, area.r, x, y
  42051. );
  42052. }
  42053. // 圆形
  42054. case 'circle':
  42055. return this.isInsideCircle(
  42056. area.x, area.y, area.r, x, y
  42057. );
  42058. // 扩展-点
  42059. case 'smicpoint': {
  42060. // SMIC-修改 - start
  42061. let icX = x;
  42062. let icY = y;
  42063. if (shape.refOriginalPosition) {
  42064. icX = x - shape.refOriginalPosition[0];
  42065. icY = y - shape.refOriginalPosition[1];
  42066. }
  42067. return this.isInsideCircle(
  42068. area.x, area.y, area.r, icX, icY
  42069. );
  42070. }
  42071. //初始代码:
  42072. // 无
  42073. // SMIC-修改 - end
  42074. // 扇形
  42075. case 'sector': {
  42076. let startAngle = area.startAngle * Math.PI / 180;
  42077. let endAngle = area.endAngle * Math.PI / 180;
  42078. if (!area.clockWise) {
  42079. startAngle = -startAngle;
  42080. endAngle = -endAngle;
  42081. }
  42082. return this.isInsideSector(
  42083. area.x, area.y, area.r0, area.r,
  42084. startAngle, endAngle,
  42085. !area.clockWise,
  42086. x, y
  42087. );
  42088. }
  42089. //初始代码:
  42090. // 无
  42091. // SMIC-增加 - end
  42092. // 扇形
  42093. case 'smicsector': {
  42094. let startAngle = area.startAngle * Math.PI / 180;
  42095. let endAngle = area.endAngle * Math.PI / 180;
  42096. if (!area.clockWise) {
  42097. startAngle = -startAngle;
  42098. endAngle = -endAngle;
  42099. }
  42100. let areaX = area.x;
  42101. let areaY = area.y;
  42102. if (shape.refOriginalPosition) {
  42103. areaX = area.x + shape.refOriginalPosition[0];
  42104. areaY = area.y + shape.refOriginalPosition[1];
  42105. }
  42106. return this.isInsideSector(
  42107. areaX, areaY, area.r0, area.r,
  42108. startAngle, endAngle,
  42109. !area.clockWise,
  42110. x, y
  42111. );
  42112. }
  42113. // 多边形
  42114. case 'path':
  42115. return this.isInsidePath(
  42116. area.pathArray, Math.max(area.lineWidth, 5),
  42117. area.brushType, x, y
  42118. );
  42119. case 'polygon':
  42120. case 'star':
  42121. case 'smicstar':
  42122. case 'isogon':
  42123. case 'smicisogon':
  42124. return this.isInsidePolygon(area.pointList, x, y);
  42125. // 扩展多边形
  42126. case 'smicpolygon': {
  42127. // SMIC-修改 - start
  42128. let icX = x;
  42129. let icY = y;
  42130. if (shape.refOriginalPosition) {
  42131. icX = x - shape.refOriginalPosition[0];
  42132. icY = y - shape.refOriginalPosition[1];
  42133. }
  42134. //岛洞面
  42135. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  42136. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  42137. // 遍历岛洞子面
  42138. var holePLS = shape.holePolygonPointLists;
  42139. var isOnHole = false;
  42140. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  42141. var holePL = holePLS[i];
  42142. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  42143. if (isOnSubHole === true) {
  42144. isOnHole = true;
  42145. }
  42146. }
  42147. // 捕获判断
  42148. return isOnBase === true && isOnHole === false;
  42149. } else {
  42150. return this.isInsidePolygon(area.pointList, icX, icY);
  42151. }
  42152. }
  42153. // 初始代码:
  42154. // 无
  42155. // SMIC-修改 - end
  42156. // 文本
  42157. case 'text':
  42158. var rect = area.__rect || shape.getRect(area);
  42159. return this.isInsideRect(
  42160. rect.x, rect.y, rect.width, rect.height, x, y
  42161. );
  42162. // 扩展文本
  42163. case 'smictext':
  42164. //用文本背景矩形判断
  42165. var textBg = shape.getTextBackground(area);
  42166. return this.isInsidePolygon(textBg, x, y);
  42167. //初始代码:
  42168. // 无
  42169. // SMIC-修改 - end
  42170. // 矩形
  42171. case 'rectangle':
  42172. case 'image':
  42173. // 图片
  42174. return this.isInsideRect(
  42175. area.x, area.y, area.width, area.height, x, y
  42176. );
  42177. case 'smicimage': {
  42178. let areaX = area.x;
  42179. let areaY = area.y;
  42180. if (shape.refOriginalPosition) {
  42181. areaX = area.x + shape.refOriginalPosition[0];
  42182. areaY = area.y + shape.refOriginalPosition[1];
  42183. }
  42184. return this.isInsideRect(
  42185. areaX, areaY, area.width, area.height, x, y
  42186. );
  42187. }
  42188. //// 扩展矩形
  42189. //case 'smicpolygon':
  42190. // // SMIC-修改 - start
  42191. // var icX = x;
  42192. // var icY = y;
  42193. // if(shape.refOriginalPosition) {
  42194. // icX = x - shape.refOriginalPosition[0];
  42195. // icY = y - shape.refOriginalPosition[1];
  42196. // }
  42197. // return this.isInsideRect(
  42198. // area.x, area.y, area.width, area.height, icX, icY
  42199. // );
  42200. //初始代码:
  42201. // 无
  42202. // SMIC-修改 - end
  42203. }
  42204. }
  42205. /**
  42206. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._buildPathMethod
  42207. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  42208. * @param {Object} shape - 图形。
  42209. * @param {Object} context - 上下文。
  42210. * @param {number} area - 目标区域。
  42211. * @param {number} x - 横坐标。
  42212. * @param {number} y - 纵坐标。
  42213. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  42214. */
  42215. _buildPathMethod(shape, context, area, x, y) {
  42216. // 图形类实现路径创建了则用类的path
  42217. context.beginPath();
  42218. shape.buildPath(context, area);
  42219. context.closePath();
  42220. return context.isPointInPath(x, y);
  42221. }
  42222. /**
  42223. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isOutside
  42224. * @description 图形是否不包含鼠标位置。
  42225. * @param {Object} shape - 图形。
  42226. * @param {number} area - 目标区域。
  42227. * @param {number} x - 横坐标。
  42228. * @param {number} y - 纵坐标。
  42229. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  42230. */
  42231. isOutside(shape, area, x, y) {
  42232. return !this.isInside(shape, area, x, y);
  42233. }
  42234. /**
  42235. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideLine
  42236. * @description 线段包含判断。
  42237. * @param {number} x0 - 线起始点横坐标。
  42238. * @param {number} y0 - 线起始点纵坐标。
  42239. * @param {number} x1 - 线终点横坐标。
  42240. * @param {number} y1 - 线终点纵坐标。
  42241. * @param {number} lineWidth - 线宽。
  42242. * @param {number} x - 鼠标位置横坐标。
  42243. * @param {number} y - 鼠标位置纵坐标。
  42244. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  42245. */
  42246. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  42247. if (lineWidth === 0) {
  42248. return false;
  42249. }
  42250. var _l = Math.max(lineWidth, 5);
  42251. var _a = 0;
  42252. var _b = 0;
  42253. // Quick reject
  42254. if (
  42255. (y > y0 + _l && y > y1 + _l)
  42256. || (y < y0 - _l && y < y1 - _l)
  42257. || (x > x0 + _l && x > x1 + _l)
  42258. || (x < x0 - _l && x < x1 - _l)
  42259. ) {
  42260. return false;
  42261. }
  42262. if (x0 !== x1) {
  42263. _a = (y0 - y1) / (x0 - x1);
  42264. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  42265. } else {
  42266. return Math.abs(x - x0) <= _l / 2;
  42267. }
  42268. var tmp = _a * x - y + _b;
  42269. var _s = tmp * tmp / (_a * _a + 1);
  42270. return _s <= _l / 2 * _l / 2;
  42271. }
  42272. /**
  42273. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  42274. * @description 三次贝塞尔曲线描边包含判断。
  42275. * @param {number} x0 - 点1横坐标。
  42276. * @param {number} y0 - 点1纵坐标。
  42277. * @param {number} x1 - 点2横坐标。
  42278. * @param {number} y1 - 点2纵坐标。
  42279. * @param {number} x2 - 点3纵坐标。
  42280. * @param {number} y2 - 点3纵坐标。
  42281. * @param {number} lineWidth - 线宽。
  42282. * @param {number} x - 鼠标位置横坐标。
  42283. * @param {number} y - 鼠标位置纵坐标。
  42284. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42285. */
  42286. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  42287. if (lineWidth === 0) {
  42288. return false;
  42289. }
  42290. var _l = Math.max(lineWidth, 5);
  42291. // Quick reject
  42292. if (
  42293. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  42294. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  42295. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  42296. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  42297. ) {
  42298. return false;
  42299. }
  42300. var d = this.curve.cubicProjectPoint(
  42301. x0, y0, x1, y1, x2, y2, x3, y3,
  42302. x, y, null
  42303. );
  42304. return d <= _l / 2;
  42305. }
  42306. /**
  42307. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  42308. * @description 二次贝塞尔曲线描边包含判断。
  42309. * @param {number} x0 - 点1横坐标。
  42310. * @param {number} y0 - 点1纵坐标。
  42311. * @param {number} x1 - 点2横坐标。
  42312. * @param {number} y1 - 点2纵坐标。
  42313. * @param {number} x2 - 点3纵坐标。
  42314. * @param {number} y2 - 点3纵坐标。
  42315. * @param {number} lineWidth - 线宽。
  42316. * @param {number} x - 鼠标位置横坐标。
  42317. * @param {number} y - 鼠标位置纵坐标。
  42318. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42319. */
  42320. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  42321. if (lineWidth === 0) {
  42322. return false;
  42323. }
  42324. var _l = Math.max(lineWidth, 5);
  42325. // Quick reject
  42326. if (
  42327. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  42328. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  42329. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  42330. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  42331. ) {
  42332. return false;
  42333. }
  42334. var d = this.curve.quadraticProjectPoint(
  42335. x0, y0, x1, y1, x2, y2,
  42336. x, y, null
  42337. );
  42338. return d <= _l / 2;
  42339. }
  42340. /**
  42341. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  42342. * @description 圆弧描边包含判断。
  42343. * @param {number} cx - 圆心横坐标。
  42344. * @param {number} cy - 圆心纵坐标。
  42345. * @param {number} r - 圆半径。
  42346. * @param {number} startAngle - 起始角度。
  42347. * @param {number} endAngle - 终止角度。
  42348. * @param {number} anticlockwise - 顺时针还是逆时针。
  42349. * @param {number} lineWidth - 线宽。
  42350. * @param {number} x - 鼠标位置横坐标。
  42351. * @param {number} y - 鼠标位置纵坐标。
  42352. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42353. */
  42354. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  42355. var PI2 = this.PI2;
  42356. if (lineWidth === 0) {
  42357. return false;
  42358. }
  42359. var _l = Math.max(lineWidth, 5);
  42360. x -= cx;
  42361. y -= cy;
  42362. var d = Math.sqrt(x * x + y * y);
  42363. if ((d - _l > r) || (d + _l < r)) {
  42364. return false;
  42365. }
  42366. if (Math.abs(startAngle - endAngle) >= PI2) {
  42367. // Is a circle
  42368. return true;
  42369. }
  42370. if (anticlockwise) {
  42371. var tmp = startAngle;
  42372. startAngle = this.normalizeRadian(endAngle);
  42373. endAngle = this.normalizeRadian(tmp);
  42374. } else {
  42375. startAngle = this.normalizeRadian(startAngle);
  42376. endAngle = this.normalizeRadian(endAngle);
  42377. }
  42378. if (startAngle > endAngle) {
  42379. endAngle += PI2;
  42380. }
  42381. var angle = Math.atan2(y, x);
  42382. if (angle < 0) {
  42383. angle += PI2;
  42384. }
  42385. return (angle >= startAngle && angle <= endAngle)
  42386. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  42387. }
  42388. /**
  42389. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  42390. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  42391. * @param {Array} points - 曲线点对象。
  42392. * @param {number} lineWidth - 线宽。
  42393. * @param {number} x - 鼠标位置横坐标。
  42394. * @param {number} y - 鼠标位置纵坐标。
  42395. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42396. */
  42397. isInsideBrokenLine(points, lineWidth, x, y) {
  42398. var _lineWidth = Math.max(lineWidth, 10);
  42399. for (var i = 0, l = points.length - 1; i < l; i++) {
  42400. var x0 = points[i][0];
  42401. var y0 = points[i][1];
  42402. var x1 = points[i + 1][0];
  42403. var y1 = points[i + 1][1];
  42404. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  42405. return true;
  42406. }
  42407. }
  42408. return false;
  42409. }
  42410. /**
  42411. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRing
  42412. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  42413. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42414. */
  42415. isInsideRing(cx, cy, r0, r, x, y) {
  42416. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  42417. return (d < r * r) && (d > r0 * r0);
  42418. }
  42419. /**
  42420. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRect
  42421. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  42422. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42423. */
  42424. isInsideRect(x0, y0, width, height, x, y) {
  42425. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  42426. }
  42427. /**
  42428. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCircle
  42429. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  42430. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42431. */
  42432. isInsideCircle(x0, y0, r, x, y) {
  42433. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  42434. }
  42435. /**
  42436. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideSector
  42437. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  42438. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42439. */
  42440. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  42441. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  42442. }
  42443. /**
  42444. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  42445. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  42446. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  42447. */
  42448. isInsidePolygon(points, x, y) {
  42449. var N = points.length;
  42450. var w = 0;
  42451. for (var i = 0, j = N - 1; i < N; i++) {
  42452. var x0 = points[j][0];
  42453. var y0 = points[j][1];
  42454. var x1 = points[i][0];
  42455. var y1 = points[i][1];
  42456. w += this.windingLine(x0, y0, x1, y1, x, y);
  42457. j = i;
  42458. }
  42459. return w !== 0;
  42460. }
  42461. /**
  42462. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingLine
  42463. */
  42464. windingLine(x0, y0, x1, y1, x, y) {
  42465. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  42466. return 0;
  42467. }
  42468. if (y1 == y0) {
  42469. return 0;
  42470. }
  42471. var dir = y1 < y0 ? 1 : -1;
  42472. var t = (y - y0) / (y1 - y0);
  42473. var x_ = t * (x1 - x0) + x0;
  42474. return x_ > x ? dir : 0;
  42475. }
  42476. /**
  42477. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.swapExtrema
  42478. */
  42479. swapExtrema() {
  42480. var tmp = this.extrema[0];
  42481. this.extrema[0] = this.extrema[1];
  42482. this.extrema[1] = tmp;
  42483. }
  42484. /**
  42485. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingCubic
  42486. */
  42487. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  42488. var curve = this.curve;
  42489. var roots = this.roots;
  42490. var extrema = this.extrema;
  42491. // Quick reject
  42492. if (
  42493. (y > y0 && y > y1 && y > y2 && y > y3)
  42494. || (y < y0 && y < y1 && y < y2 && y < y3)
  42495. ) {
  42496. return 0;
  42497. }
  42498. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  42499. if (nRoots === 0) {
  42500. return 0;
  42501. } else {
  42502. var w = 0;
  42503. var nExtrema = -1;
  42504. var y0_, y1_;
  42505. for (var i = 0; i < nRoots; i++) {
  42506. var t = roots[i];
  42507. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  42508. if (x_ < x) { // Quick reject
  42509. continue;
  42510. }
  42511. if (nExtrema < 0) {
  42512. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  42513. if (extrema[1] < extrema[0] && nExtrema > 1) {
  42514. this.swapExtrema();
  42515. }
  42516. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  42517. if (nExtrema > 1) {
  42518. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  42519. }
  42520. }
  42521. if (nExtrema == 2) {
  42522. // 分成三段单调函数
  42523. if (t < extrema[0]) {
  42524. w += y0_ < y0 ? 1 : -1;
  42525. } else if (t < extrema[1]) {
  42526. w += y1_ < y0_ ? 1 : -1;
  42527. } else {
  42528. w += y3 < y1_ ? 1 : -1;
  42529. }
  42530. } else {
  42531. // 分成两段单调函数
  42532. if (t < extrema[0]) {
  42533. w += y0_ < y0 ? 1 : -1;
  42534. } else {
  42535. w += y3 < y0_ ? 1 : -1;
  42536. }
  42537. }
  42538. }
  42539. return w;
  42540. }
  42541. }
  42542. /**
  42543. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingQuadratic
  42544. */
  42545. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  42546. var curve = this.curve;
  42547. var roots = this.roots;
  42548. // Quick reject
  42549. if (
  42550. (y > y0 && y > y1 && y > y2)
  42551. || (y < y0 && y < y1 && y < y2)
  42552. ) {
  42553. return 0;
  42554. }
  42555. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  42556. if (nRoots === 0) {
  42557. return 0;
  42558. } else {
  42559. var t = curve.quadraticExtremum(y0, y1, y2);
  42560. if (t >= 0 && t <= 1) {
  42561. var w = 0;
  42562. var y_ = curve.quadraticAt(y0, y1, y2, t);
  42563. for (let i = 0; i < nRoots; i++) {
  42564. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  42565. if (x_ > x) {
  42566. continue;
  42567. }
  42568. if (roots[i] < t) {
  42569. w += y_ < y0 ? 1 : -1;
  42570. } else {
  42571. w += y2 < y_ ? 1 : -1;
  42572. }
  42573. }
  42574. return w;
  42575. } else {
  42576. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  42577. if (x_ > x) {
  42578. return 0;
  42579. }
  42580. return y2 < y0 ? 1 : -1;
  42581. }
  42582. }
  42583. }
  42584. /**
  42585. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingArc
  42586. * // TODO Arc 旋转
  42587. */
  42588. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  42589. var roots = this.roots;
  42590. var PI2 = this.PI2;
  42591. y -= cy;
  42592. if (y > r || y < -r) {
  42593. return 0;
  42594. }
  42595. let tmp = Math.sqrt(r * r - y * y);
  42596. roots[0] = -tmp;
  42597. roots[1] = tmp;
  42598. if (Math.abs(startAngle - endAngle) >= PI2) {
  42599. // Is a circle
  42600. startAngle = 0;
  42601. endAngle = PI2;
  42602. var dir = anticlockwise ? 1 : -1;
  42603. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  42604. return dir;
  42605. } else {
  42606. return 0;
  42607. }
  42608. }
  42609. if (anticlockwise) {
  42610. let tmp = startAngle;
  42611. startAngle = this.normalizeRadian(endAngle);
  42612. endAngle = this.normalizeRadian(tmp);
  42613. } else {
  42614. startAngle = this.normalizeRadian(startAngle);
  42615. endAngle = this.normalizeRadian(endAngle);
  42616. }
  42617. if (startAngle > endAngle) {
  42618. endAngle += PI2;
  42619. }
  42620. var w = 0;
  42621. for (let i = 0; i < 2; i++) {
  42622. var x_ = roots[i];
  42623. if (x_ + cx > x) {
  42624. let angle = Math.atan2(y, x_);
  42625. let dir = anticlockwise ? 1 : -1;
  42626. if (angle < 0) {
  42627. angle = PI2 + angle;
  42628. }
  42629. if (
  42630. (angle >= startAngle && angle <= endAngle)
  42631. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  42632. ) {
  42633. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  42634. dir = -dir;
  42635. }
  42636. w += dir;
  42637. }
  42638. }
  42639. }
  42640. return w;
  42641. }
  42642. /**
  42643. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePath
  42644. * @description 与 canvas 一样采用 non-zero winding rule
  42645. */
  42646. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  42647. var w = 0;
  42648. var xi = 0;
  42649. var yi = 0;
  42650. var x0 = 0;
  42651. var y0 = 0;
  42652. var beginSubpath = true;
  42653. var firstCmd = true;
  42654. brushType = brushType || 'fill';
  42655. var hasStroke = brushType === 'stroke' || brushType === 'both';
  42656. var hasFill = brushType === 'fill' || brushType === 'both';
  42657. // var roots = [-1, -1, -1];
  42658. for (var i = 0; i < pathArray.length; i++) {
  42659. var seg = pathArray[i];
  42660. var p = seg.points;
  42661. // Begin a new subpath
  42662. if (beginSubpath || seg.command === 'M') {
  42663. if (i > 0) {
  42664. // Close previous subpath
  42665. if (hasFill) {
  42666. w += this.windingLine(xi, yi, x0, y0, x, y);
  42667. }
  42668. if (w !== 0) {
  42669. return true;
  42670. }
  42671. }
  42672. x0 = p[p.length - 2];
  42673. y0 = p[p.length - 1];
  42674. beginSubpath = false;
  42675. if (firstCmd && seg.command !== 'A') {
  42676. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  42677. // 等绘制命令的话,是会从该绘制的起点开始算的
  42678. // Arc 会在之后做单独处理所以这里忽略
  42679. firstCmd = false;
  42680. xi = x0;
  42681. yi = y0;
  42682. }
  42683. }
  42684. switch (seg.command) {
  42685. case 'M':
  42686. xi = p[0];
  42687. yi = p[1];
  42688. break;
  42689. case 'L':
  42690. if (hasStroke) {
  42691. if (this.isInsideLine(
  42692. xi, yi, p[0], p[1], lineWidth, x, y
  42693. )) {
  42694. return true;
  42695. }
  42696. }
  42697. if (hasFill) {
  42698. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  42699. }
  42700. xi = p[0];
  42701. yi = p[1];
  42702. break;
  42703. case 'C':
  42704. if (hasStroke) {
  42705. if (this.isInsideCubicStroke(
  42706. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  42707. lineWidth, x, y
  42708. )) {
  42709. return true;
  42710. }
  42711. }
  42712. if (hasFill) {
  42713. w += this.windingCubic(
  42714. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  42715. );
  42716. }
  42717. xi = p[4];
  42718. yi = p[5];
  42719. break;
  42720. case 'Q':
  42721. if (hasStroke) {
  42722. if (this.isInsideQuadraticStroke(
  42723. xi, yi, p[0], p[1], p[2], p[3],
  42724. lineWidth, x, y
  42725. )) {
  42726. return true;
  42727. }
  42728. }
  42729. if (hasFill) {
  42730. w += this.windingQuadratic(
  42731. xi, yi, p[0], p[1], p[2], p[3], x, y
  42732. );
  42733. }
  42734. xi = p[2];
  42735. yi = p[3];
  42736. break;
  42737. case 'A':
  42738. // TODO Arc 旋转
  42739. // TODO Arc 判断的开销比较大
  42740. var cx = p[0];
  42741. var cy = p[1];
  42742. var rx = p[2];
  42743. var ry = p[3];
  42744. var theta = p[4];
  42745. var dTheta = p[5];
  42746. var x1 = Math.cos(theta) * rx + cx;
  42747. var y1 = Math.sin(theta) * ry + cy;
  42748. // 不是直接使用 arc 命令
  42749. if (!firstCmd) {
  42750. w += this.windingLine(xi, yi, x1, y1);
  42751. } else {
  42752. firstCmd = false;
  42753. // 第一个命令起点还未定义
  42754. x0 = x1;
  42755. y0 = y1;
  42756. }
  42757. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  42758. var _x = (x - cx) * ry / rx + cx;
  42759. if (hasStroke) {
  42760. if (this.isInsideArcStroke(
  42761. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  42762. lineWidth, _x, y
  42763. )) {
  42764. return true;
  42765. }
  42766. }
  42767. if (hasFill) {
  42768. w += this.windingArc(
  42769. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  42770. _x, y
  42771. );
  42772. }
  42773. xi = Math.cos(theta + dTheta) * rx + cx;
  42774. yi = Math.sin(theta + dTheta) * ry + cy;
  42775. break;
  42776. case 'z':
  42777. if (hasStroke) {
  42778. if (this.isInsideLine(
  42779. xi, yi, x0, y0, lineWidth, x, y
  42780. )) {
  42781. return true;
  42782. }
  42783. }
  42784. beginSubpath = true;
  42785. break;
  42786. }
  42787. }
  42788. if (hasFill) {
  42789. w += this.windingLine(xi, yi, x0, y0, x, y);
  42790. }
  42791. return w !== 0;
  42792. }
  42793. /**
  42794. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextWidth
  42795. * @description 测算多行文本宽度
  42796. */
  42797. getTextWidth(text, textFont) {
  42798. var key = text + ':' + textFont;
  42799. if (this._textWidthCache[key]) {
  42800. return this._textWidthCache[key];
  42801. }
  42802. this._ctx = this._ctx || this.util.getContext();
  42803. this._ctx.save();
  42804. if (textFont) {
  42805. this._ctx.font = textFont;
  42806. }
  42807. text = (text + '').split('\n');
  42808. var width = 0;
  42809. for (var i = 0, l = text.length; i < l; i++) {
  42810. width = Math.max(
  42811. this._ctx.measureText(text[i]).width,
  42812. width
  42813. );
  42814. }
  42815. this._ctx.restore();
  42816. this._textWidthCache[key] = width;
  42817. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  42818. // 内存释放
  42819. this._textWidthCacheCounter = 0;
  42820. this._textWidthCache = {};
  42821. }
  42822. return width;
  42823. }
  42824. /**
  42825. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextHeight
  42826. * @description 测算多行文本高度
  42827. */
  42828. getTextHeight(text, textFont) {
  42829. var key = text + ':' + textFont;
  42830. if (this._textHeightCache[key]) {
  42831. return this._textHeightCache[key];
  42832. }
  42833. this._ctx = this._ctx || this.util.getContext();
  42834. this._ctx.save();
  42835. if (textFont) {
  42836. this._ctx.font = textFont;
  42837. }
  42838. text = (text + '').split('\n');
  42839. // 比较粗暴
  42840. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  42841. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  42842. this._ctx.restore();
  42843. this._textHeightCache[key] = height;
  42844. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  42845. // 内存释放
  42846. this._textHeightCacheCounter = 0;
  42847. this._textHeightCache = {};
  42848. }
  42849. return height;
  42850. }
  42851. }
  42852. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  42853. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42854. * This program are made available under the terms of the Apache License, Version 2.0
  42855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42856. /**
  42857. * @class SuperMap.LevelRenderer.Tool.ComputeBoundingBox
  42858. * @category Visualization Theme
  42859. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  42860. * @private
  42861. */
  42862. class ComputeBoundingBox {
  42863. /**
  42864. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.constructor
  42865. * @description 构造函数。
  42866. */
  42867. constructor() {
  42868. if (arguments.length === 3) {
  42869. this.computeBoundingBox(arguments);
  42870. }
  42871. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  42872. }
  42873. /**
  42874. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  42875. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  42876. * @param {Array.<Object>} points - 顶点数组。
  42877. * @param {Array} min - 最小
  42878. * @param {Array} max - 最大
  42879. */
  42880. computeBoundingBox(points, min, max) {
  42881. if (points.length === 0) {
  42882. return;
  42883. }
  42884. var left = points[0][0];
  42885. var right = points[0][0];
  42886. var top = points[0][1];
  42887. var bottom = points[0][1];
  42888. for (var i = 1; i < points.length; i++) {
  42889. var p = points[i];
  42890. if (p[0] < left) {
  42891. left = p[0];
  42892. }
  42893. if (p[0] > right) {
  42894. right = p[0];
  42895. }
  42896. if (p[1] < top) {
  42897. top = p[1];
  42898. }
  42899. if (p[1] > bottom) {
  42900. bottom = p[1];
  42901. }
  42902. }
  42903. min[0] = left;
  42904. min[1] = top;
  42905. max[0] = right;
  42906. max[1] = bottom;
  42907. }
  42908. /**
  42909. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  42910. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  42911. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  42912. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  42913. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  42914. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  42915. * @param {Array.<number>} min - 最小
  42916. * @param {Array.<number>} max - 最大
  42917. */
  42918. cubeBezier(p0, p1, p2, p3, min, max) {
  42919. var curve = new Curve_Curve();
  42920. var xDim = [];
  42921. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  42922. for (let i = 0; i < xDim.length; i++) {
  42923. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  42924. }
  42925. var yDim = [];
  42926. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  42927. for (let i = 0; i < yDim.length; i++) {
  42928. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  42929. }
  42930. xDim.push(p0[0], p3[0]);
  42931. yDim.push(p0[1], p3[1]);
  42932. var left = Math.min.apply(null, xDim);
  42933. var right = Math.max.apply(null, xDim);
  42934. var top = Math.min.apply(null, yDim);
  42935. var bottom = Math.max.apply(null, yDim);
  42936. min[0] = left;
  42937. min[1] = top;
  42938. max[0] = right;
  42939. max[1] = bottom;
  42940. }
  42941. /**
  42942. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  42943. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  42944. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  42945. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  42946. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  42947. * @param {Array.<number>} min - 最小
  42948. * @param {Array.<number>} max - 最大
  42949. */
  42950. quadraticBezier(p0, p1, p2, min, max) {
  42951. var curve = new Curve_Curve();
  42952. // Find extremities, where derivative in x dim or y dim is zero
  42953. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  42954. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  42955. t1 = Math.max(Math.min(t1, 1), 0);
  42956. t2 = Math.max(Math.min(t2, 1), 0);
  42957. var ct1 = 1 - t1;
  42958. var ct2 = 1 - t2;
  42959. var x1 = ct1 * ct1 * p0[0]
  42960. + 2 * ct1 * t1 * p1[0]
  42961. + t1 * t1 * p2[0];
  42962. var y1 = ct1 * ct1 * p0[1]
  42963. + 2 * ct1 * t1 * p1[1]
  42964. + t1 * t1 * p2[1];
  42965. var x2 = ct2 * ct2 * p0[0]
  42966. + 2 * ct2 * t2 * p1[0]
  42967. + t2 * t2 * p2[0];
  42968. var y2 = ct2 * ct2 * p0[1]
  42969. + 2 * ct2 * t2 * p1[1]
  42970. + t2 * t2 * p2[1];
  42971. min[0] = Math.min(p0[0], p2[0], x1, x2);
  42972. min[1] = Math.min(p0[1], p2[1], y1, y2);
  42973. max[0] = Math.max(p0[0], p2[0], x1, x2);
  42974. max[1] = Math.max(p0[1], p2[1], y1, y2);
  42975. }
  42976. /**
  42977. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  42978. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  42979. * @param {number} x - 圆弧中心点 x
  42980. * @param {number} y - 圆弧中心点 y
  42981. * @param {number} r - 圆弧半径
  42982. * @param {number} startAngle - 圆弧开始角度
  42983. * @param {number} endAngle - 圆弧结束角度
  42984. * @param {number} anticlockwise - 是否是顺时针
  42985. * @param {number} min - 最小
  42986. * @param {number} max - 最大
  42987. */
  42988. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  42989. var vec2 = new levelRenderer_Vector_Vector();
  42990. var start = vec2.create();
  42991. var end = vec2.create();
  42992. var extremity = vec2.create();
  42993. start[0] = Math.cos(startAngle) * r + x;
  42994. start[1] = Math.sin(startAngle) * r + y;
  42995. end[0] = Math.cos(endAngle) * r + x;
  42996. end[1] = Math.sin(endAngle) * r + y;
  42997. vec2.min(min, start, end);
  42998. vec2.max(max, start, end);
  42999. // Thresh to [0, Math.PI * 2]
  43000. startAngle = startAngle % (Math.PI * 2);
  43001. if (startAngle < 0) {
  43002. startAngle = startAngle + Math.PI * 2;
  43003. }
  43004. endAngle = endAngle % (Math.PI * 2);
  43005. if (endAngle < 0) {
  43006. endAngle = endAngle + Math.PI * 2;
  43007. }
  43008. if (startAngle > endAngle && !anticlockwise) {
  43009. endAngle += Math.PI * 2;
  43010. } else if (startAngle < endAngle && anticlockwise) {
  43011. startAngle += Math.PI * 2;
  43012. }
  43013. if (anticlockwise) {
  43014. var tmp = endAngle;
  43015. endAngle = startAngle;
  43016. startAngle = tmp;
  43017. }
  43018. // var number = 0;
  43019. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  43020. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  43021. if (angle > startAngle) {
  43022. extremity[0] = Math.cos(angle) * r + x;
  43023. extremity[1] = Math.sin(angle) * r + y;
  43024. vec2.min(min, extremity, min);
  43025. vec2.max(max, extremity, max);
  43026. }
  43027. }
  43028. }
  43029. }
  43030. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  43031. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43032. * This program are made available under the terms of the Apache License, Version 2.0
  43033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43034. /**
  43035. * @class SuperMap.LevelRenderer.Tool.Env
  43036. * @category Visualization Theme
  43037. * @classdesc 环境识别
  43038. * @private
  43039. */
  43040. class Env {
  43041. constructor() {
  43042. // Zepto.js
  43043. // (c) 2010-2013 Thomas Fuchs
  43044. // Zepto.js may be freely distributed under the MIT license.
  43045. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  43046. var me = this;
  43047. function detect(ua) {
  43048. var os = me.os = {};
  43049. var browser = me.browser = {};
  43050. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  43051. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  43052. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  43053. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  43054. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  43055. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  43056. var touchpad = webos && ua.match(/TouchPad/);
  43057. var kindle = ua.match(/Kindle\/([\d.]+)/);
  43058. var silk = ua.match(/Silk\/([\d._]+)/);
  43059. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  43060. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  43061. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  43062. var playbook = ua.match(/PlayBook/);
  43063. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  43064. var firefox = ua.match(/Firefox\/([\d.]+)/);
  43065. var ie = ua.match(/MSIE ([\d.]+)/);
  43066. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  43067. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  43068. // Todo: clean this up with a better OS/browser seperation:
  43069. // - discern (more) between multiple browsers on android
  43070. // - decide if kindle fire in silk mode is android or not
  43071. // - Firefox on Android doesn't specify the Android version
  43072. // - possibly devide in os, device and browser hashes
  43073. /*eslint-disable*/
  43074. if (browser.webkit = !!webkit) {
  43075. browser.version = webkit[1];
  43076. }
  43077. if (android) {
  43078. os.android = true;
  43079. os.version = android[2];
  43080. }
  43081. if (iphone && !ipod) {
  43082. os.ios = os.iphone = true;
  43083. os.version = iphone[2].replace(/_/g, '.');
  43084. }
  43085. if (ipad) {
  43086. os.ios = os.ipad = true;
  43087. os.version = ipad[2].replace(/_/g, '.');
  43088. }
  43089. if (ipod) {
  43090. os.ios = os.ipod = true;
  43091. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  43092. }
  43093. if (webos) {
  43094. os.webos = true;
  43095. os.version = webos[2];
  43096. }
  43097. if (touchpad) {
  43098. os.touchpad = true;
  43099. }
  43100. if (blackberry) {
  43101. os.blackberry = true;
  43102. os.version = blackberry[2];
  43103. }
  43104. if (bb10) {
  43105. os.bb10 = true;
  43106. os.version = bb10[2];
  43107. }
  43108. if (rimtabletos) {
  43109. os.rimtabletos = true;
  43110. os.version = rimtabletos[2];
  43111. }
  43112. if (playbook) {
  43113. browser.playbook = true;
  43114. }
  43115. if (kindle) {
  43116. os.kindle = true;
  43117. os.version = kindle[1];
  43118. }
  43119. if (silk) {
  43120. browser.silk = true;
  43121. browser.version = silk[1];
  43122. }
  43123. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  43124. browser.silk = true;
  43125. }
  43126. if (chrome) {
  43127. browser.chrome = true;
  43128. browser.version = chrome[1];
  43129. }
  43130. if (firefox) {
  43131. browser.firefox = true;
  43132. browser.version = firefox[1];
  43133. }
  43134. if (ie) {
  43135. browser.ie = true;
  43136. browser.version = ie[1];
  43137. }
  43138. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  43139. browser.safari = true;
  43140. }
  43141. if (webview) {
  43142. browser.webview = true;
  43143. }
  43144. if (ie) {
  43145. browser.ie = true;
  43146. browser.version = ie[1];
  43147. }
  43148. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  43149. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  43150. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  43151. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  43152. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  43153. return {
  43154. browser: browser,
  43155. os: os,
  43156. // 原生canvas支持
  43157. canvasSupported: document.createElement('canvas').getContext ? true : false
  43158. };
  43159. }
  43160. return detect(navigator.userAgent);
  43161. }
  43162. destory() {
  43163. return true;
  43164. }
  43165. }
  43166. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  43167. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43168. * This program are made available under the terms of the Apache License, Version 2.0
  43169. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43170. /**
  43171. * @class SuperMap.LevelRenderer.Tool.Event
  43172. * @category Visualization Theme
  43173. * @classdesc LevelRenderer 工具-事件辅助类
  43174. * @private
  43175. */
  43176. class Event_Event {
  43177. /**
  43178. * @function SuperMap.LevelRenderer.Tool.Event.prototype.constructor
  43179. * @description 构造函数。
  43180. */
  43181. constructor() {
  43182. /**
  43183. * @member {function} SuperMap.LevelRenderer.Tool.Event.prototype.stop
  43184. * @description 停止冒泡和阻止默认行为
  43185. */
  43186. this.stop = typeof window.addEventListener === 'function'
  43187. ? function (e) {
  43188. e.preventDefault();
  43189. e.stopPropagation();
  43190. e.cancelBubble = true;
  43191. }
  43192. : function (e) {
  43193. e.returnValue = false;
  43194. e.cancelBubble = true;
  43195. };
  43196. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  43197. }
  43198. /**
  43199. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getX
  43200. * @description 提取鼠标(手指)x坐标。
  43201. * @param {Event} e - 事件。
  43202. * @returns {number} 鼠标(手指)x坐标。
  43203. */
  43204. getX(e) {
  43205. return typeof e.zrenderX != 'undefined' && e.zrenderX
  43206. || typeof e.offsetX != 'undefined' && e.offsetX
  43207. || typeof e.layerX != 'undefined' && e.layerX
  43208. || typeof e.clientX != 'undefined' && e.clientX;
  43209. }
  43210. /**
  43211. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getY
  43212. * @description 提取鼠标(手指)y坐标。
  43213. * @param {Event} e - 事件。
  43214. * @returns {number} 鼠标(手指)y坐标。
  43215. */
  43216. getY(e) {
  43217. return typeof e.zrenderY != 'undefined' && e.zrenderY
  43218. || typeof e.offsetY != 'undefined' && e.offsetY
  43219. || typeof e.layerY != 'undefined' && e.layerY
  43220. || typeof e.clientY != 'undefined' && e.clientY;
  43221. }
  43222. /**
  43223. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getDelta
  43224. * @description 提取鼠标滚轮变化。
  43225. * @param {Event} e - 事件。
  43226. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  43227. */
  43228. getDelta(e) {
  43229. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  43230. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  43231. || typeof e.detail != 'undefined' && -e.detail;
  43232. }
  43233. }
  43234. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  43235. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43236. * This program are made available under the terms of the Apache License, Version 2.0
  43237. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43238. /**
  43239. * @private
  43240. * @class SuperMap.LevelRenderer.Tool.Http
  43241. * @category Visualization Theme
  43242. * @classdesc LevelRenderer 工具-Http
  43243. */
  43244. class Http {
  43245. /**
  43246. * @function SuperMap.LevelRenderer.Tool.Http.constructor
  43247. * @description 构造函数。
  43248. */
  43249. constructor() {
  43250. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  43251. }
  43252. /**
  43253. * @function SuperMap.LevelRenderer.Tool.Http.prototype.get
  43254. * @description get请求。
  43255. * @param {(string|IHTTPGetOption)} url - 请求url
  43256. * @param {function} onsuccess - 请求成功函数
  43257. * @param {function} onerror - 请求失败函数
  43258. * @param {Object} opts - 额外参数
  43259. * @returns {number} cos值
  43260. */
  43261. get(url, onsuccess, onerror) {
  43262. if (typeof(url) === 'object') {
  43263. var obj = url;
  43264. url = obj.url;
  43265. onsuccess = obj.onsuccess;
  43266. onerror = obj.onerror;
  43267. }
  43268. var xhr = window.XMLHttpRequest
  43269. ? new XMLHttpRequest()
  43270. : new window.ActiveXObject('Microsoft.XMLHTTP');
  43271. xhr.open('GET', url, true);
  43272. xhr.onreadystatechange = function () {
  43273. if (xhr.readyState == 4) {
  43274. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  43275. onsuccess && onsuccess(xhr.responseText);
  43276. } else {
  43277. onerror && onerror();
  43278. }
  43279. xhr.onreadystatechange = new Function();
  43280. xhr = null;
  43281. }
  43282. };
  43283. xhr.send(null);
  43284. }
  43285. }
  43286. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  43287. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43288. * This program are made available under the terms of the Apache License, Version 2.0
  43289. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43290. class Config {
  43291. }
  43292. /**
  43293. * @enum EVENT
  43294. * @description 事件
  43295. * @type {Object}
  43296. * @private
  43297. */
  43298. Config.EVENT = {
  43299. //窗口大小变化
  43300. RESIZE: 'resize',
  43301. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  43302. CLICK: 'click',
  43303. //双击事件
  43304. DBLCLICK: 'dblclick',
  43305. //鼠标滚轮变化,事件对象是:目标图形元素或空
  43306. MOUSEWHEEL: 'mousewheel',
  43307. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  43308. MOUSEMOVE: 'mousemove',
  43309. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  43310. MOUSEOVER: 'mouseover',
  43311. //鼠标从某图形元素移开,事件对象是:目标图形元素
  43312. MOUSEOUT: 'mouseout',
  43313. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  43314. MOUSEDOWN: 'mousedown',
  43315. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  43316. MOUSEUP: 'mouseup',
  43317. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  43318. GLOBALOUT: 'globalout',
  43319. // 一次成功元素拖拽的行为事件过程是:
  43320. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  43321. //开始拖拽时触发,事件对象是:被拖拽图形元素
  43322. DRAGSTART: 'dragstart',
  43323. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  43324. DRAGEND: 'dragend',
  43325. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  43326. DRAGENTER: 'dragenter',
  43327. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  43328. DRAGOVER: 'dragover',
  43329. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  43330. DRAGLEAVE: 'dragleave',
  43331. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  43332. DROP: 'drop',
  43333. //touch end - start < delay is click
  43334. touchClickDelay: 300
  43335. };
  43336. /**
  43337. * @enum catchBrushException
  43338. * @description 是否异常捕获
  43339. * @type {boolean}
  43340. * @private
  43341. */
  43342. Config.catchBrushException = false;
  43343. /**
  43344. * @enum debugMode
  43345. * @description debug 日志选项:catchBrushException 为 true 下有效。
  43346. * 0 : 不生成debug数据,发布用
  43347. * 1 : 异常抛出,调试用
  43348. * 2 : 控制台输出,调试用
  43349. * @type {boolean}
  43350. * @private
  43351. */
  43352. Config.debugMode = 0;
  43353. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  43354. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43355. * This program are made available under the terms of the Apache License, Version 2.0
  43356. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43357. /**
  43358. * @private
  43359. * @class SuperMap.LevelRenderer.Tool.Log
  43360. * @category Visualization Theme
  43361. * @classdesc LevelRenderer 工具-日志
  43362. */
  43363. class Log {
  43364. /**
  43365. * @function SuperMap.LevelRenderer.Tool.Log.constructor
  43366. * @description 构造函数。
  43367. */
  43368. constructor() {
  43369. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  43370. return function () {
  43371. if (Config.debugMode === 0) {
  43372. return;
  43373. } else if (Config.debugMode == 1) {
  43374. for (let k in arguments) {
  43375. throw new Error(arguments[k]);
  43376. }
  43377. } else if (Config.debugMode > 1) {
  43378. for (let k in arguments) {
  43379. console.log(arguments[k]);
  43380. }
  43381. }
  43382. };
  43383. /* for debug
  43384. return function(mes) {
  43385. document.getElementById('wrong-message').innerHTML =
  43386. mes + ' ' + (new Date() - 0)
  43387. + '<br/>'
  43388. + document.getElementById('wrong-message').innerHTML;
  43389. };
  43390. */
  43391. }
  43392. destory() {
  43393. return true;
  43394. }
  43395. }
  43396. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  43397. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43398. * This program are made available under the terms of the Apache License, Version 2.0
  43399. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43400. /**
  43401. * @private
  43402. * @class SuperMap.LevelRenderer.Tool.Math
  43403. * @category Visualization Theme
  43404. * @classdesc LevelRenderer 工具-数学辅助类
  43405. */
  43406. class MathTool {
  43407. /**
  43408. * @function SuperMap.LevelRenderer.Tool.Math.constructor
  43409. * @description 构造函数。
  43410. */
  43411. constructor() {
  43412. /**
  43413. * @member {number} SuperMap.LevelRenderer.Tool.Math._radians
  43414. * @description 角度与弧度转化参数
  43415. */
  43416. this._radians = window.Math.PI / 180;
  43417. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  43418. }
  43419. /**
  43420. * @function SuperMap.LevelRenderer.Tool.Math.prototype.sin
  43421. * @description 正弦函数。
  43422. * @param {number} angle - 弧度(角度)参数。
  43423. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  43424. * @returns {number} sin 值。
  43425. */
  43426. sin(angle, isDegrees) {
  43427. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  43428. }
  43429. /**
  43430. * @function SuperMap.LevelRenderer.Tool.Math.prototype.cos
  43431. * @description 余弦函数。
  43432. * @param {number} angle - 弧度(角度)参数。
  43433. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  43434. * @returns {number} cos 值。
  43435. */
  43436. cos(angle, isDegrees) {
  43437. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  43438. }
  43439. /**
  43440. * @function SuperMap.LevelRenderer.Tool.Math.prototype.degreeToRadian
  43441. * @description 角度转弧度。
  43442. * @param {number} angle - 弧度(角度)参数。
  43443. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  43444. * @returns {number} 弧度值。
  43445. */
  43446. degreeToRadian(angle) {
  43447. return angle * this._radians;
  43448. }
  43449. /**
  43450. * @function SuperMap.LevelRenderer.Tool.Math.prototype.radianToDegree
  43451. * @description 弧度转角度。
  43452. * @param {number} angle - 弧度(角度)参数。
  43453. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  43454. * @returns {number} 角度。
  43455. */
  43456. radianToDegree(angle) {
  43457. return angle / this._radians;
  43458. }
  43459. }
  43460. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  43461. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43462. * This program are made available under the terms of the Apache License, Version 2.0
  43463. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43464. /**
  43465. * @private
  43466. * @class SuperMap.LevelRenderer.Tool.Matrix
  43467. * @category Visualization Theme
  43468. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  43469. */
  43470. class Matrix {
  43471. /**
  43472. * @function SuperMap.LevelRenderer.Tool.Matrix.constructor
  43473. * @description 构造函数。
  43474. */
  43475. constructor() {
  43476. /**
  43477. * @member {Object} SuperMap.LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  43478. * @description 数组类型控制
  43479. */
  43480. this.ArrayCtor = typeof Float32Array === 'undefined'
  43481. ? Array
  43482. : Float32Array;
  43483. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  43484. }
  43485. /**
  43486. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.create
  43487. * @description 创建一个单位矩阵。
  43488. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  43489. */
  43490. create() {
  43491. var ArrayCtor = this.ArrayCtor;
  43492. var out = new ArrayCtor(6);
  43493. this.identity(out);
  43494. return out;
  43495. }
  43496. /**
  43497. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.identity
  43498. * @description 设置矩阵为单位矩阵。
  43499. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43500. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  43501. */
  43502. identity(out) {
  43503. out[0] = 1;
  43504. out[1] = 0;
  43505. out[2] = 0;
  43506. out[3] = 1;
  43507. out[4] = 0;
  43508. out[5] = 0;
  43509. return out;
  43510. }
  43511. /**
  43512. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.copy
  43513. * @description 复制矩阵。
  43514. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43515. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  43516. */
  43517. copy(out, m) {
  43518. out[0] = m[0];
  43519. out[1] = m[1];
  43520. out[2] = m[2];
  43521. out[3] = m[3];
  43522. out[4] = m[4];
  43523. out[5] = m[5];
  43524. return out;
  43525. }
  43526. /**
  43527. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  43528. * @description 矩阵相乘。
  43529. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43530. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  43531. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  43532. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  43533. */
  43534. mul(out, m1, m2) {
  43535. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  43536. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  43537. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  43538. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  43539. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  43540. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  43541. return out;
  43542. }
  43543. /**
  43544. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  43545. * @description 平移变换。
  43546. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43547. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  43548. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  43549. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  43550. */
  43551. translate(out, a, v) {
  43552. out[0] = a[0];
  43553. out[1] = a[1];
  43554. out[2] = a[2];
  43555. out[3] = a[3];
  43556. out[4] = a[4] + v[0];
  43557. out[5] = a[5] + v[1];
  43558. return out;
  43559. }
  43560. /**
  43561. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.rotate
  43562. * @description 平移变换。
  43563. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43564. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  43565. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  43566. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  43567. */
  43568. rotate(out, a, rad) {
  43569. var aa = a[0];
  43570. var ac = a[2];
  43571. var atx = a[4];
  43572. var ab = a[1];
  43573. var ad = a[3];
  43574. var aty = a[5];
  43575. var st = Math.sin(rad);
  43576. var ct = Math.cos(rad);
  43577. out[0] = aa * ct + ab * st;
  43578. out[1] = -aa * st + ab * ct;
  43579. out[2] = ac * ct + ad * st;
  43580. out[3] = -ac * st + ct * ad;
  43581. out[4] = ct * atx + st * aty;
  43582. out[5] = ct * aty - st * atx;
  43583. return out;
  43584. }
  43585. /**
  43586. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.scale
  43587. * @description 缩放变换。
  43588. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43589. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  43590. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  43591. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  43592. */
  43593. scale(out, a, v) {
  43594. var vx = v[0];
  43595. var vy = v[1];
  43596. out[0] = a[0] * vx;
  43597. out[1] = a[1] * vy;
  43598. out[2] = a[2] * vx;
  43599. out[3] = a[3] * vy;
  43600. out[4] = a[4] * vx;
  43601. out[5] = a[5] * vy;
  43602. return out;
  43603. }
  43604. /**
  43605. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.invert
  43606. * @description 求逆矩阵。
  43607. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43608. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  43609. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  43610. */
  43611. invert(out, a) {
  43612. var aa = a[0];
  43613. var ac = a[2];
  43614. var atx = a[4];
  43615. var ab = a[1];
  43616. var ad = a[3];
  43617. var aty = a[5];
  43618. var det = aa * ad - ab * ac;
  43619. if (!det) {
  43620. return null;
  43621. }
  43622. det = 1.0 / det;
  43623. out[0] = ad * det;
  43624. out[1] = -ab * det;
  43625. out[2] = -ac * det;
  43626. out[3] = aa * det;
  43627. out[4] = (ac * aty - ad * atx) * det;
  43628. out[5] = (ab * atx - aa * aty) * det;
  43629. return out;
  43630. }
  43631. /**
  43632. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mulVector
  43633. * @description 矩阵左乘向量。
  43634. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  43635. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  43636. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  43637. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  43638. */
  43639. mulVector(out, a, v) {
  43640. var aa = a[0];
  43641. var ac = a[2];
  43642. var atx = a[4];
  43643. var ab = a[1];
  43644. var ad = a[3];
  43645. var aty = a[5];
  43646. out[0] = v[0] * aa + v[1] * ac + atx;
  43647. out[1] = v[0] * ab + v[1] * ad + aty;
  43648. return out;
  43649. }
  43650. }
  43651. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  43652. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43653. * This program are made available under the terms of the Apache License, Version 2.0
  43654. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43655. class SUtil_SUtil {
  43656. /**
  43657. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothBezier
  43658. * @description 贝塞尔平滑曲线。
  43659. * @private
  43660. * @param {Array} points - 线段顶点数组。
  43661. * @param {number} smooth - 平滑等级, 0-1。
  43662. * @param {boolean} isLoop - isLoop。
  43663. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  43664. * @param {Array} [originalPosition=[0, 0]] - 参考原点。
  43665. * @return {Array} 生成的平滑节点数组。
  43666. */
  43667. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  43668. if (!originalPosition || originalPosition !== 2) {
  43669. originalPosition = [0, 0];
  43670. }
  43671. var __OP = originalPosition;
  43672. var cps = [];
  43673. var v = [];
  43674. var v1 = [];
  43675. var v2 = [];
  43676. var hasConstraint = !!constraint;
  43677. var min, max;
  43678. if (hasConstraint) {
  43679. min = [Infinity, Infinity];
  43680. max = [-Infinity, -Infinity];
  43681. let len = points.length;
  43682. for (let i = 0; i < len; i++) {
  43683. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  43684. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  43685. }
  43686. // 与指定的包围盒做并集
  43687. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  43688. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  43689. }
  43690. let len = points.length;
  43691. for (let i = 0; i < len; i++) {
  43692. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  43693. let prevPoint;
  43694. let nextPoint;
  43695. if (isLoop) {
  43696. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  43697. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  43698. } else {
  43699. if (i === 0 || i === len - 1) {
  43700. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  43701. continue;
  43702. } else {
  43703. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  43704. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  43705. }
  43706. }
  43707. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  43708. // use degree to scale the handle length
  43709. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  43710. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  43711. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  43712. let sum = d0 + d1;
  43713. if (sum !== 0) {
  43714. d0 /= sum;
  43715. d1 /= sum;
  43716. }
  43717. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  43718. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  43719. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  43720. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  43721. if (hasConstraint) {
  43722. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  43723. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  43724. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  43725. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  43726. }
  43727. cps.push(cp0);
  43728. cps.push(cp1);
  43729. }
  43730. if (isLoop) {
  43731. cps.push(cps.shift());
  43732. }
  43733. return cps;
  43734. }
  43735. /**
  43736. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothSpline
  43737. * @description 插值折线。
  43738. * @private
  43739. * @param {Array} points - 线段顶点数组。
  43740. * @param {boolean} isLoop - isLoop。
  43741. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  43742. * @param {Array} originalPosition - 参考原点。默认值:[0, 0]。
  43743. * @return {Array} 生成的平滑节点数组。
  43744. */
  43745. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  43746. if (!originalPosition || originalPosition !== 2) {
  43747. originalPosition = [0, 0];
  43748. }
  43749. var __OP = originalPosition;
  43750. var len = points.length;
  43751. var ret = [];
  43752. var distance = 0;
  43753. for (let i = 1; i < len; i++) {
  43754. distance += SUtil_SUtil.Util_vector.distance([points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]], [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  43755. }
  43756. var segs = distance / 5;
  43757. segs = segs < len ? len : segs;
  43758. for (let i = 0; i < segs; i++) {
  43759. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  43760. let idx = Math.floor(pos);
  43761. let w = pos - idx;
  43762. let p0;
  43763. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  43764. let p2;
  43765. let p3;
  43766. if (!isLoop) {
  43767. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  43768. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  43769. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  43770. } else {
  43771. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  43772. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  43773. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  43774. }
  43775. let w2 = w * w;
  43776. let w3 = w * w2;
  43777. ret.push([
  43778. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  43779. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  43780. ]);
  43781. }
  43782. return ret;
  43783. // inner Function
  43784. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  43785. var v0 = (p2 - p0) * 0.5;
  43786. var v1 = (p3 - p1) * 0.5;
  43787. return (2 * (p1 - p2) + v0 + v1) * t3
  43788. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  43789. + v0 * t + p1;
  43790. }
  43791. }
  43792. /**
  43793. * @function SuperMap.LevelRenderer.SUtil.SUtil_dashedLineTo
  43794. * @description 虚线 lineTo。
  43795. */
  43796. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  43797. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  43798. var dashPattern = [5, 5];
  43799. dashLength = typeof dashLength != 'number'
  43800. ? 5
  43801. : dashLength;
  43802. if (ctx.setLineDash) {
  43803. dashPattern[0] = dashLength;
  43804. dashPattern[1] = dashLength;
  43805. if (customDashPattern && (customDashPattern instanceof Array)) {
  43806. ctx.setLineDash(customDashPattern);
  43807. } else {
  43808. ctx.setLineDash(dashPattern);
  43809. }
  43810. // ctx.setLineDash(dashPattern);
  43811. ctx.moveTo(x1, y1);
  43812. ctx.lineTo(x2, y2);
  43813. return;
  43814. }
  43815. var dx = x2 - x1;
  43816. var dy = y2 - y1;
  43817. var numDashes = Math.floor(
  43818. Math.sqrt(dx * dx + dy * dy) / dashLength
  43819. );
  43820. dx = dx / numDashes;
  43821. dy = dy / numDashes;
  43822. var flag = true;
  43823. for (var i = 0; i < numDashes; ++i) {
  43824. if (flag) {
  43825. ctx.moveTo(x1, y1);
  43826. } else {
  43827. ctx.lineTo(x1, y1);
  43828. }
  43829. flag = !flag;
  43830. x1 += dx;
  43831. y1 += dy;
  43832. }
  43833. ctx.lineTo(x2, y2);
  43834. }
  43835. }
  43836. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  43837. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  43838. SUtil_SUtil.Util_area = new Area();
  43839. SUtil_SUtil.Util_color = new Color();
  43840. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  43841. SUtil_SUtil.Util_curve = new Curve_Curve();
  43842. SUtil_SUtil.Util_env = new Env();
  43843. SUtil_SUtil.Util_event = new Event_Event();
  43844. SUtil_SUtil.Util_http = new Http();
  43845. SUtil_SUtil.Util_log = new Log();
  43846. SUtil_SUtil.Util_math = new MathTool();
  43847. SUtil_SUtil.Util_matrix = new Matrix();
  43848. SUtil_SUtil.Util = new Util_Util();
  43849. SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
  43850. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  43851. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43852. * This program are made available under the terms of the Apache License, Version 2.0
  43853. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43854. /**
  43855. * @private
  43856. * @class SuperMap.LevelRenderer.Transformable
  43857. * @category Visualization Theme
  43858. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  43859. */
  43860. class Transformable {
  43861. /**
  43862. * @function SuperMap.LevelRenderer.Transformable.constructor
  43863. * @description 构造函数。
  43864. */
  43865. constructor() {
  43866. /**
  43867. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.position
  43868. * @description 平移, 默认值:[0, 0]。
  43869. */
  43870. this.position = [0, 0];
  43871. /**
  43872. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.rotation
  43873. * @description 旋转,可以通过数组二三项指定旋转的原点, 默认值:[0, 0, 0]。
  43874. */
  43875. this.rotation = [0, 0, 0];
  43876. /**
  43877. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.scale
  43878. * @description 缩放,可以通过数组三四项指定缩放的原点, 默认值:[1, 1, 0, 0]。
  43879. */
  43880. this.scale = [1, 1, 0, 0];
  43881. /**
  43882. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needLocalTransform
  43883. * @description 是否变换。默认值:false。
  43884. */
  43885. this.needLocalTransform = false;
  43886. /**
  43887. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needTransform
  43888. * @description 是否有坐标变换。默认值:false。
  43889. */
  43890. this.needTransform = false;
  43891. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  43892. /**
  43893. * @function SuperMap.LevelRenderer.Transformable.prototype.lookAt
  43894. * @description 设置图形的朝向。
  43895. */
  43896. this.lookAt = (function () {
  43897. var v = SUtil_SUtil.Util_vector.create();
  43898. // {Array.<Number>|Float32Array} target
  43899. return function (target) {
  43900. if (!this.transform) {
  43901. this.transform = SUtil_SUtil.Util_matrix.create();
  43902. }
  43903. var m = this.transform;
  43904. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  43905. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  43906. return;
  43907. }
  43908. SUtil_SUtil.Util_vector.normalize(v, v);
  43909. // Y Axis
  43910. // TODO Scale origin ?
  43911. m[2] = v[0] * this.scale[1];
  43912. m[3] = v[1] * this.scale[1];
  43913. // X Axis
  43914. m[0] = v[1] * this.scale[0];
  43915. m[1] = -v[0] * this.scale[0];
  43916. // Position
  43917. m[4] = this.position[0];
  43918. m[5] = this.position[1];
  43919. this.decomposeTransform();
  43920. function isAroundZero(val) {
  43921. var EPSILON = 5e-5;
  43922. return val > -EPSILON && val < EPSILON;
  43923. }
  43924. };
  43925. })();
  43926. }
  43927. /**
  43928. * @function SuperMap.LevelRenderer.Transformable.prototype.destroy
  43929. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  43930. */
  43931. destroy() {
  43932. this.position = null;
  43933. this.rotation = null;
  43934. this.scale = null;
  43935. this.needLocalTransform = null;
  43936. this.needTransform = null;
  43937. }
  43938. /**
  43939. * @function SuperMap.LevelRenderer.Transformable.prototype.updateNeedTransform
  43940. * @description 更新 needLocalTransform
  43941. */
  43942. updateNeedTransform() {
  43943. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  43944. || isNotAroundZero(this.position[0])
  43945. || isNotAroundZero(this.position[1])
  43946. || isNotAroundZero(this.scale[0] - 1)
  43947. || isNotAroundZero(this.scale[1] - 1);
  43948. function isNotAroundZero(val) {
  43949. var EPSILON = 5e-5;
  43950. return val > EPSILON || val < -EPSILON;
  43951. }
  43952. }
  43953. /**
  43954. * @function SuperMap.LevelRenderer.Transformable.prototype.updateTransform
  43955. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换, 则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵
  43956. */
  43957. updateTransform() {
  43958. this.updateNeedTransform();
  43959. if (this.parent) {
  43960. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  43961. } else {
  43962. this.needTransform = this.needLocalTransform;
  43963. }
  43964. if (!this.needTransform) {
  43965. return;
  43966. }
  43967. var origin = [0, 0];
  43968. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  43969. SUtil_SUtil.Util_matrix.identity(m);
  43970. if (this.needLocalTransform) {
  43971. if (
  43972. isNotAroundZero(this.scale[0])
  43973. || isNotAroundZero(this.scale[1])
  43974. ) {
  43975. origin[0] = -this.scale[2] || 0;
  43976. origin[1] = -this.scale[3] || 0;
  43977. let haveOrigin = isNotAroundZero(origin[0])
  43978. || isNotAroundZero(origin[1]);
  43979. if (haveOrigin) {
  43980. SUtil_SUtil.Util_matrix.translate(
  43981. m, m, origin
  43982. );
  43983. }
  43984. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  43985. if (haveOrigin) {
  43986. origin[0] = -origin[0];
  43987. origin[1] = -origin[1];
  43988. SUtil_SUtil.Util_matrix.translate(
  43989. m, m, origin
  43990. );
  43991. }
  43992. }
  43993. if (this.rotation instanceof Array) {
  43994. if (this.rotation[0] !== 0) {
  43995. origin[0] = -this.rotation[1] || 0;
  43996. origin[1] = -this.rotation[2] || 0;
  43997. let haveOrigin = isNotAroundZero(origin[0])
  43998. || isNotAroundZero(origin[1]);
  43999. if (haveOrigin) {
  44000. SUtil_SUtil.Util_matrix.translate(
  44001. m, m, origin
  44002. );
  44003. }
  44004. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  44005. if (haveOrigin) {
  44006. origin[0] = -origin[0];
  44007. origin[1] = -origin[1];
  44008. SUtil_SUtil.Util_matrix.translate(
  44009. m, m, origin
  44010. );
  44011. }
  44012. }
  44013. } else {
  44014. if (this.rotation !== 0) {
  44015. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  44016. }
  44017. }
  44018. if (
  44019. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  44020. ) {
  44021. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  44022. }
  44023. }
  44024. // 保存这个变换矩阵
  44025. this.transform = m;
  44026. // 应用父节点变换
  44027. if (this.parent && this.parent.needTransform) {
  44028. if (this.needLocalTransform) {
  44029. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  44030. } else {
  44031. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  44032. }
  44033. }
  44034. function isNotAroundZero(val) {
  44035. var EPSILON = 5e-5;
  44036. return val > EPSILON || val < -EPSILON;
  44037. }
  44038. }
  44039. /**
  44040. * @function SuperMap.LevelRenderer.Transformable.prototype.setTransform
  44041. * @description 将自己的 transform 应用到 context 上。
  44042. *
  44043. * @param {Context2D} ctx - Context2D 上下文。
  44044. */
  44045. setTransform(ctx) {
  44046. if (this.needTransform) {
  44047. var m = this.transform;
  44048. ctx.transform(
  44049. m[0], m[1],
  44050. m[2], m[3],
  44051. m[4], m[5]
  44052. );
  44053. }
  44054. }
  44055. /**
  44056. * @function SuperMap.LevelRenderer.Transformable.prototype.decomposeTransform
  44057. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  44058. */
  44059. decomposeTransform() {
  44060. if (!this.transform) {
  44061. return;
  44062. }
  44063. var m = this.transform;
  44064. var sx = m[0] * m[0] + m[1] * m[1];
  44065. var position = this.position;
  44066. var scale = this.scale;
  44067. var rotation = this.rotation;
  44068. if (isNotAroundZero(sx - 1)) {
  44069. sx = Math.sqrt(sx);
  44070. }
  44071. var sy = m[2] * m[2] + m[3] * m[3];
  44072. if (isNotAroundZero(sy - 1)) {
  44073. sy = Math.sqrt(sy);
  44074. }
  44075. position[0] = m[4];
  44076. position[1] = m[5];
  44077. scale[0] = sx;
  44078. scale[1] = sy;
  44079. scale[2] = scale[3] = 0;
  44080. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  44081. rotation[1] = rotation[2] = 0;
  44082. function isNotAroundZero(val) {
  44083. var EPSILON = 5e-5;
  44084. return val > EPSILON || val < -EPSILON;
  44085. }
  44086. }
  44087. }
  44088. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  44089. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44090. * This program are made available under the terms of the Apache License, Version 2.0
  44091. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44092. /**
  44093. * @private
  44094. * @class SuperMap.LevelRenderer.Shape
  44095. * @category Visualization Theme
  44096. * @classdesc 图形(shape)基类。
  44097. * @extends SuperMap.LevelRenderer.Eventful
  44098. * @extends SuperMap.LevelRenderer.Transformable
  44099. */
  44100. class Shape_Shape extends SuperMap.mixin(Eventful, Transformable) {
  44101. /**
  44102. * @function SuperMap.LevelRenderer.Shape.constructor
  44103. * @description 构造函数。
  44104. *
  44105. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  44106. *
  44107. */
  44108. constructor(options) {
  44109. super(options);
  44110. options = options || {};
  44111. /**
  44112. * @member {string} SuperMap.LevelRenderer.Shape.prototype.id
  44113. * @description 唯一标识。
  44114. */
  44115. this.id = null;
  44116. /**
  44117. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style
  44118. * @description 基础绘制样式。
  44119. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  44120. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  44121. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  44122. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  44123. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  44124. * @param {number} style.opacity - 绘制透明度。默认值:1。
  44125. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  44126. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  44127. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  44128. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  44129. * @param {string} style.text - 图形中的附加文本。默认值:""。
  44130. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  44131. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  44132. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  44133. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  44134. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  44135. *
  44136. */
  44137. this.style = {};
  44138. /**
  44139. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style.__rect
  44140. * @description 包围图形的最小矩形盒子。
  44141. *
  44142. * @param {number} x - 左上角顶点x轴坐标。
  44143. * @param {number} y - 左上角顶点y轴坐标。
  44144. * @param {number} width - 包围盒矩形宽度。
  44145. * @param {number} height - 包围盒矩形高度。
  44146. */
  44147. /**
  44148. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.highlightStyle
  44149. * @description 高亮样式。
  44150. *
  44151. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  44152. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  44153. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  44154. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  44155. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  44156. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  44157. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  44158. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  44159. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  44160. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  44161. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  44162. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  44163. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  44164. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  44165. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  44166. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  44167. */
  44168. this.highlightStyle = null;
  44169. /**
  44170. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.parent
  44171. * @description 父节点,只读属性。<SuperMap.LevelRenderer.Group>
  44172. */
  44173. this.parent = null;
  44174. /**
  44175. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.__dirty
  44176. * @description {boolean}
  44177. */
  44178. this.__dirty = true;
  44179. /**
  44180. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.__clipShapes
  44181. * @description {Array}
  44182. *
  44183. */
  44184. this.__clipShapes = [];
  44185. /**
  44186. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.invisible
  44187. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  44188. */
  44189. this.invisible = false;
  44190. /**
  44191. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.ignore
  44192. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  44193. */
  44194. this.ignore = false;
  44195. /**
  44196. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.zlevel
  44197. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  44198. */
  44199. this.zlevel = 0;
  44200. /**
  44201. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.draggable
  44202. * @description 是否可拖拽。默认值:false。
  44203. */
  44204. this.draggable = false;
  44205. /**
  44206. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.clickable
  44207. * @description 是否可点击。默认值:false。
  44208. */
  44209. this.clickable = false;
  44210. /**
  44211. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.hoverable
  44212. * @description 是否可以 hover。默认值:true。
  44213. */
  44214. this.hoverable = true;
  44215. /**
  44216. * @member {number} SuperMap.LevelRenderer.Shape.prototype.z
  44217. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  44218. */
  44219. this.z = 0;
  44220. //地理扩展
  44221. /**
  44222. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.refOriginalPosition
  44223. * @description 图形参考原点位置,图形的参考中心位置。
  44224. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  44225. *
  44226. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  44227. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  44228. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  44229. *
  44230. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  44231. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  44232. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  44233. *
  44234. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  44235. *
  44236. * refOriginalPosition。默认值是: [0, 0]。
  44237. */
  44238. this.refOriginalPosition = [0, 0];
  44239. /**
  44240. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataID
  44241. * @description 图形所关联数据的 ID。
  44242. *
  44243. */
  44244. this.refDataID = null;
  44245. /**
  44246. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.isHoverByRefDataID
  44247. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  44248. *
  44249. */
  44250. this.isHoverByRefDataID = false;
  44251. /**
  44252. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataHoverGroup
  44253. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  44254. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  44255. *
  44256. */
  44257. this.refDataHoverGroup = null;
  44258. /**
  44259. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.dataInfo
  44260. * @description 图形的数据信息。
  44261. *
  44262. */
  44263. this.dataInfo = null;
  44264. Util.extend(this, options);
  44265. this.id = this.id || Util.createUniqueID("smShape_");
  44266. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  44267. /**
  44268. * @function SuperMap.LevelRenderer.Shape.prototype.getTansform
  44269. * @description 变换鼠标位置到 shape 的局部坐标空间
  44270. *
  44271. */
  44272. this.getTansform = (function () {
  44273. var invTransform = [];
  44274. return function (x, y) {
  44275. var originPos = [x, y];
  44276. // 对鼠标的坐标也做相同的变换
  44277. if (this.needTransform && this.transform) {
  44278. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  44279. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  44280. if (x == originPos[0] && y == originPos[1]) {
  44281. // 避免外部修改导致的 needTransform 不准确
  44282. this.updateNeedTransform();
  44283. }
  44284. }
  44285. return originPos;
  44286. };
  44287. })();
  44288. }
  44289. /**
  44290. * @function SuperMap.LevelRenderer.Shape.prototype.destroy
  44291. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  44292. */
  44293. destroy() {
  44294. this.id = null;
  44295. this.style = null;
  44296. this.highlightStyle = null;
  44297. this.parent = null;
  44298. this.__dirty = null;
  44299. this.__clipShapes = null;
  44300. this.invisible = null;
  44301. this.ignore = null;
  44302. this.zlevel = null;
  44303. this.draggable = null;
  44304. this.clickable = null;
  44305. this.hoverable = null;
  44306. this.z = null;
  44307. this.refOriginalPosition = null;
  44308. this.refDataID = null;
  44309. this.refDataHoverGroup = null;
  44310. this.isHoverByRefDataID = null;
  44311. this.dataInfo = null;
  44312. super.destroy();
  44313. }
  44314. /**
  44315. * @function SuperMap.LevelRenderer.Shape.prototype.brush
  44316. * @description 绘制图形。
  44317. *
  44318. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44319. * @param {boolean} isHighlight - 是否使用高亮属性。
  44320. * @param {Function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  44321. */
  44322. brush(ctx, isHighlight) {
  44323. var style = this.beforeBrush(ctx, isHighlight);
  44324. ctx.beginPath();
  44325. this.buildPath(ctx, style);
  44326. switch (style.brushType) {
  44327. /* jshint ignore:start */
  44328. case 'both':
  44329. this.setCtxGlobalAlpha(ctx, "fill", style);
  44330. ctx.fill();
  44331. if (style.lineWidth > 0) {
  44332. this.setCtxGlobalAlpha(ctx, "stroke", style);
  44333. ctx.stroke();
  44334. }
  44335. this.setCtxGlobalAlpha(ctx, "reset", style);
  44336. break;
  44337. case 'stroke':
  44338. this.setCtxGlobalAlpha(ctx, "stroke", style);
  44339. style.lineWidth > 0 && ctx.stroke();
  44340. this.setCtxGlobalAlpha(ctx, "reset", style);
  44341. break;
  44342. /* jshint ignore:end */
  44343. default:
  44344. this.setCtxGlobalAlpha(ctx, "fill", style);
  44345. ctx.fill();
  44346. this.setCtxGlobalAlpha(ctx, "reset", style);
  44347. break;
  44348. }
  44349. this.drawText(ctx, style, this.style);
  44350. this.afterBrush(ctx);
  44351. }
  44352. /**
  44353. * @function SuperMap.LevelRenderer.Shape.prototype.beforeBrush
  44354. * @description 具体绘制操作前的一些公共操作。
  44355. *
  44356. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44357. * @param {boolean} isHighlight - 是否使用高亮属性。
  44358. * @return {Object} 处理后的样式。
  44359. */
  44360. beforeBrush(ctx, isHighlight) {
  44361. var style = this.style;
  44362. if (this.brushTypeOnly) {
  44363. style.brushType = this.brushTypeOnly;
  44364. }
  44365. if (isHighlight) {
  44366. // 根据style扩展默认高亮样式
  44367. style = this.getHighlightStyle(
  44368. style,
  44369. this.highlightStyle || {},
  44370. this.brushTypeOnly
  44371. );
  44372. }
  44373. if (this.brushTypeOnly == 'stroke') {
  44374. style.strokeColor = style.strokeColor || style.color;
  44375. }
  44376. ctx.save();
  44377. this.doClip(ctx);
  44378. this.setContext(ctx, style);
  44379. // 设置transform
  44380. this.setTransform(ctx);
  44381. return style;
  44382. }
  44383. /**
  44384. * @function SuperMap.LevelRenderer.Shape.prototype.afterBrush
  44385. * @description 绘制后的处理。
  44386. *
  44387. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44388. *
  44389. */
  44390. afterBrush(ctx) {
  44391. ctx.restore();
  44392. }
  44393. /**
  44394. * @function SuperMap.LevelRenderer.Shape.prototype.setContext
  44395. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  44396. *
  44397. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44398. * @param {Object} style - 样式。
  44399. *
  44400. */
  44401. setContext(ctx, style) {
  44402. var STYLE_CTX_MAP = [
  44403. ['color', 'fillStyle'],
  44404. ['strokeColor', 'strokeStyle'],
  44405. ['opacity', 'globalAlpha'],
  44406. ['lineCap', 'lineCap'],
  44407. ['lineJoin', 'lineJoin'],
  44408. ['miterLimit', 'miterLimit'],
  44409. ['lineWidth', 'lineWidth'],
  44410. ['shadowBlur', 'shadowBlur'],
  44411. ['shadowColor', 'shadowColor'],
  44412. ['shadowOffsetX', 'shadowOffsetX'],
  44413. ['shadowOffsetY', 'shadowOffsetY']
  44414. ];
  44415. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  44416. var styleProp = STYLE_CTX_MAP[i][0];
  44417. var styleValue = style[styleProp];
  44418. var ctxProp = STYLE_CTX_MAP[i][1];
  44419. if (typeof styleValue != 'undefined') {
  44420. ctx[ctxProp] = styleValue;
  44421. }
  44422. }
  44423. }
  44424. /**
  44425. * @function SuperMap.LevelRenderer.Shape.prototype.doClip
  44426. *
  44427. */
  44428. doClip(ctx) {
  44429. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  44430. if (this.__clipShapes) {
  44431. for (var i = 0; i < this.__clipShapes.length; i++) {
  44432. var clipShape = this.__clipShapes[i];
  44433. if (clipShape.needTransform) {
  44434. let m = clipShape.transform;
  44435. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  44436. ctx.transform(
  44437. m[0], m[1],
  44438. m[2], m[3],
  44439. m[4], m[5]
  44440. );
  44441. }
  44442. ctx.beginPath();
  44443. clipShape.buildPath(ctx, clipShape.style);
  44444. ctx.clip();
  44445. // Transform back
  44446. if (clipShape.needTransform) {
  44447. let m = clipShapeInvTransform;
  44448. ctx.transform(
  44449. m[0], m[1],
  44450. m[2], m[3],
  44451. m[4], m[5]
  44452. );
  44453. }
  44454. }
  44455. }
  44456. }
  44457. /**
  44458. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightStyle
  44459. * @description 根据默认样式扩展高亮样式
  44460. *
  44461. * @param {Object} style - 样式。
  44462. * @param {Object} highlightStyle - 高亮样式。
  44463. * @param {string} brushTypeOnly - brushTypeOnly。
  44464. *
  44465. */
  44466. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  44467. var newStyle = {};
  44468. for (let k in style) {
  44469. newStyle[k] = style[k];
  44470. }
  44471. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  44472. // 根据highlightStyle扩展
  44473. if (style.brushType != 'stroke') {
  44474. // 带填充则用高亮色加粗边线
  44475. newStyle.strokeColor = highlightColor;
  44476. // SMIC-方法修改 - start
  44477. newStyle.lineWidth = (style.lineWidth || 1);
  44478. // 原始代码
  44479. // newStyle.lineWidth = (style.lineWidth || 1)
  44480. // + this.getHighlightZoom();
  44481. // 修改代码1
  44482. // if(!style.lineType || style.lineType === "solid"){
  44483. // newStyle.lineWidth = (style.lineWidth || 1)
  44484. // + this.getHighlightZoom();
  44485. // }
  44486. // else{
  44487. // newStyle.lineWidth = (style.lineWidth || 1);
  44488. // }
  44489. // SMIC-方法修改 - end
  44490. newStyle.brushType = 'both';
  44491. } else {
  44492. if (brushTypeOnly != 'stroke') {
  44493. // 描边型的则用原色加工高亮
  44494. newStyle.strokeColor = highlightColor;
  44495. // SMIC-方法修改 - start
  44496. newStyle.lineWidth = (style.lineWidth || 1);
  44497. // 原始代码
  44498. // newStyle.lineWidth = (style.lineWidth || 1)
  44499. // + this.getHighlightZoom();
  44500. // 修改代码1
  44501. // if(!style.lineType || style.lineType === "solid"){
  44502. // newStyle.lineWidth = (style.lineWidth || 1)
  44503. // + this.getHighlightZoom();
  44504. // }
  44505. // else{
  44506. // newStyle.lineWidth = (style.lineWidth || 1);
  44507. // }
  44508. // SMIC-方法修改 - end
  44509. } else {
  44510. // 线型的则用原色加工高亮
  44511. newStyle.strokeColor = highlightStyle.strokeColor
  44512. || SUtil_SUtil.Util_color.mix(
  44513. style.strokeColor,
  44514. SUtil_SUtil.Util_color.toRGB(highlightColor)
  44515. );
  44516. }
  44517. }
  44518. // 可自定义覆盖默认值
  44519. for (let k in highlightStyle) {
  44520. if (typeof highlightStyle[k] != 'undefined') {
  44521. newStyle[k] = highlightStyle[k];
  44522. }
  44523. }
  44524. return newStyle;
  44525. }
  44526. /**
  44527. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightZoom
  44528. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  44529. *
  44530. */
  44531. getHighlightZoom() {
  44532. return this.type != 'text' ? 6 : 2;
  44533. }
  44534. /**
  44535. * @function SuperMap.LevelRenderer.Shape.prototype.drift
  44536. * @description 移动位置
  44537. *
  44538. * @param {Object} dx - 横坐标变化。
  44539. * @param {Object} dy - 纵坐标变化。
  44540. *
  44541. */
  44542. drift(dx, dy) {
  44543. this.position[0] += dx;
  44544. this.position[1] += dy;
  44545. }
  44546. /**
  44547. * @function SuperMap.LevelRenderer.Shape.prototype.buildPath
  44548. * @description 构建绘制的Path。子类必须重新实现此方法。
  44549. *
  44550. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44551. * @param {Object} style - 样式。
  44552. */
  44553. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  44554. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  44555. }
  44556. /**
  44557. * @function SuperMap.LevelRenderer.Shape.prototype.getRect
  44558. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  44559. *
  44560. * @param {Object} style - 样式。
  44561. */
  44562. getRect(style) { // eslint-disable-line no-unused-vars
  44563. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  44564. }
  44565. /**
  44566. * @function SuperMap.LevelRenderer.Shape.prototype.isCover
  44567. * @description 判断鼠标位置是否在图形内。
  44568. *
  44569. * @param {number} x - x。
  44570. * @param {number} y - y。
  44571. */
  44572. isCover(x, y) {
  44573. var originPos = this.getTansform(x, y);
  44574. x = originPos[0];
  44575. y = originPos[1];
  44576. // 快速预判并保留判断矩形
  44577. var rect = this.style.__rect;
  44578. if (!rect) {
  44579. rect = this.style.__rect = this.getRect(this.style);
  44580. }
  44581. if (x >= rect.x
  44582. && x <= (rect.x + rect.width)
  44583. && y >= rect.y
  44584. && y <= (rect.y + rect.height)
  44585. ) {
  44586. // 矩形内
  44587. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  44588. }
  44589. return false;
  44590. }
  44591. /**
  44592. * @function SuperMap.LevelRenderer.Shape.prototype.drawText
  44593. * @description 绘制附加文本。
  44594. *
  44595. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44596. * @param {string} style - 样式。
  44597. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  44598. */
  44599. drawText(ctx, style, normalStyle) {
  44600. if (typeof(style.text) == 'undefined' || style.text === false) {
  44601. return;
  44602. }
  44603. // 字体颜色策略
  44604. var textColor = style.textColor || style.color || style.strokeColor;
  44605. ctx.fillStyle = textColor;
  44606. // 文本与图形间空白间隙
  44607. var dd = 10;
  44608. var al; // 文本水平对齐
  44609. var bl; // 文本垂直对齐
  44610. var tx; // 文本横坐标
  44611. var ty; // 文本纵坐标
  44612. var textPosition = style.textPosition // 用户定义
  44613. || this.textPosition // shape默认
  44614. || 'top'; // 全局默认
  44615. // Smic 方法修改 -start
  44616. var __OP = [];
  44617. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  44618. __OP = [0, 0];
  44619. } else {
  44620. __OP = this.refOriginalPosition;
  44621. }
  44622. //原代码:
  44623. // Smic 方法修改 -end
  44624. switch (textPosition) {
  44625. case 'inside':
  44626. case 'top':
  44627. case 'bottom':
  44628. case 'left':
  44629. case 'right':
  44630. if (this.getRect) {
  44631. var rect = (normalStyle || style).__rect
  44632. || this.getRect(normalStyle || style);
  44633. switch (textPosition) {
  44634. case 'inside':
  44635. tx = rect.x + rect.width / 2;
  44636. ty = rect.y + rect.height / 2;
  44637. al = 'center';
  44638. bl = 'middle';
  44639. if (style.brushType != 'stroke'
  44640. && textColor == style.color
  44641. ) {
  44642. ctx.fillStyle = '#fff';
  44643. }
  44644. break;
  44645. case 'left':
  44646. tx = rect.x - dd;
  44647. ty = rect.y + rect.height / 2;
  44648. al = 'end';
  44649. bl = 'middle';
  44650. break;
  44651. case 'right':
  44652. tx = rect.x + rect.width + dd;
  44653. ty = rect.y + rect.height / 2;
  44654. al = 'start';
  44655. bl = 'middle';
  44656. break;
  44657. case 'top':
  44658. tx = rect.x + rect.width / 2;
  44659. ty = rect.y - dd;
  44660. al = 'center';
  44661. bl = 'bottom';
  44662. break;
  44663. case 'bottom':
  44664. tx = rect.x + rect.width / 2;
  44665. ty = rect.y + rect.height + dd;
  44666. al = 'center';
  44667. bl = 'top';
  44668. break;
  44669. }
  44670. }
  44671. break;
  44672. case 'start':
  44673. case 'end':
  44674. var xStart = 0;
  44675. var xEnd = 0;
  44676. var yStart = 0;
  44677. var yEnd = 0;
  44678. if (typeof style.pointList != 'undefined') {
  44679. var pointList = style.pointList;
  44680. if (pointList.length < 2) {
  44681. // 少于2个点就不画了~
  44682. return;
  44683. }
  44684. var length = pointList.length;
  44685. switch (textPosition) {
  44686. // Smic 方法修改 -start
  44687. case 'start':
  44688. xStart = pointList[0][0] + __OP[0];
  44689. xEnd = pointList[1][0] + __OP[0];
  44690. yStart = pointList[0][1] + __OP[1];
  44691. yEnd = pointList[1][1] + __OP[1];
  44692. break;
  44693. case 'end':
  44694. xStart = pointList[length - 2][0] + __OP[0];
  44695. xEnd = pointList[length - 1][0] + __OP[0];
  44696. yStart = pointList[length - 2][1] + __OP[1];
  44697. yEnd = pointList[length - 1][1] + __OP[1];
  44698. break;
  44699. //原代码:
  44700. /*
  44701. case 'start':
  44702. xStart = pointList[0][0];
  44703. xEnd = pointList[1][0];
  44704. yStart = pointList[0][1];
  44705. yEnd = pointList[1][1];
  44706. break;
  44707. case 'end':
  44708. xStart = pointList[length - 2][0];
  44709. xEnd = pointList[length - 1][0];
  44710. yStart = pointList[length - 2][1];
  44711. yEnd = pointList[length - 1][1];
  44712. break;
  44713. */
  44714. // Smic 方法修改 -end
  44715. }
  44716. } else {
  44717. // Smic 方法修改 -start
  44718. xStart = (style.xStart + __OP[0]) || 0;
  44719. xEnd = (style.xEnd + __OP[0]) || 0;
  44720. yStart = (style.yStart + __OP[1]) || 0;
  44721. yEnd = (style.yEnd + __OP[1]) || 0;
  44722. //原代码:
  44723. /*
  44724. xStart = style.xStart || 0;
  44725. xEnd = style.xEnd || 0;
  44726. yStart = style.yStart || 0;
  44727. yEnd = style.yEnd || 0;
  44728. */
  44729. // Smic 方法修改 -end
  44730. }
  44731. switch (textPosition) {
  44732. case 'start':
  44733. al = xStart < xEnd ? 'end' : 'start';
  44734. bl = yStart < yEnd ? 'bottom' : 'top';
  44735. tx = xStart;
  44736. ty = yStart;
  44737. break;
  44738. case 'end':
  44739. al = xStart < xEnd ? 'start' : 'end';
  44740. bl = yStart < yEnd ? 'top' : 'bottom';
  44741. tx = xEnd;
  44742. ty = yEnd;
  44743. break;
  44744. }
  44745. dd -= 4;
  44746. if (xStart && xEnd && xStart != xEnd) {
  44747. tx -= (al == 'end' ? dd : -dd);
  44748. } else {
  44749. al = 'center';
  44750. }
  44751. if (yStart != yEnd) {
  44752. ty -= (bl == 'bottom' ? dd : -dd);
  44753. } else {
  44754. bl = 'middle';
  44755. }
  44756. break;
  44757. case 'specific':
  44758. tx = style.textX || 0;
  44759. ty = style.textY || 0;
  44760. al = 'start';
  44761. bl = 'middle';
  44762. break;
  44763. }
  44764. // Smic 方法修改 -start
  44765. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  44766. tx += style.labelXOffset;
  44767. }
  44768. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  44769. ty += style.labelYOffset;
  44770. }
  44771. //原代码:
  44772. // Smic 方法修改 -end
  44773. if (tx != null && ty != null) {
  44774. Shape_Shape._fillText(
  44775. ctx,
  44776. style.text,
  44777. tx, ty,
  44778. style.textFont,
  44779. style.textAlign || al,
  44780. style.textBaseline || bl
  44781. );
  44782. }
  44783. }
  44784. /**
  44785. * @function SuperMap.LevelRenderer.Shape.prototype.modSelf
  44786. * @description 图形发生改变
  44787. */
  44788. modSelf() {
  44789. this.__dirty = true;
  44790. if (this.style) {
  44791. this.style.__rect = null;
  44792. }
  44793. if (this.highlightStyle) {
  44794. this.highlightStyle.__rect = null;
  44795. }
  44796. }
  44797. /**
  44798. * @function SuperMap.LevelRenderer.Shape.prototype.isSilent
  44799. * @description 图形是否会触发事件,通过 bind 绑定的事件
  44800. */
  44801. isSilent() {
  44802. return !(
  44803. this.hoverable || this.draggable || this.clickable
  44804. || this.onmousemove || this.onmouseover || this.onmouseout
  44805. || this.onmousedown || this.onmouseup || this.onclick
  44806. || this.ondragenter || this.ondragover || this.ondragleave
  44807. || this.ondrop
  44808. );
  44809. }
  44810. /**
  44811. * @function SuperMap.LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  44812. * @description 设置 Cavans 上下文全局透明度
  44813. *
  44814. * @param {Object} _ctx - Cavans 上下文
  44815. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  44816. * @param {Object} style - Symbolizer hash
  44817. */
  44818. setCtxGlobalAlpha(_ctx, type, style) {
  44819. if (type === "fill") {
  44820. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  44821. } else if (type === "stroke") {
  44822. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  44823. } else {
  44824. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  44825. }
  44826. }
  44827. /**
  44828. * @function SuperMap.LevelRenderer.Shape.prototype._fillText
  44829. * @description 填充文本
  44830. */
  44831. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  44832. if (textFont) {
  44833. ctx.font = textFont;
  44834. }
  44835. ctx.textAlign = textAlign;
  44836. ctx.textBaseline = textBaseline;
  44837. var rect = Shape_Shape._getTextRect(
  44838. text, x, y, textFont, textAlign, textBaseline
  44839. );
  44840. text = (text + '').split('\n');
  44841. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  44842. switch (textBaseline) {
  44843. case 'top':
  44844. y = rect.y;
  44845. break;
  44846. case 'bottom':
  44847. y = rect.y + lineHeight;
  44848. break;
  44849. default:
  44850. y = rect.y + lineHeight / 2;
  44851. }
  44852. for (var i = 0, l = text.length; i < l; i++) {
  44853. ctx.fillText(text[i], x, y);
  44854. y += lineHeight;
  44855. }
  44856. }
  44857. /**
  44858. * @function SuperMap.LevelRenderer.Shape._getTextRect
  44859. * @description 返回矩形区域,用于局部刷新和文字定位
  44860. *
  44861. * @param {string} text - text。
  44862. * @param {number} x - x。
  44863. * @param {number} y - y。
  44864. * @param {string} textFont - textFont。
  44865. * @param {string} textAlign - textAlign。
  44866. * @param {string} textBaseline - textBaseline。
  44867. * @return {Object} 矩形区域。
  44868. */
  44869. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  44870. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  44871. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  44872. text = (text + '').split('\n');
  44873. switch (textAlign) {
  44874. case 'end':
  44875. case 'right':
  44876. x -= width;
  44877. break;
  44878. case 'center':
  44879. x -= (width / 2);
  44880. break;
  44881. }
  44882. switch (textBaseline) {
  44883. case 'top':
  44884. break;
  44885. case 'bottom':
  44886. y -= lineHeight * text.length;
  44887. break;
  44888. default:
  44889. y -= lineHeight * text.length / 2;
  44890. }
  44891. return {
  44892. x: x,
  44893. y: y,
  44894. width: width,
  44895. height: lineHeight * text.length
  44896. };
  44897. }
  44898. }
  44899. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  44900. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44901. * This program are made available under the terms of the Apache License, Version 2.0
  44902. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44903. /**
  44904. * @private
  44905. * @class SuperMap.LevelRenderer.Shape.SmicPoint
  44906. * @category Visualization Theme
  44907. * @classdesc 点。
  44908. * @extends SuperMap.LevelRenderer.Shape
  44909. * @example
  44910. * var shape = new SuperMap.LevelRenderer.Shape.SmicPoint({
  44911. * style: {
  44912. * x: 100,
  44913. * y: 100,
  44914. * r: 40,
  44915. * brushType: 'both',
  44916. * color: 'blue',
  44917. * strokeColor: 'red',
  44918. * lineWidth: 3,
  44919. * text: 'point'
  44920. * }
  44921. * });
  44922. * levelRenderer.addShape(shape);
  44923. *
  44924. *
  44925. */
  44926. class SmicPoint extends Shape_Shape {
  44927. /**
  44928. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.style
  44929. * @description 绘制样式。
  44930. *
  44931. * @param {number} style.x - 圆心x坐标,必设参数。
  44932. * @param {number} style.y - 圆心y坐标,必设参数。
  44933. * @param {number} style.r - 半径,必设参数。
  44934. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  44935. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  44936. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  44937. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  44938. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  44939. * @param {number} style.opacity - 绘制透明度。默认值:1。
  44940. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  44941. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  44942. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  44943. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  44944. * @param {string} style.text - 图形中的附加文本。默认值:""。
  44945. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  44946. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  44947. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  44948. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  44949. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  44950. */
  44951. //打开接口 style
  44952. /**
  44953. * @function SuperMap.LevelRenderer.Shape.SmicPoint.constructor
  44954. * @description 构造函数。
  44955. *
  44956. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  44957. *
  44958. */
  44959. constructor(options) {
  44960. super(options);
  44961. /**
  44962. * @member {string} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.type
  44963. * @description 图形类型。
  44964. */
  44965. this.type = 'smicpoint';
  44966. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  44967. this.refOriginalPosition = [0, 0];
  44968. }
  44969. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  44970. }
  44971. /**
  44972. * @function cdestroy
  44973. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  44974. */
  44975. destroy() {
  44976. this.type = null;
  44977. super.destroy();
  44978. }
  44979. /**
  44980. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.buildPath
  44981. * @description 创建点触。
  44982. *
  44983. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  44984. * @param {Object} style - style。
  44985. *
  44986. */
  44987. buildPath(ctx, style) {
  44988. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  44989. this.refOriginalPosition = [0, 0];
  44990. }
  44991. var __OP = this.refOriginalPosition;
  44992. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  44993. return;
  44994. }
  44995. /**
  44996. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.getRect
  44997. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  44998. *
  44999. * @param {Object} style - style
  45000. * @return {Object} 边框对象。包含属性:x,y,width,height。
  45001. */
  45002. getRect(style) {
  45003. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45004. this.refOriginalPosition = [0, 0];
  45005. }
  45006. var __OP = this.refOriginalPosition;
  45007. if (style.__rect) {
  45008. return style.__rect;
  45009. }
  45010. var lineWidth;
  45011. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  45012. lineWidth = style.lineWidth || 1;
  45013. } else {
  45014. lineWidth = 0;
  45015. }
  45016. style.__rect = {
  45017. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  45018. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  45019. width: style.r * 2 + lineWidth,
  45020. height: style.r * 2 + lineWidth
  45021. };
  45022. return style.__rect;
  45023. }
  45024. }
  45025. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  45026. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45027. * This program are made available under the terms of the Apache License, Version 2.0
  45028. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45029. /**
  45030. * @private
  45031. * @class SuperMap.LevelRenderer.Shape.SmicText
  45032. * @category Visualization Theme
  45033. * @extends {SuperMap.LevelRenderer.Shape}
  45034. * @example
  45035. * var shape = new SuperMap.LevelRenderer.Shape.SmicText({
  45036. * style: {
  45037. * text: 'Label',
  45038. * x: 100,
  45039. * y: 100,
  45040. * textFont: '14px Arial'
  45041. * }
  45042. * });
  45043. * levelRenderer.addShape(shape);
  45044. *
  45045. */
  45046. class SmicText extends Shape_Shape {
  45047. /**
  45048. * @member {Object} SuperMap.LevelRenderer.Shape.SmicText.prototype.style
  45049. * @description 绘制样式。
  45050. *
  45051. * @param {number} style.x - 横坐标,必设参数。
  45052. * @param {number} style.y - 纵坐标,必设参数。
  45053. * @param {string} style.text - 图形中的附加文本。默认值:""。
  45054. * @param {number} style.maxWidth - 最大宽度限制。默认值:null。
  45055. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  45056. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  45057. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  45058. * @param {string} style.brushType -画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45059. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  45060. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  45061. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  45062. * @param {number} style.opacity - 绘制透明度。默认值:1。
  45063. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  45064. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  45065. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  45066. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  45067. */
  45068. //打开接口 style
  45069. /**
  45070. * @function SuperMap.LevelRenderer.Shape.SmicText.constructor
  45071. * @description 构造函数。
  45072. *
  45073. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  45074. *
  45075. */
  45076. constructor(options) {
  45077. super(options);
  45078. /**
  45079. * @member {string} SuperMap.LevelRenderer.Shape.SmicText.prototype.type
  45080. * @description 图形类型.
  45081. */
  45082. this.type = 'smictext';
  45083. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45084. this.refOriginalPosition = [0, 0];
  45085. }
  45086. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  45087. }
  45088. /**
  45089. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.destroy
  45090. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45091. */
  45092. destroy() {
  45093. this.type = null;
  45094. super.destroy();
  45095. }
  45096. /**
  45097. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.brush
  45098. * @description 笔触。
  45099. *
  45100. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45101. * @param {boolean} isHighlight - 是否使用高亮属性。
  45102. *
  45103. */
  45104. brush(ctx, isHighlight) {
  45105. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45106. this.refOriginalPosition = [0, 0];
  45107. }
  45108. var __OP = this.refOriginalPosition;
  45109. var style = this.style;
  45110. if (isHighlight) {
  45111. // 根据style扩展默认高亮样式
  45112. style = this.getHighlightStyle(
  45113. style, this.highlightStyle || {}
  45114. );
  45115. }
  45116. if (typeof(style.text) == 'undefined' || style.text === false) {
  45117. return;
  45118. }
  45119. ctx.save();
  45120. this.doClip(ctx);
  45121. this.setContext(ctx, style);
  45122. // 设置transform
  45123. this.setTransform(ctx);
  45124. if (style.textFont) {
  45125. ctx.font = style.textFont;
  45126. }
  45127. ctx.textAlign = style.textAlign || 'start';
  45128. ctx.textBaseline = style.textBaseline || 'middle';
  45129. var text = (style.text + '').split('\n');
  45130. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  45131. var rect = this.getRectNoRotation(style);
  45132. // var x = style.x;
  45133. var x = style.x + __OP[0];
  45134. var y;
  45135. if (style.textBaseline == 'top') {
  45136. y = rect.y;
  45137. } else if (style.textBaseline == 'bottom') {
  45138. y = rect.y + lineHeight;
  45139. } else {
  45140. y = rect.y + lineHeight / 2;
  45141. }
  45142. var ox = style.x + __OP[0];
  45143. var oy = style.y + __OP[1];
  45144. //文本绘制
  45145. for (var i = 0, l = text.length; i < l; i++) {
  45146. //是否渲染矩形背景及颜色
  45147. if (style.labelRect) {
  45148. //+4,-2是为了让文字距边框左右边缘有点间隔
  45149. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  45150. ctx.fillStyle = style.strokeColor;
  45151. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  45152. ctx.fillStyle = style.textColor;
  45153. }
  45154. switch (style.brushType) {
  45155. case 'stroke':
  45156. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45157. if (style.textRotation && style.textRotation !== 0) {
  45158. ctx.save();
  45159. ctx.translate(ox, oy);
  45160. ctx.rotate(style.textRotation * Math.PI / 180);
  45161. if (style.textBaseline == 'top') {
  45162. if (style.maxWidth) {
  45163. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  45164. } else {
  45165. ctx.strokeText(text[i], 0, lineHeight * i);
  45166. }
  45167. } else if (style.textBaseline == 'bottom') {
  45168. if (style.maxWidth) {
  45169. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45170. } else {
  45171. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  45172. }
  45173. } else {
  45174. if (style.maxWidth) {
  45175. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  45176. } else {
  45177. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  45178. }
  45179. }
  45180. ctx.restore();
  45181. } else {
  45182. if (style.maxWidth) {
  45183. ctx.strokeText(text[i], x, y, style.maxWidth);
  45184. } else {
  45185. ctx.strokeText(text[i], x, y);
  45186. }
  45187. }
  45188. this.setCtxGlobalAlpha(ctx, "reset", style);
  45189. break;
  45190. case 'both':
  45191. if (style.textRotation && style.textRotation !== 0) {
  45192. ctx.save();
  45193. ctx.translate(ox, oy);
  45194. ctx.rotate(style.textRotation * Math.PI / 180);
  45195. if (style.textBaseline == 'top') {
  45196. if (style.maxWidth) {
  45197. this.setCtxGlobalAlpha(ctx, "fill", style);
  45198. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  45199. this.setCtxGlobalAlpha(ctx, "reset", style);
  45200. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45201. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  45202. this.setCtxGlobalAlpha(ctx, "reset", style);
  45203. } else {
  45204. this.setCtxGlobalAlpha(ctx, "fill", style);
  45205. ctx.fillText(text[i], 0, lineHeight * i);
  45206. this.setCtxGlobalAlpha(ctx, "reset", style);
  45207. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45208. ctx.strokeText(text[i], 0, lineHeight * i);
  45209. this.setCtxGlobalAlpha(ctx, "reset", style);
  45210. }
  45211. } else if (style.textBaseline == 'bottom') {
  45212. if (style.maxWidth) {
  45213. this.setCtxGlobalAlpha(ctx, "fill", style);
  45214. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45215. this.setCtxGlobalAlpha(ctx, "reset", style);
  45216. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45217. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45218. this.setCtxGlobalAlpha(ctx, "reset", style);
  45219. } else {
  45220. this.setCtxGlobalAlpha(ctx, "fill", style);
  45221. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  45222. this.setCtxGlobalAlpha(ctx, "reset", style);
  45223. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45224. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  45225. this.setCtxGlobalAlpha(ctx, "reset", style);
  45226. }
  45227. } else {
  45228. if (style.maxWidth) {
  45229. this.setCtxGlobalAlpha(ctx, "fill", style);
  45230. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  45231. this.setCtxGlobalAlpha(ctx, "reset", style);
  45232. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45233. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  45234. this.setCtxGlobalAlpha(ctx, "reset", style);
  45235. } else {
  45236. this.setCtxGlobalAlpha(ctx, "fill", style);
  45237. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  45238. this.setCtxGlobalAlpha(ctx, "reset", style);
  45239. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45240. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  45241. this.setCtxGlobalAlpha(ctx, "reset", style);
  45242. }
  45243. }
  45244. ctx.restore();
  45245. } else {
  45246. if (style.maxWidth) {
  45247. this.setCtxGlobalAlpha(ctx, "fill", style);
  45248. ctx.fillText(text[i], x, y, style.maxWidth);
  45249. this.setCtxGlobalAlpha(ctx, "reset", style);
  45250. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45251. ctx.strokeText(text[i], x, y, style.maxWidth);
  45252. this.setCtxGlobalAlpha(ctx, "reset", style);
  45253. } else {
  45254. this.setCtxGlobalAlpha(ctx, "fill", style);
  45255. ctx.fillText(text[i], x, y);
  45256. this.setCtxGlobalAlpha(ctx, "reset", style);
  45257. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45258. ctx.strokeText(text[i], x, y);
  45259. this.setCtxGlobalAlpha(ctx, "reset", style);
  45260. }
  45261. }
  45262. break;
  45263. default:
  45264. //fill or others
  45265. this.setCtxGlobalAlpha(ctx, "fill", style);
  45266. if (style.textRotation && style.textRotation !== 0) {
  45267. ctx.save();
  45268. ctx.translate(ox, oy);
  45269. ctx.rotate(style.textRotation * Math.PI / 180);
  45270. if (style.textBaseline == 'top') {
  45271. if (style.maxWidth) {
  45272. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  45273. } else {
  45274. ctx.fillText(text[i], 0, lineHeight * i);
  45275. }
  45276. } else if (style.textBaseline == 'bottom') {
  45277. if (style.maxWidth) {
  45278. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  45279. } else {
  45280. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  45281. }
  45282. } else {
  45283. if (style.maxWidth) {
  45284. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  45285. } else {
  45286. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  45287. }
  45288. }
  45289. ctx.restore();
  45290. } else {
  45291. if (style.maxWidth) {
  45292. ctx.fillText(text[i], x, y, style.maxWidth);
  45293. } else {
  45294. ctx.fillText(text[i], x, y);
  45295. }
  45296. }
  45297. this.setCtxGlobalAlpha(ctx, "reset", style);
  45298. }
  45299. y += lineHeight;
  45300. }
  45301. ctx.restore();
  45302. return;
  45303. }
  45304. /**
  45305. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRect
  45306. * @description 返回文字包围盒矩形
  45307. */
  45308. getRect(style) {
  45309. if (style.__rect) {
  45310. return style.__rect;
  45311. }
  45312. var left, top, right, bottom
  45313. var tbg = this.getTextBackground(style, true);
  45314. for (var i = 0, len = tbg.length; i < len; i++) {
  45315. var poi = tbg[i];
  45316. //用第一个点初始化
  45317. if (i == 0) {
  45318. left = poi[0];
  45319. right = poi[0];
  45320. top = poi[1];
  45321. bottom = poi[1];
  45322. } else {
  45323. if (poi[0] < left) {
  45324. left = poi[0]
  45325. }
  45326. if (poi[0] > right) {
  45327. right = poi[0]
  45328. }
  45329. if (poi[1] < top) {
  45330. top = poi[1]
  45331. }
  45332. if (poi[1] > bottom) {
  45333. bottom = poi[1]
  45334. }
  45335. }
  45336. }
  45337. style.__rect = {
  45338. x: left,
  45339. y: top,
  45340. width: right - left,
  45341. height: bottom - top
  45342. };
  45343. return style.__rect;
  45344. }
  45345. /**
  45346. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  45347. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  45348. */
  45349. getRectNoRotation(style) {
  45350. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45351. this.refOriginalPosition = [0, 0];
  45352. }
  45353. var __OP = this.refOriginalPosition;
  45354. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  45355. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  45356. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  45357. //处理文字位置,注:文本的绘制是由此 rect 决定
  45358. var textX = style.x + __OP[0]; // 默认start == left
  45359. if (style.textAlign == 'end' || style.textAlign == 'right') {
  45360. textX -= width;
  45361. } else if (style.textAlign == 'center') {
  45362. textX -= (width / 2);
  45363. }
  45364. var textY;
  45365. if (style.textBaseline == 'top') {
  45366. // textY = style.y;
  45367. textY = style.y + __OP[1];
  45368. } else if (style.textBaseline == 'bottom') {
  45369. textY = (style.y + __OP[1]) - height;
  45370. } else {
  45371. // middle
  45372. textY = (style.y + __OP[1]) - height / 2;
  45373. }
  45374. var isWidthChangeByMaxWidth = false;
  45375. var widthBeforeChangeByMaxWidth;
  45376. //处理 maxWidth
  45377. if (style.maxWidth) {
  45378. var maxWidth = parseInt(style.maxWidth);
  45379. if (maxWidth < width) {
  45380. widthBeforeChangeByMaxWidth = width;
  45381. isWidthChangeByMaxWidth = true;
  45382. width = maxWidth;
  45383. }
  45384. textX = style.x + __OP[0];
  45385. if (style.textAlign == 'end' || style.textAlign == 'right') {
  45386. textX -= width;
  45387. } else if (style.textAlign == 'center') {
  45388. textX -= (width / 2);
  45389. }
  45390. }
  45391. //处理斜体字
  45392. if (style.textFont) {
  45393. var textFont = style.textFont;
  45394. var textFontStr = textFont.toLowerCase()
  45395. if (textFontStr.indexOf("italic") > -1) {
  45396. if (isWidthChangeByMaxWidth === true) {
  45397. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  45398. } else {
  45399. width += lineHeight / 3;
  45400. }
  45401. }
  45402. }
  45403. var rect = {
  45404. x: textX,
  45405. y: textY,
  45406. width: width,
  45407. height: height
  45408. };
  45409. return rect;
  45410. }
  45411. /**
  45412. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getTextBackground
  45413. * @description 获取文本背景框范围
  45414. *
  45415. * @param {Object} style - 样式。
  45416. * @param {boolean} redo - 是否强制重新计算 textBackground。
  45417. */
  45418. getTextBackground(style, redo) {
  45419. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45420. this.refOriginalPosition = [0, 0];
  45421. }
  45422. var __OP = this.refOriginalPosition;
  45423. if ((!redo) && style.__textBackground) {
  45424. return style.__textBackground;
  45425. }
  45426. //不旋转时矩形框
  45427. var rect = this.getRectNoRotation(style);
  45428. //旋转中心点
  45429. var ox = style.x + __OP[0];
  45430. var oy = style.y + __OP[1];
  45431. //背景框
  45432. var background = [];
  45433. if (style.textRotation && style.textRotation !== 0) {
  45434. let textRotation = style.textRotation;
  45435. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  45436. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  45437. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  45438. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  45439. background.push(ltPoi);
  45440. background.push(rtPoi);
  45441. background.push(rbPoi);
  45442. background.push(lbPoi);
  45443. } else {
  45444. let ltPoi = [rect.x, rect.y];
  45445. let rtPoi = [rect.x + rect.width, rect.y];
  45446. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  45447. let lbPoi = [rect.x, rect.y + rect.height];
  45448. background.push(ltPoi);
  45449. background.push(rtPoi);
  45450. background.push(rbPoi);
  45451. background.push(lbPoi);
  45452. }
  45453. style.__textBackground = background;
  45454. return style.__textBackground;
  45455. }
  45456. /**
  45457. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  45458. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  45459. *
  45460. * @param {number} x - 旋转点横坐标。
  45461. * @param {number} y - 旋转点纵坐标。
  45462. * @param {number} rx - 旋转中心点横坐标。
  45463. * @param {number} ry - 旋转中心点纵坐标。
  45464. * @param {number} angle - 旋转角度(度)。
  45465. * @return {Array} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  45466. */
  45467. getRotatedLocation(x, y, rx, ry, angle) {
  45468. var loc = new Array(), x0, y0;
  45469. y = -y;
  45470. ry = -ry;
  45471. angle = -angle;//顺时针旋转
  45472. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  45473. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  45474. loc[0] = x0;
  45475. loc[1] = -y0;
  45476. return loc;
  45477. }
  45478. }
  45479. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  45480. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45481. * This program are made available under the terms of the Apache License, Version 2.0
  45482. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45483. /**
  45484. * @private
  45485. * @class SuperMap.LevelRenderer.Shape.SmicCircle
  45486. * @category Visualization Theme
  45487. * @classdesc 圆形
  45488. * @extends SuperMap.LevelRenderer.Shape
  45489. * @example
  45490. * var shape = new SuperMap.LevelRenderer.Shape.SmicCircle({
  45491. * style: {
  45492. * x: 100,
  45493. * y: 100,
  45494. * r: 60,
  45495. * brushType: "both",
  45496. * color: "blue",
  45497. * strokeColor: "red",
  45498. * lineWidth: 3,
  45499. * text: "Circle"
  45500. * }
  45501. * });
  45502. * levelRenderer.addShape(shape);
  45503. *
  45504. *
  45505. */
  45506. class SmicCircle extends Shape_Shape {
  45507. /**
  45508. * @member {Object} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.style
  45509. * @description 绘制样式。
  45510. *
  45511. * @param {number} x - 圆心x坐标,必设参数
  45512. * @param {number} y - 圆心y坐标,必设参数
  45513. * @param {number} r - 半径,必设参数
  45514. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45515. * @param {string} color - 填充颜色,默认值"#000000"
  45516. * @param {string} strokeColor - 描边颜色,默认值为'#000000'
  45517. * @param {string} lineCape — 线帽样式,可以是 butt, round, square,默认是butt
  45518. * @param {number} lineWidth - 描边宽度、默认是1
  45519. * @param {number} opacity - 绘制透明度、默认是1,不透明
  45520. * @param {number} shadowBlur - 阴影模糊度,大于0有效,默认是0
  45521. * @param {string} shadowColor - 阴影颜色,默认是'#000000'
  45522. * @param {number} shadowOffsetX - 阴影横向偏移,默认是0
  45523. * @param {number} shadowOffsetY - 阴影纵向偏移,默认是0
  45524. * @param {string} text - 图形中的附加文本,默认是0
  45525. * @param {string} textColor - 文本颜色,默认是'#000000'
  45526. * @param {string} textFont - 附加文本样式,eg:'bold 18px verdana'
  45527. * @param {string} textPosition - 附加文本位置, 可以是 inside, left, right, top, bottom
  45528. * @param {string} textAlign - 默认根据textPosition自动设置,附加文本水平对齐。可以是start, end, left, right, center
  45529. * @param {string} textBaseline 默认根据textPosition自动设置,附加文本垂直对齐。可以是top, bottom, middle, alphabetic, hanging, ideographic
  45530. */
  45531. //打开接口 style
  45532. /**
  45533. * @function SuperMap.LevelRenderer.Shape.SmicCircle.constructor
  45534. * @description 构造函数。
  45535. *
  45536. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  45537. *
  45538. */
  45539. constructor(options) {
  45540. super(options);
  45541. /**
  45542. * @member {string} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.type
  45543. * @description 图形类型。
  45544. */
  45545. this.type = 'smiccircle';
  45546. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45547. this.refOriginalPosition = [0, 0];
  45548. }
  45549. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  45550. }
  45551. /**
  45552. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.destroy
  45553. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45554. */
  45555. destroy() {
  45556. this.type = null;
  45557. super.destroy();
  45558. }
  45559. /**
  45560. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.buildPath
  45561. * @description 创建图形路径。
  45562. *
  45563. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45564. * @param {Object} style - style。
  45565. *
  45566. */
  45567. buildPath(ctx, style) {
  45568. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45569. this.refOriginalPosition = [0, 0];
  45570. }
  45571. var __OP = this.refOriginalPosition;
  45572. var x = style.x + __OP[0]; // 圆心x
  45573. var y = style.y + __OP[1]; // 圆心y
  45574. ctx.moveTo(x + style.r, y);
  45575. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  45576. return true;
  45577. }
  45578. /**
  45579. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.getRect
  45580. * @description 返回圆形包围盒矩形
  45581. *
  45582. * @param {Object} style - style
  45583. * @return {Object} 边框对象。包含属性:x,y,width,height。
  45584. *
  45585. */
  45586. getRect(style) {
  45587. if (style.__rect) {
  45588. return style.__rect;
  45589. }
  45590. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45591. this.refOriginalPosition = [0, 0];
  45592. }
  45593. var __OP = this.refOriginalPosition;
  45594. var x = style.x + __OP[0]; // 圆心x
  45595. var y = style.y + __OP[1]; // 圆心y
  45596. var r = style.r; // 圆r
  45597. var lineWidth;
  45598. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  45599. lineWidth = style.lineWidth || 1;
  45600. } else {
  45601. lineWidth = 0;
  45602. }
  45603. style.__rect = {
  45604. x: Math.round(x - r - lineWidth / 2),
  45605. y: Math.round(y - r - lineWidth / 2),
  45606. width: r * 2 + lineWidth,
  45607. height: r * 2 + lineWidth
  45608. };
  45609. return style.__rect;
  45610. }
  45611. }
  45612. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  45613. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45614. * This program are made available under the terms of the Apache License, Version 2.0
  45615. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45616. /**
  45617. * @private
  45618. * @class SuperMap.LevelRenderer.Shape.SmicPolygon
  45619. * @category Visualization Theme
  45620. * @classdesc 多边形。
  45621. * @extends SuperMap.LevelRenderer.Shape
  45622. * @example
  45623. * var shape = new SuperMap.LevelRenderer.Shape.SmicPolygon({
  45624. * style: {
  45625. * // 100x100 的正方形
  45626. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  45627. * color: 'blue'
  45628. * }
  45629. * });
  45630. * levelRenderer.addShape(shape);
  45631. *
  45632. */
  45633. class SmicPolygon extends Shape_Shape {
  45634. /**
  45635. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.style
  45636. * @description 绘制样式。
  45637. *
  45638. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  45639. * (code)
  45640. * (start code)
  45641. * [
  45642. * [10, 20], //单个节点
  45643. * [30, 40],
  45644. * [25, 30]
  45645. * ]
  45646. * (end)
  45647. * @param {string} style.smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  45648. * @param {number} style.smoothConstraint - 平滑约束。
  45649. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45650. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  45651. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  45652. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  45653. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  45654. * @param {number} style.opacity - 绘制透明度。默认值:1。
  45655. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  45656. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  45657. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  45658. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  45659. * @param {string} style.text - 图形中的附加文本。默认值:""。
  45660. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  45661. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  45662. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  45663. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  45664. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  45665. */
  45666. //打开接口 style
  45667. /**
  45668. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.constructor
  45669. * @description 构造函数。
  45670. *
  45671. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  45672. *
  45673. */
  45674. constructor(options) {
  45675. super(options);
  45676. /**
  45677. * @member {string} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.type
  45678. * @description 图形类型.
  45679. */
  45680. this.type = 'smicpolygon';
  45681. /**
  45682. * @member {Array} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  45683. * @description 岛洞面多边形顶点数组(三维数组)
  45684. *
  45685. */
  45686. this.holePolygonPointLists = null;
  45687. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45688. this.refOriginalPosition = [0, 0];
  45689. }
  45690. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  45691. }
  45692. /**
  45693. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.destroy
  45694. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45695. */
  45696. destroy() {
  45697. this.type = null;
  45698. this.holePolygonPointLists = null;
  45699. super.destroy();
  45700. }
  45701. /**
  45702. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.brush
  45703. * @description 笔触。
  45704. *
  45705. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45706. * @param {boolean} isHighlight - 是否使用高亮属性。
  45707. *
  45708. */
  45709. brush(ctx, isHighlight) {
  45710. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45711. this.refOriginalPosition = [0, 0];
  45712. }
  45713. var style = this.style;
  45714. if (isHighlight) {
  45715. // 根据style扩展默认高亮样式
  45716. style = this.getHighlightStyle(
  45717. style,
  45718. this.highlightStyle || {}
  45719. );
  45720. }
  45721. ctx.save();
  45722. this.setContext(ctx, style);
  45723. // 设置 transform
  45724. this.setTransform(ctx);
  45725. // 先 fill 再stroke
  45726. var hasPath = false;
  45727. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  45728. ctx.beginPath();
  45729. if (style.lineType == 'dashed'
  45730. || style.lineType == 'dotted'
  45731. || style.lineType == 'dot'
  45732. || style.lineType == 'dash'
  45733. || style.lineType == 'dashdot'
  45734. || style.lineType == 'longdash'
  45735. || style.lineType == 'longdashdot'
  45736. ) {
  45737. // 特殊处理,虚线围不成path,实线再build一次
  45738. this.buildPath(ctx, {
  45739. lineType: 'solid',
  45740. lineWidth: style.lineWidth,
  45741. pointList: style.pointList
  45742. }
  45743. );
  45744. } else {
  45745. this.buildPath(ctx, style);
  45746. hasPath = true; // 这个path能用
  45747. }
  45748. ctx.closePath();
  45749. this.setCtxGlobalAlpha(ctx, "fill", style);
  45750. ctx.fill();
  45751. this.setCtxGlobalAlpha(ctx, "reset", style);
  45752. }
  45753. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  45754. if (!hasPath) {
  45755. ctx.beginPath();
  45756. this.buildPath(ctx, style);
  45757. }
  45758. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45759. ctx.stroke();
  45760. this.setCtxGlobalAlpha(ctx, "reset", style);
  45761. }
  45762. this.drawText(ctx, style, this.style);
  45763. //岛洞
  45764. var hpStyle = Util.cloneObject(style);
  45765. if (hpStyle.pointList) {
  45766. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  45767. var holePLS = this.holePolygonPointLists;
  45768. var holePLSen = holePLS.length;
  45769. for (var i = 0; i < holePLSen; i++) {
  45770. var holePL = holePLS[i];
  45771. //岛洞面
  45772. hpStyle.pointList = holePL;
  45773. ctx.globalCompositeOperation = "destination-out";
  45774. // 先 fill 再stroke
  45775. hasPath = false;
  45776. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  45777. ctx.beginPath();
  45778. if (hpStyle.lineType == 'dashed'
  45779. || hpStyle.lineType == 'dotted'
  45780. || hpStyle.lineType == 'dot'
  45781. || hpStyle.lineType == 'dash'
  45782. || hpStyle.lineType == 'dashdot'
  45783. || hpStyle.lineType == 'longdash'
  45784. || hpStyle.lineType == 'longdashdot'
  45785. ) {
  45786. // 特殊处理,虚线围不成path,实线再build一次
  45787. this.buildPath(ctx, {
  45788. lineType: 'solid',
  45789. lineWidth: hpStyle.lineWidth,
  45790. pointList: hpStyle.pointList
  45791. }
  45792. );
  45793. } else {
  45794. this.buildPath(ctx, hpStyle);
  45795. hasPath = true; // 这个path能用
  45796. }
  45797. ctx.closePath();
  45798. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  45799. ctx.fill();
  45800. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  45801. }
  45802. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  45803. if (!hasPath) {
  45804. ctx.beginPath();
  45805. this.buildPath(ctx, hpStyle);
  45806. }
  45807. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  45808. ctx.globalCompositeOperation = "source-over";
  45809. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  45810. ctx.stroke();
  45811. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  45812. } else {
  45813. ctx.globalCompositeOperation = "source-over";
  45814. }
  45815. }
  45816. }
  45817. }
  45818. ctx.restore();
  45819. return;
  45820. }
  45821. /**
  45822. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  45823. * @description 创建多边形路径。
  45824. *
  45825. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45826. * @param {Object} style - style。
  45827. *
  45828. */
  45829. buildPath(ctx, style) {
  45830. if (style.showShadow) {
  45831. ctx.shadowBlur = style.shadowBlur;
  45832. ctx.shadowColor = style.shadowColor;
  45833. ctx.shadowOffsetX = style.shadowOffsetX;
  45834. ctx.shadowOffsetY = style.shadowOffsetY;
  45835. }
  45836. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  45837. this.refOriginalPosition = [0, 0];
  45838. }
  45839. var __OP = this.refOriginalPosition;
  45840. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  45841. var pointList = style.pointList;
  45842. if (pointList.length < 2) {
  45843. // 少于2个点就不画了~
  45844. return;
  45845. }
  45846. if (style.smooth && style.smooth !== 'spline') {
  45847. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  45848. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  45849. var cp1;
  45850. var cp2;
  45851. var p;
  45852. var len = pointList.length;
  45853. for (var i = 0; i < len; i++) {
  45854. cp1 = controlPoints[i * 2];
  45855. cp2 = controlPoints[i * 2 + 1];
  45856. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  45857. ctx.bezierCurveTo(
  45858. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  45859. );
  45860. }
  45861. } else {
  45862. if (style.smooth === 'spline') {
  45863. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  45864. }
  45865. if (!style.lineType || style.lineType == 'solid') {
  45866. // 默认为实线
  45867. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  45868. for (let i = 1; i < pointList.length; i++) {
  45869. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  45870. }
  45871. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  45872. } else if (style.lineType === 'dashed'
  45873. || style.lineType === 'dotted'
  45874. || style.lineType === 'dot'
  45875. || style.lineType === 'dash'
  45876. || style.lineType === 'longdash'
  45877. ) {
  45878. // SMIC-方法修改 - start
  45879. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  45880. style._dashLength = dashLengthForStyle;
  45881. let dashLength = (style.lineWidth || 1);
  45882. let pattern1 = dashLength;
  45883. let pattern2 = dashLength;
  45884. //dashed
  45885. if (style.lineType === 'dashed') {
  45886. pattern1 *= 5;
  45887. pattern2 *= 5;
  45888. if (style.lineCap && style.lineCap !== "butt") {
  45889. pattern1 -= dashLength;
  45890. pattern2 += dashLength;
  45891. }
  45892. }
  45893. //dotted
  45894. if (style.lineType === 'dotted') {
  45895. if (style.lineCap && style.lineCap !== "butt") {
  45896. pattern1 = 1;
  45897. pattern2 += dashLength;
  45898. }
  45899. }
  45900. //dot
  45901. if (style.lineType === 'dot') {
  45902. pattern2 *= 4;
  45903. if (style.lineCap && style.lineCap !== "butt") {
  45904. pattern1 = 1;
  45905. pattern2 += dashLength;
  45906. }
  45907. }
  45908. //dash
  45909. if (style.lineType === 'dash') {
  45910. pattern1 *= 4;
  45911. pattern2 *= 4;
  45912. if (style.lineCap && style.lineCap !== "butt") {
  45913. pattern1 -= dashLength;
  45914. pattern2 += dashLength;
  45915. }
  45916. }
  45917. //longdash
  45918. if (style.lineType === 'longdash') {
  45919. pattern1 *= 8;
  45920. pattern2 *= 4;
  45921. if (style.lineCap && style.lineCap !== "butt") {
  45922. pattern1 -= dashLength;
  45923. pattern2 += dashLength;
  45924. }
  45925. }
  45926. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  45927. for (let i = 1; i < pointList.length; i++) {
  45928. SUtil_SUtil.SUtil_dashedLineTo(
  45929. ctx,
  45930. pointList[i - 1][0] + __OP[0],
  45931. pointList[i - 1][1] + __OP[1],
  45932. pointList[i][0] + __OP[0],
  45933. pointList[i][1] + __OP[1],
  45934. dashLength,
  45935. [pattern1, pattern2]
  45936. );
  45937. }
  45938. SUtil_SUtil.SUtil_dashedLineTo(
  45939. ctx,
  45940. pointList[pointList.length - 1][0] + __OP[0],
  45941. pointList[pointList.length - 1][1] + __OP[1],
  45942. pointList[0][0] + __OP[0],
  45943. pointList[0][1] + __OP[1],
  45944. dashLength,
  45945. [pattern1, pattern2]
  45946. );
  45947. } else if (style.lineType === 'dashdot'
  45948. || style.lineType === 'longdashdot'
  45949. ) {
  45950. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  45951. style._dashLength = dashLengthForStyle;
  45952. let dashLength = (style.lineWidth || 1);
  45953. let pattern1 = dashLength;
  45954. let pattern2 = dashLength;
  45955. let pattern3 = dashLength;
  45956. let pattern4 = dashLength;
  45957. //dashdot
  45958. if (style.lineType === 'dashdot') {
  45959. pattern1 *= 4;
  45960. pattern2 *= 4;
  45961. pattern4 *= 4;
  45962. if (style.lineCap && style.lineCap !== "butt") {
  45963. pattern1 -= dashLength;
  45964. pattern2 += dashLength;
  45965. pattern3 = 1;
  45966. pattern4 += dashLength;
  45967. }
  45968. }
  45969. //longdashdot
  45970. if (style.lineType === 'longdashdot') {
  45971. pattern1 *= 8;
  45972. pattern2 *= 4;
  45973. pattern4 *= 4;
  45974. if (style.lineCap && style.lineCap !== "butt") {
  45975. pattern1 -= dashLength;
  45976. pattern2 += dashLength;
  45977. pattern3 = 1;
  45978. pattern4 += dashLength;
  45979. }
  45980. }
  45981. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  45982. for (let i = 1; i < pointList.length; i++) {
  45983. SUtil_SUtil.SUtil_dashedLineTo(
  45984. ctx,
  45985. pointList[i - 1][0] + __OP[0],
  45986. pointList[i - 1][1] + __OP[1],
  45987. pointList[i][0] + __OP[0],
  45988. pointList[i][1] + __OP[1],
  45989. dashLength,
  45990. [pattern1, pattern2, pattern3, pattern4]
  45991. );
  45992. }
  45993. SUtil_SUtil.SUtil_dashedLineTo(
  45994. ctx,
  45995. pointList[pointList.length - 1][0] + __OP[0],
  45996. pointList[pointList.length - 1][1] + __OP[1],
  45997. pointList[0][0] + __OP[0],
  45998. pointList[0][1] + __OP[1],
  45999. dashLength,
  46000. [pattern1, pattern2, pattern3, pattern4]
  46001. );
  46002. }
  46003. }
  46004. return;
  46005. }
  46006. /**
  46007. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.getRect
  46008. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  46009. *
  46010. * @param {Object} style - style
  46011. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46012. *
  46013. */
  46014. getRect(style, refOriginalPosition) {
  46015. var __OP;
  46016. if (!refOriginalPosition) {
  46017. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46018. this.refOriginalPosition = [0, 0];
  46019. }
  46020. __OP = this.refOriginalPosition;
  46021. } else {
  46022. __OP = refOriginalPosition;
  46023. }
  46024. if (style.__rect) {
  46025. return style.__rect;
  46026. }
  46027. var minX = Number.MAX_VALUE;
  46028. var maxX = Number.MIN_VALUE;
  46029. var minY = Number.MAX_VALUE;
  46030. var maxY = Number.MIN_VALUE;
  46031. var pointList = style.pointList;
  46032. for (var i = 0, l = pointList.length; i < l; i++) {
  46033. if (pointList[i][0] + __OP[0] < minX) {
  46034. minX = pointList[i][0] + __OP[0];
  46035. }
  46036. if (pointList[i][0] + __OP[0] > maxX) {
  46037. maxX = pointList[i][0] + __OP[0];
  46038. }
  46039. if (pointList[i][1] + __OP[1] < minY) {
  46040. minY = pointList[i][1] + __OP[1];
  46041. }
  46042. if (pointList[i][1] + __OP[1] > maxY) {
  46043. maxY = pointList[i][1] + __OP[1];
  46044. }
  46045. }
  46046. var lineWidth;
  46047. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  46048. lineWidth = style.lineWidth || 1;
  46049. } else {
  46050. lineWidth = 0;
  46051. }
  46052. style.__rect = {
  46053. x: Math.round(minX - lineWidth / 2),
  46054. y: Math.round(minY - lineWidth / 2),
  46055. width: maxX - minX + lineWidth,
  46056. height: maxY - minY + lineWidth
  46057. };
  46058. return style.__rect;
  46059. }
  46060. }
  46061. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  46062. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46063. * This program are made available under the terms of the Apache License, Version 2.0
  46064. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46065. /**
  46066. * @private
  46067. * @class SuperMap.LevelRenderer.Shape.SmicBrokenLine
  46068. * @category Visualization Theme
  46069. * @classdesc 折线(ic)。
  46070. * @extends SuperMap.LevelRenderer.Shape
  46071. * @example
  46072. * var shape = new SuperMap.LevelRenderer.Shape.SmicBrokenLine({
  46073. * style: {
  46074. * pointList: [[0, 0], [100, 100], [100, 0]],
  46075. * smooth: 'bezier',
  46076. * strokeColor: 'purple'
  46077. * }
  46078. * });
  46079. * levelRenderer.addShape(shape);
  46080. *
  46081. *
  46082. */
  46083. class SmicBrokenLine extends Shape_Shape {
  46084. /**
  46085. * @member {Object} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.style
  46086. * @description 绘制样式。
  46087. *
  46088. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  46089. * (code)
  46090. * (start code)
  46091. * [
  46092. * [10, 20], //单个节点
  46093. * [30, 40],
  46094. * [25, 30]
  46095. * ]
  46096. * (end)
  46097. * @param {string} smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  46098. * @param {number} smoothConstraint - 平滑约束。
  46099. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  46100. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46101. * @param {number} lineWidth - 描边宽度。默认值:1。
  46102. * @param {number} opacity - 绘制透明度。默认值:1。
  46103. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46104. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  46105. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  46106. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  46107. * @param {string} text - 图形中的附加文本。默认值:""。
  46108. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  46109. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  46110. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46111. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46112. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46113. */
  46114. //打开接口 style
  46115. /**
  46116. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.constructor
  46117. * @description 构造函数。
  46118. *
  46119. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46120. *
  46121. */
  46122. constructor(options) {
  46123. super(options);
  46124. /**
  46125. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  46126. * @description 线条只能描边。
  46127. */
  46128. this.brushTypeOnly = 'stroke';
  46129. /**
  46130. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  46131. * @description 文本位置。
  46132. */
  46133. this.textPosition = 'end';
  46134. /**
  46135. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.type
  46136. * @description 图形类型.
  46137. */
  46138. this.type = 'smicbroken-line';
  46139. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46140. this.refOriginalPosition = [0, 0];
  46141. }
  46142. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  46143. }
  46144. /**
  46145. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  46146. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46147. */
  46148. destroy() {
  46149. this.brushTypeOnly = null;
  46150. this.textPosition = null;
  46151. this.type = null;
  46152. super.destroy();
  46153. }
  46154. /**
  46155. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  46156. * @description 创建折线路径。
  46157. *
  46158. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46159. * @param {Object} style - style。
  46160. *
  46161. */
  46162. buildPath(ctx, style) {
  46163. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46164. this.refOriginalPosition = [0, 0];
  46165. }
  46166. var __OP = this.refOriginalPosition;
  46167. var pointList = style.pointList;
  46168. if (pointList.length < 2) {
  46169. // 少于2个点就不画了~
  46170. return;
  46171. }
  46172. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  46173. if (style.smooth && style.smooth !== 'spline') {
  46174. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  46175. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46176. var cp1;
  46177. var cp2;
  46178. var p;
  46179. for (let i = 0; i < len - 1; i++) {
  46180. cp1 = controlPoints[i * 2];
  46181. cp2 = controlPoints[i * 2 + 1];
  46182. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  46183. ctx.bezierCurveTo(
  46184. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  46185. );
  46186. }
  46187. } else {
  46188. if (style.smooth === 'spline') {
  46189. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  46190. len = pointList.length;
  46191. }
  46192. if (!style.lineType || style.lineType === 'solid') {
  46193. // 默认为实线
  46194. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46195. for (let i = 1; i < len; i++) {
  46196. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  46197. }
  46198. } else if (style.lineType === 'dashed'
  46199. || style.lineType === 'dotted'
  46200. || style.lineType === 'dot'
  46201. || style.lineType === 'dash'
  46202. || style.lineType === 'longdash'
  46203. ) {
  46204. let dashLength = (style.lineWidth || 1);
  46205. let pattern1 = dashLength;
  46206. let pattern2 = dashLength;
  46207. //dashed
  46208. if (style.lineType === 'dashed') {
  46209. pattern1 *= 5;
  46210. pattern2 *= 5;
  46211. if (style.lineCap && style.lineCap !== "butt") {
  46212. pattern1 -= dashLength;
  46213. pattern2 += dashLength;
  46214. }
  46215. }
  46216. //dotted
  46217. if (style.lineType === 'dotted') {
  46218. if (style.lineCap && style.lineCap !== "butt") {
  46219. pattern1 = 1;
  46220. pattern2 += dashLength;
  46221. }
  46222. }
  46223. //dot
  46224. if (style.lineType === 'dot') {
  46225. pattern2 *= 4;
  46226. if (style.lineCap && style.lineCap !== "butt") {
  46227. pattern1 = 1;
  46228. pattern2 += dashLength;
  46229. }
  46230. }
  46231. //dash
  46232. if (style.lineType === 'dash') {
  46233. pattern1 *= 4;
  46234. pattern2 *= 4;
  46235. if (style.lineCap && style.lineCap !== "butt") {
  46236. pattern1 -= dashLength;
  46237. pattern2 += dashLength;
  46238. }
  46239. }
  46240. //longdash
  46241. if (style.lineType === 'longdash') {
  46242. pattern1 *= 8;
  46243. pattern2 *= 4;
  46244. if (style.lineCap && style.lineCap !== "butt") {
  46245. pattern1 -= dashLength;
  46246. pattern2 += dashLength;
  46247. }
  46248. }
  46249. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46250. for (var i = 1; i < len; i++) {
  46251. SUtil_SUtil.SUtil_dashedLineTo(
  46252. ctx,
  46253. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  46254. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  46255. dashLength,
  46256. [pattern1, pattern2]
  46257. );
  46258. }
  46259. } else if (style.lineType === 'dashdot'
  46260. || style.lineType === 'longdashdot'
  46261. ) {
  46262. let dashLength = (style.lineWidth || 1);
  46263. let pattern1 = dashLength;
  46264. let pattern2 = dashLength;
  46265. let pattern3 = dashLength;
  46266. let pattern4 = dashLength;
  46267. //dashdot
  46268. if (style.lineType === 'dashdot') {
  46269. pattern1 *= 4;
  46270. pattern2 *= 4;
  46271. pattern4 *= 4;
  46272. if (style.lineCap && style.lineCap !== "butt") {
  46273. pattern1 -= dashLength;
  46274. pattern2 += dashLength;
  46275. pattern3 = 1;
  46276. pattern4 += dashLength;
  46277. }
  46278. }
  46279. //longdashdot
  46280. if (style.lineType === 'longdashdot') {
  46281. pattern1 *= 8;
  46282. pattern2 *= 4;
  46283. pattern4 *= 4;
  46284. if (style.lineCap && style.lineCap !== "butt") {
  46285. pattern1 -= dashLength;
  46286. pattern2 += dashLength;
  46287. pattern3 = 1;
  46288. pattern4 += dashLength;
  46289. }
  46290. }
  46291. dashLength = (style.lineWidth || 1)
  46292. * (style.lineType === 'dashed' ? 5 : 1);
  46293. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  46294. for (let i = 1; i < len; i++) {
  46295. SUtil_SUtil.SUtil_dashedLineTo(
  46296. ctx,
  46297. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  46298. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  46299. dashLength,
  46300. [pattern1, pattern2, pattern3, pattern4]
  46301. );
  46302. }
  46303. }
  46304. }
  46305. return;
  46306. }
  46307. /**
  46308. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  46309. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  46310. *
  46311. * @param {Object} style - style
  46312. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46313. */
  46314. getRect(style) {
  46315. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46316. this.refOriginalPosition = [0, 0];
  46317. }
  46318. var __OP = this.refOriginalPosition;
  46319. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  46320. }
  46321. }
  46322. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  46323. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46324. * This program are made available under the terms of the Apache License, Version 2.0
  46325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46326. /**
  46327. * @private
  46328. * @class SuperMap.LevelRenderer.Shape.SmicImage
  46329. * @category Visualization Theme
  46330. * @classdesc 图片绘制。
  46331. * @extends SuperMap.LevelRenderer.Shape
  46332. * @example
  46333. * var shape = new SuperMap.LevelRenderer.Shape.SmicImage({
  46334. * style: {
  46335. * image: 'test.jpg',
  46336. * x: 100,
  46337. * y: 100
  46338. * }
  46339. * });
  46340. * levelRenderer.addShape(shape);
  46341. *
  46342. *
  46343. */
  46344. class SmicImage extends Shape_Shape {
  46345. /**
  46346. * @member {Object} SuperMap.LevelRenderer.Shape.SmicImage.prototype.style
  46347. * @description 绘制样式。
  46348. *
  46349. * @param {number} style.x - 左上角横坐标,必设参数。
  46350. * @param {number} style.y - 左上角纵坐标,必设参数。
  46351. * @param {(string/Cavans)} style.image - 图片地址或cavans对象,必设参数。
  46352. * @param {number} style.width - 绘制到画布上的宽度,默认为图片高度。
  46353. * @param {number} style.height - 绘制到画布上的高度,默认为图片高度。
  46354. * @param {number} style.sx - 从图片中裁剪的左上角横坐标。
  46355. * @param {number} style.sy - 从图片中裁剪的左上角纵坐标。
  46356. * @param {number} style.sWidth - 从图片中裁剪的宽度,默认为图片高度。
  46357. * @param {number} style.sHeight - 绘制到画布上的高度,默认为图片高度。
  46358. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46359. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46360. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46361. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46362. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46363. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46364. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  46365. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46366. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46367. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46368. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46369. */
  46370. //打开接口 style
  46371. /**
  46372. * @function SuperMap.LevelRenderer.Shape.SmicImage.constructor
  46373. * @description 构造函数。
  46374. *
  46375. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46376. *
  46377. */
  46378. constructor(options) {
  46379. super(options);
  46380. /**
  46381. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype.type
  46382. * @description 图形类型。
  46383. */
  46384. this.type = 'smicimage';
  46385. /**
  46386. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype._imageCache
  46387. * @description 图片缓存。
  46388. */
  46389. this._imageCache = {};
  46390. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46391. this.refOriginalPosition = [0, 0];
  46392. }
  46393. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  46394. }
  46395. /**
  46396. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.destroy
  46397. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46398. */
  46399. destroy() {
  46400. this.type = null;
  46401. this._imageCache = null;
  46402. super.destroy();
  46403. }
  46404. /**
  46405. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.buildPath
  46406. * @description 创建图片。
  46407. *
  46408. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46409. * @param {Object} style - style。
  46410. *
  46411. */
  46412. brush(ctx, isHighlight, refresh) {
  46413. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46414. this.refOriginalPosition = [0, 0];
  46415. }
  46416. var __OP = this.refOriginalPosition;
  46417. var style = this.style || {};
  46418. if (isHighlight) {
  46419. // 根据style扩展默认高亮样式
  46420. style = this.getHighlightStyle(
  46421. style, this.highlightStyle || {}
  46422. );
  46423. }
  46424. var image = style.image;
  46425. var me = this;
  46426. if (typeof(image) === 'string') {
  46427. var src = image;
  46428. if (this._imageCache[src]) {
  46429. image = this._imageCache[src];
  46430. } else {
  46431. image = new Image();
  46432. image.onload = function () {
  46433. image.onload = null;
  46434. clearTimeout(SmicImage._refreshTimeout);
  46435. SmicImage._needsRefresh.push(me);
  46436. // 防止因为缓存短时间内触发多次onload事件
  46437. SmicImage._refreshTimeout = setTimeout(function () {
  46438. refresh && refresh(SmicImage._needsRefresh);
  46439. // 清空 needsRefresh
  46440. SmicImage._needsRefresh = [];
  46441. }, 10);
  46442. };
  46443. image.src = src;
  46444. this._imageCache[src] = image;
  46445. }
  46446. }
  46447. if (image) {
  46448. // 图片已经加载完成
  46449. if (image.nodeName.toUpperCase() == 'IMG') {
  46450. if (window.ActiveXObject) {
  46451. if (image.readyState != 'complete') {
  46452. return;
  46453. }
  46454. } else {
  46455. if (!image.complete) {
  46456. return;
  46457. }
  46458. }
  46459. }
  46460. // Else is canvas
  46461. var width = style.width || image.width;
  46462. var height = style.height || image.height;
  46463. var x = style.x + __OP[0];
  46464. var y = style.y + __OP[1];
  46465. // 图片加载失败
  46466. if (!image.width || !image.height) {
  46467. return;
  46468. }
  46469. ctx.save();
  46470. this.doClip(ctx);
  46471. this.setContext(ctx, style);
  46472. // 设置transform
  46473. this.setTransform(ctx);
  46474. if (style.sWidth && style.sHeight) {
  46475. let sx = (style.sx + __OP[0]) || 0;
  46476. let sy = (style.sy + __OP[1]) || 0;
  46477. ctx.drawImage(
  46478. image,
  46479. sx, sy, style.sWidth, style.sHeight,
  46480. x, y, width, height
  46481. );
  46482. } else if (style.sx && style.sy) {
  46483. let sx = style.sx + __OP[0];
  46484. let sy = style.sy + __OP[1];
  46485. var sWidth = width - sx;
  46486. var sHeight = height - sy;
  46487. ctx.drawImage(
  46488. image,
  46489. sx, sy, sWidth, sHeight,
  46490. x, y, width, height
  46491. );
  46492. } else {
  46493. ctx.drawImage(image, x, y, width, height);
  46494. }
  46495. // 如果没设置宽和高的话自动根据图片宽高设置
  46496. if (!style.width) {
  46497. style.width = width;
  46498. }
  46499. if (!style.height) {
  46500. style.height = height;
  46501. }
  46502. if (!this.style.width) {
  46503. this.style.width = width;
  46504. }
  46505. if (!this.style.height) {
  46506. this.style.height = height;
  46507. }
  46508. this.drawText(ctx, style, this.style);
  46509. ctx.restore();
  46510. }
  46511. }
  46512. /**
  46513. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.getRect
  46514. * @description 计算返回图片的包围盒矩形。
  46515. *
  46516. * @param {Object} style - style
  46517. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46518. */
  46519. getRect(style) {
  46520. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46521. this.refOriginalPosition = [0, 0];
  46522. }
  46523. var __OP = this.refOriginalPosition;
  46524. return {
  46525. x: style.x + __OP[0],
  46526. y: style.y + __OP[1],
  46527. width: style.width,
  46528. height: style.height
  46529. };
  46530. }
  46531. /**
  46532. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.clearCache
  46533. * @description 清除图片缓存。
  46534. *
  46535. * @param {Object} style - style
  46536. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46537. *
  46538. */
  46539. clearCache() {
  46540. this._imageCache = {};
  46541. }
  46542. }
  46543. SmicImage._needsRefresh = [];
  46544. SmicImage._refreshTimeout = null;
  46545. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  46546. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46547. * This program are made available under the terms of the Apache License, Version 2.0
  46548. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46549. /**
  46550. * @private
  46551. * @class SuperMap.LevelRenderer.Shape.SmicRectangle
  46552. * @category Visualization Theme
  46553. * @classdesc 矩形。
  46554. * @extends SuperMap.LevelRenderer.Shape
  46555. * @example
  46556. * var shape = new SuperMap.LevelRenderer.Shape.SmicRectangle({
  46557. * style: {
  46558. * x: 0,
  46559. * y: 0,
  46560. * width: 100,
  46561. * height: 100,
  46562. * radius: 20
  46563. * }
  46564. * });
  46565. * levelRenderer.addShape(shape);
  46566. *
  46567. */
  46568. class SmicRectangle extends Shape_Shape {
  46569. /**
  46570. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.style
  46571. * @description 绘制样式。
  46572. *
  46573. * @param {number} style.x - 左上角 x 坐标,必设参数。
  46574. * @param {number} style.y - 左上角 y 坐标,必设参数。
  46575. * @param {number} style.width - 宽度,必设参数。
  46576. * @param {number} style.height - 高度,必设参数。
  46577. * @param {Array} style.radius - 矩形圆角,可以用数组分别指定四个角的圆角,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 则 radius为 [r1、r2、r3、r4 ]。
  46578. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46579. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  46580. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  46581. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46582. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  46583. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46584. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46585. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46586. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46587. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46588. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46589. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  46590. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46591. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46592. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46593. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46594. */
  46595. //打开接口 style
  46596. /**
  46597. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.constructor
  46598. * @description 构造函数。
  46599. *
  46600. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46601. *
  46602. */
  46603. constructor(options) {
  46604. super(options);
  46605. /**
  46606. * @member {string} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.type
  46607. * @description 图形类型.
  46608. */
  46609. this.type = 'smicrectangle';
  46610. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46611. this.refOriginalPosition = [0, 0];
  46612. }
  46613. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  46614. }
  46615. /**
  46616. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.destroy
  46617. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46618. */
  46619. destroy() {
  46620. this.type = null;
  46621. super.destroy();
  46622. }
  46623. /**
  46624. * APIMethod: _buildRadiusPath
  46625. * 创建矩形的圆角路径。
  46626. *
  46627. * Parameters:
  46628. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  46629. * style - {Object} style。
  46630. *
  46631. */
  46632. _buildRadiusPath(ctx, style) {
  46633. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46634. this.refOriginalPosition = [0, 0];
  46635. }
  46636. var __OP = this.refOriginalPosition;
  46637. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  46638. // r缩写为1 相当于 [1, 1, 1, 1]
  46639. // r缩写为[1] 相当于 [1, 1, 1, 1]
  46640. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  46641. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  46642. var x = style.x + __OP[0];
  46643. var y = style.y + __OP[1];
  46644. var width = style.width;
  46645. var height = style.height;
  46646. var r = style.radius;
  46647. var r1;
  46648. var r2;
  46649. var r3;
  46650. var r4;
  46651. if (typeof r === 'number') {
  46652. r1 = r2 = r3 = r4 = r;
  46653. } else if (r instanceof Array) {
  46654. if (r.length === 1) {
  46655. r1 = r2 = r3 = r4 = r[0];
  46656. } else if (r.length === 2) {
  46657. r1 = r3 = r[0];
  46658. r2 = r4 = r[1];
  46659. } else if (r.length === 3) {
  46660. r1 = r[0];
  46661. r2 = r4 = r[1];
  46662. r3 = r[2];
  46663. } else {
  46664. r1 = r[0];
  46665. r2 = r[1];
  46666. r3 = r[2];
  46667. r4 = r[3];
  46668. }
  46669. } else {
  46670. r1 = r2 = r3 = r4 = 0;
  46671. }
  46672. var total;
  46673. if (r1 + r2 > width) {
  46674. total = r1 + r2;
  46675. r1 *= width / total;
  46676. r2 *= width / total;
  46677. }
  46678. if (r3 + r4 > width) {
  46679. total = r3 + r4;
  46680. r3 *= width / total;
  46681. r4 *= width / total;
  46682. }
  46683. if (r2 + r3 > height) {
  46684. total = r2 + r3;
  46685. r2 *= height / total;
  46686. r3 *= height / total;
  46687. }
  46688. if (r1 + r4 > height) {
  46689. total = r1 + r4;
  46690. r1 *= height / total;
  46691. r4 *= height / total;
  46692. }
  46693. ctx.moveTo(x + r1, y);
  46694. ctx.lineTo(x + width - r2, y);
  46695. r2 !== 0 && ctx.quadraticCurveTo(
  46696. x + width, y, x + width, y + r2
  46697. );
  46698. ctx.lineTo(x + width, y + height - r3);
  46699. r3 !== 0 && ctx.quadraticCurveTo(
  46700. x + width, y + height, x + width - r3, y + height
  46701. );
  46702. ctx.lineTo(x + r4, y + height);
  46703. r4 !== 0 && ctx.quadraticCurveTo(
  46704. x, y + height, x, y + height - r4
  46705. );
  46706. ctx.lineTo(x, y + r1);
  46707. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  46708. }
  46709. /**
  46710. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  46711. * @description 创建矩形路径。
  46712. *
  46713. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46714. * @param {Object} style - style。
  46715. *
  46716. */
  46717. buildPath(ctx, style) {
  46718. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46719. this.refOriginalPosition = [0, 0];
  46720. }
  46721. var __OP = this.refOriginalPosition;
  46722. if (!style.radius) {
  46723. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  46724. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  46725. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  46726. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  46727. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  46728. // ctx.rect(style.x, style.y, style.width, style.height);
  46729. } else {
  46730. this._buildRadiusPath(ctx, style);
  46731. }
  46732. ctx.closePath();
  46733. return;
  46734. }
  46735. /**
  46736. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.getRect
  46737. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  46738. *
  46739. * @param {Object} style - style
  46740. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46741. */
  46742. getRect(style) {
  46743. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46744. this.refOriginalPosition = [0, 0];
  46745. }
  46746. var __OP = this.refOriginalPosition;
  46747. if (style.__rect) {
  46748. return style.__rect;
  46749. }
  46750. var lineWidth;
  46751. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  46752. lineWidth = style.lineWidth || 1;
  46753. } else {
  46754. lineWidth = 0;
  46755. }
  46756. style.__rect = {
  46757. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  46758. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  46759. width: style.width + lineWidth,
  46760. height: style.height + lineWidth
  46761. };
  46762. return style.__rect;
  46763. }
  46764. }
  46765. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  46766. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46767. * This program are made available under the terms of the Apache License, Version 2.0
  46768. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46769. /**
  46770. * @private
  46771. * @class SuperMap.LevelRenderer.Shape.SmicSector
  46772. * @category Visualization Theme
  46773. * @classdesc 扇形。
  46774. * @extends SuperMap.LevelRenderer.Shape
  46775. * @example
  46776. * var shape = new SuperMap.LevelRenderer.Shape.SmicSector({
  46777. * style: {
  46778. * x: 100,
  46779. * y: 100,
  46780. * r: 60,
  46781. * r0: 30,
  46782. * startAngle: 0,
  46783. * endEngle: 180
  46784. * }
  46785. * });
  46786. * levelRenderer.addShape(shape);
  46787. *
  46788. *
  46789. */
  46790. class SmicSector extends Shape_Shape {
  46791. /**
  46792. * @member {Object} SuperMap.LevelRenderer.Shape.SmicSector.prototype.style
  46793. * @description 绘制样式。
  46794. *
  46795. * @param {number} style.x - 圆心 x 坐标,必设参数。
  46796. * @param {number} style.y - 圆心 y 坐标,必设参数。
  46797. * @param {number} style.r - 外圆半径,必设参数。
  46798. * @param {number} style.r0 - 内圆半径,指定后将出现内弧,同时扇边长度为`r - r0`。取值范围[0, r),默认值:0。
  46799. * @param {number} style.startAngle - 起始角度,必设参数。取值范围[0, 360)。
  46800. * @param {number} style.endAngle - 结束角度,必设参数。取值范围(0, 360。
  46801. * @param {boolean} style.clockWise - 是否是顺时针。默认值:false。
  46802. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46803. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  46804. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  46805. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46806. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  46807. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46808. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46809. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46810. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46811. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46812. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46813. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  46814. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46815. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46816. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46817. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46818. */
  46819. //打开接口 style
  46820. /**
  46821. * @function SuperMap.LevelRenderer.Shape.SmicSector.constructor
  46822. * @description 构造函数。
  46823. *
  46824. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46825. *
  46826. */
  46827. constructor(options) {
  46828. super(options);
  46829. /**
  46830. * @member {string} SuperMap.LevelRenderer.Shape.SmicSector.protptype.type
  46831. * @description 图形类型。
  46832. */
  46833. this.type = 'smicsector';
  46834. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46835. this.refOriginalPosition = [0, 0];
  46836. }
  46837. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  46838. }
  46839. /**
  46840. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.destroy
  46841. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46842. */
  46843. destroy() {
  46844. this.type = null;
  46845. super.destroy();
  46846. }
  46847. /**
  46848. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.buildPath
  46849. * @description 创建扇形路径。
  46850. *
  46851. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46852. * @param {Object} style - style。
  46853. *
  46854. */
  46855. buildPath(ctx, style) {
  46856. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46857. this.refOriginalPosition = [0, 0];
  46858. }
  46859. var __OP = this.refOriginalPosition;
  46860. var x = style.x + __OP[0]; // 圆心x
  46861. var y = style.y + __OP[1]; // 圆心y
  46862. var r0 = style.r0 || 0; // 形内半径[0,r)
  46863. var r = style.r; // 扇形外半径(0,r]
  46864. var startAngle = style.startAngle; // 起始角度[0,360)
  46865. var endAngle = style.endAngle; // 结束角度(0,360]
  46866. var clockWise = style.clockWise || false;
  46867. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  46868. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  46869. if (!clockWise) {
  46870. // 扇形默认是逆时针方向,Y轴向上
  46871. // 这个跟arc的标准不一样,为了兼容echarts
  46872. startAngle = -startAngle;
  46873. endAngle = -endAngle;
  46874. }
  46875. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  46876. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  46877. ctx.moveTo(
  46878. unitX * r0 + x,
  46879. unitY * r0 + y
  46880. );
  46881. ctx.lineTo(
  46882. unitX * r + x,
  46883. unitY * r + y
  46884. );
  46885. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  46886. ctx.lineTo(
  46887. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  46888. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  46889. );
  46890. if (r0 !== 0) {
  46891. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  46892. }
  46893. ctx.closePath();
  46894. return;
  46895. }
  46896. /**
  46897. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.getRect
  46898. * @description 返回扇形包围盒矩形
  46899. *
  46900. * @param {Object} style - style
  46901. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46902. *
  46903. */
  46904. getRect(style) {
  46905. if (style.__rect) {
  46906. return style.__rect;
  46907. }
  46908. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46909. this.refOriginalPosition = [0, 0];
  46910. }
  46911. var __OP = this.refOriginalPosition;
  46912. var min0 = SUtil_SUtil.Util_vector.create();
  46913. var min1 = SUtil_SUtil.Util_vector.create();
  46914. var max0 = SUtil_SUtil.Util_vector.create();
  46915. var max1 = SUtil_SUtil.Util_vector.create();
  46916. var x = style.x + __OP[0]; // 圆心x
  46917. var y = style.y + __OP[1]; // 圆心y
  46918. var r0 = style.r0 || 0; // 形内半径[0,r)
  46919. var r = style.r; // 扇形外半径(0,r]
  46920. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  46921. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  46922. var clockWise = style.clockWise;
  46923. if (!clockWise) {
  46924. startAngle = -startAngle;
  46925. endAngle = -endAngle;
  46926. }
  46927. if (r0 > 1) {
  46928. SUtil_SUtil.Util_computeBoundingBox.arc(
  46929. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  46930. );
  46931. } else {
  46932. min0[0] = max0[0] = x;
  46933. min0[1] = max0[1] = y;
  46934. }
  46935. SUtil_SUtil.Util_computeBoundingBox.arc(
  46936. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  46937. );
  46938. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  46939. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  46940. style.__rect = {
  46941. x: min0[0],
  46942. y: min0[1],
  46943. width: max0[0] - min0[0],
  46944. height: max0[1] - min0[1]
  46945. };
  46946. return style.__rect;
  46947. }
  46948. }
  46949. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  46950. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46951. * This program are made available under the terms of the Apache License, Version 2.0
  46952. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46953. /**
  46954. * @class SuperMap.Feature.ShapeFactory
  46955. * @category Visualization Theme
  46956. * @classdesc 图形工厂类。
  46957. * 目前支持创建的图形有:<br>
  46958. * 用于统计专题图:<br>
  46959. * 点 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Point}> <br>
  46960. * 线 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Line}> <br>
  46961. * 面 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Polygon}> <br>
  46962. * 矩形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Rectangle}> <br>
  46963. * 扇形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Sector}> <br>
  46964. * 标签 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Label}> <br>
  46965. * 图片 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Image}> <br>
  46966. * 用于符号专题图:<br>
  46967. * 圆形 - 参数对象:<{@link SuperMap.Feature.ShapeParameters.Cilcle}>
  46968. */
  46969. class ShapeFactory {
  46970. /**
  46971. * @function SuperMap.Feature.ShapeFactory.prototype.constructor
  46972. * @description 构建图形工厂对象。
  46973. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象,可选参数。
  46974. * @returns {SuperMap.Feature.ShapeFactory} 返回图形工厂类对象。
  46975. */
  46976. constructor(shapeParameters) {
  46977. /**
  46978. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.shapeParameters
  46979. * @description 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。必设参数,默认值 null。
  46980. */
  46981. this.shapeParameters = shapeParameters;
  46982. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  46983. }
  46984. /**
  46985. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  46986. * @description 销毁图形工厂类对象。
  46987. */
  46988. destroy() {
  46989. this.shapeParameters = null;
  46990. }
  46991. /**
  46992. * @function SuperMap.Feature.ShapeParameters.prototype.createShape
  46993. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  46994. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。
  46995. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  46996. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  46997. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  46998. */
  46999. createShape(shapeParameters) {
  47000. if (shapeParameters) {
  47001. this.shapeParameters = shapeParameters;
  47002. }
  47003. if (!this.shapeParameters) {
  47004. return null;
  47005. }
  47006. var sps = this.shapeParameters;
  47007. if (sps instanceof Point_Point) { // 点
  47008. //设置style
  47009. let style = new Object();
  47010. style["x"] = sps.x;
  47011. style["y"] = sps.y;
  47012. style["r"] = sps.r;
  47013. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  47014. //创建图形
  47015. let shape = new SmicPoint();
  47016. shape.style = ShapeFactory.transformStyle(style);
  47017. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47018. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  47019. return shape;
  47020. } else if (sps instanceof Line_Line) { // 线
  47021. //检查参数 pointList 是否存在
  47022. if (!sps.pointList) {
  47023. return null;
  47024. }
  47025. // 设置style
  47026. let style = new Object();
  47027. style["pointList"] = sps.pointList;
  47028. style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  47029. // 创建图形
  47030. let shape = new SmicBrokenLine();
  47031. shape.style = ShapeFactory.transformStyle(style);
  47032. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47033. Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  47034. return shape;
  47035. } else if (sps instanceof Polygon_Polygon) { // 面
  47036. //检查参数 pointList 是否存在
  47037. if (!sps.pointList) {
  47038. return null;
  47039. }
  47040. //设置style
  47041. let style = new Object();
  47042. style["pointList"] = sps.pointList;
  47043. style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  47044. //创建图形
  47045. let shape = new SmicPolygon();
  47046. shape.style = ShapeFactory.transformStyle(style);
  47047. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47048. Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  47049. return shape;
  47050. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  47051. //检查参数 pointList 是否存在
  47052. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  47053. return null;
  47054. }
  47055. //设置style
  47056. let style = new Object();
  47057. style["x"] = sps.x;
  47058. style["y"] = sps.y;
  47059. style["width"] = sps.width;
  47060. style["height"] = sps.height;
  47061. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  47062. //创建图形
  47063. let shape = new SmicRectangle();
  47064. shape.style = ShapeFactory.transformStyle(style);
  47065. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47066. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  47067. return shape;
  47068. } else if (sps instanceof Sector) { // 扇形
  47069. //设置style
  47070. let style = new Object();
  47071. style["x"] = sps.x;
  47072. style["y"] = sps.y;
  47073. style["r"] = sps.r;
  47074. style["startAngle"] = sps.startAngle;
  47075. style["endAngle"] = sps.endAngle;
  47076. if (sps["r0"]) {
  47077. style["r0"] = sps.r0
  47078. }
  47079. if (sps["clockWise"]) {
  47080. style["clockWise"] = sps.clockWise
  47081. }
  47082. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  47083. //创建图形
  47084. let shape = new SmicSector();
  47085. shape.style = ShapeFactory.transformStyle(style);
  47086. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47087. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  47088. return shape;
  47089. } else if (sps instanceof Label) { // 标签
  47090. //设置style
  47091. let style = new Object();
  47092. style["x"] = sps.x;
  47093. style["y"] = sps.y;
  47094. style["text"] = sps.text;
  47095. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  47096. //创建图形
  47097. let shape = new SmicText();
  47098. shape.style = ShapeFactory.transformStyle(style);
  47099. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47100. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  47101. return shape;
  47102. } else if (sps instanceof Image_Image) { // 图片
  47103. //设置style
  47104. let style = new Object();
  47105. style["x"] = sps.x;
  47106. style["y"] = sps.y;
  47107. if (sps["image"]) {
  47108. style["image"] = sps.image;
  47109. }
  47110. if (sps["width"]) {
  47111. style["width"] = sps.width;
  47112. }
  47113. if (sps["height"]) {
  47114. style["height"] = sps.height;
  47115. }
  47116. if (sps["sx"]) {
  47117. style["sx"] = sps.sx;
  47118. }
  47119. if (sps["sy"]) {
  47120. style["sy"] = sps.sy;
  47121. }
  47122. if (sps["sWidth"]) {
  47123. style["sWidth"] = sps.sWidth
  47124. }
  47125. if (sps["sHeight"]) {
  47126. style["sHeight"] = sps.sHeight
  47127. }
  47128. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  47129. //创建图形
  47130. let shape = new SmicImage();
  47131. shape.style = ShapeFactory.transformStyle(style);
  47132. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47133. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  47134. return shape;
  47135. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  47136. //设置stytle
  47137. let style = new Object();
  47138. style["x"] = sps.x;
  47139. style["r"] = sps.r;
  47140. style["y"] = sps.y;
  47141. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  47142. //创建图形
  47143. let shape = new SmicCircle();
  47144. shape.style = ShapeFactory.transformStyle(style);
  47145. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  47146. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  47147. return shape;
  47148. }
  47149. return null
  47150. }
  47151. /**
  47152. * @function SuperMap.Feature.ShapeParameters.prototype.transformStyle
  47153. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  47154. * @param {Object} style - 用户 style。
  47155. * @returns {Object} 符合 levelRenderer 的 style。
  47156. */
  47157. static transformStyle(style) {
  47158. var newStyle = {};
  47159. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  47160. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  47161. //画笔类型 ["fill", "stroke"];
  47162. var brushType = [true, false];
  47163. for (var ss in style) {
  47164. switch (ss) {
  47165. case "fill":
  47166. brushType[0] = style[ss];
  47167. break;
  47168. case "fillColor":
  47169. newStyle["color"] = style[ss];
  47170. break;
  47171. case "stroke":
  47172. brushType[1] = style[ss];
  47173. break;
  47174. case "strokeWidth":
  47175. newStyle["lineWidth"] = style[ss];
  47176. break;
  47177. case "strokeLinecap":
  47178. newStyle["lineCap"] = style[ss];
  47179. break;
  47180. case "strokeLineJoin":
  47181. newStyle["lineJoin"] = style[ss];
  47182. break;
  47183. case "strokeDashstyle":
  47184. newStyle["lineType"] = style[ss];
  47185. break;
  47186. case "pointRadius":
  47187. newStyle["r"] = style[ss];
  47188. break;
  47189. case "label":
  47190. newStyle["text"] = style[ss];
  47191. break;
  47192. case "labelRect":
  47193. newStyle["labelRect"] = style[ss];
  47194. break;
  47195. case "fontColor":
  47196. newStyle["textColor"] = style[ss];
  47197. break;
  47198. case "fontStyle":
  47199. fontStr[0] = style[ss];
  47200. break;
  47201. case "fontVariant":
  47202. fontStr[1] = style[ss];
  47203. break;
  47204. case "fontWeight":
  47205. fontStr[2] = style[ss];
  47206. break;
  47207. case "fontSize":
  47208. var unit = "";
  47209. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  47210. unit = "px";
  47211. }
  47212. fontStr[3] = style[ss] + unit;
  47213. break;
  47214. case "fontFamily":
  47215. fontStr[4] = style[ss];
  47216. break;
  47217. case "fontOpacity":
  47218. newStyle["opacity"] = style[ss];
  47219. break;
  47220. case "labelPosition":
  47221. newStyle["textPosition"] = style[ss];
  47222. break;
  47223. case "labelAlign":
  47224. newStyle["textAlign"] = style[ss];
  47225. break;
  47226. case "labelBaseline":
  47227. newStyle["textBaseline"] = style[ss];
  47228. break;
  47229. case "labelRotation":
  47230. newStyle["textRotation"] = style[ss];
  47231. break;
  47232. default:
  47233. newStyle[ss] = style[ss];
  47234. break;
  47235. }
  47236. }
  47237. //拼接字体字符串
  47238. newStyle["textFont"] = fontStr.join(" ");
  47239. //画笔类型
  47240. if (brushType[0] === true && brushType[1] === false) {
  47241. newStyle["brushType"] = "fill";
  47242. } else if (brushType[0] === false && brushType[1] === true) {
  47243. newStyle["brushType"] = "stroke";
  47244. } else if (brushType[0] === true && brushType[1] === true) {
  47245. newStyle["brushType"] = "both";
  47246. } else {
  47247. newStyle["brushType"] = "fill";
  47248. }
  47249. //默认线宽 1
  47250. if (newStyle["lineWidth"] == null) {
  47251. newStyle["lineWidth"] = 1;
  47252. }
  47253. return newStyle;
  47254. }
  47255. /**
  47256. * @function SuperMap.Feature.ShapeParameters.prototype.Background
  47257. * @description 创建一个矩形背景框图形对象。
  47258. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  47259. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  47260. * @param {Object} setting - 图表配置参数,必设参数。本函数中图形配置对象 setting 可设属性:
  47261. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Rectangle#style>。
  47262. * @param {Array} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  47263. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  47264. */
  47265. static Background(shapeFactory, box, setting) {
  47266. var sets = setting ? setting : {};
  47267. // 背景框图形参数对象
  47268. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  47269. // 默认样式
  47270. bgSP.style = {
  47271. fillColor: "#f3f3f3"
  47272. };
  47273. // 设置用户 style
  47274. if (sets.backgroundStyle) {
  47275. Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  47276. }
  47277. // 设置背景框圆角参数
  47278. if (sets.backgroundRadius) {
  47279. bgSP.style["radius"] = sets.backgroundRadius;
  47280. }
  47281. // 禁止背景框响应事件
  47282. bgSP.clickable = false;
  47283. bgSP.hoverable = false;
  47284. return shapeFactory.createShape(bgSP);
  47285. }
  47286. /**
  47287. * @function SuperMap.Feature.ShapeParameters.prototype.GraphAxis
  47288. * @description 创建一个统计图表坐标轴图形对象组。
  47289. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  47290. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  47291. * @param {Object} setting - 图表配置参数,必设参数。
  47292. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  47293. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  47294. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  47295. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  47296. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  47297. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  47298. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  47299. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  47300. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  47301. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  47302. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  47303. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  47304. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  47305. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  47306. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  47307. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  47308. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  47309. */
  47310. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  47311. var dvb = dataViewBox;
  47312. var sets = setting ? setting : {};
  47313. // 参考线图形对象组
  47314. var refLines = [];
  47315. //坐标轴箭头对象组
  47316. var arrows = [];
  47317. // 是否使用参水平考线,默认不使用
  47318. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  47319. // y 轴上的刻度
  47320. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  47321. // 坐标轴节点数组
  47322. var pois = [];
  47323. //z 轴箭头数组
  47324. var zArrowPois = [];
  47325. // x,y 轴主干节点数组
  47326. var xMainPois = [];
  47327. if (axisytick == 0) {
  47328. xMainPois.push([dvb[0], dvb[3] - 5]);
  47329. xMainPois.push([dvb[0], dvb[1]]);
  47330. // 3D 坐标轴 第三象限平分线
  47331. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  47332. let axis3DParameter = parseInt(sets.axis3DParameter);
  47333. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  47334. // 添加 3D 轴节点
  47335. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  47336. //箭头坐标
  47337. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  47338. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  47339. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  47340. //3D轴
  47341. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47342. } else {
  47343. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47344. }
  47345. xMainPois.push([dvb[0], dvb[1]]);
  47346. }
  47347. xMainPois.push([dvb[2] + 5, dvb[1]]);
  47348. } else {
  47349. // 单位刻度长度
  47350. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  47351. // 刻度 y 坐标
  47352. var thckY = dvb[3];
  47353. xMainPois.push([dvb[0], thckY - 5]);
  47354. for (var i = 0; i < axisytick; i++) {
  47355. xMainPois.push([dvb[0], thckY]);
  47356. xMainPois.push([dvb[0] - 5, thckY]);
  47357. xMainPois.push([dvb[0], thckY]);
  47358. // 参考线
  47359. if (isAddRefLine) {
  47360. // 参考线参数对象
  47361. var refLineSP = new Line_Line([
  47362. [dvb[0], thckY],
  47363. [dvb[2], thckY]
  47364. ]);
  47365. // 参考线默认样式对象
  47366. refLineSP.style = {
  47367. strokeColor: "#cfcfcf",
  47368. strokeLinecap: "butt",
  47369. strokeLineJoin: "round",
  47370. strokeWidth: 1
  47371. };
  47372. // 禁止事件
  47373. refLineSP.clickable = false;
  47374. refLineSP.hoverable = false;
  47375. // 用户style
  47376. if (sets.xReferenceLineStyle) {
  47377. Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  47378. }
  47379. // 生成参考线图形对象
  47380. refLines.push(shapeFactory.createShape(refLineSP))
  47381. }
  47382. // y 刻度增量
  47383. thckY += unitTick;
  47384. }
  47385. xMainPois.push([dvb[0], dvb[1]]);
  47386. // 3D 坐标轴 第三象限平分线
  47387. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  47388. let axis3DParameter = parseInt(sets.axis3DParameter);
  47389. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  47390. /*
  47391. // 箭头计算过程
  47392. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  47393. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  47394. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  47395. if(sets.axisUseArrow){
  47396. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47397. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  47398. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47399. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  47400. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47401. }
  47402. else{
  47403. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47404. }
  47405. */
  47406. // 添加 3D 轴节点
  47407. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  47408. //箭头坐标
  47409. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  47410. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  47411. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  47412. //3D轴
  47413. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47414. } else {
  47415. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  47416. }
  47417. xMainPois.push([dvb[0], dvb[1]]);
  47418. }
  47419. xMainPois.push([dvb[2] + 5, dvb[1]]);
  47420. }
  47421. // 坐标轴箭头
  47422. if (sets.axisUseArrow) {
  47423. // x 轴箭头节点数组
  47424. var xArrowPois = [
  47425. [dvb[2] + 5, dvb[1] + 4],
  47426. [dvb[2] + 13, dvb[1]],
  47427. [dvb[2] + 5, dvb[1] - 4]
  47428. ];
  47429. // y 轴箭头节点数组
  47430. var yArrowPois = [
  47431. [dvb[0] - 4, dvb[3] - 5],
  47432. [dvb[0], dvb[3] - 13],
  47433. [dvb[0] + 4, dvb[3] - 5]
  47434. ];
  47435. //x轴箭头
  47436. var xSP = new Polygon_Polygon(xArrowPois);
  47437. xSP.style = {fillColor: "#008acd"};
  47438. Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  47439. arrows.push(shapeFactory.createShape(xSP));
  47440. //y轴箭头
  47441. var ySP = new Polygon_Polygon(yArrowPois);
  47442. ySP.style = {fillColor: "#008acd"};
  47443. Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  47444. arrows.push(shapeFactory.createShape(ySP));
  47445. // z轴箭头 坐标轴箭头是否要使用
  47446. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  47447. var zSP = new Polygon_Polygon(zArrowPois);
  47448. zSP.style = {fillColor: "#008acd"};
  47449. Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  47450. arrows.push(shapeFactory.createShape(zSP));
  47451. }
  47452. }
  47453. //不带箭头的坐标轴
  47454. pois = xMainPois;
  47455. // 坐标轴参数对象
  47456. var axisSP = new Line_Line(pois);
  47457. // 坐标轴默认style
  47458. axisSP.style = {
  47459. strokeLinecap: "butt",
  47460. strokeLineJoin: "round",
  47461. strokeColor: "#008acd",
  47462. strokeWidth: 1
  47463. };
  47464. // 用户 style
  47465. if (sets.axisStyle) {
  47466. Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  47467. }
  47468. // 禁止事件
  47469. axisSP.clickable = false;
  47470. axisSP.hoverable = false;
  47471. // 创建坐标轴图形对象
  47472. var axisMain = [shapeFactory.createShape(axisSP)];
  47473. // Y 轴标签
  47474. var yLabels = [];
  47475. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  47476. var axisYLabels = sets.axisYLabels;
  47477. let len = axisYLabels.length;
  47478. // 标签偏移量
  47479. var ylOffset = [0, 0];
  47480. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  47481. ylOffset = sets.axisYLabelsOffset;
  47482. }
  47483. if (len == 1) {
  47484. // 标签参数对象
  47485. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  47486. labelYSP.style = {
  47487. labelAlign: "right"
  47488. };
  47489. // 用户 style
  47490. if (sets.axisYLabelsStyle) {
  47491. Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  47492. }
  47493. // 禁止事件
  47494. labelYSP.clickable = false;
  47495. labelYSP.hoverable = false;
  47496. // 制作标签
  47497. yLabels.push(shapeFactory.createShape(labelYSP));
  47498. } else {
  47499. var labelY = dvb[3];
  47500. // y 轴标签单位距离
  47501. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  47502. for (var j = 0; j < len; j++) {
  47503. // 标签参数对象
  47504. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  47505. labelYSP.style = {
  47506. labelAlign: "right"
  47507. };
  47508. // 用户 style
  47509. if (sets.axisYLabelsStyle) {
  47510. Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  47511. }
  47512. // 禁止事件
  47513. labelYSP.clickable = false;
  47514. labelYSP.hoverable = false;
  47515. // 制作标签
  47516. yLabels.push(shapeFactory.createShape(labelYSP));
  47517. // y 轴标签 y 方向增量
  47518. labelY += yUnit;
  47519. }
  47520. }
  47521. }
  47522. // X 轴标签
  47523. var xLabels = [];
  47524. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  47525. let axisXLabels = sets.axisXLabels;
  47526. let len = axisXLabels.length;
  47527. // 标签偏移量
  47528. let xlOffset = [0, 0];
  47529. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  47530. xlOffset = sets.axisXLabelsOffset;
  47531. }
  47532. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  47533. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  47534. let xsCenter = xShapeInfo.xPositions;
  47535. for (let K = 0; K < len; K++) {
  47536. // 标签参数对象
  47537. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  47538. // 默认 style
  47539. labelXSP.style = {
  47540. labelAlign: "center",
  47541. labelBaseline: "top"
  47542. };
  47543. // 用户 style
  47544. if (sets.axisXLabelsStyle) {
  47545. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  47546. }
  47547. // 禁止事件
  47548. labelXSP.clickable = false;
  47549. labelXSP.hoverable = false;
  47550. // 创建标签对象
  47551. xLabels.push(shapeFactory.createShape(labelXSP));
  47552. }
  47553. } else {
  47554. if (len == 1) {
  47555. // 标签参数对象
  47556. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  47557. // 默认 style
  47558. labelXSP.style = {
  47559. labelAlign: "center",
  47560. labelBaseline: "top"
  47561. };
  47562. // 用户 style
  47563. if (sets.axisXLabelsStyle) {
  47564. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  47565. }
  47566. // 禁止事件
  47567. labelXSP.clickable = false;
  47568. labelXSP.hoverable = false;
  47569. // 创建标签对象
  47570. xLabels.push(shapeFactory.createShape(labelXSP));
  47571. } else {
  47572. let labelX = dvb[0];
  47573. // x 轴标签单位距离
  47574. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  47575. for (let m = 0; m < len; m++) {
  47576. // 标签参数对象
  47577. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  47578. // 默认 style
  47579. labelXSP.style = {
  47580. labelAlign: "center",
  47581. labelBaseline: "top"
  47582. };
  47583. // 用户 style
  47584. if (sets.axisXLabelsStyle) {
  47585. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  47586. }
  47587. // 禁止事件
  47588. labelXSP.clickable = false;
  47589. labelXSP.hoverable = false;
  47590. // 创建标签对象
  47591. xLabels.push(shapeFactory.createShape(labelXSP));
  47592. // x 轴标签 x 方向增量
  47593. labelX += xUnit;
  47594. }
  47595. }
  47596. }
  47597. }
  47598. // 组装并返回构成坐标轴的图形
  47599. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  47600. }
  47601. /**
  47602. * @function SuperMap.Feature.ShapeParameters.prototype.ShapeStyleTool
  47603. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  47604. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。
  47605. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  47606. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  47607. * 其可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  47608. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  47609. * (start code)
  47610. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  47611. * // start: 值域值下限(包含);
  47612. * // end: 值域值上限(不包含);
  47613. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <SuperMap.Feature.ShapeParameters> 子类对象的 style 属性。。
  47614. * // dataStyleByCodomain 数组形如:
  47615. * [
  47616. * {
  47617. * start:0,
  47618. * end:250,
  47619. * style:{
  47620. * fillColor:"#00CD00"
  47621. * }
  47622. * },
  47623. * {
  47624. * start:250,
  47625. * end:500,
  47626. * style:{
  47627. * fillColor:"#00EE00"
  47628. * }
  47629. * },
  47630. * {
  47631. * start:500,
  47632. * end:750,
  47633. * style:{
  47634. * fillColor:"#00FF7F"
  47635. * }
  47636. * },
  47637. * {
  47638. * start:750,
  47639. * end:1500,
  47640. * style:{
  47641. * fillColor:"#00FF00"
  47642. * }
  47643. * }
  47644. * ]
  47645. * (end)
  47646. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  47647. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  47648. * @returns {Object} 合并后的样式 (style) 对象。
  47649. */
  47650. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  47651. // 用 defaultStyle 初始化 style 对象
  47652. var finalStyle = defaultStyle ? defaultStyle : {};
  47653. // 基础 style
  47654. if (style) {
  47655. Util.copyAttributesWithClip(finalStyle, style);
  47656. }
  47657. // 按索引赋 style
  47658. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  47659. if (styleGroup[index]) {
  47660. Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  47661. }
  47662. }
  47663. // 按值域赋 style
  47664. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  47665. var dsc = styleByCodomain;
  47666. var dscLen = dsc.length;
  47667. var v = parseFloat(value);
  47668. for (var i = 0; i < dscLen; i++) {
  47669. if (dsc[i].start <= v && v < dsc[i].end) {
  47670. Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  47671. break;
  47672. }
  47673. }
  47674. }
  47675. return finalStyle;
  47676. }
  47677. }
  47678. SuperMap.Feature = SuperMap.Feature || {};
  47679. SuperMap.Feature.ShapeFactory = ShapeFactory;
  47680. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  47681. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47682. * This program are made available under the terms of the Apache License, Version 2.0
  47683. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47684. /**
  47685. * @class SuperMap.Feature.Theme
  47686. * @category Visualization Theme
  47687. * @classdesc 专题要素基类,此类不可实例化。
  47688. */
  47689. class Theme_Theme {
  47690. /**
  47691. * @function SuperMap.Feature.Theme.prototype.constructor
  47692. * @description 构造函数。
  47693. * @param {Object} data - 用户数据,用于生成可视化 shape,必设参数。
  47694. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层,必设参数。
  47695. * @returns {SuperMap.Feature.Theme} 返回一个专题要素。
  47696. */
  47697. constructor(data, layer) {
  47698. if (!data) {
  47699. return;
  47700. }
  47701. // layer 必须已经添加到地图, 且已初始化渲染器
  47702. if (!layer || !layer.map || !layer.renderer) {
  47703. return;
  47704. }
  47705. /**
  47706. * @member {string} SuperMap.Feature.Theme.prototype.id
  47707. * @description 专题要素唯一标识。
  47708. */
  47709. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  47710. /**
  47711. * @member {SuperMap.LonLat} SuperMap.Feature.Theme.prototype.lonlat
  47712. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  47713. */
  47714. this.lonlat = null;
  47715. /**
  47716. * @member {Array} SuperMap.Feature.Theme.prototype.location
  47717. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  47718. */
  47719. this.location = [];
  47720. /**
  47721. * @readonly
  47722. * @member {Object} SuperMap.Feature.Theme.prototype.data
  47723. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<SuperMap.Feature.Vector>。
  47724. */
  47725. this.data = data;
  47726. /**
  47727. * @readonly
  47728. * @member {Array} SuperMap.Feature.Theme.prototype.shapes
  47729. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  47730. */
  47731. this.shapes = [];
  47732. /**
  47733. * @readonly
  47734. * @member {SuperMap.Layer.Theme} SuperMap.Feature.Theme.prototype.layer
  47735. * @description 此专题要素所在专题图层。
  47736. */
  47737. this.layer = layer;
  47738. this.CLASS_NAME = "SuperMap.Feature.Theme";
  47739. }
  47740. /**
  47741. * @function SuperMap.Feature.Theme.prototype.destroy
  47742. * @description 销毁专题要素。
  47743. */
  47744. destroy() {
  47745. this.data = null;
  47746. this.id = null;
  47747. this.lonlat = null;
  47748. this.location = null;
  47749. this.shapes = null;
  47750. this.layer = null;
  47751. }
  47752. /**
  47753. * @function SuperMap.Feature.Theme.prototype.getLocalXY
  47754. * @description 地理坐标转为像素坐标。
  47755. * @param {(SuperMap.Geometry.Point|SuperMap.Geometry.GeoText|SuperMap.LonLat)} coordinate - 地理坐标点。
  47756. * @returns {Array} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  47757. */
  47758. getLocalXY(coordinate) {
  47759. var resolution = this.layer.map.getResolution();
  47760. var extent = this.layer.map.getExtent();
  47761. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  47762. let x = (coordinate.x / resolution + (-extent.left / resolution));
  47763. let y = ((extent.top / resolution) - coordinate.y / resolution);
  47764. return [x, y];
  47765. } else if (coordinate instanceof LonLat) {
  47766. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  47767. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  47768. return [x, y];
  47769. } else {
  47770. return null;
  47771. }
  47772. }
  47773. }
  47774. SuperMap.Feature = SuperMap.Feature || {};
  47775. SuperMap.Feature.Theme = Theme_Theme;
  47776. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  47777. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47778. * This program are made available under the terms of the Apache License, Version 2.0
  47779. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47780. /**
  47781. * @class SuperMap.Feature.Theme.Graph
  47782. * @classdesc 统计专题要素基类。
  47783. * @category Visualization Theme
  47784. * @description 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  47785. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.Graph.setting> 的基础属性只有 7 个,
  47786. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  47787. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  47788. * @extends SuperMap.Feature.Theme
  47789. * @param {SuperMap.Feature.Vector} data - 用户数据。
  47790. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  47791. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  47792. * @param {Object} setting - 图表配置对象。
  47793. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  47794. */
  47795. class Graph extends Theme_Theme {
  47796. constructor(data, layer, fields, setting, lonlat, options) {
  47797. super(data, layer, fields, setting, lonlat, options);
  47798. /**
  47799. * @member {SuperMap.Feature.ShapeFactory} SuperMap.Feature.Theme.Graph.prototype.shapeFactory
  47800. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  47801. */
  47802. this.shapeFactory = new ShapeFactory();
  47803. /**
  47804. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.shapeParameters
  47805. * @description 当前图形参数对象,<SuperMap.Feature.ShapeParameters> 的子类对象。
  47806. */
  47807. this.shapeParameters = null;
  47808. /**
  47809. * @member {boolean} [SuperMap.Feature.Theme.Graph.prototype.RelativeCoordinate]
  47810. * @description 图形是否已经计算了相对坐标。
  47811. */
  47812. this.RelativeCoordinate = false;
  47813. /**
  47814. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.setting
  47815. * @description 图表配置对象,该对象控制着图表的可视化显示。
  47816. * @param {number} width - 专题要素(图表)宽度。
  47817. * @param {number} height - 专题要素(图表)高度。
  47818. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  47819. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  47820. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  47821. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  47822. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  47823. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  47824. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  47825. *
  47826. */
  47827. this.setting = null;
  47828. /**
  47829. * @readonly
  47830. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPoint
  47831. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  47832. */
  47833. this.origonPoint = null;
  47834. /**
  47835. * @readonly
  47836. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.chartBox
  47837. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  47838. * 下端 y坐标值、 右端 x坐标值、 上端 y 坐标值;[left, bottom, right, top]。
  47839. */
  47840. this.chartBox = null;
  47841. /**
  47842. * @readonly
  47843. * @member {SuperMap.Bounds} SuperMap.Feature.Theme.Graph.prototype.chartBounds
  47844. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  47845. */
  47846. this.chartBounds = null;
  47847. /**
  47848. * @readonly
  47849. * @member {number} SuperMap.Feature.Theme.Graph.prototype.width
  47850. * @description 专题要素(图表)宽度 。
  47851. */
  47852. this.width = null;
  47853. /**
  47854. * @readonly
  47855. * @member {number} SuperMap.Feature.Theme.Graph.prototype.height
  47856. * @description 专题要素(图表)高度 。
  47857. */
  47858. this.height = null;
  47859. /**
  47860. * @readonly
  47861. * @member {number} SuperMap.Feature.Theme.Graph.prototype.XOffset
  47862. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  47863. */
  47864. this.XOffset = 0;
  47865. /**
  47866. * @readonly
  47867. * @member {number} SuperMap.Feature.Theme.Graph.prototype.YOffset
  47868. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  47869. */
  47870. this.YOffset = 0;
  47871. /**
  47872. * @readonly
  47873. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBParameter
  47874. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  47875. * 此属性用于指定数据视图框 dataViewBox 的范围。
  47876. */
  47877. this.DVBParameter = null;
  47878. /**
  47879. * @readonly
  47880. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataViewBox
  47881. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  47882. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  47883. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  47884. */
  47885. this.dataViewBox = null;
  47886. /**
  47887. * @readonly
  47888. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCodomain
  47889. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  47890. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  47891. */
  47892. this.DVBCodomain = null;
  47893. /**
  47894. * @readonly
  47895. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCenterPoint
  47896. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  47897. */
  47898. this.DVBCenterPoint = null;
  47899. /**
  47900. * @readonly
  47901. * @member {string} SuperMap.Feature.Theme.Graph.prototype.DVBUnitValue
  47902. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  47903. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  47904. */
  47905. this.DVBUnitValue = null;
  47906. /**
  47907. * @readonly
  47908. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBOrigonPoint
  47909. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  47910. */
  47911. this.DVBOrigonPoint = null;
  47912. /**
  47913. * @readonly
  47914. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBWidth
  47915. * @description 数据视图框宽度。
  47916. */
  47917. this.DVBWidth = null;
  47918. /**
  47919. * @readonly
  47920. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBHeight
  47921. * @description 数据视图框高度。
  47922. */
  47923. this.DVBHeight = null;
  47924. /**
  47925. * @readonly
  47926. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPointOffset
  47927. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  47928. */
  47929. this.origonPointOffset = null;
  47930. /**
  47931. * @readonly
  47932. * @member {Array.<string>} SuperMap.Feature.Theme.Graph.prototype.fields
  47933. * @description 数据{SuperMap.Feature.Vector}属性字段。
  47934. */
  47935. this.fields = fields || [];
  47936. /**
  47937. * @readonly
  47938. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataValues
  47939. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  47940. */
  47941. this.dataValues = null;
  47942. // 图表位置
  47943. if (lonlat) {
  47944. this.lonlat = lonlat;
  47945. } else {
  47946. // 默认使用 bounds 中心
  47947. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  47948. }
  47949. // 配置项检测与赋值
  47950. if (setting && setting.width && setting.height && setting.codomain) {
  47951. this.setting = setting;
  47952. }
  47953. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  47954. }
  47955. /**
  47956. * @function SuperMap.Feature.Theme.Graph.prototype.destroy
  47957. * @description 销毁专题要素。
  47958. */
  47959. destroy() {
  47960. this.shapeFactory = null;
  47961. this.shapeParameters = null;
  47962. this.width = null;
  47963. this.height = null;
  47964. this.origonPoint = null;
  47965. this.chartBox = null;
  47966. this.dataViewBox = null;
  47967. this.chartBounds = null;
  47968. this.DVBParameter = null;
  47969. this.DVBOrigonPoint = null;
  47970. this.DVBCenterPoint = null;
  47971. this.DVBWidth = null;
  47972. this.DVBHeight = null;
  47973. this.DVBCodomain = null;
  47974. this.DVBUnitValue = null;
  47975. this.origonPointOffset = null;
  47976. this.XOffset = null;
  47977. this.YOffset = null;
  47978. this.fields = null;
  47979. this.dataValues = null;
  47980. this.setting = null;
  47981. super.destroy();
  47982. }
  47983. /**
  47984. * @function SuperMap.Feature.Theme.Graph.prototype.initBaseParameter
  47985. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  47986. * 调用此函数关系到 setting 对象的以下属性。
  47987. * @param {number} width - 专题要素(图表)宽度。
  47988. * @param {number} height - 专题要素(图表)高度。
  47989. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  47990. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  47991. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  47992. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  47993. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  47994. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  47995. * @returns {boolean} 初始化参数是否成功。
  47996. */
  47997. initBaseParameter() {
  47998. // 参数初始化是否成功
  47999. var isSuccess = true;
  48000. // setting 属性是否已成功赋值
  48001. if (!this.setting) {
  48002. return false;
  48003. }
  48004. var sets = this.setting;
  48005. // 检测 setting 的必设参数
  48006. if (!(sets.width && sets.height && sets.codomain)) {
  48007. return false;
  48008. }
  48009. // 数据
  48010. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  48011. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  48012. this.dataValues = dataEffective ? dataEffective : [];
  48013. // 基础参数 width, height, codomain
  48014. this.width = parseFloat(sets.width);
  48015. this.height = parseFloat(sets.height);
  48016. this.DVBCodomain = sets.codomain;
  48017. // 图表偏移
  48018. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  48019. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  48020. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  48021. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  48022. // 其他默认值
  48023. this.origonPoint = [];
  48024. this.chartBox = [];
  48025. this.dataViewBox = [];
  48026. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  48027. this.DVBOrigonPoint = [];
  48028. this.DVBCenterPoint = [];
  48029. this.origonPointOffset = [];
  48030. // 图表位置
  48031. this.resetLocation();
  48032. // 专题要素宽度 w
  48033. var w = this.width;
  48034. // 专题要素高度 h
  48035. var h = this.height;
  48036. // 专题要素像素位置 loc
  48037. var loc = this.location;
  48038. // 专题要素像素位置 loc
  48039. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  48040. // 专题要素原点(左上角)
  48041. var op = this.origonPoint;
  48042. // 图表框([left, bottom, right, top])
  48043. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  48044. // 图表框
  48045. var cb = this.chartBox;
  48046. // 数据视图框参数,它是图表框各方向对应的内偏距
  48047. var dbbP = this.DVBParameter;
  48048. // 数据视图框 ([left, bottom, right, top])
  48049. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  48050. // 数据视图框
  48051. var dvb = this.dataViewBox;
  48052. //检查数据视图框是否合法
  48053. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  48054. return false;
  48055. }
  48056. // 数据视图框原点
  48057. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  48058. // 数据视图框宽度
  48059. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  48060. // 数据视图框高度
  48061. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  48062. // 数据视图框中心点
  48063. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  48064. // 数据视图框原点与图表框的原点偏移量
  48065. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  48066. return isSuccess;
  48067. }
  48068. /**
  48069. * @function SuperMap.Feature.Theme.Graph.prototype.resetLocation
  48070. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  48071. * @param {SuperMap.LonLat} lonlat - 专题要素新的像素中心位置。
  48072. * @returns {Array.<number>} - 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  48073. */
  48074. resetLocation(lonlat) {
  48075. if (lonlat) {
  48076. this.lonlat = lonlat;
  48077. }
  48078. // 获取地理位置对应的像素坐标 newLocalLX
  48079. var newLocalLX = this.getLocalXY(this.lonlat);
  48080. // 处理偏移量 XOffset, YOffset
  48081. newLocalLX[0] += this.XOffset;
  48082. newLocalLX[1] += this.YOffset;
  48083. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  48084. this.location = newLocalLX;
  48085. // 更新图表像素 Bounds
  48086. var w = this.width;
  48087. var h = this.height;
  48088. var loc = this.location;
  48089. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  48090. //重新计算当前渐变色
  48091. this.resetLinearGradient();
  48092. return loc;
  48093. }
  48094. /**
  48095. * @function SuperMap.Feature.Theme.Graph.prototype.resetLinearGradient
  48096. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  48097. */
  48098. resetLinearGradient() {
  48099. //子类实现此方法
  48100. }
  48101. /**
  48102. * @function SuperMap.Feature.Theme.Graph.prototype.shapesConvertToRelativeCoordinate
  48103. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  48104. */
  48105. shapesConvertToRelativeCoordinate() {
  48106. var shapes = this.shapes;
  48107. var shapeROP = this.location;
  48108. for (var i = 0, len = shapes.length; i < len; i++) {
  48109. shapes[i].refOriginalPosition = shapeROP;
  48110. var style = shapes[i].style;
  48111. for (var sty in style) {
  48112. switch (sty) {
  48113. case "pointList":
  48114. var pl = style[sty];
  48115. for (var j = 0, len2 = pl.length; j < len2; j++) {
  48116. pl[j][0] -= shapeROP[0];
  48117. pl[j][1] -= shapeROP[1];
  48118. }
  48119. break;
  48120. case "x":
  48121. style[sty] -= shapeROP[0];
  48122. break;
  48123. case "y":
  48124. style[sty] -= shapeROP[1];
  48125. break;
  48126. default:
  48127. break;
  48128. }
  48129. }
  48130. }
  48131. this.RelativeCoordinate = true;
  48132. }
  48133. /**
  48134. * @function SuperMap.Feature.Theme.Graph.prototype.assembleShapes
  48135. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  48136. * 重写此方法的步骤:<br>
  48137. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  48138. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  48139. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  48140. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  48141. * @example
  48142. * //子类实现 assembleShapes() 接口的步骤示例:
  48143. * assembleShapes: function(){
  48144. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  48145. *
  48146. * // 图表配置对象
  48147. * var sets = this.setting;
  48148. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  48149. * if(!sets.dataViewBoxParameter){
  48150. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  48151. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  48152. * }
  48153. * else{
  48154. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  48155. * }
  48156. * }
  48157. *
  48158. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  48159. * if(!this.initBaseParameter()) return;
  48160. *
  48161. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  48162. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  48163. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  48164. * var uv = this.DVBUnitValue;
  48165. *
  48166. * // 图形参数计算代码......
  48167. *
  48168. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  48169. * var barParams = new SuperMap.Feature.ShapeParameters.Polygon(poiLists);
  48170. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  48171. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  48172. * // 图形携带数据ID信息
  48173. * barParams.refDataID = this.data.id;
  48174. * // 创建图形并添加到图表图形数组中
  48175. * this.shapes.push(this.shapeFactory.createShape(barParams));
  48176. *
  48177. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  48178. * this.shapesConvertToRelativeCoordinate();
  48179. * },
  48180. */
  48181. assembleShapes() {
  48182. //子类必须实现此方法
  48183. }
  48184. /**
  48185. * @function SuperMap.Feature.Theme.Graph.prototype.getLocalXY
  48186. * @description 地理坐标转为像素坐标。
  48187. * @param {SuperMap.Lonlat} lonlat - 带转换的地理坐标。
  48188. * @returns 屏幕像素坐标。
  48189. */
  48190. getLocalXY(lonlat) {
  48191. return this.layer.getLocalXY(lonlat);
  48192. }
  48193. }
  48194. /**
  48195. * @function SuperMap.Feature.Theme.getDataValues
  48196. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  48197. * @param {SuperMap.Feature.Vector} data - 数据。
  48198. * @param {Array.<string>} [fields] - 字段名数组。
  48199. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  48200. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  48201. */
  48202. Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  48203. if (!data.attributes) {
  48204. return false;
  48205. }
  48206. var fieldsValue = [];
  48207. var attrs = data.attributes;
  48208. for (var i = 0; i < fields.length; i++) {
  48209. for (var field in attrs) {
  48210. if (field !== fields[i]) {
  48211. continue
  48212. }
  48213. // 数字转换判断
  48214. try {
  48215. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  48216. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  48217. } else {
  48218. fieldsValue.push(parseFloat(attrs[field].toString()));
  48219. }
  48220. } catch (e) {
  48221. throw new Error("not a number")
  48222. }
  48223. }
  48224. }
  48225. if (fieldsValue.length === fields.length) {
  48226. return fieldsValue;
  48227. } else {
  48228. return false;
  48229. }
  48230. };
  48231. SuperMap.Feature.Theme.Graph = Graph;
  48232. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  48233. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48234. * This program are made available under the terms of the Apache License, Version 2.0
  48235. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48236. /**
  48237. * @class SuperMap.Feature.Theme.Bar
  48238. * @classdesc 柱状图 。
  48239. * @category Visualization Theme
  48240. * @example
  48241. * // barStyleByCodomain参数用法如下:
  48242. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  48243. * // start: 值域值下限(包含);
  48244. * // end: 值域值上限(不包含);
  48245. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  48246. * // barStyleByCodomain 数组形如:
  48247. * [
  48248. * {
  48249. * start:0,
  48250. * end:250,
  48251. * style:{
  48252. * fillColor:"#00CD00"
  48253. * }
  48254. * },
  48255. * {
  48256. * start:250,
  48257. * end:500,
  48258. * style:{
  48259. * fillColor:"#00EE00"
  48260. * }
  48261. * },
  48262. * {
  48263. * start:500,
  48264. * end:750,
  48265. * style:{
  48266. * fillColor:"#00FF7F"
  48267. * }
  48268. * },
  48269. * {
  48270. * start:750,
  48271. * end:1500,
  48272. * style:{
  48273. * fillColor:"#00FF00"
  48274. * }
  48275. * }
  48276. * ]
  48277. * @extends SuperMap.Feature.Theme.Graph
  48278. * @param {SuperMap.Feature.Vector} data - 用户数据。
  48279. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  48280. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  48281. * @param {SuperMap.Feature.Theme.Bar.setting} setting - 图表配置对象。
  48282. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  48283. */
  48284. class Bar extends Graph {
  48285. constructor(data, layer, fields, setting, lonlat) {
  48286. super(data, layer, fields, setting, lonlat);
  48287. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  48288. }
  48289. /**
  48290. * @function SuperMap.Feature.Theme.Bar.prototype.destroy
  48291. * @override
  48292. */
  48293. destroy() {
  48294. super.destroy();
  48295. }
  48296. /**
  48297. * @function SuperMap.Feature.Theme.Bar.prototype.assembleShapes
  48298. * @description 图表图形装配函数。
  48299. */
  48300. assembleShapes() {
  48301. //默认渐变颜色数组
  48302. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  48303. //默认阴影
  48304. var deafaultShawdow = {
  48305. showShadow: true,
  48306. shadowBlur: 8,
  48307. shadowColor: "rgba(100,100,100,0.8)",
  48308. shadowOffsetX: 2,
  48309. shadowOffsetY: 2
  48310. };
  48311. // 图表配置对象
  48312. var sets = this.setting;
  48313. if (!sets.barLinearGradient) {
  48314. sets.barLinearGradient = deafaultColors;
  48315. }
  48316. // 默认数据视图框
  48317. if (!sets.dataViewBoxParameter) {
  48318. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  48319. sets.dataViewBoxParameter = [45, 15, 15, 15];
  48320. } else {
  48321. sets.dataViewBoxParameter = [5, 5, 5, 5];
  48322. }
  48323. }
  48324. // 重要步骤:初始化参数
  48325. if (!this.initBaseParameter()) {
  48326. return;
  48327. }
  48328. // 值域
  48329. var codomain = this.DVBCodomain;
  48330. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  48331. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  48332. // 数据视图域
  48333. var dvb = this.dataViewBox;
  48334. // 用户数据值
  48335. var fv = this.dataValues;
  48336. if (fv.length < 1) {
  48337. return;
  48338. } // 没有数据
  48339. // 数据溢出值域范围处理
  48340. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  48341. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  48342. return;
  48343. }
  48344. }
  48345. // 获取 x 轴上的图形信息
  48346. var xShapeInfo = this.calculateXShapeInfo();
  48347. if (!xShapeInfo) {
  48348. return;
  48349. }
  48350. // 每个柱条 x 位置
  48351. var xsLoc = xShapeInfo.xPositions;
  48352. // 柱条宽度
  48353. var xsWdith = xShapeInfo.width;
  48354. // 背景框,默认启用
  48355. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  48356. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  48357. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  48358. }
  48359. // 坐标轴, 默认启用
  48360. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  48361. // 添加坐标轴图形数组
  48362. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  48363. }
  48364. for (var i = 0; i < fv.length; i++) {
  48365. // 计算柱条 top 边的 y 轴坐标值
  48366. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  48367. // 柱条节点数组
  48368. var poiLists = [
  48369. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  48370. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  48371. [xsLoc[i] + xsWdith / 2, yPx],
  48372. [xsLoc[i] - xsWdith / 2, yPx]
  48373. ];
  48374. // 柱条参数对象(一个面参数对象)
  48375. var barParams = new Polygon_Polygon(poiLists);
  48376. // 柱条 阴影 style
  48377. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  48378. if (sets.barShadowStyle) {
  48379. var sss = sets.barShadowStyle;
  48380. if (sss.shadowBlur) {
  48381. deafaultShawdow.shadowBlur = sss.shadowBlur;
  48382. }
  48383. if (sss.shadowColor) {
  48384. deafaultShawdow.shadowColor = sss.shadowColor;
  48385. }
  48386. if (sss.shadowOffsetX) {
  48387. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  48388. }
  48389. if (sss.shadowOffsetY) {
  48390. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  48391. }
  48392. }
  48393. barParams.style = {};
  48394. Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  48395. }
  48396. // 图形携带的数据信息
  48397. barParams.refDataID = this.data.id;
  48398. barParams.dataInfo = {
  48399. field: this.fields[i],
  48400. value: fv[i]
  48401. };
  48402. // 柱条 hover click
  48403. if (typeof(sets.barHoverAble) !== "undefined") {
  48404. barParams.hoverable = sets.barHoverAble;
  48405. }
  48406. if (typeof(sets.barClickAble) !== "undefined") {
  48407. barParams.clickable = sets.barClickAble;
  48408. }
  48409. // 创建柱条并添加到图表图形数组中
  48410. this.shapes.push(this.shapeFactory.createShape(barParams));
  48411. }
  48412. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  48413. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  48414. this.shapesConvertToRelativeCoordinate();
  48415. }
  48416. /**
  48417. * @function SuperMap.Feature.Theme.Bar.prototype.calculateXShapeInfo
  48418. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  48419. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  48420. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  48421. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  48422. * 本函数中图形配置对象 setting 可设属性:
  48423. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  48424. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  48425. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  48426. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  48427. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  48428. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  48429. *
  48430. */
  48431. calculateXShapeInfo() {
  48432. var dvb = this.dataViewBox; // 数据视图框
  48433. var sets = this.setting; // 图表配置对象
  48434. var fvc = this.dataValues.length; // 数组值个数
  48435. if (fvc < 1) {
  48436. return null;
  48437. }
  48438. var xBlank; // x 轴空白间隔参数
  48439. var xShapePositions = []; // x 轴上图形的位置
  48440. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  48441. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  48442. // x 轴空白间隔参数处理
  48443. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  48444. xBlank = sets.xShapeBlank;
  48445. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  48446. if (xsLen <= fvc) {
  48447. return null;
  48448. }
  48449. xShapeWidth = xsLen / fvc
  48450. } else {
  48451. // 默认使用等距离空白间隔,空白间隔为图形宽度
  48452. xShapeWidth = dvbWidth / (2 * fvc + 1);
  48453. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  48454. }
  48455. // 图形 x 轴上的位置计算
  48456. var xOffset = 0
  48457. for (var i = 0; i < fvc; i++) {
  48458. if (i == 0) {
  48459. xOffset = xBlank[0] + xShapeWidth / 2;
  48460. } else {
  48461. xOffset += (xShapeWidth + xBlank[1]);
  48462. }
  48463. xShapePositions.push(dvb[0] + xOffset);
  48464. }
  48465. return {
  48466. "xPositions": xShapePositions,
  48467. "width": xShapeWidth
  48468. };
  48469. }
  48470. /**
  48471. * @function SuperMap.Feature.Theme.Bar.prototype.resetLinearGradient
  48472. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  48473. */
  48474. resetLinearGradient() {
  48475. if (this.RelativeCoordinate) {
  48476. var shpelength = this.shapes.length;
  48477. var barLinearGradient = this.setting.barLinearGradient;
  48478. var index = -1;
  48479. for (var i = 0; i < shpelength; i++) {
  48480. var shape = this.shapes[i];
  48481. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  48482. var style = shape.style;
  48483. //计算出当前的绝对 x y
  48484. var x1 = this.location[0] + style.pointList[0][0];
  48485. var x2 = this.location[0] + style.pointList[1][0];
  48486. //渐变颜色
  48487. index++;
  48488. //以防定义的颜色数组不够用
  48489. if (index >= barLinearGradient.length) {
  48490. index = index % barLinearGradient.length;
  48491. }
  48492. var color1 = barLinearGradient[index][0];
  48493. var color2 = barLinearGradient[index][1];
  48494. //颜色
  48495. var zcolor = new Color();
  48496. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  48497. [[0, color1], [1, color2]]);
  48498. //赋值
  48499. shape.style.color = linearGradient;
  48500. }
  48501. }
  48502. }
  48503. }
  48504. }
  48505. /**
  48506. * @typedef {Object} SuperMap.Feature.Theme.Bar.setting
  48507. * @property {number} width - 专题要素(图表)宽度。
  48508. * @property {number} height - 专题要素(图表)高度。
  48509. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  48510. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  48511. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  48512. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)
  48513. * 在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];
  48514. * 不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  48515. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  48516. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  48517. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  48518. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  48519. * 则 backgroundRadius 为 [r1、r2、r3、r4]。
  48520. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  48521. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  48522. * @property {boolean} [showShadow=true] - 阴影开关。
  48523. * @property {Object} [barShadowStyle] - 阴影样式,如:{shadowBlur : 8, shadowOffsetX: 2 , shadowOffsetY : 2,shadowColor : "rgba(100,100,100,0.8)"}
  48524. * @property {Array.<string>} [barLinearGradient] - 按字段设置柱条样式[渐变开始颜色,渐变终止颜色] 与 themeLayer.themeFields 中的字段一一对应),
  48525. * 如:[["#00FF00","#00CD00"],["#00CCFF","#5E87A2"],["#00FF66","#669985"],["#CCFF00","#94A25E"],["#FF9900","#A2945E"]]
  48526. * @property {boolean} [useAxis=true] - 是否使用坐标轴。</br>
  48527. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  48528. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  48529. * @property {number} [axisYTick=0] - y 轴刻度数量。
  48530. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  48531. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  48532. * @property {Array.<number>} [axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  48533. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  48534. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  48535. * @property {Array.<number>} [axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  48536. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  48537. * @property {SuperMap.Feature.ShapeParameters.Line.style} xReferenceLineStyle - 水平参考线样式。
  48538. * @property {Object} barStyle - 柱状图柱条基础 style,此参数控制柱条基础样式,优先级低于 barStyleByFields 和 barStyleByCodomain。
  48539. * @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。
  48540. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} barStyleByCodomain - 按柱条代表的数据值所在值域范围控制柱条样式,优先级高于 barStyle 和 barStyleByFields。
  48541. * @property {Object} [barHoverStyle] - 柱条 hover 状态时的样式,barHoverAble 为 true 时有效。
  48542. * @property {Object} [barHoverAble] - 是否允许柱条使用 hover 状态,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  48543. * @property {Object} [barClickAble] - 是否允许柱条被点击,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  48544. */
  48545. SuperMap.Feature.Theme.Bar = Bar;
  48546. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  48547. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48548. * This program are made available under the terms of the Apache License, Version 2.0
  48549. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48550. /**
  48551. * @class SuperMap.Feature.Theme.Bar3D
  48552. * @classdesc 三维柱状图 。
  48553. * @category Visualization Theme
  48554. * @extends SuperMap.Feature.Theme.Graph
  48555. * @param {SuperMap.Feature.Vector} data - 用户数据。
  48556. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  48557. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  48558. * @param {SuperMap.Feature.Theme.Bar3D.setting} setting - 图表配置对象。
  48559. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  48560. *
  48561. *
  48562. * @example
  48563. * // barFaceStyleByCodomain 用法示例如下:
  48564. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  48565. * // start: 值域值下限(包含);
  48566. * // end: 值域值上限(不包含);
  48567. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  48568. * // barFaceStyleByCodomain 数组形如:
  48569. * [
  48570. * {
  48571. * start:0,
  48572. * end:250,
  48573. * style:{
  48574. * fillColor:"#00CD00"
  48575. * }
  48576. * },
  48577. * {
  48578. * start:250,
  48579. * end:500,
  48580. * style:{
  48581. * fillColor:"#00EE00"
  48582. * }
  48583. * },
  48584. * {
  48585. * start:500,
  48586. * end:750,
  48587. * style:{
  48588. * fillColor:"#00FF7F"
  48589. * }
  48590. * },
  48591. * {
  48592. * start:750,
  48593. * end:1500,
  48594. * style:{
  48595. * fillColor:"#00FF00"
  48596. * }
  48597. * }
  48598. * ]
  48599. *
  48600. * @example
  48601. * // barSideStyleByCodomain 用法示例如下:
  48602. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  48603. * // start: 值域值下限(包含);
  48604. * // end: 值域值上限(不包含);
  48605. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  48606. * // barSideStyleByCodomain 数组形如:
  48607. * [
  48608. * {
  48609. * start:0,
  48610. * end:250,
  48611. * style:{
  48612. * fillColor:"#00CD00"
  48613. * }
  48614. * },
  48615. * {
  48616. * start:250,
  48617. * end:500,
  48618. * style:{
  48619. * fillColor:"#00EE00"
  48620. * }
  48621. * },
  48622. * {
  48623. * start:500,
  48624. * end:750,
  48625. * style:{
  48626. * fillColor:"#00FF7F"
  48627. * }
  48628. * },
  48629. * {
  48630. * start:750,
  48631. * end:1500,
  48632. * style:{
  48633. * fillColor:"#00FF00"
  48634. * }
  48635. * }
  48636. * ]
  48637. *
  48638. * @example
  48639. * // barTopStyleByCodomain 用法示例如下:
  48640. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  48641. * // start: 值域值下限(包含);
  48642. * // end: 值域值上限(不包含);
  48643. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<SuperMap.Feature.ShapeParameters.Polygon.style> 。
  48644. * // barTopStyleByCodomain 数组形如:
  48645. * [
  48646. * {
  48647. * start:0,
  48648. * end:250,
  48649. * style:{
  48650. * fillColor:"#00CD00"
  48651. * }
  48652. * },
  48653. * {
  48654. * start:250,
  48655. * end:500,
  48656. * style:{
  48657. * fillColor:"#00EE00"
  48658. * }
  48659. * },
  48660. * {
  48661. * start:500,
  48662. * end:750,
  48663. * style:{
  48664. * fillColor:"#00FF7F"
  48665. * }
  48666. * },
  48667. * {
  48668. * start:750,
  48669. * end:1500,
  48670. * style:{
  48671. * fillColor:"#00FF00"
  48672. * }
  48673. * }
  48674. * ]
  48675. */
  48676. class Bar3D extends Graph {
  48677. constructor(data, layer, fields, setting, lonlat) {
  48678. super(data, layer, fields, setting, lonlat);
  48679. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  48680. }
  48681. /**
  48682. * @function SuperMap.Feature.Theme.Bar3D.prototype.destroy
  48683. * @override
  48684. */
  48685. destroy() {
  48686. super.destroy();
  48687. }
  48688. /**
  48689. * @function SuperMap.Feature.Theme.Bar3D.prototype.assembleShapes
  48690. * @description 图形装配实现(扩展接口)。
  48691. */
  48692. assembleShapes() {
  48693. // 图表配置对象
  48694. var sets = this.setting;
  48695. // 默认数据视图框
  48696. if (!sets.dataViewBoxParameter) {
  48697. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  48698. sets.dataViewBoxParameter = [45, 25, 20, 20];
  48699. } else {
  48700. sets.dataViewBoxParameter = [5, 5, 5, 5];
  48701. }
  48702. }
  48703. // 3d 柱图的坐标轴默认使用坐标轴箭头
  48704. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  48705. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  48706. // 重要步骤:初始化参数
  48707. if (!this.initBaseParameter()) {
  48708. return;
  48709. }
  48710. // 值域
  48711. var codomain = this.DVBCodomain;
  48712. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  48713. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  48714. // 数据视图域
  48715. var dvb = this.dataViewBox;
  48716. // 用户数据值
  48717. var fv = this.dataValues;
  48718. if (fv.length < 1) {
  48719. return;
  48720. } // 没有数据
  48721. // 数据溢出值域范围处理
  48722. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  48723. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  48724. return;
  48725. }
  48726. }
  48727. // 获取 x 轴上的图形信息
  48728. var xShapeInfo = this.calculateXShapeInfo();
  48729. if (!xShapeInfo) {
  48730. return;
  48731. }
  48732. // 每个柱条 x 位置
  48733. var xsLoc = xShapeInfo.xPositions;
  48734. // 柱条宽度
  48735. var xsWdith = xShapeInfo.width;
  48736. // 坐标轴, 默认启用
  48737. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  48738. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  48739. }
  48740. // 坐标轴
  48741. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  48742. sets.axis3DParameter = 20;
  48743. }
  48744. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  48745. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  48746. }
  48747. // 3d 偏移量, 默认值 10;
  48748. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  48749. for (let i = 0; i < fv.length; i++) {
  48750. // 无 3d 偏移量时的柱面顶部 y 坐标
  48751. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  48752. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  48753. var iPoiL = xsLoc[i] - xsWdith / 2;
  48754. var iPoiR = xsLoc[i] + xsWdith / 2;
  48755. // 3d 柱顶面节点
  48756. var bar3DTopPois = [
  48757. [iPoiL, yPx],
  48758. [iPoiR, yPx],
  48759. [iPoiR - offset3d, yPx + offset3d],
  48760. [iPoiL - offset3d, yPx + offset3d]
  48761. ];
  48762. // 3d 柱侧面节点
  48763. var bar3DSidePois = [
  48764. [iPoiR, yPx],
  48765. [iPoiR - offset3d, yPx + offset3d],
  48766. [iPoiR - offset3d, dvb[1] + offset3d],
  48767. [iPoiR, dvb[1]]
  48768. ];
  48769. // 3d 柱正面节点
  48770. var bar3DFacePois = [
  48771. [iPoiL - offset3d, dvb[1] + offset3d],
  48772. [iPoiR - offset3d, dvb[1] + offset3d],
  48773. [iPoiR - offset3d, yPx + offset3d],
  48774. [iPoiL - offset3d, yPx + offset3d]
  48775. ];
  48776. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  48777. bar3DFacePois = [
  48778. [iPoiL, dvb[1]],
  48779. [iPoiR, dvb[1]],
  48780. [iPoiR, yPx],
  48781. [iPoiL, yPx]
  48782. ];
  48783. }
  48784. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  48785. var polyTopSP = new Polygon_Polygon(bar3DTopPois);
  48786. var polySideSP = new Polygon_Polygon(bar3DSidePois);
  48787. var polyFaceSP = new Polygon_Polygon(bar3DFacePois);
  48788. // 侧面、正面图形 style 默认值
  48789. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  48790. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  48791. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  48792. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  48793. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  48794. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  48795. // 顶面、侧面、正面图形 style
  48796. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  48797. stroke: true,
  48798. strokeColor: "#ffffff",
  48799. fillColor: "#ee9900"
  48800. },
  48801. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  48802. polySideSP.style = ShapeFactory.ShapeStyleTool({
  48803. stroke: true,
  48804. strokeColor: "#ffffff",
  48805. fillColor: "#ee9900"
  48806. },
  48807. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  48808. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  48809. stroke: true,
  48810. strokeColor: "#ffffff",
  48811. fillColor: "#ee9900"
  48812. },
  48813. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  48814. // 3d 柱条高亮样式
  48815. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  48816. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  48817. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  48818. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  48819. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  48820. // 图形携带的数据 id 信息 & 高亮模式
  48821. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  48822. // hover 模式(组合)
  48823. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  48824. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  48825. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util.createUniqueID("lr_shg");
  48826. // 图形携带的数据信息
  48827. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  48828. field: this.fields[i],
  48829. value: fv[i]
  48830. };
  48831. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  48832. if (typeof(sets.barHoverAble) !== "undefined") {
  48833. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  48834. }
  48835. if (typeof(sets.barClickAble) !== "undefined") {
  48836. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  48837. }
  48838. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  48839. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  48840. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  48841. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  48842. }
  48843. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  48844. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  48845. this.shapesConvertToRelativeCoordinate();
  48846. }
  48847. /**
  48848. * @function SuperMap.Feature.Theme.Bar3D.prototype.calculateXShapeInfo
  48849. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  48850. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  48851. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  48852. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  48853. * 本函数中图形配置对象 setting 可设属性:
  48854. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  48855. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  48856. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  48857. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  48858. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  48859. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  48860. */
  48861. calculateXShapeInfo() {
  48862. var dvb = this.dataViewBox; // 数据视图框
  48863. var sets = this.setting; // 图表配置对象
  48864. var fvc = this.dataValues.length; // 数组值个数
  48865. if (fvc < 1) {
  48866. return null;
  48867. }
  48868. var xBlank; // x 轴空白间隔参数
  48869. var xShapePositions = []; // x 轴上图形的位置
  48870. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  48871. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  48872. // x 轴空白间隔参数处理
  48873. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  48874. xBlank = sets.xShapeBlank;
  48875. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  48876. if (xsLen <= fvc) {
  48877. return null;
  48878. }
  48879. xShapeWidth = xsLen / fvc
  48880. } else {
  48881. // 默认使用等距离空白间隔,空白间隔为图形宽度
  48882. xShapeWidth = dvbWidth / (2 * fvc + 1);
  48883. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  48884. }
  48885. // 图形 x 轴上的位置计算
  48886. var xOffset = 0
  48887. for (var i = 0; i < fvc; i++) {
  48888. if (i == 0) {
  48889. xOffset = xBlank[0] + xShapeWidth / 2;
  48890. } else {
  48891. xOffset += (xShapeWidth + xBlank[1]);
  48892. }
  48893. xShapePositions.push(dvb[0] + xOffset);
  48894. }
  48895. return {
  48896. "xPositions": xShapePositions,
  48897. "width": xShapeWidth
  48898. };
  48899. }
  48900. }
  48901. /**
  48902. * @typedef {Object} SuperMap.Feature.Theme.Bar3D.setting
  48903. * @property {number} width - 专题要素(图表)宽度。
  48904. * @property {number} height - 专题要素(图表)高度。
  48905. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  48906. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  48907. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  48908. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 25, 20, 20];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  48909. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  48910. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  48911. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  48912. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  48913. * @property {Array.<number>} [xShapeBlank] - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  48914. * @property {number} [bar3DParameter=10] - 3D 柱状参数,3d柱形正面相对于背面向 x 轴和 y 轴负方向偏移的绝对值。
  48915. * @property {boolean} [useAxis=true] - 是否使用坐标轴。
  48916. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  48917. * @property {boolean} [axisUseArrow=true] -坐标轴是否使用箭头。
  48918. * @property {number} [axisYTick=0] - y 轴刻度数量。
  48919. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  48920. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  48921. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  48922. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  48923. * @property {SuperMap.Feature.ShapeParameters.Label.style} axisXLabelsStyle - x 轴上的标签组样式。
  48924. * @property {Array.<number>} axisXLabelsOffset - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:-10;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:10。
  48925. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  48926. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  48927. * @property {number} [axis3DParameter=20] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  48928. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} barFaceStyle - 3d 柱状图柱条正面基础 style,此参数控制柱条正面基础样式,优先级低于 barFaceStyleByFields 和 barFaceStyleByCodomain。
  48929. * @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。
  48930. * @property {Array.<Object>} [barFaceStyleByCodomain] - 按柱条正面代表的数据值所在值域范围控制柱条正面样式,优先级高于 barFaceStyle 和 barFaceStyleByFields。
  48931. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barSideStyle=barFaceStyle] - 3d 柱状图柱条侧面基础 style,此参数控制柱条侧面基础样式,优先级低于 barSideStyleByFields 和 barSideStyleByCodomain。
  48932. * @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。
  48933. * @property {Array.<Object>} [barSideStyleByCodomain=barFaceStyleByCodomain] - 按柱条侧面代表的数据值所在值域范围控制柱条侧面样式,优先级高于 barSideStyle 和 barSideStyleByFields。
  48934. * @property {Object} [barFaceHoverStyle] - 3d 柱条正面 hover 状态时的样式,barHoverAble 为 true 时有效。
  48935. * @property {Object} [barSideHoverStyle=barFaceHoverStyle] - 3d 柱条侧面 hover 状态时的样式,barHoverAble 为 true 时有效。
  48936. * @property {Object} [barTopHoverStyle=barFaceHoverStyle] - 3d 柱条顶面 hover 状态时的样式,barHoverAble 为 true 时有效。
  48937. * @property {boolean} [barHoverAble=true] - 是否允许柱条使用 hover 状态。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  48938. * @property {boolean} [barClickAble=true] - 是否允许柱条被点击。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  48939. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barTopStyle=barFaceStyle] - 3d 柱状图柱条顶面基础 style,此参数控制柱条顶面基础样式,优先级低于 barTopStyleByFields 和 barTopStyleByCodomain。
  48940. * @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。
  48941. * @property {Array.<Object>} [barTopStyleByCodomain=barFaceStyleByCodomain] - 按柱条顶面代表的数据值所在值域范围控制柱条顶面样式,优先级高于 barTopStyle 和 barTopStyleByFields。
  48942. */
  48943. SuperMap.Feature.Theme.Bar3D = Bar3D;
  48944. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  48945. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48946. * This program are made available under the terms of the Apache License, Version 2.0
  48947. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48948. /**
  48949. * @class SuperMap.Feature.Theme.RankSymbol
  48950. * @classdesc 符号专题要素基类。
  48951. * @category Visualization Theme
  48952. * @description 此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  48953. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.RankSymbol.setting> 的基础属性只有 5 个,
  48954. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  48955. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  48956. * @param {SuperMap.Feature.Vector} data - 用户数据。
  48957. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  48958. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  48959. * @param {Object} setting - 图表配置对象。
  48960. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  48961. *
  48962. * @extends SuperMap.Feature.Theme.Graph
  48963. *
  48964. */
  48965. class RankSymbol extends Graph {
  48966. constructor(data, layer, fields, setting, lonlat, options) {
  48967. super(data, layer, fields, setting, lonlat, options);
  48968. /**
  48969. * @member SuperMap.Feature.Theme.RankSymbol.prototype.setting -{Object}
  48970. * @description 符号配置对象,该对象控制着图表的可视化显示。
  48971. * 下面是此配置对象的 5 个基础可设属性:<br>
  48972. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  48973. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  48974. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  48975. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  48976. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  48977. * 除了以上 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同。
  48978. * 请在此类的子类中查看 setting 对象的可设属性和属性含义。
  48979. */
  48980. this.setting = null;
  48981. // 配置项检测与赋值
  48982. if (setting && setting.codomain) {
  48983. this.setting = setting;
  48984. this.DVBCodomain = this.setting.codomain;
  48985. }
  48986. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  48987. }
  48988. /**
  48989. * @function SuperMap.Feature.Theme.RankSymbol.prototype.destroy
  48990. * @description 销毁专题要素。
  48991. */
  48992. destroy() {
  48993. this.setting = null;
  48994. super.destroy();
  48995. }
  48996. /**
  48997. * @function SuperMap.Feature.Theme.RankSymbol.prototype.initBaseParameter
  48998. * @description 初始化专题要素(图形)基础参数。
  48999. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  49000. * 调用此函数关系到 setting 对象的以下属性。
  49001. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49002. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  49003. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  49004. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49005. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49006. * @returns {boolean} 初始化参数是否成功。
  49007. */
  49008. initBaseParameter() {
  49009. // 参数初始化是否成功
  49010. var isSuccess = true;
  49011. // setting 属性是否已成功赋值
  49012. if (!this.setting) {
  49013. return false;
  49014. }
  49015. var sets = this.setting;
  49016. // 图表偏移
  49017. if (sets.XOffset) {
  49018. this.XOffset = sets.XOffset;
  49019. }
  49020. if (sets.YOffset) {
  49021. this.YOffset = sets.YOffset;
  49022. }
  49023. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  49024. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  49025. // 其他默认值
  49026. this.origonPoint = [];
  49027. this.chartBox = [];
  49028. this.dataViewBox = [];
  49029. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  49030. this.DVBOrigonPoint = [];
  49031. this.DVBCenterPoint = [];
  49032. this.origonPointOffset = [];
  49033. // 图表位置
  49034. this.resetLocation();
  49035. // 专题要素宽度 w
  49036. var w = this.width;
  49037. // 专题要素高度 h
  49038. var h = this.height;
  49039. // 专题要素像素位置 loc
  49040. var loc = this.location;
  49041. // 专题要素像素位置 loc
  49042. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  49043. // 专题要素原点(左上角)
  49044. var op = this.origonPoint;
  49045. // 图表框([left, bottom, right, top])
  49046. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  49047. // 图表框
  49048. var cb = this.chartBox;
  49049. // 数据视图框参数,它是图表框各方向对应的内偏距
  49050. var dbbP = this.DVBParameter;
  49051. // 数据视图框 ([left, bottom, right, top])
  49052. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  49053. // 数据视图框
  49054. var dvb = this.dataViewBox;
  49055. //检查数据视图框是否合法
  49056. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  49057. return false;
  49058. }
  49059. // 数据视图框原点
  49060. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  49061. // 数据视图框宽度
  49062. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  49063. // 数据视图框高度
  49064. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  49065. // 数据视图框中心点
  49066. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  49067. // 数据视图框原点与图表框的原点偏移量
  49068. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  49069. return isSuccess;
  49070. }
  49071. }
  49072. SuperMap.Feature.Theme.RankSymbol = RankSymbol;
  49073. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  49074. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49075. * This program are made available under the terms of the Apache License, Version 2.0
  49076. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49077. /**
  49078. * @class SuperMap.Feature.Theme.Circle
  49079. * @classdesc 圆类。
  49080. * @category Visualization Theme
  49081. * @extends SuperMap.Feature.Theme.RankSymbol
  49082. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49083. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  49084. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49085. * @param {SuperMap.Feature.Theme.Circle.setting} setting - 图表配置对象。
  49086. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  49087. */
  49088. class Circle extends RankSymbol {
  49089. constructor(data, layer, fields, setting, lonlat) {
  49090. super(data, layer, fields, setting, lonlat);
  49091. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  49092. }
  49093. /**
  49094. * @function SuperMap.Feature.Theme.Circle.prototype.destroy
  49095. * @override
  49096. */
  49097. destroy() {
  49098. super.destroy();
  49099. }
  49100. /**
  49101. * @function SuperMap.Feature.Theme.Circle.prototype.assembleShapes
  49102. * @description 装配图形(扩展接口)。
  49103. */
  49104. assembleShapes() {
  49105. //默认填充颜色
  49106. var defaultFillColor = "#ff9277";
  49107. // setting 属性是否已成功赋值
  49108. if (!this.setting) {
  49109. return false;
  49110. }
  49111. var sets = this.setting;
  49112. // 检测 setting 的必设参数
  49113. if (!(sets.codomain)) {
  49114. return false;
  49115. }
  49116. // 数据
  49117. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  49118. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  49119. this.dataValues = dataEffective ? dataEffective : [];
  49120. // 数据值数组
  49121. var fv = this.dataValues;
  49122. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  49123. //if(fv[0] < 0) return; //数据为负值
  49124. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  49125. if (!sets.maxR) {
  49126. sets.maxR = 100;
  49127. }
  49128. if (!sets.minR) {
  49129. sets.minR = 0;
  49130. }
  49131. // 值域范围
  49132. var codomain = this.DVBCodomain;
  49133. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  49134. // 用户定义了值域范围
  49135. if (codomain && codomain[1] - codomain[0] > 0) {
  49136. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  49137. } else {
  49138. //this.DVBUnitValue = sets.maxR / maxValue;
  49139. this.DVBUnitValue = sets.maxR;
  49140. }
  49141. var uv = this.DVBUnitValue;
  49142. //圆半径
  49143. var r = fv[0] * uv + sets.minR;
  49144. this.width = 2 * r;
  49145. this.height = 2 * r;
  49146. // 重要步骤:初始化参数
  49147. if (!this.initBaseParameter()) {
  49148. return;
  49149. }
  49150. //假如用户设置了值域范围 没有在值域范围直接返回
  49151. if (codomain) {
  49152. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  49153. return;
  49154. }
  49155. }
  49156. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  49157. //圆形对象参数
  49158. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  49159. //circleSP.sytle 初始化
  49160. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  49161. //图形的填充颜色
  49162. if (typeof (sets.fillColor) !== "undefined") {
  49163. //用户自定义
  49164. circleSP.style.fillColor = sets.fillColor;
  49165. } else {
  49166. //当前默认
  49167. circleSP.style.fillColor = defaultFillColor;
  49168. }
  49169. //圆形 Hover样式
  49170. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  49171. //圆形 Hover 与 click 设置
  49172. if (typeof(sets.circleHoverAble) !== "undefined") {
  49173. circleSP.hoverable = sets.circleHoverAble;
  49174. }
  49175. if (typeof(sets.circleClickAble) !== "undefined") {
  49176. circleSP.clickable = sets.circleClickAble;
  49177. }
  49178. //图形携带的数据信息
  49179. circleSP.refDataID = this.data.id;
  49180. circleSP.dataInfo = {
  49181. field: this.fields[0],
  49182. r: r,
  49183. value: fv[0]
  49184. };
  49185. // 创建扇形并把此扇形添加到图表图形数组
  49186. this.shapes.push(this.shapeFactory.createShape(circleSP));
  49187. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49188. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49189. this.shapesConvertToRelativeCoordinate();
  49190. }
  49191. }
  49192. /**
  49193. * @typedef {Object} SuperMap.Feature.Theme.Circle.setting
  49194. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49195. * @property {number} [maxR] - 圆形的最大半径。
  49196. * @property {number} [minR] - 圆形的最小半径。
  49197. * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  49198. * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  49199. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49200. * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  49201. * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  49202. * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  49203. *
  49204. */
  49205. SuperMap.Feature.Theme.Circle = Circle;
  49206. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  49207. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49208. * This program are made available under the terms of the Apache License, Version 2.0
  49209. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49210. /**
  49211. * @class SuperMap.Feature.Theme.Line
  49212. * @classdesc 折线图。
  49213. * @category Visualization Theme
  49214. * @example
  49215. * // pointStyleByCodomain 参数用法示例
  49216. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49217. * // start: 值域值下限(包含);
  49218. * // end: 值域值上限(不包含);
  49219. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  49220. * // pointStyleByCodomain 数组形如:
  49221. * [
  49222. * {
  49223. * start:0,
  49224. * end:250,
  49225. * style:{
  49226. * fillColor:"#00CD00"
  49227. * }
  49228. * },
  49229. * {
  49230. * start:250,
  49231. * end:500,
  49232. * style:{
  49233. * fillColor:"#00EE00"
  49234. * }
  49235. * },
  49236. * {
  49237. * start:500,
  49238. * end:750,
  49239. * style:{
  49240. * fillColor:"#00FF7F"
  49241. * }
  49242. * },
  49243. * {
  49244. * start:750,
  49245. * end:1500,
  49246. * style:{
  49247. * fillColor:"#00FF00"
  49248. * }
  49249. * }
  49250. * ]
  49251. *
  49252. * @extends SuperMap.Feature.Theme.Graph
  49253. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49254. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49255. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49256. * @param {SuperMap.Feature.Theme.Line.setting} setting - 图表配置对象。
  49257. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49258. */
  49259. class Line extends Graph {
  49260. constructor(data, layer, fields, setting, lonlat, options) {
  49261. super(data, layer, fields, setting, lonlat, options);
  49262. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  49263. }
  49264. /**
  49265. * @function SuperMap.Feature.Theme.Line.prototype.destroy
  49266. * @override
  49267. */
  49268. destroy() {
  49269. super.destroy();
  49270. }
  49271. /**
  49272. * @function SuperMap.Feature.Theme.Line.prototype.assembleShapes
  49273. * @description 装配图形(扩展接口)。
  49274. */
  49275. assembleShapes() {
  49276. // 图表配置对象
  49277. var sets = this.setting;
  49278. // 默认数据视图框
  49279. if (!sets.dataViewBoxParameter) {
  49280. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49281. sets.dataViewBoxParameter = [45, 15, 15, 15];
  49282. } else {
  49283. sets.dataViewBoxParameter = [5, 5, 5, 5];
  49284. }
  49285. }
  49286. // 重要步骤:初始化参数
  49287. if (!this.initBaseParameter()) {
  49288. return;
  49289. }
  49290. var dvb = this.dataViewBox;
  49291. // 值域
  49292. var codomain = this.DVBCodomain;
  49293. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  49294. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  49295. var uv = this.DVBUnitValue;
  49296. // 数据值数组
  49297. var fv = this.dataValues;
  49298. if (fv.length < 1) {
  49299. return;
  49300. } // 没有数据
  49301. // 获取 x 轴上的图形信息
  49302. var xShapeInfo = this.calculateXShapeInfo();
  49303. if (!xShapeInfo) {
  49304. return;
  49305. }
  49306. // 折线每个节点的 x 位置
  49307. var xsLoc = xShapeInfo.xPositions;
  49308. // 背景框,默认启用
  49309. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  49310. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  49311. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49312. }
  49313. // 折线图必须使用坐标轴
  49314. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  49315. // var isDataEffective = true;
  49316. var xPx; // 折线节点 x 坐标
  49317. var yPx; // 折线节点 y 坐标
  49318. var poiLists = []; // 折线节点数组
  49319. var shapePois = []; // 折线节点图形数组
  49320. for (var i = 0, len = fv.length; i < len; i++) {
  49321. // 数据溢出值域检查
  49322. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49323. // isDataEffective = false;
  49324. return null;
  49325. }
  49326. xPx = xsLoc[i];
  49327. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  49328. // 折线节点参数对象
  49329. var poiSP = new Point_Point(xPx, yPx);
  49330. // 折线节点 style
  49331. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  49332. // 折线节点 hover 样式
  49333. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  49334. // 折线节点 hover click
  49335. if (typeof(sets.pointHoverAble) !== "undefined") {
  49336. poiSP.hoverable = sets.pointHoverAble;
  49337. }
  49338. if (typeof(sets.pointClickAble) !== "undefined") {
  49339. poiSP.clickable = sets.pointClickAble;
  49340. }
  49341. // 图形携带的数据信息
  49342. poiSP.refDataID = this.data.id;
  49343. poiSP.dataInfo = {
  49344. field: this.fields[i],
  49345. value: fv[i]
  49346. };
  49347. // 创建图形并把此图形添加到折线节点图形数组
  49348. shapePois.push(this.shapeFactory.createShape(poiSP));
  49349. // 添加折线节点到折线节点数组
  49350. var poi = [xPx, yPx];
  49351. poiLists.push(poi);
  49352. }
  49353. // 折线参数对象
  49354. var lineSP = new Line_Line(poiLists);
  49355. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  49356. // 禁止事件响应
  49357. lineSP.clickable = false;
  49358. lineSP.hoverable = false;
  49359. var shapeLine = this.shapeFactory.createShape(lineSP);
  49360. this.shapes.push(shapeLine);
  49361. // 添加节点到图表图形数组
  49362. this.shapes = this.shapes.concat(shapePois);
  49363. // // 数据范围检测未通过,清空图形
  49364. // if (isDataEffective === false) {
  49365. // this.shapes = [];
  49366. // }
  49367. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49368. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49369. this.shapesConvertToRelativeCoordinate();
  49370. }
  49371. /**
  49372. * @function SuperMap.Feature.Theme.Line.prototype.calculateXShapeInfo
  49373. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  49374. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  49375. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49376. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49377. * 本函数中图形配置对象 setting 可设属性:<br>
  49378. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  49379. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  49380. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  49381. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  49382. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49383. */
  49384. calculateXShapeInfo() {
  49385. var dvb = this.dataViewBox; // 数据视图框
  49386. var sets = this.setting; // 图表配置对象
  49387. var fvc = this.dataValues.length; // 数组值个数
  49388. if (fvc < 1) {
  49389. return null;
  49390. }
  49391. var xBlank; // x 轴空白间隔参数
  49392. var xShapePositions = []; // x 轴上图形的位置
  49393. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  49394. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  49395. var unitOffset = 0; // 单位偏移量
  49396. // x 轴空白间隔参数处理
  49397. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  49398. xBlank = sets.xShapeBlank;
  49399. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  49400. if (xsLen <= fvc) {
  49401. return null;
  49402. }
  49403. unitOffset = xsLen / (fvc - 1);
  49404. } else {
  49405. // 默认使用等距离空白间隔,空白间隔为图形宽度
  49406. unitOffset = dvbWidth / (fvc + 1);
  49407. xBlank = [unitOffset, unitOffset, unitOffset];
  49408. }
  49409. // 图形 x 轴上的位置计算
  49410. var xOffset = 0
  49411. for (var i = 0; i < fvc; i++) {
  49412. if (i == 0) {
  49413. xOffset = xBlank[0];
  49414. } else {
  49415. xOffset += unitOffset;
  49416. }
  49417. xShapePositions.push(dvb[0] + xOffset);
  49418. }
  49419. return {
  49420. "xPositions": xShapePositions,
  49421. "width": xShapeWidth
  49422. };
  49423. }
  49424. }
  49425. /**
  49426. * @typedef {Object} SuperMap.Feature.Theme.Line.setting
  49427. * @property {number} width - 专题要素(图表)宽度。
  49428. * @property {number} height - 专题要素(图表)高度。
  49429. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49430. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49431. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49432. * @property {Array.<number>} [dataViewBoxParameter] - {Array.<number>} 数据视图框 dataViewBox 参数,
  49433. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49434. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  49435. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49436. * @property {boolean} [useBackground] - 是否使用图表背景框。
  49437. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  49438. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  49439. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  49440. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 2 的数组,第一元素表示折线左端点与数据视图框左端的空白间距,
  49441. * 第二个元素表示折线右端点右端与数据视图框右端端的空白间距。
  49442. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  49443. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  49444. * @property {number} [axisYTick=0] - y 轴刻度数量。
  49445. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  49446. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  49447. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正。
  49448. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  49449. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  49450. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  49451. * 否则沿数据视图框下面条边等距排布标签。
  49452. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  49453. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;
  49454. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正;
  49455. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  49456. * @property {SuperMap.Feature.ShapeParameters.Line.style} ]xReferenceLineStyle] - 水平参考线样式。
  49457. * @property {SuperMap.Feature.ShapeParameters.Line.style} [lineStyle] - 折线图中折线 style。
  49458. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 折线图中折线节点基础 style,此参数控制折线节点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  49459. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为折线节点赋 style,此参数按字段控制折线节点样式,
  49460. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  49461. * 此参数中的 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"],
  49462. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的折线节点使用 style1,字段 POP_1995 对应的折线节点使用 style2 ,字段 POP_1999 对应的折线节点使用 style3。
  49463. * @property {Array.<Object>} pointStyleByCodomain - 按折线节点代表的数据值所在值域范围控制折线节点样式,优先级高于 pointStyle 和 pointStyleByFields。
  49464. * @property {Object} [pointHoverStyle=true] - 折线节点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  49465. * @property {boolean} [pointHoverAble=true] - 是否允许折线节点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  49466. * @property {boolean} [pointClickAble=true] - 是否允许折线节点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  49467. */
  49468. SuperMap.Feature.Theme.Line = Line;
  49469. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  49470. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49471. * This program are made available under the terms of the Apache License, Version 2.0
  49472. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49473. /**
  49474. * @class SuperMap.Feature.Theme.Pie
  49475. * @classdesc 饼图。
  49476. * @category Visualization Theme
  49477. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49478. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49479. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49480. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  49481. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49482. * @extends SuperMap.Feature.Theme.Graph
  49483. * @example
  49484. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49485. * // start: 值域值下限(包含);
  49486. * // end: 值域值上限(不包含);
  49487. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  49488. * // sectorStyleByCodomain 数组形如:
  49489. * [
  49490. * {
  49491. * start:0,
  49492. * end:250,
  49493. * style:{
  49494. * fillColor:"#00CD00"
  49495. * }
  49496. * },
  49497. * {
  49498. * start:250,
  49499. * end:500,
  49500. * style:{
  49501. * fillColor:"#00EE00"
  49502. * }
  49503. * },
  49504. * {
  49505. * start:500,
  49506. * end:750,
  49507. * style:{
  49508. * fillColor:"#00FF7F"
  49509. * }
  49510. * },
  49511. * {
  49512. * start:750,
  49513. * end:1500,
  49514. * style:{
  49515. * fillColor:"#00FF00"
  49516. * }
  49517. * }
  49518. * ]
  49519. * @extends {SuperMap.Feature.Theme.Graph}
  49520. */
  49521. class Pie extends Graph {
  49522. constructor(data, layer, fields, setting, lonlat) {
  49523. super(data, layer, fields, setting, lonlat);
  49524. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  49525. }
  49526. /**
  49527. * @function SuperMap.Feature.Theme.Pie.prototype.destroy
  49528. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  49529. */
  49530. destroy() {
  49531. super.destroy();
  49532. }
  49533. /**
  49534. * @function SuperMap.Feature.Theme.Pie.prototype.assembleShapes
  49535. * @description 装配图形(扩展接口)。
  49536. */
  49537. assembleShapes() {
  49538. // 图表配置对象
  49539. var sets = this.setting;
  49540. // 一个默认 style 组
  49541. var defaultStyleGroup = [
  49542. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  49543. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  49544. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  49545. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  49546. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  49547. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  49548. ];
  49549. // 重要步骤:初始化参数
  49550. if (!this.initBaseParameter()) {
  49551. return;
  49552. }
  49553. // 背景框,默认不启用
  49554. if (sets.useBackground) {
  49555. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49556. }
  49557. // 数据值数组
  49558. var fv = this.dataValues;
  49559. if (fv.length < 1) {
  49560. return;
  49561. } // 没有数据
  49562. // 值域范围
  49563. var codomain = this.DVBCodomain;
  49564. // 值域范围检测
  49565. for (let i = 0; i < fv.length; i++) {
  49566. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49567. return;
  49568. }
  49569. }
  49570. // 值的绝对值总和
  49571. var valueSum = 0;
  49572. for (let i = 0; i < fv.length; i++) {
  49573. valueSum += Math.abs(fv[i]);
  49574. }
  49575. // 重要步骤:定义图表 Pie 数据视图框中单位值的含义,单位值:每度代表的数值
  49576. this.DVBUnitValue = 360 / valueSum;
  49577. var uv = this.DVBUnitValue;
  49578. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  49579. var startAngle = 0; // 扇形起始边角度
  49580. var endAngle = 0; // 扇形终止边角度
  49581. var startAngleTmp = startAngle; // 扇形临时起始边角度
  49582. // 扇形(自适应)半径
  49583. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  49584. for (var i = 0; i < fv.length; i++) {
  49585. var fvi = Math.abs(fv[i]);
  49586. //计算终止角
  49587. if (i === 0) {
  49588. endAngle = startAngle + fvi * uv;
  49589. } else if (i === fvi.length - 1) {
  49590. endAngle = startAngleTmp;
  49591. } else {
  49592. endAngle = startAngle + fvi * uv;
  49593. }
  49594. //矫正误差计算
  49595. if ((endAngle - startAngle) >= 360) {
  49596. endAngle = 359.9999999;
  49597. }
  49598. // 扇形参数对象
  49599. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  49600. // 扇形样式
  49601. if (typeof(sets.sectorStyleByFields) === "undefined") {
  49602. // 使用默认 style 组
  49603. var colorIndex = i % defaultStyleGroup.length;
  49604. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  49605. } else {
  49606. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  49607. }
  49608. // 扇形 hover 样式
  49609. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  49610. // 扇形 hover 与 click 设置
  49611. if (typeof(sets.sectorHoverAble) !== "undefined") {
  49612. sectorSP.hoverable = sets.sectorHoverAble;
  49613. }
  49614. if (typeof(sets.sectorClickAble) !== "undefined") {
  49615. sectorSP.clickable = sets.sectorClickAble;
  49616. }
  49617. // 图形携带的数据信息
  49618. sectorSP.refDataID = this.data.id;
  49619. sectorSP.dataInfo = {
  49620. field: this.fields[i],
  49621. value: fv[i]
  49622. };
  49623. // 创建扇形并把此扇形添加到图表图形数组
  49624. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  49625. // 把上一次的结束角度作为下一次的起始角度
  49626. startAngle = endAngle;
  49627. }
  49628. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49629. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49630. this.shapesConvertToRelativeCoordinate();
  49631. }
  49632. }
  49633. /**
  49634. * @typedef {Object} SuperMap.Feature.Theme.Pie.setting
  49635. * @property {number} width - 专题要素(图表)宽度。
  49636. * @property {number} height - 专题要素(图表)高度。
  49637. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49638. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49639. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49640. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,
  49641. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49642. * @property {Array.<number>} decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49643. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  49644. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  49645. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  49646. * @property {SuperMap.Feature.ShapeParameters.Sector.style} sectorStyle - 饼图中扇形的基础 style,此参数控制饼图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  49647. * @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"],
  49648. * sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的饼图扇形使用 style1,字段 POP_1995 对应的饼图扇形使用 style2 ,字段 POP_1999 对应的饼图扇形使用 style3。
  49649. * @property {Array.<Object>} sectorStyleByCodomain - 按饼图扇形代表的数据值所在值域范围控制饼图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  49650. * @property {Object} [sectorHoverStyle] 饼图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  49651. * @property {boolean} [sectorHoverAble=true] 是否允许饼图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  49652. * @property {boolean} [sectorClickAble=true] 是否允许饼图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  49653. */
  49654. SuperMap.Feature.Theme.Pie = Pie;
  49655. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  49656. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49657. * This program are made available under the terms of the Apache License, Version 2.0
  49658. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49659. /**
  49660. * @class SuperMap.Feature.Theme.Point
  49661. * @classdesc 点状图。
  49662. * @category Visualization Theme
  49663. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49664. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49665. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49666. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  49667. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49668. * @example
  49669. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49670. * // start: 值域值下限(包含);
  49671. * // end: 值域值上限(不包含);
  49672. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  49673. * // pointStyleByCodomain 数组形如:
  49674. * [
  49675. * {
  49676. * start:0,
  49677. * end:250,
  49678. * style:{
  49679. * fillColor:"#00CD00"
  49680. * }
  49681. * },
  49682. * {
  49683. * start:250,
  49684. * end:500,
  49685. * style:{
  49686. * fillColor:"#00EE00"
  49687. * }
  49688. * },
  49689. * {
  49690. * start:500,
  49691. * end:750,
  49692. * style:{
  49693. * fillColor:"#00FF7F"
  49694. * }
  49695. * },
  49696. * {
  49697. * start:750,
  49698. * end:1500,
  49699. * style:{
  49700. * fillColor:"#00FF00"
  49701. * }
  49702. * }
  49703. * ]
  49704. *@extends {SuperMap.Feature.Theme.Graph}
  49705. */
  49706. class overlay_Point_Point extends Graph {
  49707. constructor(data, layer, fields, setting, lonlat, options) {
  49708. super(data, layer, fields, setting, lonlat, options);
  49709. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  49710. }
  49711. /**
  49712. * @function SuperMap.Feature.Theme.Point.prototype.destroy
  49713. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  49714. */
  49715. destroy() {
  49716. super.destroy();
  49717. }
  49718. /**
  49719. * @function SuperMap.Feature.Theme.prototype.Point.assembleShapes
  49720. * @description 装配图形(扩展接口)。
  49721. */
  49722. assembleShapes() {
  49723. // 图表配置对象
  49724. var sets = this.setting;
  49725. // 默认数据视图框
  49726. if (!sets.dataViewBoxParameter) {
  49727. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49728. sets.dataViewBoxParameter = [45, 15, 15, 15];
  49729. } else {
  49730. sets.dataViewBoxParameter = [5, 5, 5, 5];
  49731. }
  49732. }
  49733. // 重要步骤:初始化参数
  49734. if (!this.initBaseParameter()) {
  49735. return;
  49736. }
  49737. var dvb = this.dataViewBox;
  49738. // 值域
  49739. var codomain = this.DVBCodomain;
  49740. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  49741. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  49742. var uv = this.DVBUnitValue;
  49743. var fv = this.dataValues;
  49744. // 获取 x 轴上的图形信息
  49745. var xShapeInfo = this.calculateXShapeInfo();
  49746. if (!xShapeInfo) {
  49747. return;
  49748. }
  49749. // 折线每个节点的 x 位置
  49750. var xsLoc = xShapeInfo.xPositions;
  49751. // 背景框,默认启用
  49752. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  49753. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  49754. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49755. }
  49756. // 点状图必须使用坐标轴
  49757. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  49758. var xPx; // 图形点 x 坐标
  49759. var yPx; // 图形点 y 坐标
  49760. for (var i = 0, len = fv.length; i < len; i++) {
  49761. // 数据溢出值域检查
  49762. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49763. //isDataEffective = false;
  49764. return null;
  49765. }
  49766. xPx = xsLoc[i];
  49767. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  49768. // 图形点参数对象
  49769. var poiSP = new Point_Point(xPx, yPx);
  49770. // 图形点 style
  49771. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  49772. // 图形点 hover 样式
  49773. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  49774. // 图形点 hover click
  49775. if (typeof(sets.pointHoverAble) !== "undefined") {
  49776. poiSP.hoverable = sets.pointHoverAble;
  49777. }
  49778. if (typeof(sets.pointClickAble) !== "undefined") {
  49779. poiSP.clickable = sets.pointClickAble;
  49780. }
  49781. // 图形携带的数据信息
  49782. poiSP.refDataID = this.data.id;
  49783. poiSP.dataInfo = {
  49784. field: this.fields[i],
  49785. value: fv[i]
  49786. };
  49787. // 创建图形点并把此图形添加到图表图形数组
  49788. this.shapes.push(this.shapeFactory.createShape(poiSP));
  49789. }
  49790. // 数据范围检测未通过,清空图形
  49791. // if (isDataEffective === false) {
  49792. // this.shapes = [];
  49793. // }
  49794. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49795. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49796. this.shapesConvertToRelativeCoordinate();
  49797. }
  49798. /**
  49799. * @function SuperMap.Feature.Theme.Point.prototype.calculateXShapeInfo
  49800. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  49801. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  49802. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49803. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49804. * 本函数中图形配置对象 setting 可设属性:<br>
  49805. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  49806. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  49807. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  49808. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49809. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49810. */
  49811. calculateXShapeInfo() {
  49812. var dvb = this.dataViewBox; // 数据视图框
  49813. var sets = this.setting; // 图表配置对象
  49814. var fvc = this.dataValues.length; // 数组值个数
  49815. if (fvc < 1) {
  49816. return null;
  49817. }
  49818. var xBlank; // x 轴空白间隔参数
  49819. var xShapePositions = []; // x 轴上图形的位置
  49820. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  49821. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  49822. var unitOffset = 0; // 单位偏移量
  49823. // x 轴空白间隔参数处理
  49824. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  49825. xBlank = sets.xShapeBlank;
  49826. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  49827. if (xsLen <= fvc) {
  49828. return null;
  49829. }
  49830. unitOffset = xsLen / (fvc - 1);
  49831. } else {
  49832. // 默认使用等距离空白间隔,空白间隔为图形宽度
  49833. unitOffset = dvbWidth / (fvc + 1);
  49834. xBlank = [unitOffset, unitOffset, unitOffset];
  49835. }
  49836. // 图形 x 轴上的位置计算
  49837. var xOffset = 0
  49838. for (var i = 0; i < fvc; i++) {
  49839. if (i == 0) {
  49840. xOffset = xBlank[0];
  49841. } else {
  49842. xOffset += unitOffset;
  49843. }
  49844. xShapePositions.push(dvb[0] + xOffset);
  49845. }
  49846. return {
  49847. "xPositions": xShapePositions,
  49848. "width": xShapeWidth
  49849. };
  49850. }
  49851. }
  49852. /**
  49853. * @typedef {Object} SuperMap.Feature.Theme.Point.setting
  49854. * @property {number} width - 专题要素(图表)宽度。
  49855. * @property {number} height - 专题要素(图表)高度。
  49856. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49857. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49858. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49859. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,
  49860. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49861. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  49862. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49863. * @property {boolean} [useBackground] - 是否使用图表背景框。
  49864. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  49865. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  49866. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  49867. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。
  49868. * 长度为 2 的数组,第一个元素表示第一个(沿 x 轴方向)图形点与数据视图框左端的空白间距,第二个元素表示最后一个(沿 x 轴方向)图形点与数据视图框右端端的空白间距 。
  49869. * @property {Object} axisStyle - 坐标轴样式。
  49870. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  49871. * @property {number} [axisYTick=0] - y 轴刻度数量。
  49872. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  49873. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  49874. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;
  49875. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  49876. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  49877. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  49878. * 否则沿数据视图框下面条边等距排布标签。
  49879. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  49880. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,
  49881. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  49882. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  49883. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  49884. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 点状图中图形点基础 style,此参数控制图形点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  49885. * @property {Array.<SuperMap.Feature.ShapeParameters.Point.style>} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为图形点赋 style,此参数按字段控制图形点样式,
  49886. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  49887. * 此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  49888. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的图形点使用 style1,字段 POP_1995 对应的图形点使用 style2 ,字段 POP_1999 对应的图形点使用 style3。
  49889. * @property {Array.<Object>} pointStyleByCodomain - 按图形点代表的数据值所在值域范围控制图形点样式,优先级高于 pointStyle 和 pointStyleByFields。
  49890. * @property {Object} [pointHoverStyle] - 图形点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  49891. * @property {Object} [pointHoverAble=true] - 是否允许图形点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  49892. * @property {Object} [pointClickAble=true] - 是否允许图形点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  49893. */
  49894. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  49895. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  49896. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49897. * This program are made available under the terms of the Apache License, Version 2.0
  49898. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49899. /**
  49900. * @class SuperMap.Feature.Theme.Ring
  49901. * @classdesc 环状图。
  49902. * @category Visualization Theme
  49903. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  49904. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49905. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49906. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49907. * @param {SuperMap.Feature.Theme.Ring.setting} setting - 图表配置对象。
  49908. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49909. * @example
  49910. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49911. * // start: 值域值下限(包含);
  49912. * // end: 值域值上限(不包含);
  49913. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  49914. * // sectorStyleByCodomain 数组形如:
  49915. * [
  49916. * {
  49917. * start:0,
  49918. * end:250,
  49919. * style:{
  49920. * fillColor:"#00CD00"
  49921. * }
  49922. * },
  49923. * {
  49924. * start:250,
  49925. * end:500,
  49926. * style:{
  49927. * fillColor:"#00EE00"
  49928. * }
  49929. * },
  49930. * {
  49931. * start:500,
  49932. * end:750,
  49933. * style:{
  49934. * fillColor:"#00FF7F"
  49935. * }
  49936. * },
  49937. * {
  49938. * start:750,
  49939. * end:1500,
  49940. * style:{
  49941. * fillColor:"#00FF00"
  49942. * }
  49943. * }
  49944. * ]
  49945. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  49946. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  49947. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  49948. *
  49949. * @extends {SuperMap.Feature.Theme.Graph}
  49950. */
  49951. class Ring extends Graph {
  49952. constructor(data, layer, fields, setting, lonlat) {
  49953. super(data, layer, fields, setting, lonlat);
  49954. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  49955. }
  49956. /**
  49957. * @function SuperMap.Feature.Theme.Ring.prototype.destroy
  49958. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  49959. */
  49960. destroy() {
  49961. super.destroy();
  49962. }
  49963. /**
  49964. * @function SuperMap.Feature.Theme.Ring.prototype.assembleShapes
  49965. * @description 装配图形(扩展接口)。
  49966. */
  49967. assembleShapes() {
  49968. // 重要步骤:初始化参数
  49969. if (!this.initBaseParameter()) {
  49970. return;
  49971. }
  49972. // 一个默认 style 组
  49973. var defaultStyleGroup = [
  49974. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  49975. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  49976. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  49977. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  49978. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  49979. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  49980. ];
  49981. // 图表配置对象
  49982. var sets = this.setting;
  49983. // 背景框,默认不启用
  49984. if (sets.useBackground) {
  49985. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49986. }
  49987. // 数据值数组
  49988. var fv = this.dataValues;
  49989. if (fv.length < 1) {
  49990. return;
  49991. } // 没有数据
  49992. // 值域范围
  49993. var codomain = this.DVBCodomain;
  49994. // 值域范围检测
  49995. for (let i = 0; i < fv.length; i++) {
  49996. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49997. return;
  49998. }
  49999. }
  50000. // 值的绝对值总和
  50001. var valueSum = 0;
  50002. for (let i = 0; i < fv.length; i++) {
  50003. valueSum += Math.abs(fv[i]);
  50004. }
  50005. // 重要步骤:定义图表 Ring 数据视图框中单位值的含义,单位值:每度代表的数值
  50006. this.DVBUnitValue = 360 / valueSum;
  50007. var uv = this.DVBUnitValue;
  50008. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  50009. var startAngle = 0; // 扇形起始边角度
  50010. var endAngle = 0; // 扇形终止边角度
  50011. var startAngleTmp = startAngle; // 扇形临时起始边角度
  50012. // 扇形外环(自适应)半径
  50013. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  50014. // 扇形内环(自适应)半径
  50015. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  50016. var r0 = (
  50017. typeof(sets.innerRingRadius) !== "undefined"
  50018. && !isNaN(sets.innerRingRadius)
  50019. && isInRange
  50020. ) ? sets.innerRingRadius : 0;
  50021. for (var i = 0; i < fv.length; i++) {
  50022. var fvi = Math.abs(fv[i]);
  50023. // 计算结束角度
  50024. if (i === 0) {
  50025. endAngle = startAngle + fvi * uv;
  50026. } else if (i === fvi.length - 1) {
  50027. endAngle = startAngleTmp;
  50028. } else {
  50029. endAngle = startAngle + fvi * uv;
  50030. }
  50031. // 扇形参数对象
  50032. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  50033. // 扇形样式
  50034. if (typeof(sets.sectorStyleByFields) === "undefined") {
  50035. // 使用默认 style 组
  50036. var colorIndex = i % defaultStyleGroup.length;
  50037. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  50038. } else {
  50039. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  50040. }
  50041. // 扇形 hover 样式
  50042. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  50043. // 扇形 hover 与 click 设置
  50044. if (typeof(sets.sectorHoverAble) !== "undefined") {
  50045. sectorSP.hoverable = sets.sectorHoverAble;
  50046. }
  50047. if (typeof(sets.sectorClickAble) !== "undefined") {
  50048. sectorSP.clickable = sets.sectorClickAble;
  50049. }
  50050. // 图形携带的数据信息
  50051. sectorSP.refDataID = this.data.id;
  50052. sectorSP.dataInfo = {
  50053. field: this.fields[i],
  50054. value: fv[i]
  50055. };
  50056. // 创建扇形并把此扇形添加到图表图形数组
  50057. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  50058. // 把上一次的结束角度作为下一次的起始角度
  50059. startAngle = endAngle;
  50060. }
  50061. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50062. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50063. this.shapesConvertToRelativeCoordinate();
  50064. }
  50065. }
  50066. /**
  50067. * @typedef {Object} SuperMap.Feature.Theme.Ring.setting
  50068. * @property {number} width - 专题要素(图表)宽度。
  50069. * @property {number} height - 专题要素(图表)高度。
  50070. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50071. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50072. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50073. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50074. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50075. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  50076. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式,此样式对象对象可设属性。
  50077. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50078. * @property {number} [innerRingRadius=0] - 环状图内环半径,取值范围大于 0,小于外环半径(外环半径:数据视图框长和宽中较小值的二分之一)。
  50079. * @property {SuperMap.Feature.ShapeParameters.Sector.style} [sectorStyle] - 环状图中扇形的基础 style,此参数控制环状图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  50080. * @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。
  50081. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} [sectorStyleByCodomain] - 按环状图扇形代表的数据值所在值域范围控制环状图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  50082. */
  50083. SuperMap.Feature.Theme.Ring = Ring;
  50084. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  50085. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50086. * This program are made available under the terms of the Apache License, Version 2.0
  50087. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50088. /**
  50089. * @class SuperMap.Feature.Theme.Vector
  50090. * @classdesc 矢量专题要素类。
  50091. * @category Visualization Theme
  50092. * @extends SuperMap.Feature.Theme
  50093. * @param {SuperMap.Feature.Vector} data - 用户数据,的类型为矢量数据 feature。
  50094. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  50095. * @param {Object} style - 样式。
  50096. * @param {Object} options - 创建专题要素时的可选参数。
  50097. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离, 单位:像素。
  50098. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  50099. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  50100. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  50101. * @param {Object} [options.highlightStyle] - 高亮样式。
  50102. */
  50103. class ThemeVector extends Theme_Theme {
  50104. constructor(data, layer, style, options, shapeOptions) {
  50105. super(data, layer);
  50106. //数据的 geometry 属性必须存在且类型是 SuperMap.Geometry 或其子类的类型
  50107. if (!data.geometry) {
  50108. return;
  50109. }
  50110. if (!(data.geometry instanceof Geometry)) {
  50111. return;
  50112. }
  50113. /**
  50114. * @member {SuperMap.Bounds} [SuperMap.Feature.Theme.Vector.prototype.dataBounds]
  50115. * @description 用户数据的(feature.geometry)地理范围。
  50116. */
  50117. this.dataBounds = data.geometry.getBounds();
  50118. /**
  50119. * @member {number} [SuperMap.Feature.Theme.Vector.prototype.nodesClipPixel=2]
  50120. * @description 节点抽稀像素距离。
  50121. */
  50122. this.nodesClipPixel = 2;
  50123. /**
  50124. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isHoverAble=true]
  50125. * @description 图形是否可 hover。
  50126. */
  50127. this.isHoverAble = true;
  50128. /**
  50129. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isMultiHover=true]
  50130. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  50131. */
  50132. this.isMultiHover = true;
  50133. /**
  50134. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isClickAble=true]
  50135. * @description 图形是否可点击。
  50136. */
  50137. this.isClickAble = true;
  50138. /**
  50139. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.highlightStyle]
  50140. * @description 高亮样式。
  50141. */
  50142. this.highlightStyle = null;
  50143. /**
  50144. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.shapeOptions]
  50145. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  50146. */
  50147. this.shapeOptions = {};
  50148. /**
  50149. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.style]
  50150. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  50151. */
  50152. this.style = style || {};
  50153. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  50154. this.style = style ? style : {};
  50155. if (options) {
  50156. Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  50157. }
  50158. if (shapeOptions) {
  50159. Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  50160. }
  50161. //设置基础参数 dataBounds、lonlat、location
  50162. var geometry = data.geometry;
  50163. this.lonlat = this.dataBounds.getCenterLonLat();
  50164. this.location = this.getLocalXY(this.lonlat);
  50165. //将地理要素转为专题要素
  50166. if (geometry instanceof LinearRing) {
  50167. this.lineToTF(geometry);
  50168. } else if (geometry instanceof LineString) {
  50169. this.lineToTF(geometry);
  50170. } else if (geometry instanceof Curve) {
  50171. //独立几何体
  50172. } else if (geometry instanceof MultiPoint) {
  50173. this.multiPointToTF(geometry);
  50174. } else if (geometry instanceof MultiLineString) {
  50175. this.multiLineStringToTF(geometry);
  50176. } else if (geometry instanceof MultiPolygon) {
  50177. this.multiPolygonToTF(geometry);
  50178. } else if (geometry instanceof Polygon) {
  50179. this.polygonToTF(geometry);
  50180. } else if (geometry instanceof Collection) {
  50181. //独立几何体
  50182. } else if (geometry instanceof Point) {
  50183. this.pointToTF(geometry);
  50184. } else if (geometry instanceof Rectangle) {
  50185. this.rectangleToTF(geometry);
  50186. } else if (geometry instanceof GeoText) {
  50187. this.geoTextToTF(geometry);
  50188. }
  50189. }
  50190. /**
  50191. * @function SuperMap.Feature.Theme.Vector.prototype.destroy
  50192. * @override
  50193. */
  50194. destroy() {
  50195. this.style = null;
  50196. this.dataBounds = null;
  50197. this.nodesClipPixel = null;
  50198. this.isHoverAble = null;
  50199. this.isMultiHover = null;
  50200. this.isClickAble = null;
  50201. this.highlightStyle = null;
  50202. this.shapeOptions = null;
  50203. super.destroy();
  50204. }
  50205. /**
  50206. * @function SuperMap.Feature.Theme.Vector.prototype.lineToTF
  50207. * @description 转换线和线环要素。
  50208. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 LineString 或 LineRing。
  50209. */
  50210. lineToTF(geometry) {
  50211. var components = geometry.components;
  50212. //节点像素坐标
  50213. var localLX = [];
  50214. //参考位置,参考中心为
  50215. var refLocal = [];
  50216. var location = this.location;
  50217. var pointList = [];
  50218. //节点抽稀距离
  50219. var nCPx = this.nodesClipPixel;
  50220. for (var i = 0; i < components.length; i++) {
  50221. var components_i = components[i];
  50222. refLocal = [];
  50223. localLX = this.getLocalXY(components_i);
  50224. refLocal[0] = localLX[0] - location[0];
  50225. refLocal[1] = localLX[1] - location[1];
  50226. //抽稀 - 2 px
  50227. if (pointList.length > 0) {
  50228. var lastLocalXY = pointList[pointList.length - 1];
  50229. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  50230. continue;
  50231. }
  50232. }
  50233. //使用参考点
  50234. pointList.push(refLocal);
  50235. }
  50236. if (pointList.length < 2) {
  50237. return null;
  50238. }
  50239. //赋 style
  50240. var style = new Object();
  50241. style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
  50242. style.pointList = pointList;
  50243. //创建图形
  50244. var shape = new SmicBrokenLine({
  50245. style: style,
  50246. clickable: this.isClickAble,
  50247. hoverable: this.isHoverAble
  50248. });
  50249. //设置高亮样式
  50250. if (this.highlightStyle) {
  50251. shape.highlightStyle = this.highlightStyle;
  50252. }
  50253. //设置参考中心,指定图形位置
  50254. shape.refOriginalPosition = this.location;
  50255. //储存数据 id 属性,用于事件
  50256. shape.refDataID = this.data.id;
  50257. //储存数据 id 属性,用于事件-多图形同时高亮
  50258. shape.isHoverByRefDataID = this.isMultiHover;
  50259. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  50260. if (this.shapeOptions) {
  50261. Util.copyAttributesWithClip(shape, this.shapeOptions);
  50262. }
  50263. this.shapes.push(shape);
  50264. }
  50265. /**
  50266. * @function SuperMap.Feature.Theme.Vector.prototype.multiPointToTF
  50267. * @description 转多点要素。
  50268. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  50269. */
  50270. multiPointToTF(geometry) {
  50271. /* //-- 不抽稀
  50272. var components = geometry.components;
  50273. for(var i = 0; i < components.length; i++){
  50274. var components_i = components[i];
  50275. this.pointToTF(components_i);
  50276. }
  50277. */
  50278. var components = geometry.components;
  50279. //节点像素坐标
  50280. var localLX = [];
  50281. //参考位置,参考中心为
  50282. var refLocal = [];
  50283. var location = this.location;
  50284. var pointList = [];
  50285. //节点抽稀距离
  50286. var nCPx = this.nodesClipPixel;
  50287. for (var i = 0; i < components.length; i++) {
  50288. var components_i = components[i];
  50289. refLocal = [];
  50290. localLX = this.getLocalXY(components_i);
  50291. refLocal[0] = localLX[0] - location[0];
  50292. refLocal[1] = localLX[1] - location[1];
  50293. //抽稀
  50294. if (pointList.length > 0) {
  50295. var lastLocalXY = pointList[pointList.length - 1];
  50296. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  50297. continue;
  50298. }
  50299. }
  50300. //使用参考点
  50301. pointList.push(refLocal);
  50302. //赋 style
  50303. var style = new Object();
  50304. style.r = 6; //防止漏设此参数,默认 6 像素
  50305. style = Util.copyAttributesWithClip(style, this.style);
  50306. style.x = refLocal[0];
  50307. style.y = refLocal[1];
  50308. //创建图形
  50309. var shape = new SmicPoint({
  50310. style: style,
  50311. clickable: this.isClickAble,
  50312. hoverable: this.isHoverAble
  50313. });
  50314. //设置高亮样式
  50315. if (this.highlightStyle) {
  50316. shape.highlightStyle = this.highlightStyle;
  50317. }
  50318. //设置参考中心,指定图形位置
  50319. shape.refOriginalPosition = location;
  50320. //储存数据 id 属性,用于事件
  50321. shape.refDataID = this.data.id;
  50322. //储存数据 id 属性,用于事件-多图形同时高亮
  50323. shape.isHoverByRefDataID = this.isMultiHover;
  50324. //修改一些 shape 可选属性,通常不需要这么做
  50325. if (this.shapeOptions) {
  50326. Util.copyAttributesWithClip(shape, this.shapeOptions);
  50327. }
  50328. this.shapes.push(shape);
  50329. }
  50330. }
  50331. /**
  50332. * @function SuperMap.Feature.Theme.Vector.prototype.multiLineStringToTF
  50333. * @description 转换多线要素。
  50334. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  50335. */
  50336. multiLineStringToTF(geometry) {
  50337. var components = geometry.components;
  50338. for (var i = 0; i < components.length; i++) {
  50339. var components_i = components[i];
  50340. this.lineToTF(components_i);
  50341. }
  50342. }
  50343. /**
  50344. * @function SuperMap.Feature.Theme.Vector.prototype.multiPolygonToTF
  50345. * @description 转换多面要素。
  50346. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  50347. */
  50348. multiPolygonToTF(geometry) {
  50349. var components = geometry.components;
  50350. for (var i = 0; i < components.length; i++) {
  50351. var components_i = components[i];
  50352. this.polygonToTF(components_i);
  50353. }
  50354. }
  50355. /**
  50356. * @function SuperMap.Feature.Theme.Vector.prototype.pointToTF
  50357. * @description 转换点要素。
  50358. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  50359. */
  50360. pointToTF(geometry) {
  50361. //参考位置,参考中心为
  50362. var location = this.location;
  50363. //geometry 像素坐标
  50364. var localLX = this.getLocalXY(geometry);
  50365. //赋 style
  50366. var style = new Object();
  50367. style.r = 6; //防止漏设此参数,默认 6 像素
  50368. style = Util.copyAttributesWithClip(style, this.style);
  50369. style.x = localLX[0] - location[0];
  50370. style.y = localLX[1] - location[1];
  50371. //创建图形
  50372. var shape = new SmicPoint({
  50373. style: style,
  50374. clickable: this.isClickAble,
  50375. hoverable: this.isHoverAble
  50376. });
  50377. //设置高亮样式
  50378. if (this.highlightStyle) {
  50379. shape.highlightStyle = this.highlightStyle;
  50380. }
  50381. //设置参考中心,指定图形位置
  50382. shape.refOriginalPosition = location;
  50383. //储存数据 id 属性,用于事件
  50384. shape.refDataID = this.data.id;
  50385. //储存数据 id 属性,用于事件-多图形同时高亮
  50386. shape.isHoverByRefDataID = this.isMultiHover;
  50387. //修改一些 shape 可选属性,通常不需要这么做
  50388. if (this.shapeOptions) {
  50389. Util.copyAttributesWithClip(shape, this.shapeOptions);
  50390. }
  50391. this.shapes.push(shape);
  50392. }
  50393. /**
  50394. * @function SuperMap.Feature.Theme.Vector.prototype.polygonToThemeFeature
  50395. * @description 转换面要素。
  50396. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  50397. */
  50398. polygonToTF(geometry) {
  50399. var components = geometry.components;
  50400. //节点像素坐标
  50401. var localLX = [];
  50402. //参考位置,参考中心为
  50403. var refLocal = [];
  50404. var location = this.location;
  50405. var pointList = [];
  50406. //岛洞
  50407. var holePolygonPointList = [];
  50408. var holePolygonPointLists = [];
  50409. //节点抽稀距离
  50410. var nCPx = this.nodesClipPixel;
  50411. for (var i = 0; i < components.length; i++) {
  50412. var components_i = components[i].components;
  50413. if (i === 0) {
  50414. // 第一个 component 正常绘制
  50415. pointList = [];
  50416. for (var j = 0; j < components_i.length; j++) {
  50417. refLocal = [];
  50418. localLX = this.getLocalXY(components_i[j]);
  50419. refLocal[0] = localLX[0] - location[0];
  50420. refLocal[1] = localLX[1] - location[1];
  50421. //抽稀 - 2 px
  50422. if (pointList.length > 0) {
  50423. var lastLocalXY = pointList[pointList.length - 1];
  50424. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  50425. continue;
  50426. }
  50427. }
  50428. //使用参考点
  50429. pointList.push(refLocal);
  50430. }
  50431. } else {
  50432. // 其它 component 作为岛洞
  50433. holePolygonPointList = [];
  50434. for (var k = 0; k < components_i.length; k++) {
  50435. refLocal = [];
  50436. localLX = this.getLocalXY(components_i[k]);
  50437. refLocal[0] = localLX[0] - location[0];
  50438. refLocal[1] = localLX[1] - location[1];
  50439. //抽稀 - 2 px
  50440. if (holePolygonPointList.length > 0) {
  50441. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  50442. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  50443. continue;
  50444. }
  50445. }
  50446. //使用参考点
  50447. holePolygonPointList.push(refLocal);
  50448. }
  50449. }
  50450. if (holePolygonPointList.length < 2) {
  50451. continue;
  50452. }
  50453. holePolygonPointLists.push(holePolygonPointList);
  50454. }
  50455. if (pointList.length < 2) {
  50456. return;
  50457. }
  50458. //赋 style
  50459. var style = {};
  50460. style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
  50461. style.pointList = pointList;
  50462. //创建图形
  50463. var shape = new SmicPolygon({
  50464. style: style,
  50465. clickable: this.isClickAble,
  50466. hoverable: this.isHoverAble
  50467. });
  50468. //设置高亮样式
  50469. if (this.highlightStyle) {
  50470. shape.highlightStyle = this.highlightStyle;
  50471. }
  50472. //设置参考中心,指定图形位置
  50473. shape.refOriginalPosition = this.location;
  50474. //储存数据 id 属性,用于事件
  50475. shape.refDataID = this.data.id;
  50476. //储存数据 id 属性,用于事件-多图形同时高亮
  50477. shape.isHoverByRefDataID = this.isMultiHover;
  50478. //岛洞面
  50479. if (holePolygonPointLists.length > 0) {
  50480. shape.holePolygonPointLists = holePolygonPointLists;
  50481. }
  50482. //修改一些 shape 可选属性,通常不需要这么做
  50483. if (this.shapeOptions) {
  50484. Util.copyAttributesWithClip(shape, this.shapeOptions);
  50485. }
  50486. this.shapes.push(shape);
  50487. }
  50488. /**
  50489. * @function SuperMap.Feature.Theme.Vector.prototype.rectangleToTF
  50490. * @description 转换矩形要素。
  50491. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  50492. */
  50493. rectangleToTF(geometry) {
  50494. //参考位置,参考中心为
  50495. var location = this.location;
  50496. var ll = new LonLat(geometry.x, geometry.y);
  50497. //地图分辨率
  50498. var res = this.layer.map.getResolution();
  50499. //geometry 像素坐标
  50500. var localLX = this.getLocalXY(ll);
  50501. //赋 style
  50502. var style = new Object();
  50503. style.r = 6; //防止漏设此参数,默认 6 像素
  50504. style = Util.copyAttributesWithClip(style, this.style);
  50505. style.x = localLX[0] - location[0];
  50506. // SuperMap.Geometry.Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  50507. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  50508. style.width = geometry.width / res;
  50509. style.height = geometry.height / res;
  50510. //创建图形
  50511. var shape = new SmicRectangle({
  50512. style: style,
  50513. clickable: this.isClickAble,
  50514. hoverable: this.isHoverAble
  50515. });
  50516. //设置高亮样式
  50517. if (this.highlightStyle) {
  50518. shape.highlightStyle = this.highlightStyle;
  50519. }
  50520. //设置参考中心,指定图形位置
  50521. shape.refOriginalPosition = location;
  50522. //储存数据 id 属性,用于事件
  50523. shape.refDataID = this.data.id;
  50524. //储存数据 id 属性,用于事件-多图形同时高亮
  50525. shape.isHoverByRefDataID = this.isMultiHover;
  50526. //修改一些 shape 可选属性,通常不需要这么做
  50527. if (this.shapeOptions) {
  50528. Util.copyAttributesWithClip(shape, this.shapeOptions);
  50529. }
  50530. this.shapes.push(shape);
  50531. }
  50532. /**
  50533. * @function SuperMap.Feature.Theme.Vector.prototype.geoTextToTF
  50534. * @description 转换文本要素。
  50535. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  50536. */
  50537. geoTextToTF(geometry) {
  50538. //参考位置,参考中心为
  50539. var location = this.location;
  50540. //geometry 像素坐标
  50541. var localLX = this.getLocalXY(geometry);
  50542. //赋 style
  50543. var style = new Object();
  50544. style.r = 6; //防止漏设此参数,默认 6 像素
  50545. style = Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  50546. style.x = localLX[0] - location[0];
  50547. style.y = localLX[1] - location[1];
  50548. style.text = geometry.text;
  50549. //创建图形
  50550. var shape = new SmicText({
  50551. style: style,
  50552. clickable: this.isClickAble,
  50553. hoverable: this.isHoverAble
  50554. });
  50555. //设置高亮样式
  50556. if (this.highlightStyle) {
  50557. shape.highlightStyle = this.highlightStyle;
  50558. }
  50559. //设置参考中心,指定图形位置
  50560. shape.refOriginalPosition = location;
  50561. //储存数据 id 属性,用于事件
  50562. shape.refDataID = this.data.id;
  50563. //储存数据 id 属性,用于事件-多图形同时高亮
  50564. shape.isHoverByRefDataID = this.isMultiHover;
  50565. //修改一些 shape 可选属性,通常不需要这么做
  50566. if (this.shapeOptions) {
  50567. Util.copyAttributesWithClip(shape, this.shapeOptions);
  50568. }
  50569. this.shapes.push(shape);
  50570. }
  50571. /**
  50572. * @function SuperMap.Feature.Theme.Vector.prototype.updateAndAddShapes
  50573. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  50574. */
  50575. updateAndAddShapes() {
  50576. var newLocalLX = this.getLocalXY(this.lonlat);
  50577. this.location = newLocalLX;
  50578. var render = this.layer.renderer;
  50579. for (var i = 0, len = this.shapes.length; i < len; i++) {
  50580. var shape = this.shapes[i];
  50581. //设置参考中心,指定图形位置
  50582. shape.refOriginalPosition = newLocalLX;
  50583. render.addShape(shape);
  50584. }
  50585. }
  50586. /**
  50587. * @function SuperMap.Feature.Theme.Vector.prototype.getShapesCount
  50588. * @description 获得专题要素中可视化图形的数量。
  50589. * @returns {number} 可视化图形的数量。
  50590. */
  50591. getShapesCount() {
  50592. return this.shapes.length;
  50593. }
  50594. /**
  50595. * @function SuperMap.Feature.Theme.Vector.prototype.getLocalXY
  50596. * @description 地理坐标转为像素坐标。
  50597. * @param {SuperMap.LonLat} lonlat - 专题要素地理位置。
  50598. */
  50599. getLocalXY(lonlat) {
  50600. return this.layer.getLocalXY(lonlat);
  50601. }
  50602. }
  50603. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  50604. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  50605. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50606. * This program are made available under the terms of the Apache License, Version 2.0
  50607. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50608. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  50609. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50610. * This program are made available under the terms of the Apache License, Version 2.0
  50611. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50612. /**
  50613. * @class SuperMap.LevelRenderer.Group
  50614. * @category Visualization Theme
  50615. * @private
  50616. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  50617. * @extends {SuperMap.LevelRenderer.Transformable}
  50618. * (code)
  50619. * var g = new SuperMap.LevelRenderer.Group();
  50620. * var Circle = new SuperMap.LevelRenderer.Shape.Circle();
  50621. * g.position[0] = 100;
  50622. * g.position[1] = 100;
  50623. * g.addChild(new Circle({
  50624. * style: {
  50625. * x: 100,
  50626. * y: 100,
  50627. * r: 20,
  50628. * brushType: 'fill'
  50629. * }
  50630. * }));
  50631. * LR.addGroup(g);
  50632. * (end)
  50633. */
  50634. class Group extends SuperMap.mixin(Eventful, Transformable) {
  50635. /**
  50636. * @function SuperMap.LevelRenderer.Group.prototype.constructor
  50637. * @description 构造函数。
  50638. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  50639. */
  50640. constructor(options) {
  50641. super(options)
  50642. options = options || {};
  50643. /**
  50644. * @member {string} SuperMap.LevelRenderer.Group.prototype.id
  50645. * @description Group 的唯一标识。
  50646. */
  50647. this.id = null;
  50648. /**
  50649. * @readonly
  50650. * @member {string} [SuperMap.LevelRenderer.Group.prototype.type='group']
  50651. * @description 类型。
  50652. */
  50653. this.type = 'group';
  50654. //http://www.w3.org/TR/2dcontext/#clipping-region
  50655. /**
  50656. * @member {string} SuperMap.LevelRenderer.Group.prototype.clipShape
  50657. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  50658. */
  50659. this.clipShape = null;
  50660. /**
  50661. * @member {Array} SuperMap.LevelRenderer.Group.prototype._children
  50662. * @description _children。
  50663. */
  50664. this._children = [];
  50665. /**
  50666. * @member {Array} SuperMap.LevelRenderer.Group.prototype._storage
  50667. * @description _storage。
  50668. */
  50669. this._storage = null;
  50670. /**
  50671. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.__dirty=true]
  50672. * @description __dirty。
  50673. */
  50674. this.__dirty = true;
  50675. /**
  50676. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.ignore=false]
  50677. * @description 是否忽略该 Group 及其所有子节点。
  50678. */
  50679. this.ignore = false;
  50680. Util.extend(this, options);
  50681. this.id = this.id || Util.createUniqueID("smShapeGroup_");
  50682. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  50683. }
  50684. /**
  50685. * @function SuperMap.LevelRenderer.Group.prototype.destroy
  50686. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  50687. */
  50688. destroy() {
  50689. this.id = null;
  50690. this.type = null;
  50691. this.clipShape = null;
  50692. this._children = null;
  50693. this._storage = null;
  50694. this.__dirty = null;
  50695. this.ignore = null;
  50696. super.destroy();
  50697. }
  50698. /**
  50699. * @function SuperMap.LevelRenderer.Group.prototype.children
  50700. * @description 复制并返回一份新的包含所有儿子节点的数组。
  50701. * @returns {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  50702. */
  50703. children() {
  50704. return this._children.slice();
  50705. }
  50706. /**
  50707. * @function SuperMap.LevelRenderer.Group.prototype.childAt
  50708. * @description 获取指定 index 的儿子节点
  50709. * @param {number} idx - 节点索引。
  50710. * @returns {SuperMap.LevelRenderer.Shape} 图形。
  50711. */
  50712. childAt(idx) {
  50713. return this._children[idx];
  50714. }
  50715. /**
  50716. * @function SuperMap.LevelRenderer.Group.prototype.addChild
  50717. * @description 添加子节点,可以是 Shape 或者 Group。
  50718. * @param {(SuperMap.LevelRenderer.Shape|SuperMap.LevelRenderer.Group)} child - 节点图形。
  50719. */
  50720. // TODO Type Check
  50721. addChild(child) {
  50722. if (child == this) {
  50723. return;
  50724. }
  50725. if (child.parent == this) {
  50726. return;
  50727. }
  50728. if (child.parent) {
  50729. child.parent.removeChild(child);
  50730. }
  50731. this._children.push(child);
  50732. child.parent = this;
  50733. if (this._storage && this._storage !== child._storage) {
  50734. this._storage.addToMap(child);
  50735. if (child instanceof Group) {
  50736. child.addChildrenToStorage(this._storage);
  50737. }
  50738. }
  50739. }
  50740. /**
  50741. * @function SuperMap.LevelRenderer.Group.prototype.removeChild
  50742. * @description 移除子节点。
  50743. * @param {SuperMap.LevelRenderer.Shape} child - 需要移除的子节点图形。
  50744. */
  50745. removeChild(child) {
  50746. var idx = Util.indexOf(this._children, child);
  50747. this._children.splice(idx, 1);
  50748. child.parent = null;
  50749. if (this._storage) {
  50750. this._storage.delFromMap(child.id);
  50751. if (child instanceof Group) {
  50752. child.delChildrenFromStorage(this._storage);
  50753. }
  50754. }
  50755. }
  50756. /**
  50757. * @function SuperMap.LevelRenderer.Group.prototype.eachChild
  50758. * @description 遍历所有子节点。
  50759. * @param {function} cb - 回调函数。
  50760. * @param {Object} context - 上下文。
  50761. */
  50762. eachChild(cb, context) {
  50763. var haveContext = !!context;
  50764. for (var i = 0; i < this._children.length; i++) {
  50765. var child = this._children[i];
  50766. if (haveContext) {
  50767. cb.call(context, child);
  50768. } else {
  50769. cb(child);
  50770. }
  50771. }
  50772. }
  50773. /**
  50774. * @function SuperMap.LevelRenderer.Group.prototype.traverse
  50775. * @description 深度优先遍历所有子孙节点。
  50776. * @param {function} cb - 回调函数。
  50777. * @param {Object} context - 上下文。
  50778. */
  50779. traverse(cb, context) {
  50780. var haveContext = !!context;
  50781. for (var i = 0; i < this._children.length; i++) {
  50782. var child = this._children[i];
  50783. if (haveContext) {
  50784. cb.call(context, child);
  50785. } else {
  50786. cb(child);
  50787. }
  50788. if (child.type === 'group') {
  50789. child.traverse(cb, context);
  50790. }
  50791. }
  50792. }
  50793. /**
  50794. * @function SuperMap.LevelRenderer.Group.prototype.addChildrenToStorage
  50795. * @description 把子图形添加到仓库。
  50796. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  50797. */
  50798. addChildrenToStorage(storage) {
  50799. for (var i = 0; i < this._children.length; i++) {
  50800. var child = this._children[i];
  50801. storage.addToMap(child);
  50802. if (child.type === 'group') {
  50803. child.addChildrenToStorage(storage);
  50804. }
  50805. }
  50806. }
  50807. /**
  50808. * @function SuperMap.LevelRenderer.Group.prototype.delChildrenFromStorage
  50809. * @description 从仓库把子图形删除。
  50810. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  50811. */
  50812. delChildrenFromStorage(storage) {
  50813. for (var i = 0; i < this._children.length; i++) {
  50814. var child = this._children[i];
  50815. storage.delFromMap(child.id);
  50816. if (child.type === 'group') {
  50817. child.delChildrenFromStorage(storage);
  50818. }
  50819. }
  50820. }
  50821. /**
  50822. * @function SuperMap.LevelRenderer.Group.prototype.modSelf
  50823. * @description 是否修改。
  50824. */
  50825. modSelf() {
  50826. this.__dirty = true;
  50827. }
  50828. }
  50829. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  50830. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50831. * This program are made available under the terms of the Apache License, Version 2.0
  50832. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50833. /**
  50834. * @private
  50835. * @class SuperMap.LevelRenderer.Storage
  50836. * @category Visualization Theme
  50837. * @classdesc 内容(图像)仓库 (M) 。
  50838. */
  50839. class Storage {
  50840. /**
  50841. * @function SuperMap.LevelRenderer.Storage.constructor
  50842. * @description 构造函数。
  50843. */
  50844. constructor() {
  50845. /**
  50846. * @member {Object} SuperMap.LevelRenderer.Storage.prototype._elements
  50847. * @description 所有常规形状,id 索引的 map。
  50848. */
  50849. this._elements = {};
  50850. /**
  50851. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._hoverElements
  50852. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  50853. *
  50854. */
  50855. this._hoverElements = [];
  50856. /**
  50857. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._roots
  50858. * @description _roots。
  50859. *
  50860. */
  50861. this._roots = [];
  50862. /**
  50863. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._shapeList
  50864. * @description _shapeList。
  50865. *
  50866. */
  50867. this._shapeList = [];
  50868. /**
  50869. * @member {number} SuperMap.LevelRenderer.Storage.prototype._shapeListOffset
  50870. * @description _shapeListOffset。默认值:0。
  50871. *
  50872. */
  50873. this._shapeListOffset = 0;
  50874. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  50875. }
  50876. /**
  50877. * @function SuperMap.LevelRenderer.Storage.prototype.destroy
  50878. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  50879. */
  50880. destroy() {
  50881. this.dispose();
  50882. this._shapeList = null;
  50883. this._shapeListOffset = null;
  50884. }
  50885. /**
  50886. * @function SuperMap.LevelRenderer.Storage.prototype.iterShape
  50887. * @description 遍历迭代器。
  50888. *
  50889. * @param {Function} fun - 迭代回调函数,return true终止迭代。
  50890. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  50891. * @param {boolean} [hover=true] - 是否是高亮层图形。
  50892. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  50893. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  50894. * @return {SuperMap.LevelRenderer.Storage} this。
  50895. */
  50896. iterShape(fun, option) {
  50897. if (!option) {
  50898. var defaultIterateOption = {
  50899. hover: false,
  50900. normal: 'down',
  50901. update: false
  50902. };
  50903. option = defaultIterateOption;
  50904. }
  50905. if (option.hover) {
  50906. // 高亮层数据遍历
  50907. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  50908. var el = this._hoverElements[i];
  50909. el.updateTransform();
  50910. if (fun(el)) {
  50911. return this;
  50912. }
  50913. }
  50914. }
  50915. if (option.update) {
  50916. this.updateShapeList();
  50917. }
  50918. // 遍历: 'down' | 'up'
  50919. switch (option.normal) {
  50920. case 'down':
  50921. {
  50922. // 降序遍历,高层优先
  50923. let l = this._shapeList.length;
  50924. while (l--) {
  50925. if (fun(this._shapeList[l])) {
  50926. return this;
  50927. }
  50928. }
  50929. break;
  50930. }
  50931. // case 'up':
  50932. default:
  50933. {
  50934. // 升序遍历,底层优先
  50935. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  50936. if (fun(this._shapeList[i])) {
  50937. return this;
  50938. }
  50939. }
  50940. break;
  50941. }
  50942. }
  50943. return this;
  50944. }
  50945. /**
  50946. * @function SuperMap.LevelRenderer.Storage.prototype.getHoverShapes
  50947. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  50948. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  50949. */
  50950. getHoverShapes(update) {
  50951. // hoverConnect
  50952. var hoverElements = [], len = this._hoverElements.length;
  50953. for (let i = 0; i < len; i++) {
  50954. hoverElements.push(this._hoverElements[i]);
  50955. var target = this._hoverElements[i].hoverConnect;
  50956. if (target) {
  50957. var shape;
  50958. target = target instanceof Array ? target : [target];
  50959. for (var j = 0, k = target.length; j < k; j++) {
  50960. shape = target[j].id ? target[j] : this.get(target[j]);
  50961. if (shape) {
  50962. hoverElements.push(shape);
  50963. }
  50964. }
  50965. }
  50966. }
  50967. hoverElements.sort(Storage.shapeCompareFunc);
  50968. if (update) {
  50969. for (let i = 0, l = hoverElements.length; i < l; i++) {
  50970. hoverElements[i].updateTransform();
  50971. }
  50972. }
  50973. return hoverElements;
  50974. }
  50975. /**
  50976. * @function SuperMap.LevelRenderer.Storage.prototype.getShapeList
  50977. * @description 返回所有图形的绘制队列。
  50978. *
  50979. * @param {boolean} [update=false] - 是否在返回前更新该数组。 详见:<SuperMap.LevelRenderer.Shape> updateShapeList。
  50980. * @return {SuperMap.LevelRenderer.Shape} 图形。
  50981. */
  50982. getShapeList(update) {
  50983. if (update) {
  50984. this.updateShapeList();
  50985. }
  50986. return this._shapeList;
  50987. }
  50988. /**
  50989. * @function SuperMap.LevelRenderer.Storage.prototype.updateShapeList
  50990. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  50991. */
  50992. updateShapeList() {
  50993. this._shapeListOffset = 0;
  50994. var rootsLen = this._roots.length;
  50995. for (let i = 0; i < rootsLen; i++) {
  50996. let root = this._roots[i];
  50997. this._updateAndAddShape(root);
  50998. }
  50999. this._shapeList.length = this._shapeListOffset;
  51000. var shapeListLen = this._shapeList.length;
  51001. for (let i = 0; i < shapeListLen; i++) {
  51002. this._shapeList[i].__renderidx = i;
  51003. }
  51004. this._shapeList.sort(Storage.shapeCompareFunc);
  51005. }
  51006. /**
  51007. * @function SuperMap.LevelRenderer.Storage.prototype._updateAndAddShape
  51008. * @description 更新并添加图形。
  51009. *
  51010. */
  51011. _updateAndAddShape(el, clipShapes) {
  51012. if (el.ignore) {
  51013. return;
  51014. }
  51015. el.updateTransform();
  51016. if (el.type == 'group') {
  51017. if (el.clipShape) {
  51018. // clipShape 的变换是基于 group 的变换
  51019. el.clipShape.parent = el;
  51020. el.clipShape.updateTransform();
  51021. // PENDING 效率影响
  51022. if (clipShapes) {
  51023. clipShapes = clipShapes.slice();
  51024. clipShapes.push(el.clipShape);
  51025. } else {
  51026. clipShapes = [el.clipShape];
  51027. }
  51028. }
  51029. for (var i = 0; i < el._children.length; i++) {
  51030. var child = el._children[i];
  51031. // Force to mark as dirty if group is dirty
  51032. child.__dirty = el.__dirty || child.__dirty;
  51033. this._updateAndAddShape(child, clipShapes);
  51034. }
  51035. // Mark group clean here
  51036. el.__dirty = false;
  51037. } else {
  51038. el.__clipShapes = clipShapes;
  51039. this._shapeList[this._shapeListOffset++] = el;
  51040. }
  51041. }
  51042. /**
  51043. * @function SuperMap.LevelRenderer.Storage.prototype.mod
  51044. * @description 修改图形(Shape)或者组(Group)。
  51045. *
  51046. * @param {string} elId - 唯一标识。
  51047. * @param {Object} params - 参数。
  51048. * @return {SuperMap.LevelRenderer.Storage} this。
  51049. */
  51050. mod(elId, params) {
  51051. var el = this._elements[elId];
  51052. if (el) {
  51053. el.modSelf();
  51054. if (params) {
  51055. // 如果第二个参数直接使用 shape
  51056. // parent, _storage, __startClip 三个属性会有循环引用
  51057. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  51058. if (params.parent || params._storage || params.__startClip) {
  51059. var target = {};
  51060. for (var name in params) {
  51061. if (
  51062. name == 'parent'
  51063. || name == '_storage'
  51064. || name == '__startClip'
  51065. ) {
  51066. continue;
  51067. }
  51068. if (params.hasOwnProperty(name)) {
  51069. target[name] = params[name];
  51070. }
  51071. }
  51072. new Util_Util().merge(el, target, true);
  51073. } else {
  51074. new Util_Util().merge(el, params, true);
  51075. }
  51076. }
  51077. }
  51078. return this;
  51079. }
  51080. /**
  51081. * @function SuperMap.LevelRenderer.Storage.prototype.drift
  51082. * @description 移动指定的图形(Shape)的位置。
  51083. * @param {string} shapeId - 唯一标识。
  51084. * @param {number} dx
  51085. * @param {number} dy
  51086. * @return {SuperMap.LevelRenderer.Storage} this。
  51087. */
  51088. drift(shapeId, dx, dy) {
  51089. var shape = this._elements[shapeId];
  51090. if (shape) {
  51091. shape.needTransform = true;
  51092. if (shape.draggable === 'horizontal') {
  51093. dy = 0;
  51094. } else if (shape.draggable === 'vertical') {
  51095. dx = 0;
  51096. }
  51097. if (!shape.ondrift // ondrift
  51098. // 有onbrush并且调用执行返回false或undefined则继续
  51099. || (shape.ondrift && !shape.ondrift(dx, dy))
  51100. ) {
  51101. shape.drift(dx, dy);
  51102. }
  51103. }
  51104. return this;
  51105. }
  51106. /**
  51107. * @function SuperMap.LevelRenderer.Storage.prototype.addHover
  51108. * @description 添加高亮层数据。
  51109. * @param {SuperMap.LevelRenderer.Shape} shape - 图形。
  51110. * @return {SuperMap.LevelRenderer.Storage} this。
  51111. */
  51112. addHover(shape) {
  51113. shape.updateNeedTransform();
  51114. this._hoverElements.push(shape);
  51115. return this;
  51116. }
  51117. /**
  51118. * @function SuperMap.LevelRenderer.Storage.prototype.delHover
  51119. * @description 清空高亮层数据。
  51120. * @return {SuperMap.LevelRenderer.Storage} this。
  51121. */
  51122. delHover() {
  51123. this._hoverElements = [];
  51124. return this;
  51125. }
  51126. /**
  51127. * @function SuperMap.LevelRenderer.Storage.prototype.hasHoverShape
  51128. * @description 是否有图形在高亮层里。
  51129. * @return {boolean} 是否有图形在高亮层里。
  51130. */
  51131. hasHoverShape() {
  51132. return this._hoverElements.length > 0;
  51133. }
  51134. /**
  51135. * @function SuperMap.LevelRenderer.Storage.prototype.addRoot
  51136. * @description 添加图形(Shape)或者组(Group)到根节点。
  51137. *
  51138. * @param {(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)} el - 图形。
  51139. *
  51140. */
  51141. addRoot(el) {
  51142. if (el instanceof Group) {
  51143. el.addChildrenToStorage(this);
  51144. }
  51145. this.addToMap(el);
  51146. this._roots.push(el);
  51147. }
  51148. /**
  51149. * @function SuperMap.LevelRenderer.Storage.prototype.delRoot
  51150. * @description 删除指定的图形(Shape)或者组(Group)。
  51151. *
  51152. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 id 数组。如果为空清空整个Storage。
  51153. *
  51154. */
  51155. delRoot(elId) {
  51156. if (typeof(elId) == 'undefined') {
  51157. // 不指定elId清空
  51158. for (var i = 0; i < this._roots.length; i++) {
  51159. var root = this._roots[i];
  51160. if (root instanceof Group) {
  51161. root.delChildrenFromStorage(this);
  51162. }
  51163. }
  51164. this._elements = {};
  51165. this._hoverElements = [];
  51166. this._roots = [];
  51167. return;
  51168. }
  51169. if (elId instanceof Array) {
  51170. var elIdLen = elId.length;
  51171. for (let i = 0; i < elIdLen; i++) {
  51172. this.delRoot(elId[i]);
  51173. }
  51174. return;
  51175. }
  51176. var el;
  51177. if (typeof(elId) == 'string') {
  51178. el = this._elements[elId];
  51179. } else {
  51180. el = elId;
  51181. }
  51182. var idx = new Util_Util().indexOf(this._roots, el);
  51183. if (idx >= 0) {
  51184. this.delFromMap(el.id);
  51185. this._roots.splice(idx, 1);
  51186. if (el instanceof Group) {
  51187. el.delChildrenFromStorage(this);
  51188. }
  51189. }
  51190. }
  51191. /**
  51192. * @function SuperMap.LevelRenderer.Storage.prototype.addToMap
  51193. * @description 添加图形到 map。
  51194. *
  51195. * @param {SuperMap.LevelRenderer.Shape} el - 图形。
  51196. * @return {SuperMap.LevelRenderer.Storage} this。
  51197. */
  51198. addToMap(el) {
  51199. if (el instanceof Group) {
  51200. el._storage = this;
  51201. }
  51202. el.modSelf();
  51203. this._elements[el.id] = el;
  51204. return this;
  51205. }
  51206. /**
  51207. * @function SuperMap.LevelRenderer.Storage.prototype.get
  51208. * @description 获取指定图形。
  51209. *
  51210. * @param {string} elId - 图形 id。
  51211. * @return {SuperMap.LevelRenderer.Shape} 图形。
  51212. */
  51213. get(elId) {
  51214. return this._elements[elId];
  51215. }
  51216. /**
  51217. * @function SuperMap.LevelRenderer.Storage.prototype.delFromMap
  51218. * @description 从 map 中删除指定图形。
  51219. *
  51220. * @param {string} elId - 图形id。
  51221. * @return {SuperMap.LevelRenderer.Storage} this。
  51222. */
  51223. delFromMap(elId) {
  51224. var el = this._elements[elId];
  51225. if (el) {
  51226. delete this._elements[elId];
  51227. if (el instanceof Group) {
  51228. el._storage = null;
  51229. }
  51230. }
  51231. return this;
  51232. }
  51233. /**
  51234. * @function SuperMap.LevelRenderer.Storage.prototype.dispose
  51235. * @description 清空并且释放 Storage。
  51236. */
  51237. dispose() {
  51238. this._elements = null;
  51239. // this._renderList = null;
  51240. this._roots = null;
  51241. this._hoverElements = null;
  51242. }
  51243. static shapeCompareFunc(a, b) {
  51244. if (a.zlevel == b.zlevel) {
  51245. if (a.z == b.z) {
  51246. return a.__renderidx - b.__renderidx;
  51247. }
  51248. return a.z - b.z;
  51249. }
  51250. return a.zlevel - b.zlevel;
  51251. }
  51252. }
  51253. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  51254. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51255. * This program are made available under the terms of the Apache License, Version 2.0
  51256. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51257. /**
  51258. * @private
  51259. * @class SuperMap.LevelRenderer.Painter
  51260. * @category Visualization Theme
  51261. * @classdesc Painter 绘图模块。
  51262. */
  51263. class Painter {
  51264. /**
  51265. * @function SuperMap.LevelRenderer.Painter.constructor
  51266. * @description 构造函数。
  51267. *
  51268. * @param {HTMLElement} root - 绘图区域(DIV)。
  51269. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  51270. *
  51271. */
  51272. constructor(root, storage) {
  51273. /**
  51274. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype.root
  51275. * @description 绘图容器。
  51276. *
  51277. */
  51278. this.root = root;
  51279. /**
  51280. * @member {Array} SuperMap.LevelRenderer.Painter.prototype.storage
  51281. * @description 图形仓库。
  51282. *
  51283. */
  51284. this.storage = storage;
  51285. /**
  51286. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype._domRoot
  51287. * @description 容器根 dom 对象。
  51288. *
  51289. */
  51290. this._domRoot = null;
  51291. /**
  51292. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layers
  51293. * @description 绘制层对象。
  51294. *
  51295. */
  51296. this._layers = {};
  51297. /**
  51298. * @member {Array} SuperMap.LevelRenderer.Painter.prototype._zlevelList
  51299. * @description 层列表。
  51300. *
  51301. */
  51302. this._zlevelList = [];
  51303. /**
  51304. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layerConfig
  51305. * @description 绘制层配置对象。
  51306. *
  51307. */
  51308. this._layerConfig = {};
  51309. /**
  51310. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._bgDom
  51311. * @description 背景层 Canvas (Dom)。
  51312. *
  51313. */
  51314. this._bgDom = null;
  51315. /**
  51316. * @member {Function} SuperMap.LevelRenderer.Painter.prototype.shapeToImage
  51317. * @description 形状转图像函数。
  51318. *
  51319. */
  51320. this.shapeToImage = null;
  51321. // retina 屏幕优化
  51322. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  51323. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  51324. this.root.innerHTML = '';
  51325. this._width = this._getWidth(); // 宽,缓存记录
  51326. this._height = this._getHeight(); // 高,缓存记录
  51327. var domRoot = document.createElement('div');
  51328. this._domRoot = domRoot;
  51329. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  51330. domRoot.style.position = 'relative';
  51331. domRoot.style.overflow = 'hidden';
  51332. domRoot.style.width = this._width + 'px';
  51333. domRoot.style.height = this._height + 'px';
  51334. this.root.appendChild(domRoot);
  51335. this.shapeToImage = this._createShapeToImageProcessor();
  51336. // 创建各层canvas
  51337. // 背景
  51338. //this._bgDom = Painter.createDom('bg', 'div', this);
  51339. this._bgDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  51340. domRoot.appendChild(this._bgDom);
  51341. this._bgDom.onselectstart = returnFalse;
  51342. this._bgDom.style['-webkit-user-select'] = 'none';
  51343. this._bgDom.style['user-select'] = 'none';
  51344. this._bgDom.style['-webkit-touch-callout'] = 'none';
  51345. // 高亮
  51346. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  51347. var hoverLayer = new PaintLayer(Util.createUniqueID("_highLightLayer_"), this);
  51348. this._layers['hover'] = hoverLayer;
  51349. domRoot.appendChild(hoverLayer.dom);
  51350. hoverLayer.initContext();
  51351. hoverLayer.dom.onselectstart = returnFalse;
  51352. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  51353. hoverLayer.dom.style['user-select'] = 'none';
  51354. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  51355. var me = this;
  51356. this.updatePainter = function (shapeList, callback) {
  51357. me.refreshShapes(shapeList, callback);
  51358. };
  51359. // 返回false的方法,用于避免页面被选中
  51360. function returnFalse() {
  51361. return false;
  51362. }
  51363. /* eslint-disable */
  51364. // 什么都不干的空方法
  51365. function doNothing() { //NOSONAR
  51366. }
  51367. /* eslint-enable */
  51368. }
  51369. /**
  51370. * @function SuperMap.LevelRenderer.Painter.prototype.destroy
  51371. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  51372. */
  51373. destroy() {
  51374. this.dispose();
  51375. this._zlevelList = null;
  51376. this._layerConfig = null;
  51377. this._bgDom = null;
  51378. this.shapeToImage = null;
  51379. }
  51380. /**
  51381. * @function SuperMap.LevelRenderer.Painter.prototype.render
  51382. * @description 渲染。首次绘图,创建各种 dom 和 context。
  51383. *
  51384. * @param {Function} callback - 绘画结束后的回调函数。
  51385. * @return {SuperMap.LevelRenderer.Painter} this。
  51386. */
  51387. render(callback) {
  51388. // TODO
  51389. this.refresh(callback, true);
  51390. return this;
  51391. }
  51392. /**
  51393. * @function SuperMap.LevelRenderer.Painter.prototype.refresh
  51394. * @description 刷新。
  51395. *
  51396. * @param {Function} callback - 刷新结束后的回调函数。
  51397. * @param {boolean} paintAll - 强制绘制所有 shape。
  51398. * @return {SuperMap.LevelRenderer.Painter} this。
  51399. */
  51400. refresh(callback, paintAll) {
  51401. var list = this.storage.getShapeList(true);
  51402. this._paintList(list, paintAll);
  51403. if (typeof callback == 'function') {
  51404. callback();
  51405. }
  51406. return this;
  51407. }
  51408. /**
  51409. * Method: _paintList
  51410. * 按列表绘制图形。
  51411. */
  51412. _paintList(list, paintAll) {
  51413. if (typeof(paintAll) == 'undefined') {
  51414. paintAll = false;
  51415. }
  51416. this._updateLayerStatus(list);
  51417. var currentLayer;
  51418. var currentZLevel;
  51419. var ctx;
  51420. for (var id in this._layers) {
  51421. if (id !== 'hover') {
  51422. this._layers[id].unusedCount++;
  51423. this._layers[id].updateTransform();
  51424. }
  51425. }
  51426. var invTransform = [];
  51427. for (var i = 0, l = list.length; i < l; i++) {
  51428. var shape = list[i];
  51429. if (currentZLevel !== shape.zlevel) {
  51430. if (currentLayer && currentLayer.needTransform) {
  51431. ctx.restore();
  51432. }
  51433. currentLayer = this.getLayer(shape.zlevel);
  51434. ctx = currentLayer.ctx;
  51435. currentZLevel = shape.zlevel;
  51436. // Reset the count
  51437. currentLayer.unusedCount = 0;
  51438. if (currentLayer.dirty || paintAll) {
  51439. currentLayer.clear();
  51440. }
  51441. if (currentLayer.needTransform) {
  51442. ctx.save();
  51443. currentLayer.setTransform(ctx);
  51444. }
  51445. }
  51446. // Start group clipping
  51447. if (ctx && shape.__startClip) {
  51448. var clipShape = shape.__startClip;
  51449. ctx.save();
  51450. // Set transform
  51451. if (clipShape.needTransform) {
  51452. let m = clipShape.transform;
  51453. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  51454. ctx.transform(
  51455. m[0], m[1],
  51456. m[2], m[3],
  51457. m[4], m[5]
  51458. );
  51459. }
  51460. ctx.beginPath();
  51461. clipShape.buildPath(ctx, clipShape.style);
  51462. ctx.clip();
  51463. // Transform back
  51464. if (clipShape.needTransform) {
  51465. let m = invTransform;
  51466. ctx.transform(
  51467. m[0], m[1],
  51468. m[2], m[3],
  51469. m[4], m[5]
  51470. );
  51471. }
  51472. }
  51473. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  51474. if (
  51475. !shape.onbrush
  51476. || (shape.onbrush && !shape.onbrush(ctx, false))
  51477. ) {
  51478. if (Config.catchBrushException) {
  51479. try {
  51480. shape.brush(ctx, false, this.updatePainter);
  51481. } catch (error) {
  51482. SUtil_SUtil.Util_log(
  51483. error,
  51484. 'brush error of ' + shape.type,
  51485. shape
  51486. );
  51487. }
  51488. } else {
  51489. shape.brush(ctx, false, this.updatePainter);
  51490. }
  51491. }
  51492. }
  51493. // Stop group clipping
  51494. if (ctx && shape.__stopClip) {
  51495. ctx.restore();
  51496. }
  51497. shape.__dirty = false;
  51498. }
  51499. if (ctx && currentLayer && currentLayer.needTransform) {
  51500. ctx.restore();
  51501. }
  51502. for (let id in this._layers) {
  51503. if (id !== 'hover') {
  51504. var layer = this._layers[id];
  51505. layer.dirty = false;
  51506. // 删除过期的层
  51507. // PENDING
  51508. // if (layer.unusedCount >= 500) {
  51509. // this.delLayer(id);
  51510. // }
  51511. if (layer.unusedCount == 1) {
  51512. layer.clear();
  51513. }
  51514. }
  51515. }
  51516. }
  51517. /**
  51518. * @function SuperMap.LevelRenderer.Painter.prototype.getLayer
  51519. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  51520. *
  51521. * @param {number} zlevel - zlevel。
  51522. * @return {SuperMap.LevelRenderer.Painter} this。
  51523. */
  51524. getLayer(zlevel) {
  51525. // Change draw layer
  51526. var currentLayer = this._layers[zlevel];
  51527. if (!currentLayer) {
  51528. var len = this._zlevelList.length;
  51529. var prevLayer = null;
  51530. var i = -1;
  51531. if (len > 0 && zlevel > this._zlevelList[0]) {
  51532. for (i = 0; i < len - 1; i++) {
  51533. if (
  51534. this._zlevelList[i] < zlevel
  51535. && this._zlevelList[i + 1] > zlevel
  51536. ) {
  51537. break;
  51538. }
  51539. }
  51540. prevLayer = this._layers[this._zlevelList[i]];
  51541. }
  51542. this._zlevelList.splice(i + 1, 0, zlevel);
  51543. // Create a new layer
  51544. //currentLayer = new PaintLayer(zlevel, this);
  51545. currentLayer = new PaintLayer(Util.createUniqueID("_levelLayer_" + zlevel), this);
  51546. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  51547. if (prevDom.nextSibling) {
  51548. prevDom.parentNode.insertBefore(
  51549. currentLayer.dom,
  51550. prevDom.nextSibling
  51551. );
  51552. } else {
  51553. prevDom.parentNode.appendChild(
  51554. currentLayer.dom
  51555. );
  51556. }
  51557. currentLayer.initContext();
  51558. this._layers[zlevel] = currentLayer;
  51559. if (this._layerConfig[zlevel]) {
  51560. new Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  51561. }
  51562. currentLayer.updateTransform();
  51563. }
  51564. return currentLayer;
  51565. }
  51566. /**
  51567. * @function SuperMap.LevelRenderer.Painter.prototype.getLayers
  51568. * @description 获取所有已创建的层。
  51569. * @return {Array.<Painter.Layer>} 已创建的层
  51570. */
  51571. getLayers() {
  51572. return this._layers;
  51573. }
  51574. /**
  51575. * Method: _updateLayerStatus
  51576. * 更新绘制层状态。
  51577. */
  51578. _updateLayerStatus(list) {
  51579. var layers = this._layers;
  51580. var elCounts = {};
  51581. for (let z in layers) {
  51582. if (z !== 'hover') {
  51583. elCounts[z] = layers[z].elCount;
  51584. layers[z].elCount = 0;
  51585. }
  51586. }
  51587. for (let i = 0; i < list.length; i++) {
  51588. var shape = list[i];
  51589. var zlevel = shape.zlevel;
  51590. var layer = layers[zlevel];
  51591. if (layer) {
  51592. layer.elCount++;
  51593. // 已经被标记为需要刷新
  51594. if (layer.dirty) {
  51595. continue;
  51596. }
  51597. layer.dirty = shape.__dirty;
  51598. }
  51599. }
  51600. // 层中的元素数量有发生变化
  51601. for (let z in layers) {
  51602. if (z !== 'hover') {
  51603. if (elCounts[z] !== layers[z].elCount) {
  51604. layers[z].dirty = true;
  51605. }
  51606. }
  51607. }
  51608. }
  51609. /**
  51610. * @function SuperMap.LevelRenderer.Painter.prototype.refreshShapes
  51611. * @description 更新的图形元素列表。
  51612. *
  51613. * @param {number} shapeList - 需要更新的图形元素列表。
  51614. * @param {number} callback - 视图更新后回调函数。
  51615. * @return {SuperMap.LevelRenderer.Painter} this。
  51616. */
  51617. refreshShapes(shapeList, callback) {
  51618. for (var i = 0, l = shapeList.length; i < l; i++) {
  51619. var shape = shapeList[i];
  51620. this.storage.mod(shape.id);
  51621. }
  51622. this.refresh(callback);
  51623. return this;
  51624. }
  51625. /**
  51626. * @function SuperMap.LevelRenderer.Painter.prototype.clear
  51627. * @description 清除 hover 层外所有内容。
  51628. * @return {SuperMap.LevelRenderer.Painter} this。
  51629. */
  51630. clear() {
  51631. for (var k in this._layers) {
  51632. if (k == 'hover') {
  51633. continue;
  51634. }
  51635. this._layers[k].clear();
  51636. }
  51637. return this;
  51638. }
  51639. /**
  51640. * @function SuperMap.LevelRenderer.Painter.prototype.modLayer
  51641. * @description 修改指定 zlevel 的绘制参数。
  51642. *
  51643. * @param {string} zlevel - zlevel。
  51644. * @param {Object} config - 配置对象。
  51645. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  51646. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  51647. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  51648. * @param {Array.<number>} config.position - 层的平移。
  51649. * @param {Array.<number>} config.rotation - 层的旋转。
  51650. * @param {Array.<number>} config.scale - 层的缩放。
  51651. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  51652. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  51653. *
  51654. */
  51655. modLayer(zlevel, config) {
  51656. if (config) {
  51657. if (!this._layerConfig[zlevel]) {
  51658. this._layerConfig[zlevel] = config;
  51659. } else {
  51660. new Util_Util().merge(this._layerConfig[zlevel], config, true);
  51661. }
  51662. var layer = this._layers[zlevel];
  51663. if (layer) {
  51664. new Util_Util().merge(layer, this._layerConfig[zlevel], true);
  51665. }
  51666. }
  51667. }
  51668. /**
  51669. * @function SuperMap.LevelRenderer.Painter.prototype.delLayer
  51670. * @description 删除指定层。
  51671. *
  51672. * @param {string} zlevel - 层所在的 zlevel。
  51673. */
  51674. delLayer(zlevel) {
  51675. var layer = this._layers[zlevel];
  51676. if (!layer) {
  51677. return;
  51678. }
  51679. // Save config
  51680. this.modLayer(zlevel, {
  51681. position: layer.position,
  51682. rotation: layer.rotation,
  51683. scale: layer.scale
  51684. });
  51685. layer.dom.parentNode.removeChild(layer.dom);
  51686. delete this._layers[zlevel];
  51687. this._zlevelList.splice(new Util_Util().indexOf(this._zlevelList, zlevel), 1);
  51688. }
  51689. /**
  51690. * @function SuperMap.LevelRenderer.Painter.prototype.refreshHover
  51691. * @description 刷新 hover 层。
  51692. * @return {SuperMap.LevelRenderer.Painter} this。
  51693. */
  51694. refreshHover() {
  51695. this.clearHover();
  51696. var list = this.storage.getHoverShapes(true);
  51697. for (var i = 0, l = list.length; i < l; i++) {
  51698. this._brushHover(list[i]);
  51699. }
  51700. this.storage.delHover();
  51701. return this;
  51702. }
  51703. /**
  51704. * @function SuperMap.LevelRenderer.Painter.prototype.clearHover
  51705. * @description 清除 hover 层所有内容。
  51706. * @return {SuperMap.LevelRenderer.Painter} this。
  51707. */
  51708. clearHover() {
  51709. var hover = this._layers.hover;
  51710. hover && hover.clear();
  51711. return this;
  51712. }
  51713. /**
  51714. * @function SuperMap.LevelRenderer.Painter.prototype.resize
  51715. * @description 区域大小变化后重绘。
  51716. * @return {SuperMap.LevelRenderer.Painter} this。
  51717. */
  51718. resize() {
  51719. var domRoot = this._domRoot;
  51720. domRoot.style.display = 'none';
  51721. var width = this._getWidth();
  51722. var height = this._getHeight();
  51723. domRoot.style.display = '';
  51724. // 优化没有实际改变的resize
  51725. if (this._width != width || height != this._height) {
  51726. this._width = width;
  51727. this._height = height;
  51728. domRoot.style.width = width + 'px';
  51729. domRoot.style.height = height + 'px';
  51730. for (var id in this._layers) {
  51731. this._layers[id].resize(width, height);
  51732. }
  51733. this.refresh(null, true);
  51734. }
  51735. return this;
  51736. }
  51737. /**
  51738. * @function SuperMap.LevelRenderer.Painter.prototype.clearLayer
  51739. * @description 清除指定的一个层。
  51740. * @param {number} zLevel - 层。
  51741. */
  51742. clearLayer(zLevel) {
  51743. var layer = this._layers[zLevel];
  51744. if (layer) {
  51745. layer.clear();
  51746. }
  51747. }
  51748. /**
  51749. * @function SuperMap.LevelRenderer.Painter.prototype.dispose
  51750. * @description 释放。
  51751. *
  51752. */
  51753. dispose() {
  51754. this.root.innerHTML = '';
  51755. this.root = null;
  51756. this.storage = null;
  51757. this._domRoot = null;
  51758. this._layers = null;
  51759. }
  51760. /**
  51761. * @function SuperMap.LevelRenderer.Painter.prototype.getDomHover
  51762. * @description 获取 Hover 层的 Dom。
  51763. */
  51764. getDomHover() {
  51765. return this._layers.hover.dom;
  51766. }
  51767. /**
  51768. * @function SuperMap.LevelRenderer.Painter.prototype.toDataURL
  51769. * @description 图像导出。
  51770. * @param {string} type - 图片类型。
  51771. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  51772. * @param {Object} args
  51773. * @return {string} 图片的Base64 url。
  51774. */
  51775. toDataURL(type, backgroundColor, args) {
  51776. //var imageDom = Painter.createDom('image', 'canvas', this);
  51777. var imageDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  51778. this._bgDom.appendChild(imageDom);
  51779. var ctx = imageDom.getContext('2d');
  51780. Painter.devicePixelRatio != 1
  51781. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  51782. ctx.fillStyle = backgroundColor || '#fff';
  51783. ctx.rect(
  51784. 0, 0,
  51785. this._width * Painter.devicePixelRatio,
  51786. this._height * Painter.devicePixelRatio
  51787. );
  51788. ctx.fill();
  51789. var self = this;
  51790. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  51791. this.storage.iterShape(
  51792. function (shape) {
  51793. if (!shape.invisible) {
  51794. if (!shape.onbrush // 没有onbrush
  51795. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  51796. || (shape.onbrush && !shape.onbrush(ctx, false))
  51797. ) {
  51798. if (Config.catchBrushException) {
  51799. try {
  51800. shape.brush(ctx, false, self.updatePainter);
  51801. } catch (error) {
  51802. SUtil_SUtil.Util_log(
  51803. error,
  51804. 'brush error of ' + shape.type,
  51805. shape
  51806. );
  51807. }
  51808. } else {
  51809. shape.brush(ctx, false, self.updatePainter);
  51810. }
  51811. }
  51812. }
  51813. },
  51814. {normal: 'up', update: true}
  51815. );
  51816. var image = imageDom.toDataURL(type, args);
  51817. ctx = null;
  51818. this._bgDom.removeChild(imageDom);
  51819. return image;
  51820. }
  51821. /**
  51822. * @function SuperMap.LevelRenderer.Painter.prototype.getWidth
  51823. * @description 获取绘图区域宽度。
  51824. * @return {number} 绘图区域宽度。
  51825. */
  51826. getWidth() {
  51827. return this._width;
  51828. }
  51829. /**
  51830. * @function SuperMap.LevelRenderer.Painter.prototype.getHeight
  51831. * @description 获取绘图区域高度。
  51832. * @return {number} 绘图区域高度。
  51833. */
  51834. getHeight() {
  51835. return this._height;
  51836. }
  51837. /**
  51838. * Method: _getWidth
  51839. *
  51840. */
  51841. _getWidth() {
  51842. var root = this.root;
  51843. var stl = root.currentStyle
  51844. || document.defaultView.getComputedStyle(root);
  51845. return ((root.clientWidth || parseInt(stl.width, 10))
  51846. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  51847. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  51848. }
  51849. /**
  51850. * Method: _getHeight
  51851. *
  51852. */
  51853. _getHeight() {
  51854. var root = this.root;
  51855. var stl = root.currentStyle
  51856. || document.defaultView.getComputedStyle(root);
  51857. return ((root.clientHeight || parseInt(stl.height, 10))
  51858. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  51859. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  51860. }
  51861. /**
  51862. * Method: _brushHover
  51863. *
  51864. */
  51865. _brushHover(shape) {
  51866. var ctx = this._layers.hover.ctx;
  51867. if (!shape.onbrush // 没有onbrush
  51868. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  51869. || (shape.onbrush && !shape.onbrush(ctx, true))
  51870. ) {
  51871. var layer = this.getLayer(shape.zlevel);
  51872. if (layer.needTransform) {
  51873. ctx.save();
  51874. layer.setTransform(ctx);
  51875. }
  51876. // Retina 优化
  51877. if (Config.catchBrushException) {
  51878. try {
  51879. shape.brush(ctx, true, this.updatePainter);
  51880. } catch (error) {
  51881. SUtil_SUtil.Util_log(
  51882. error, 'hoverBrush error of ' + shape.type, shape
  51883. );
  51884. }
  51885. } else {
  51886. shape.brush(ctx, true, this.updatePainter);
  51887. }
  51888. if (layer.needTransform) {
  51889. ctx.restore();
  51890. }
  51891. }
  51892. }
  51893. /**
  51894. * Method: _shapeToImage
  51895. *
  51896. */
  51897. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  51898. var canvas = document.createElement('canvas');
  51899. var ctx = canvas.getContext('2d');
  51900. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  51901. canvas.style.width = width + 'px';
  51902. canvas.style.height = height + 'px';
  51903. canvas.setAttribute('width', width * _devicePixelRatio);
  51904. canvas.setAttribute('height', height * _devicePixelRatio);
  51905. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  51906. var shapeTransform = {
  51907. position: shape.position,
  51908. rotation: shape.rotation,
  51909. scale: shape.scale
  51910. };
  51911. shape.position = [0, 0, 0];
  51912. shape.rotation = 0;
  51913. shape.scale = [1, 1];
  51914. if (shape) {
  51915. shape.brush(ctx, false);
  51916. }
  51917. var imgShape = new SmicImage({
  51918. id: id,
  51919. style: {
  51920. x: 0,
  51921. y: 0,
  51922. image: canvas
  51923. }
  51924. });
  51925. if (shapeTransform.position != null) {
  51926. imgShape.position = shape.position = shapeTransform.position;
  51927. }
  51928. if (shapeTransform.rotation != null) {
  51929. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  51930. }
  51931. if (shapeTransform.scale != null) {
  51932. imgShape.scale = shape.scale = shapeTransform.scale;
  51933. }
  51934. return imgShape;
  51935. }
  51936. /**
  51937. * Method: _createShapeToImageProcessor
  51938. *
  51939. */
  51940. _createShapeToImageProcessor() {
  51941. var me = this;
  51942. return function (id, e, width, height) {
  51943. return me._shapeToImage(
  51944. id, e, width, height, Painter.devicePixelRatio
  51945. );
  51946. };
  51947. }
  51948. // SMIC-方法扩展 - start
  51949. /**
  51950. * @function SuperMap.LevelRenderer.Painter.prototype.updateHoverLayer
  51951. * @description 更新设置显示高亮图层。
  51952. * @param {Array} shapes - 图形数组。
  51953. */
  51954. updateHoverLayer(shapes) {
  51955. if (!(shapes instanceof Array)) {
  51956. return this;
  51957. }
  51958. //清除高亮
  51959. this.clearHover();
  51960. this.storage.delHover();
  51961. for (var i = 0; i < shapes.length; i++) {
  51962. this.storage.addHover(shapes[i]);
  51963. this._brushHover(shapes[i]);
  51964. }
  51965. }
  51966. /**
  51967. * @function SuperMap.LevelRenderer.Painter.prototype.createDom
  51968. * @description 创建 Dom。
  51969. *
  51970. * @param {string} id - Dom id
  51971. * @param {string} type - Dom type
  51972. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  51973. * @return {Object} Dom
  51974. */
  51975. static createDom(id, type, painter) {
  51976. var newDom = document.createElement(type);
  51977. var width = painter._width;
  51978. var height = painter._height;
  51979. // 没append呢,请原谅我这样写,清晰~
  51980. newDom.style.position = 'absolute';
  51981. newDom.style.left = 0;
  51982. newDom.style.top = 0;
  51983. newDom.style.width = width + 'px';
  51984. newDom.style.height = height + 'px';
  51985. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  51986. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  51987. // id不作为索引用,避免可能造成的重名,定义为私有属性
  51988. //newDom.setAttribute('data-zr-dom-id', id);
  51989. newDom.setAttribute('id', id);
  51990. return newDom;
  51991. }
  51992. }
  51993. /**
  51994. * @private
  51995. * @class Painter.Layer
  51996. * @classdesc 绘制层类。
  51997. * @extends SuperMap.LevelRenderer.Transformable
  51998. */
  51999. class PaintLayer extends Transformable {
  52000. /**
  52001. * @function Painter.Layer.constructor
  52002. * @description 构造函数。
  52003. *
  52004. * @param {string} id - id。
  52005. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  52006. *
  52007. */
  52008. constructor(id, painter) {
  52009. super(id, painter);
  52010. /**
  52011. * @member {Object} Painter.Layer.prototype.dom
  52012. * @description dom。
  52013. */
  52014. this.dom = null;
  52015. /**
  52016. * @member {Object} Painter.Layer.prototype.domBack
  52017. * @description domBack。
  52018. */
  52019. this.domBack = null;
  52020. /**
  52021. * @member {Object} Painter.Layer.prototype.ctxBack
  52022. * @description ctxBack。
  52023. */
  52024. this.ctxBack = null;
  52025. /**
  52026. * @member {SuperMap.LevelRenderer.Painter} Painter.Layer.prototype.painter
  52027. * @description painter。
  52028. */
  52029. this.painter = painter;
  52030. /**
  52031. * @member {number} Painter.Layer.prototype.unusedCount
  52032. * @description unusedCount。
  52033. */
  52034. this.unusedCount = 0;
  52035. /**
  52036. * @member {Object} Painter.Layer.prototype.config
  52037. * @description config。
  52038. */
  52039. this.config = null;
  52040. /**
  52041. * @member {boolean} Painter.Layer.prototype.dirty
  52042. * @description dirty。
  52043. */
  52044. this.dirty = true;
  52045. /**
  52046. * @member {number} Painter.Layer.prototype.elCount
  52047. * @description elCount。
  52048. */
  52049. this.elCount = 0;
  52050. // Configs
  52051. /**
  52052. * @member {string} Painter.Layer.prototype.clearColor
  52053. * @description 每次清空画布的颜色。默认值:0;
  52054. */
  52055. this.clearColor = 0;
  52056. /**
  52057. * @member {boolean} Painter.Layer.prototype.motionBlur
  52058. * @description 是否开启动态模糊。默认值:false;
  52059. */
  52060. this.motionBlur = false;
  52061. /**
  52062. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  52063. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  52064. */
  52065. this.lastFrameAlpha = 0.7;
  52066. /**
  52067. * @member {boolean} Painter.Layer.prototype.zoomable
  52068. * @description 层是否支持鼠标平移操作。默认值:false;
  52069. */
  52070. this.zoomable = false;
  52071. /**
  52072. * @member {boolean} Painter.Layer.prototype.panable
  52073. * @description 层是否支持鼠标缩放操作。默认值:false;
  52074. */
  52075. this.panable = false;
  52076. /**
  52077. * @member {number} Painter.Layer.prototype.maxZoom
  52078. * @description maxZoom。默认值:Infinity。
  52079. */
  52080. this.maxZoom = Infinity;
  52081. /**
  52082. * @member {number} Painter.Layer.prototype.minZoom
  52083. * @description minZoom。默认值:0。
  52084. */
  52085. this.minZoom = 0;
  52086. /**
  52087. * @member {number} Painter.Layer.prototype.ctx
  52088. * @description Canvas 上下文。
  52089. */
  52090. this.ctx = null;
  52091. this.dom = Painter.createDom(Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  52092. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  52093. this.dom.style['-webkit-user-select'] = 'none';
  52094. this.dom.style['user-select'] = 'none';
  52095. this.dom.style['-webkit-touch-callout'] = 'none';
  52096. // Function
  52097. // 返回false的方法,用于避免页面被选中
  52098. function returnFalse() {
  52099. return false;
  52100. }
  52101. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  52102. }
  52103. /**
  52104. * @function Painter.Layer.prototype.destroy
  52105. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52106. */
  52107. destroy() {
  52108. this.dom = null;
  52109. this.domBack = null;
  52110. this.ctxBack = null;
  52111. this.painter = null;
  52112. this.unusedCount = null;
  52113. this.config = null;
  52114. this.dirty = null;
  52115. this.elCount = null;
  52116. this.clearColor = null;
  52117. this.motionBlur = null;
  52118. this.lastFrameAlpha = null;
  52119. this.zoomable = null;
  52120. this.panable = null;
  52121. this.maxZoom = null;
  52122. this.minZoom = null;
  52123. this.ctx = null;
  52124. Transformable.destroy.apply(this, arguments);
  52125. }
  52126. /**
  52127. * @function Painter.Layer.prototype.initContext
  52128. * @description 初始化 Canvan 2D 上下文。
  52129. */
  52130. initContext() {
  52131. this.ctx = this.dom.getContext('2d');
  52132. if (Painter.devicePixelRatio != 1) {
  52133. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  52134. }
  52135. }
  52136. /**
  52137. * @function Painter.Layer.prototype.createBackBuffer
  52138. * @description 创建备份缓冲。
  52139. */
  52140. createBackBuffer() {
  52141. this.domBack = Painter.createDom(Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  52142. this.ctxBack = this.domBack.getContext('2d');
  52143. if (Painter.devicePixelRatio != 1) {
  52144. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  52145. }
  52146. }
  52147. /**
  52148. * @function Painter.Layer.prototype.resize
  52149. * @description 改变大小。
  52150. *
  52151. * @param {number} width - 宽。
  52152. * @param {number} height - 高。
  52153. */
  52154. resize(width, height) {
  52155. this.dom.style.width = width + 'px';
  52156. this.dom.style.height = height + 'px';
  52157. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  52158. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  52159. if (Painter.devicePixelRatio != 1) {
  52160. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  52161. }
  52162. if (this.domBack) {
  52163. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  52164. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  52165. if (Painter.devicePixelRatio != 1) {
  52166. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  52167. }
  52168. }
  52169. }
  52170. /**
  52171. * @function Painter.Layer.prototype.clear
  52172. * @description 清空该层画布。
  52173. */
  52174. clear() {
  52175. var dom = this.dom;
  52176. var ctx = this.ctx;
  52177. var width = dom.width;
  52178. var height = dom.height;
  52179. var haveClearColor = this.clearColor;
  52180. var haveMotionBLur = this.motionBlur;
  52181. var lastFrameAlpha = this.lastFrameAlpha;
  52182. if (haveMotionBLur) {
  52183. if (!this.domBack) {
  52184. this.createBackBuffer();
  52185. }
  52186. this.ctxBack.globalCompositeOperation = 'copy';
  52187. this.ctxBack.drawImage(
  52188. dom, 0, 0,
  52189. width / Painter.devicePixelRatio,
  52190. height / Painter.devicePixelRatio
  52191. );
  52192. }
  52193. if (haveClearColor) {
  52194. ctx.save();
  52195. ctx.fillStyle = this.config.clearColor;
  52196. ctx.fillRect(
  52197. 0, 0,
  52198. width / Painter.devicePixelRatio,
  52199. height / Painter.devicePixelRatio
  52200. );
  52201. ctx.restore();
  52202. } else {
  52203. ctx.clearRect(
  52204. 0, 0,
  52205. width / Painter.devicePixelRatio,
  52206. height / Painter.devicePixelRatio
  52207. );
  52208. }
  52209. if (haveMotionBLur) {
  52210. var domBack = this.domBack;
  52211. ctx.save();
  52212. ctx.globalAlpha = lastFrameAlpha;
  52213. ctx.drawImage(
  52214. domBack, 0, 0,
  52215. width / Painter.devicePixelRatio,
  52216. height / Painter.devicePixelRatio
  52217. );
  52218. ctx.restore();
  52219. }
  52220. }
  52221. }
  52222. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  52223. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52224. * This program are made available under the terms of the Apache License, Version 2.0
  52225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52226. /**
  52227. * @private
  52228. * @class SuperMap.LevelRenderer.Handler
  52229. * @category Visualization Theme
  52230. * @classdesc Handler控制模块。
  52231. * @extends {SuperMap.LevelRenderer.Eventful}
  52232. */
  52233. class Handler extends Eventful {
  52234. /**
  52235. * @function SuperMap.LevelRenderer.Handler.constructor
  52236. * @description 构造函数。
  52237. * @param {HTMLElement} root - 绘图区域。
  52238. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  52239. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  52240. */
  52241. constructor(root, storage, painter) {
  52242. super(root, storage, painter);
  52243. /**
  52244. * @member {HTMLElement} SuperMap.LevelRenderer.Handler.prototype.root
  52245. * @description 绘图区域
  52246. */
  52247. this.root = root;
  52248. /**
  52249. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Handler.prototype.storage
  52250. * @description Storage 实例
  52251. */
  52252. this.storage = storage;
  52253. /**
  52254. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Handler.prototype.Painter
  52255. * @description Painter 实例
  52256. */
  52257. this.painter = painter;
  52258. /**
  52259. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastX=0]
  52260. * @description 上一次鼠标位置x坐标值
  52261. */
  52262. this._lastX = 0;
  52263. /**
  52264. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastY=0]
  52265. * @description 上一次鼠标位置y坐标值
  52266. */
  52267. this._lastY = 0;
  52268. /**
  52269. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseX=0]
  52270. * @description 当前鼠标位置x坐标值
  52271. */
  52272. this._mouseX = 0;
  52273. /**
  52274. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseY=0]
  52275. * @description 当前鼠标位置y坐标值
  52276. */
  52277. this._mouseY = 0;
  52278. /**
  52279. * @member {Function} SuperMap.LevelRenderer.Handler.prototype._findHover
  52280. * @description 查找 Hover 图形
  52281. */
  52282. this._findHover = null;
  52283. /**
  52284. * @member {Object} SuperMap.LevelRenderer.Handler.prototype._domHover
  52285. * @description 高亮 DOM
  52286. */
  52287. this._domHover = null;
  52288. // 各种事件标识的私有变量
  52289. // this._hasfound = false; // 是否找到 hover 图形元素
  52290. // this._lastHover = null; // 最后一个 hover 图形元素
  52291. // this._mouseDownTarget = null;
  52292. // this._draggingTarget = null; // 当前被拖拽的图形元素
  52293. // this._isMouseDown = false;
  52294. // this._isDragging = false;
  52295. // this._lastMouseDownMoment;
  52296. // this._lastTouchMoment;
  52297. // this._lastDownButton;
  52298. this._findHover = bind3Arg(findHover, this);
  52299. this._domHover = painter.getDomHover();
  52300. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  52301. var domHandlers = {
  52302. /**
  52303. * Method: resize
  52304. * 窗口大小改变响应函数。
  52305. *
  52306. * Parameters:
  52307. * event - {Event} event。
  52308. *
  52309. */
  52310. resize: function (event) {
  52311. event = event || window.event;
  52312. this._lastHover = null;
  52313. this._isMouseDown = 0;
  52314. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  52315. this.dispatch(Config.EVENT.RESIZE, event);
  52316. },
  52317. /**
  52318. * Method: click
  52319. * 点击响应函数。
  52320. *
  52321. * Parameters:
  52322. * event - {Event} event。
  52323. *
  52324. */
  52325. click: function (event) {
  52326. event = this._zrenderEventFixed(event);
  52327. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  52328. var _lastHover = this._lastHover;
  52329. if ((_lastHover && _lastHover.clickable)
  52330. || !_lastHover
  52331. ) {
  52332. // 判断没有发生拖拽才触发click事件
  52333. if (this._clickThreshold < 10) {
  52334. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  52335. }
  52336. }
  52337. this._mousemoveHandler(event);
  52338. },
  52339. /**
  52340. * Method: dblclick
  52341. * 双击响应函数。
  52342. *
  52343. * Parameters:
  52344. * event - {Event} event。
  52345. *
  52346. */
  52347. dblclick: function (event) {
  52348. event = event || window.event;
  52349. event = this._zrenderEventFixed(event);
  52350. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  52351. var _lastHover = this._lastHover;
  52352. if ((_lastHover && _lastHover.clickable)
  52353. || !_lastHover
  52354. ) {
  52355. // 判断没有发生拖拽才触发dblclick事件
  52356. if (this._clickThreshold < 5) {
  52357. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  52358. }
  52359. }
  52360. this._mousemoveHandler(event);
  52361. },
  52362. /**
  52363. * Method: mousewheel
  52364. * 鼠标滚轮响应函数。
  52365. *
  52366. * Parameters:
  52367. * event - {Event} event。
  52368. *
  52369. */
  52370. mousewheel: function (event) {
  52371. event = this._zrenderEventFixed(event);
  52372. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  52373. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  52374. var delta = event.wheelDelta // Webkit
  52375. || -event.detail; // Firefox
  52376. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  52377. var layers = this.painter.getLayers();
  52378. var needsRefresh = false;
  52379. for (var z in layers) {
  52380. if (z !== 'hover') {
  52381. var layer = layers[z];
  52382. var pos = layer.position;
  52383. if (layer.zoomable) {
  52384. layer.__zoom = layer.__zoom || 1;
  52385. var newZoom = layer.__zoom;
  52386. newZoom *= scale;
  52387. newZoom = Math.max(
  52388. Math.min(layer.maxZoom, newZoom),
  52389. layer.minZoom
  52390. );
  52391. scale = newZoom / layer.__zoom;
  52392. layer.__zoom = newZoom;
  52393. // Keep the mouse center when scaling
  52394. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  52395. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  52396. layer.scale[0] *= scale;
  52397. layer.scale[1] *= scale;
  52398. layer.dirty = true;
  52399. needsRefresh = true;
  52400. }
  52401. }
  52402. }
  52403. if (needsRefresh) {
  52404. this.painter.refresh();
  52405. }
  52406. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  52407. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  52408. this._mousemoveHandler(event);
  52409. },
  52410. /**
  52411. * Method: mousemove
  52412. * 鼠标(手指)移动响应函数。
  52413. *
  52414. * Parameters:
  52415. * event - {Event} event。
  52416. *
  52417. */
  52418. mousemove: function (event) {
  52419. // 拖拽不触发click事件
  52420. this._clickThreshold++;
  52421. event = this._zrenderEventFixed(event);
  52422. this._lastX = this._mouseX;
  52423. this._lastY = this._mouseY;
  52424. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  52425. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  52426. var dx = this._mouseX - this._lastX;
  52427. var dy = this._mouseY - this._lastY;
  52428. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  52429. // 避免手抖点击误认为拖拽
  52430. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  52431. this._processDragStart(event);
  52432. // }
  52433. this._hasfound = 0;
  52434. this._event = event;
  52435. this._iterateAndFindHover();
  52436. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  52437. if (!this._hasfound) {
  52438. // 过滤首次拖拽产生的mouseout和dragLeave
  52439. if (!this._draggingTarget
  52440. || (this._lastHover && this._lastHover != this._draggingTarget)
  52441. ) {
  52442. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  52443. this._processOutShape(event);
  52444. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  52445. this._processDragLeave(event);
  52446. }
  52447. this._lastHover = null;
  52448. this.storage.delHover();
  52449. this.painter.clearHover();
  52450. }
  52451. // set cursor for root element
  52452. var cursor = '';
  52453. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  52454. if (this._draggingTarget) {
  52455. this.storage.drift(this._draggingTarget.id, dx, dy);
  52456. this._draggingTarget.modSelf();
  52457. this.storage.addHover(this._draggingTarget);
  52458. } else if (this._isMouseDown) {
  52459. // Layer dragging
  52460. var layers = this.painter.getLayers();
  52461. var needsRefresh = false;
  52462. for (var z in layers) {
  52463. if (z !== 'hover') {
  52464. var layer = layers[z];
  52465. if (layer.panable) {
  52466. // PENDING
  52467. cursor = 'move';
  52468. // Keep the mouse center when scaling
  52469. layer.position[0] += dx;
  52470. layer.position[1] += dy;
  52471. needsRefresh = true;
  52472. layer.dirty = true;
  52473. }
  52474. }
  52475. }
  52476. if (needsRefresh) {
  52477. this.painter.refresh();
  52478. }
  52479. }
  52480. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  52481. cursor = 'move';
  52482. } else if (this._hasfound && this._lastHover.clickable) {
  52483. cursor = 'pointer';
  52484. }
  52485. this.root.style.cursor = cursor;
  52486. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  52487. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  52488. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  52489. this.painter.refreshHover();
  52490. }
  52491. },
  52492. /**
  52493. * Method: mouseout
  52494. * 鼠标(手指)离开响应函数。
  52495. *
  52496. * Parameters:
  52497. * event - {Event} event。
  52498. *
  52499. */
  52500. mouseout: function (event) {
  52501. event = this._zrenderEventFixed(event);
  52502. var element = event.toElement || event.relatedTarget;
  52503. if (element != this.root) {
  52504. while (element && element.nodeType != 9) {
  52505. // 忽略包含在root中的dom引起的mouseOut
  52506. if (element == this.root) {
  52507. this._mousemoveHandler(event);
  52508. return;
  52509. }
  52510. element = element.parentNode;
  52511. }
  52512. }
  52513. event.zrenderX = this._lastX;
  52514. event.zrenderY = this._lastY;
  52515. this.root.style.cursor = '';
  52516. this._isMouseDown = 0;
  52517. this._processOutShape(event);
  52518. this._processDrop(event);
  52519. this._processDragEnd(event);
  52520. this.painter.refreshHover();
  52521. this.dispatch(Config.EVENT.GLOBALOUT, event);
  52522. },
  52523. /**
  52524. * Method: mousedown
  52525. * 鼠标(手指)按下响应函数。
  52526. *
  52527. * Parameters:
  52528. * event - {Event} event。
  52529. *
  52530. */
  52531. mousedown: function (event) {
  52532. // 重置 clickThreshold
  52533. this._clickThreshold = 0;
  52534. if (this._lastDownButton == 2) {
  52535. this._lastDownButton = event.button;
  52536. this._mouseDownTarget = null;
  52537. // 仅作为关闭右键菜单使用
  52538. return;
  52539. }
  52540. this._lastMouseDownMoment = new Date();
  52541. event = this._zrenderEventFixed(event);
  52542. this._isMouseDown = 1;
  52543. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  52544. this._mouseDownTarget = this._lastHover;
  52545. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  52546. this._lastDownButton = event.button;
  52547. },
  52548. /**
  52549. * Method: mouseup
  52550. * 鼠标(手指)抬起响应函数。
  52551. *
  52552. * Parameters:
  52553. * event - {Event} event。
  52554. *
  52555. */
  52556. mouseup: function (event) {
  52557. event = this._zrenderEventFixed(event);
  52558. this.root.style.cursor = '';
  52559. this._isMouseDown = 0;
  52560. this._mouseDownTarget = null;
  52561. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  52562. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  52563. this._processDrop(event);
  52564. this._processDragEnd(event);
  52565. },
  52566. /**
  52567. * Method: touchstart
  52568. * Touch 开始响应函数。
  52569. *
  52570. * Parameters:
  52571. * event - {Event} event。
  52572. *
  52573. */
  52574. touchstart: function (event) {
  52575. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  52576. event = this._zrenderEventFixed(event, true);
  52577. this._lastTouchMoment = new Date();
  52578. // 平板补充一次findHover
  52579. this._mobildFindFixed(event);
  52580. this._mousedownHandler(event);
  52581. },
  52582. /**
  52583. * Method: touchmove
  52584. * Touch 移动响应函数。
  52585. *
  52586. * Parameters:
  52587. * event - {Event} event。
  52588. *
  52589. */
  52590. touchmove: function (event) {
  52591. event = this._zrenderEventFixed(event, true);
  52592. this._mousemoveHandler(event);
  52593. if (this._isDragging) {
  52594. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  52595. }
  52596. },
  52597. /**
  52598. * Method: touchend
  52599. * Touch 结束响应函数。
  52600. *
  52601. * Parameters:
  52602. * event - {Event} event。
  52603. *
  52604. */
  52605. touchend: function (event) {
  52606. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  52607. event = this._zrenderEventFixed(event, true);
  52608. this._mouseupHandler(event);
  52609. var now = new Date();
  52610. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  52611. this._mobildFindFixed(event);
  52612. this._clickHandler(event);
  52613. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  52614. this._dblclickHandler(event);
  52615. if (this._lastHover && this._lastHover.clickable) {
  52616. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  52617. }
  52618. }
  52619. this._lastClickMoment = now;
  52620. }
  52621. this.painter.clearHover();
  52622. }
  52623. };
  52624. initDomHandler(this);
  52625. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  52626. if (window.addEventListener) {
  52627. window.addEventListener('resize', this._resizeHandler);
  52628. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  52629. // mobile支持
  52630. root.addEventListener('touchstart', this._touchstartHandler);
  52631. root.addEventListener('touchmove', this._touchmoveHandler);
  52632. root.addEventListener('touchend', this._touchendHandler);
  52633. } else {
  52634. // mobile的click/move/up/down自己模拟
  52635. root.addEventListener('click', this._clickHandler);
  52636. root.addEventListener('dblclick', this._dblclickHandler);
  52637. root.addEventListener('mousewheel', this._mousewheelHandler);
  52638. root.addEventListener('mousemove', this._mousemoveHandler);
  52639. root.addEventListener('mousedown', this._mousedownHandler);
  52640. root.addEventListener('mouseup', this._mouseupHandler);
  52641. }
  52642. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  52643. root.addEventListener('mouseout', this._mouseoutHandler);
  52644. } else {
  52645. window.attachEvent('onresize', this._resizeHandler);
  52646. root.attachEvent('onclick', this._clickHandler);
  52647. //root.attachEvent('ondblclick ', this._dblclickHandler);
  52648. root.ondblclick = this._dblclickHandler;
  52649. root.attachEvent('onmousewheel', this._mousewheelHandler);
  52650. root.attachEvent('onmousemove', this._mousemoveHandler);
  52651. root.attachEvent('onmouseout', this._mouseoutHandler);
  52652. root.attachEvent('onmousedown', this._mousedownHandler);
  52653. root.attachEvent('onmouseup', this._mouseupHandler);
  52654. }
  52655. // 辅助函数 start
  52656. /**
  52657. * Method: bind1Arg
  52658. * bind 一个参数的 function。
  52659. *
  52660. * Parameters:
  52661. * handler - {Function} 要 bind 的 function。
  52662. * context - {Object} 运行时 this 环境。
  52663. *
  52664. * Returns:
  52665. * {Function}
  52666. */
  52667. function bind1Arg(handler, context) {
  52668. return function (e) {
  52669. return handler.call(context, e);
  52670. };
  52671. }
  52672. /*
  52673. // bind 两个参数的 function
  52674. function bind2Arg(handler, context) {
  52675. return function (arg1, arg2) {
  52676. return handler.call(context, arg1, arg2);
  52677. };
  52678. }
  52679. */
  52680. // bind 三个参数的 function
  52681. function bind3Arg(handler, context) {
  52682. return function (arg1, arg2, arg3) {
  52683. return handler.call(context, arg1, arg2, arg3);
  52684. };
  52685. }
  52686. /**
  52687. * Method: initDomHandler
  52688. * 为控制类实例初始化 dom 事件处理函数。
  52689. *
  52690. * Parameters:
  52691. * instance - {<SuperMap.LevelRenderer.Handler>} 控制类实例 。
  52692. *
  52693. * Returns:
  52694. * {Function}
  52695. */
  52696. function initDomHandler(instance) {
  52697. var domHandlerNames = [
  52698. 'resize', 'click', 'dblclick',
  52699. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  52700. 'touchstart', 'touchend', 'touchmove'
  52701. ];
  52702. var len = domHandlerNames.length;
  52703. while (len--) {
  52704. var name = domHandlerNames[len];
  52705. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  52706. }
  52707. }
  52708. /**
  52709. * Method: findHover
  52710. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  52711. *
  52712. * Parameters:
  52713. * shape - {Object} 图形。
  52714. * x - {number} 鼠标 x。
  52715. * y - {number} 鼠标 y。
  52716. *
  52717. * Returns:
  52718. * {boolean} 是否找到图形。
  52719. *
  52720. */
  52721. function findHover(shape, x, y) {
  52722. var me = this;
  52723. if (
  52724. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  52725. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  52726. ) {
  52727. return false;
  52728. }
  52729. var event = me._event;
  52730. if (shape.isCover(x, y)) {
  52731. if (shape.hoverable) {
  52732. // SMIC-修改 - start
  52733. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  52734. if (shape.refDataID) {
  52735. var fid = shape.refDataID;
  52736. //me.painter.clearHover();
  52737. //me.storage.delHover();
  52738. var hoverGroup = null;
  52739. if (shape.refDataHoverGroup) {
  52740. hoverGroup = shape.refDataHoverGroup;
  52741. }
  52742. //查找同一个用户数据 feature 的所有图形
  52743. var shapeList = me.storage._shapeList;
  52744. for (var i = 0, len = shapeList.length; i < len; i++) {
  52745. var si = shapeList[i];
  52746. if (si.refDataID && fid === si.refDataID) {
  52747. if (hoverGroup) {
  52748. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  52749. me.storage.addHover(si);
  52750. }
  52751. } else {
  52752. me.storage.addHover(si);
  52753. }
  52754. }
  52755. }
  52756. }
  52757. } else {
  52758. me.storage.addHover(shape);
  52759. }
  52760. //初始代码:
  52761. // me.storage.addHover(shape);
  52762. // SMIC-修改 - end
  52763. }
  52764. // 查找是否在 clipShape 中
  52765. var p = shape.parent;
  52766. while (p) {
  52767. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  52768. // 已经被祖先 clip 掉了
  52769. return false;
  52770. }
  52771. p = p.parent;
  52772. }
  52773. if (me._lastHover != shape) {
  52774. me._processOutShape(event);
  52775. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  52776. me._processDragLeave(event);
  52777. me._lastHover = shape;
  52778. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  52779. me._processDragEnter(event);
  52780. }
  52781. me._processOverShape(event);
  52782. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  52783. me._processDragOver(event);
  52784. me._hasfound = 1;
  52785. return true; // 找到则中断迭代查找
  52786. }
  52787. return false;
  52788. }
  52789. // 辅助函数 end
  52790. }
  52791. /**
  52792. * @function SuperMap.LevelRenderer.Handler.prototype.destroy
  52793. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  52794. */
  52795. destroy() {
  52796. this.dispose();
  52797. this._lastX = null;
  52798. this._lastY = null;
  52799. this._mouseX = null;
  52800. this._mouseY = null;
  52801. this._findHover = null;
  52802. Eventful.prototype.destroy.apply(this, arguments);
  52803. }
  52804. /**
  52805. * @function SuperMap.LevelRenderer.Handler.prototype.on
  52806. * @description 自定义事件绑定。
  52807. * @param {string} eventName - 事件名称,resize、hover、drag等。
  52808. * @param {function} handler - 响应函数。
  52809. * @returns {SuperMap.LevelRenderer.Handler} this。
  52810. */
  52811. on(eventName, handler) {
  52812. this.bind(eventName, handler);
  52813. return this;
  52814. }
  52815. /**
  52816. * @function SuperMap.LevelRenderer.Handler.prototype.un
  52817. * @description 自定义事件解除绑定。
  52818. * @param {string} eventName - 事件名称,resize、hover、drag等。
  52819. * @param {function} handler - 响应函数。
  52820. * @returns {SuperMap.LevelRenderer.Handler} this。
  52821. */
  52822. un(eventName, handler) {
  52823. this.unbind(eventName, handler);
  52824. return this;
  52825. }
  52826. /**
  52827. * @function SuperMap.LevelRenderer.Handler.prototype.trigger
  52828. * @description 事件触发。
  52829. * @param {string} eventName - 事件名称,resize、hover、drag等。
  52830. * @param {event} eventArgs - dom事件对象。
  52831. */
  52832. trigger(eventName, eventArgs) {
  52833. var EVENT = Config.EVENT;
  52834. switch (eventName) {
  52835. case EVENT.RESIZE:
  52836. case EVENT.CLICK:
  52837. case EVENT.DBLCLICK:
  52838. case EVENT.MOUSEWHEEL:
  52839. case EVENT.MOUSEMOVE:
  52840. case EVENT.MOUSEDOWN:
  52841. case EVENT.MOUSEUP:
  52842. case EVENT.MOUSEOUT:
  52843. this['_' + eventName + 'Handler'](eventArgs);
  52844. break;
  52845. }
  52846. }
  52847. /**
  52848. * @function SuperMap.LevelRenderer.Handler.prototype.dispose
  52849. * @description 释放,解绑所有事件。
  52850. */
  52851. dispose() {
  52852. var root = this.root;
  52853. if (window.removeEventListener) {
  52854. window.removeEventListener('resize', this._resizeHandler);
  52855. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  52856. // mobile支持
  52857. root.removeEventListener('touchstart', this._touchstartHandler);
  52858. root.removeEventListener('touchmove', this._touchmoveHandler);
  52859. root.removeEventListener('touchend', this._touchendHandler);
  52860. } else {
  52861. // mobile的click自己模拟
  52862. root.removeEventListener('click', this._clickHandler);
  52863. root.removeEventListener('dblclick', this._dblclickHandler);
  52864. root.removeEventListener('mousewheel', this._mousewheelHandler);
  52865. root.removeEventListener('mousemove', this._mousemoveHandler);
  52866. root.removeEventListener('mousedown', this._mousedownHandler);
  52867. root.removeEventListener('mouseup', this._mouseupHandler);
  52868. }
  52869. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  52870. root.removeEventListener('mouseout', this._mouseoutHandler);
  52871. } else {
  52872. window.detachEvent('onresize', this._resizeHandler);
  52873. root.detachEvent('onclick', this._clickHandler);
  52874. root.detachEvent('dblclick', this._dblclickHandler);
  52875. root.detachEvent('onmousewheel', this._mousewheelHandler);
  52876. root.detachEvent('onmousemove', this._mousemoveHandler);
  52877. root.detachEvent('onmouseout', this._mouseoutHandler);
  52878. root.detachEvent('onmousedown', this._mousedownHandler);
  52879. root.detachEvent('onmouseup', this._mouseupHandler);
  52880. }
  52881. this.root = null;
  52882. this._domHover = null;
  52883. this.storage = null;
  52884. this.painter = null;
  52885. this.un();
  52886. }
  52887. /**
  52888. * Method: _processDragStart
  52889. * 拖拽开始。
  52890. *
  52891. * Parameters:
  52892. * event - {Object} 事件对象。
  52893. *
  52894. */
  52895. _processDragStart(event) {
  52896. var _lastHover = this._lastHover;
  52897. if (this._isMouseDown
  52898. && _lastHover
  52899. && _lastHover.draggable
  52900. && !this._draggingTarget
  52901. && this._mouseDownTarget == _lastHover
  52902. ) {
  52903. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  52904. if (_lastHover.dragEnableTime &&
  52905. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  52906. ) {
  52907. return;
  52908. }
  52909. var _draggingTarget = _lastHover;
  52910. this._draggingTarget = _draggingTarget;
  52911. this._isDragging = 1;
  52912. _draggingTarget.invisible = true;
  52913. this.storage.mod(_draggingTarget.id);
  52914. // 分发 Config.EVENT.DRAGSTART事件
  52915. this._dispatchAgency(
  52916. _draggingTarget,
  52917. Config.EVENT.DRAGSTART,
  52918. event
  52919. );
  52920. this.painter.refresh();
  52921. }
  52922. }
  52923. /**
  52924. * Method: _processDragEnter
  52925. * 拖拽进入目标元素。
  52926. *
  52927. * Parameters:
  52928. * event - {Object} 事件对象。
  52929. *
  52930. */
  52931. _processDragEnter(event) {
  52932. if (this._draggingTarget) {
  52933. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  52934. this._dispatchAgency(
  52935. this._lastHover,
  52936. Config.EVENT.DRAGENTER,
  52937. event,
  52938. this._draggingTarget
  52939. );
  52940. }
  52941. }
  52942. /**
  52943. * Method: _processDragOver
  52944. * 拖拽在目标元素上移动。
  52945. *
  52946. * Parameters:
  52947. * event - {Object} 事件对象。
  52948. *
  52949. */
  52950. _processDragOver(event) {
  52951. if (this._draggingTarget) {
  52952. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  52953. this._dispatchAgency(
  52954. this._lastHover,
  52955. Config.EVENT.DRAGOVER,
  52956. event,
  52957. this._draggingTarget
  52958. );
  52959. }
  52960. }
  52961. /**
  52962. * Method: _processDragLeave
  52963. * 拖拽离开目标元素。
  52964. *
  52965. * Parameters:
  52966. * event - {Object} 事件对象。
  52967. *
  52968. */
  52969. _processDragLeave(event) {
  52970. if (this._draggingTarget) {
  52971. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  52972. this._dispatchAgency(
  52973. this._lastHover,
  52974. Config.EVENT.DRAGLEAVE,
  52975. event,
  52976. this._draggingTarget
  52977. );
  52978. }
  52979. }
  52980. /**
  52981. * Method: _processDrop
  52982. * 拖拽在目标元素上完成。
  52983. *
  52984. * Parameters:
  52985. * event - {Object} 事件对象。
  52986. *
  52987. */
  52988. _processDrop(event) {
  52989. if (this._draggingTarget) {
  52990. this._draggingTarget.invisible = false;
  52991. this.storage.mod(this._draggingTarget.id);
  52992. this.painter.refresh();
  52993. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  52994. this._dispatchAgency(
  52995. this._lastHover,
  52996. Config.EVENT.DROP,
  52997. event,
  52998. this._draggingTarget
  52999. );
  53000. }
  53001. }
  53002. /**
  53003. * Method: _processDragEnd
  53004. * 拖拽结束。
  53005. *
  53006. * Parameters:
  53007. * event - {Object} 事件对象。
  53008. *
  53009. */
  53010. _processDragEnd(event) {
  53011. if (this._draggingTarget) {
  53012. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  53013. this._dispatchAgency(
  53014. this._draggingTarget,
  53015. Config.EVENT.DRAGEND,
  53016. event
  53017. );
  53018. this._lastHover = null;
  53019. }
  53020. this._isDragging = 0;
  53021. this._draggingTarget = null;
  53022. }
  53023. /**
  53024. * Method: _processOverShape
  53025. * 鼠标在某个图形元素上移动。
  53026. *
  53027. * Parameters:
  53028. * event - {Object} 事件对象。
  53029. *
  53030. */
  53031. _processOverShape(event) {
  53032. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  53033. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  53034. }
  53035. /**
  53036. * Method: _processOutShape
  53037. * 鼠标离开某个图形元素。
  53038. *
  53039. * Parameters:
  53040. * event - {Object} 事件对象。
  53041. *
  53042. */
  53043. _processOutShape(event) {
  53044. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  53045. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  53046. }
  53047. /**
  53048. * Method: _dispatchAgency
  53049. * 鼠标离开某个图形元素。
  53050. *
  53051. * Parameters:
  53052. * targetShape - {Object} 目标图形元素。
  53053. * eventName - {Object} 事件名称。
  53054. * event - {Object} 事件对象。
  53055. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  53056. *
  53057. */
  53058. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  53059. var eventHandler = 'on' + eventName;
  53060. var eventPacket = {
  53061. type: eventName,
  53062. event: event,
  53063. target: targetShape,
  53064. cancelBubble: false
  53065. };
  53066. var el = targetShape;
  53067. if (draggedShape) {
  53068. eventPacket.dragged = draggedShape;
  53069. }
  53070. while (el) {
  53071. el[eventHandler]
  53072. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  53073. el.dispatch(eventName, eventPacket);
  53074. el = el.parent;
  53075. if (eventPacket.cancelBubble) {
  53076. break;
  53077. }
  53078. }
  53079. if (targetShape) {
  53080. // 冒泡到顶级 zrender 对象
  53081. if (!eventPacket.cancelBubble) {
  53082. this.dispatch(eventName, eventPacket);
  53083. }
  53084. } else if (!draggedShape) {
  53085. // 无hover目标,无拖拽对象,原生事件分发
  53086. this.dispatch(eventName, {
  53087. type: eventName,
  53088. event: event
  53089. });
  53090. }
  53091. }
  53092. /**
  53093. * Method: _iterateAndFindHover
  53094. * 迭代寻找 hover shape。
  53095. *
  53096. */
  53097. _iterateAndFindHover() {
  53098. var invTransform = SUtil_SUtil.Util_matrix.create();
  53099. var list = this.storage.getShapeList();
  53100. var currentZLevel;
  53101. var currentLayer;
  53102. var tmp = [0, 0];
  53103. for (var i = list.length - 1; i >= 0; i--) {
  53104. var shape = list[i];
  53105. if (currentZLevel !== shape.zlevel) {
  53106. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  53107. tmp[0] = this._mouseX;
  53108. tmp[1] = this._mouseY;
  53109. if (currentLayer.needTransform) {
  53110. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  53111. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  53112. }
  53113. }
  53114. if (this._findHover(shape, tmp[0], tmp[1])) {
  53115. break;
  53116. }
  53117. }
  53118. }
  53119. /**
  53120. * Method: _mobildFindFixed
  53121. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  53122. *
  53123. * Parameters:
  53124. * event - {Object} 事件对象。
  53125. *
  53126. */
  53127. _mobildFindFixed(event) {
  53128. // touch指尖错觉的尝试偏移量配置
  53129. var MOBILE_TOUCH_OFFSETS = [
  53130. {x: 10},
  53131. {x: -20},
  53132. {x: 10, y: 10},
  53133. {y: -20}
  53134. ];
  53135. this._lastHover = null;
  53136. this._mouseX = event.zrenderX;
  53137. this._mouseY = event.zrenderY;
  53138. this._event = event;
  53139. this._iterateAndFindHover();
  53140. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  53141. var offset = MOBILE_TOUCH_OFFSETS[i];
  53142. offset.x && (this._mouseX += offset.x);
  53143. offset.y && (this._mouseX += offset.y);
  53144. this._iterateAndFindHover();
  53145. }
  53146. if (this._lastHover) {
  53147. event.zrenderX = this._mouseX;
  53148. event.zrenderY = this._mouseY;
  53149. }
  53150. }
  53151. /**
  53152. * Method: _zrenderEventFixed
  53153. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  53154. *
  53155. * Parameters:
  53156. * event - {Object} 事件。
  53157. * isTouch - {boolean} 是否触摸。
  53158. *
  53159. */
  53160. _zrenderEventFixed(event, isTouch) {
  53161. if (event.zrenderFixed) {
  53162. return event;
  53163. }
  53164. if (!isTouch) {
  53165. event = event || window.event;
  53166. // 进入对象优先~
  53167. var target = event.toElement
  53168. || event.relatedTarget
  53169. || event.srcElement
  53170. || event.target;
  53171. if (target && target != this._domHover) {
  53172. event.zrenderX = (typeof event.offsetX != 'undefined'
  53173. ? event.offsetX
  53174. : event.layerX)
  53175. + target.offsetLeft;
  53176. event.zrenderY = (typeof event.offsetY != 'undefined'
  53177. ? event.offsetY
  53178. : event.layerY)
  53179. + target.offsetTop;
  53180. }
  53181. } else {
  53182. var touch = event.type != 'touchend'
  53183. ? event.targetTouches[0]
  53184. : event.changedTouches[0];
  53185. if (touch) {
  53186. var rBounding = this.root.getBoundingClientRect();
  53187. // touch事件坐标是全屏的~
  53188. event.zrenderX = touch.clientX - rBounding.left;
  53189. event.zrenderY = touch.clientY - rBounding.top;
  53190. }
  53191. }
  53192. event.zrenderFixed = 1;
  53193. return event;
  53194. }
  53195. // SMIC-方法扩展 - start
  53196. /**
  53197. * @function SuperMap.LevelRenderer.Handler.prototype.getLastHoverOne
  53198. * @description 获取单个高亮图形
  53199. */
  53200. getLastHoverOne() {
  53201. if (this._lastHover) {
  53202. return this._lastHover;
  53203. }
  53204. return null;
  53205. }
  53206. // SMIC-方法扩展 - end
  53207. }
  53208. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  53209. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  53210. * This program are made available under the terms of the Apache License, Version 2.0
  53211. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53212. /**
  53213. * @class SuperMap.LevelRenderer.Animation.easing
  53214. * @category Visualization Theme
  53215. * @classdesc 缓动
  53216. * @private
  53217. */
  53218. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  53219. // http://sole.github.io/tween.js/examples/03_graphs.html
  53220. class Easing {
  53221. /**
  53222. * @function SuperMap.LevelRenderer.Animation.easing.constructor
  53223. * @description 构造函数。
  53224. */
  53225. constructor() {
  53226. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  53227. }
  53228. /**
  53229. * @function SuperMap.LevelRenderer.Animation.easing.destroy
  53230. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  53231. */
  53232. destroy() {
  53233. }
  53234. /**
  53235. * @function SuperMap.LevelRenderer.Animation.easing.Linear
  53236. * @description 线性缓动
  53237. * @param {number} k - 参数
  53238. * @return {number} 输入值
  53239. */
  53240. Linear(k) {
  53241. return k;
  53242. }
  53243. /**
  53244. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticIn
  53245. * @description 二次方的缓动(t^2)
  53246. * @param {number} k - 参数
  53247. * @return {number} 二次方的缓动的值
  53248. */
  53249. QuadraticIn(k) {
  53250. return k * k;
  53251. }
  53252. /**
  53253. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticOut
  53254. * @description 返回按二次方缓动退出的值
  53255. * @param {number} k - 参数
  53256. * @return {number} 按二次方缓动退出的值
  53257. */
  53258. QuadraticOut(k) {
  53259. return k * (2 - k);
  53260. }
  53261. /**
  53262. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticInOut
  53263. * @description 返回按二次方缓动进入和退出的值
  53264. * @param {number} k - 参数
  53265. * @return {number} 按二次方缓动进入和退出的值
  53266. */
  53267. QuadraticInOut(k) {
  53268. if ((k *= 2) < 1) {
  53269. return 0.5 * k * k;
  53270. }
  53271. return -0.5 * (--k * (k - 2) - 1);
  53272. }
  53273. /**
  53274. * @function SuperMap.LevelRenderer.Animation.easing.CubicIn
  53275. * @description 三次方的缓动(t^3)
  53276. * @param {number} k - 参数
  53277. * @return {number} 按三次方缓动的值
  53278. */
  53279. CubicIn(k) {
  53280. return k * k * k;
  53281. }
  53282. /**
  53283. * @function SuperMap.LevelRenderer.Animation.easing.CubicOut
  53284. * @description 返回按三次方缓动退出的值
  53285. * @param {number} k - 参数
  53286. * @return {number} 按三次方缓动退出的值
  53287. */
  53288. CubicOut(k) {
  53289. return --k * k * k + 1;
  53290. }
  53291. /**
  53292. * @function SuperMap.LevelRenderer.Animation.easing.CubicInOut
  53293. * @description 返回按三次方缓动进入退出的值
  53294. * @param {number} k - 参数
  53295. * @return {number} 按三次方缓动进入退出的值
  53296. */
  53297. CubicInOut(k) {
  53298. if ((k *= 2) < 1) {
  53299. return 0.5 * k * k * k;
  53300. }
  53301. return 0.5 * ((k -= 2) * k * k + 2);
  53302. }
  53303. /**
  53304. * @function SuperMap.LevelRenderer.Animation.easing.QuarticIn
  53305. * @description 返回按四次方缓动进入的值
  53306. * @param {number} k - 参数
  53307. * @return {number} 按四次方缓动进入的值
  53308. */
  53309. QuarticIn(k) {
  53310. return k * k * k * k;
  53311. }
  53312. /**
  53313. * @function SuperMap.LevelRenderer.Animation.easing.QuarticOut
  53314. * @description 返回按四次方缓动退出的值
  53315. * @param {number} k - 参数
  53316. * @return {number} 按四次方缓动退出的值
  53317. */
  53318. QuarticOut(k) {
  53319. return 1 - (--k * k * k * k);
  53320. }
  53321. /**
  53322. * @function SuperMap.LevelRenderer.Animation.easing.QuarticInOut
  53323. * @description 返回按四次方缓动进入退出的值
  53324. * @param {number} k - 参数
  53325. * @return {number} 按四次方缓动进入退出的值
  53326. */
  53327. QuarticInOut(k) {
  53328. if ((k *= 2) < 1) {
  53329. return 0.5 * k * k * k * k;
  53330. }
  53331. return -0.5 * ((k -= 2) * k * k * k - 2);
  53332. }
  53333. // 五次方的缓动(t^5)
  53334. /**
  53335. * @function SuperMap.LevelRenderer.Animation.easing.QuinticIn
  53336. * @description 返回按五次方缓动的值
  53337. * @param {number} k - 参数
  53338. * @return {number} 按五次方缓动的值
  53339. */
  53340. QuinticIn(k) {
  53341. return k * k * k * k * k;
  53342. }
  53343. /**
  53344. * @function SuperMap.LevelRenderer.Animation.easing.QuinticOut
  53345. * @description 返回按五次方缓动退出的值
  53346. * @param {number} k - 参数
  53347. * @return {number} 按五次方缓动退出的值
  53348. */
  53349. QuinticOut(k) {
  53350. return --k * k * k * k * k + 1;
  53351. }
  53352. /**
  53353. * @function SuperMap.LevelRenderer.Animation.easing.QuinticInOut
  53354. * @description 返回按五次方缓动进入退出的值
  53355. * @param {number} k - 参数
  53356. * @return {number} 按五次方缓动进入退出的值
  53357. */
  53358. QuinticInOut(k) {
  53359. if ((k *= 2) < 1) {
  53360. return 0.5 * k * k * k * k * k;
  53361. }
  53362. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  53363. }
  53364. // 正弦曲线的缓动(sin(t))
  53365. /**
  53366. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalIn
  53367. * @description 返回按正弦曲线的缓动进入的值
  53368. * @param {number} k - 参数
  53369. * @return {number} 按正弦曲线的缓动进入的值
  53370. */
  53371. SinusoidalIn(k) {
  53372. return 1 - Math.cos(k * Math.PI / 2);
  53373. }
  53374. /**
  53375. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalOut
  53376. * @description 返回按正弦曲线的缓动退出的值
  53377. * @param {number} k - 参数
  53378. * @return {number} 按正弦曲线的缓动退出的值
  53379. */
  53380. SinusoidalOut(k) {
  53381. return Math.sin(k * Math.PI / 2);
  53382. }
  53383. /**
  53384. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalInOut
  53385. * @description 返回按正弦曲线的缓动进入退出的值
  53386. * @param {number} k - 参数
  53387. * @return {number} 按正弦曲线的缓动进入退出的值
  53388. */
  53389. SinusoidalInOut(k) {
  53390. return 0.5 * (1 - Math.cos(Math.PI * k));
  53391. }
  53392. // 指数曲线的缓动(2^t)
  53393. /**
  53394. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialIn
  53395. * @description 返回按指数曲线的缓动进入的值
  53396. * @param {number} k - 参数
  53397. * @return {number} 按指数曲线的缓动进入的值
  53398. */
  53399. ExponentialIn(k) {
  53400. return k === 0 ? 0 : Math.pow(1024, k - 1);
  53401. }
  53402. /**
  53403. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialOut
  53404. * @description 返回按指数曲线的缓动退出的值
  53405. * @param {number} k - 参数
  53406. * @return {number} 按指数曲线的缓动退出的值
  53407. */
  53408. ExponentialOut(k) {
  53409. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  53410. }
  53411. /**
  53412. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialInOut
  53413. * @description 返回按指数曲线的缓动进入退出的值
  53414. * @param {number} k - 参数
  53415. * @return {number} 按指数曲线的缓动进入退出的值
  53416. */
  53417. ExponentialInOut(k) {
  53418. if (k === 0) {
  53419. return 0;
  53420. }
  53421. if (k === 1) {
  53422. return 1;
  53423. }
  53424. if ((k *= 2) < 1) {
  53425. return 0.5 * Math.pow(1024, k - 1);
  53426. }
  53427. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  53428. }
  53429. // 圆形曲线的缓动(sqrt(1-t^2))
  53430. /**
  53431. * @function SuperMap.LevelRenderer.Animation.easing.CircularIn
  53432. * @description 返回按圆形曲线的缓动进入的值
  53433. * @param {number} k - 参数
  53434. * @return {number} 按圆形曲线的缓动进入的值
  53435. */
  53436. CircularIn(k) {
  53437. return 1 - Math.sqrt(1 - k * k);
  53438. }
  53439. /**
  53440. * @function SuperMap.LevelRenderer.Animation.easing.CircularOut
  53441. * @description 返回按圆形曲线的缓动退出的值
  53442. * @param {number} k - 参数
  53443. * @return {number} 按圆形曲线的缓动退出的值
  53444. */
  53445. CircularOut(k) {
  53446. return Math.sqrt(1 - (--k * k));
  53447. }
  53448. /**
  53449. * @function SuperMap.LevelRenderer.Animation.easing.CircularInOut
  53450. * @description 返回按圆形曲线的缓动进入退出的值
  53451. * @param {number} k - 参数
  53452. * @return {number} 按圆形曲线的缓动进入退出的值
  53453. */
  53454. CircularInOut(k) {
  53455. if ((k *= 2) < 1) {
  53456. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  53457. }
  53458. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  53459. }
  53460. // 创建类似于弹簧在停止前来回振荡的动画
  53461. /**
  53462. * @function SuperMap.LevelRenderer.Animation.easing.ElasticIn
  53463. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  53464. * @param {number} k - 参数
  53465. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  53466. */
  53467. ElasticIn(k) {
  53468. var s;
  53469. var a = 0.1;
  53470. var p = 0.4;
  53471. if (k === 0) {
  53472. return 0;
  53473. }
  53474. if (k === 1) {
  53475. return 1;
  53476. }
  53477. if (a < 1) {
  53478. a = 1;
  53479. s = p / 4;
  53480. } else {
  53481. s = p * Math.asin(1 / a) / (2 * Math.PI);
  53482. }
  53483. return -(a * Math.pow(2, 10 * (k -= 1)) *
  53484. Math.sin((k - s) * (2 * Math.PI) / p));
  53485. }
  53486. /**
  53487. * @function SuperMap.LevelRenderer.Animation.easing.ElasticOut
  53488. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  53489. * @param {number} k - 参数
  53490. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  53491. */
  53492. ElasticOut(k) {
  53493. var s;
  53494. var a = 0.1;
  53495. var p = 0.4;
  53496. if (k === 0) {
  53497. return 0;
  53498. }
  53499. if (k === 1) {
  53500. return 1;
  53501. }
  53502. if (a < 1) {
  53503. a = 1;
  53504. s = p / 4;
  53505. } else {
  53506. s = p * Math.asin(1 / a) / (2 * Math.PI);
  53507. }
  53508. return (a * Math.pow(2, -10 * k) *
  53509. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  53510. }
  53511. /**
  53512. * @function SuperMap.LevelRenderer.Animation.easing.ElasticInOut
  53513. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  53514. * @param {number} k - 参数
  53515. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  53516. */
  53517. ElasticInOut(k) {
  53518. var s;
  53519. var a = 0.1;
  53520. var p = 0.4;
  53521. if (k === 0) {
  53522. return 0;
  53523. }
  53524. if (k === 1) {
  53525. return 1;
  53526. }
  53527. if (a < 1) {
  53528. a = 1;
  53529. s = p / 4;
  53530. } else {
  53531. s = p * Math.asin(1 / a) / (2 * Math.PI);
  53532. }
  53533. if ((k *= 2) < 1) {
  53534. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  53535. * Math.sin((k - s) * (2 * Math.PI) / p));
  53536. }
  53537. return a * Math.pow(2, -10 * (k -= 1))
  53538. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  53539. }
  53540. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  53541. /**
  53542. * @function SuperMap.LevelRenderer.Animation.easing.BackIn
  53543. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  53544. * @param {number} k - 参数
  53545. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  53546. */
  53547. BackIn(k) {
  53548. var s = 1.70158;
  53549. return k * k * ((s + 1) * k - s);
  53550. }
  53551. /**
  53552. * @function SuperMap.LevelRenderer.Animation.easing.BackOut
  53553. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  53554. * @param {number} k - 参数
  53555. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  53556. */
  53557. BackOut(k) {
  53558. var s = 1.70158;
  53559. return --k * k * ((s + 1) * k + s) + 1;
  53560. }
  53561. /**
  53562. * @function SuperMap.LevelRenderer.Animation.easing.BackInOut
  53563. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  53564. * @param {number} k - 参数
  53565. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  53566. */
  53567. BackInOut(k) {
  53568. var s = 1.70158 * 1.525;
  53569. if ((k *= 2) < 1) {
  53570. return 0.5 * (k * k * ((s + 1) * k - s));
  53571. }
  53572. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  53573. }
  53574. // 创建弹跳效果
  53575. /**
  53576. * @function SuperMap.LevelRenderer.Animation.easing.BounceIn
  53577. * @description 返回按弹跳效果的缓动进入的值
  53578. * @param {number} k - 参数
  53579. * @return {number} 按弹跳效果的缓动进入的值
  53580. */
  53581. BounceIn(k) {
  53582. return 1 - this.BounceOut(1 - k);
  53583. }
  53584. /**
  53585. * @function SuperMap.LevelRenderer.Animation.easing.BounceOut
  53586. * @description 返回按弹跳效果的缓动退出的值
  53587. * @param {number} k - 参数
  53588. * @return {number} 按弹跳效果的缓动退出的值
  53589. */
  53590. BounceOut(k) {
  53591. if (k < (1 / 2.75)) {
  53592. return 7.5625 * k * k;
  53593. } else if (k < (2 / 2.75)) {
  53594. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  53595. } else if (k < (2.5 / 2.75)) {
  53596. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  53597. } else {
  53598. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  53599. }
  53600. }
  53601. /**
  53602. * @function SuperMap.LevelRenderer.Animation.easing.BounceInOut
  53603. * @description 返回按弹跳效果的缓动进入退出的值
  53604. * @param {number} k - 参数
  53605. * @return {number} 按弹跳效果的缓动进入退出的值
  53606. */
  53607. BounceInOut(k) {
  53608. if (k < 0.5) {
  53609. return this.BounceIn(k * 2) * 0.5;
  53610. }
  53611. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  53612. }
  53613. }
  53614. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  53615. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  53616. * This program are made available under the terms of the Apache License, Version 2.0
  53617. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53618. /**
  53619. * @class SuperMap.LevelRenderer.Animation.Clip
  53620. * @category Visualization Theme
  53621. * @classdec 动画片段
  53622. * @private
  53623. */
  53624. class Clip {
  53625. /**
  53626. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.constructor
  53627. * @description 构造函数。
  53628. * @param {Object} options - 参数。
  53629. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  53630. * @param {number} [options.life=1000] - 动画时长。
  53631. * @param {number} [options.delay=0] - 动画延迟时间。
  53632. * @param {boolean} [options.loop=true] - 是否循环。
  53633. * @param {number} [options.gap=0] - 循环的间隔时间。
  53634. * @param {Object} options.onframe - 帧。
  53635. * @param {boolean} options.easing - 是否消除。
  53636. * @param {boolean} options.ondestroy - 是否销毁。
  53637. * @param {boolean} options.onrestart - 是否重播。
  53638. */
  53639. constructor(options) {
  53640. this._targetPool = options.target || {};
  53641. if (!(this._targetPool instanceof Array)) {
  53642. this._targetPool = [this._targetPool];
  53643. }
  53644. // 生命周期
  53645. this._life = options.life || 1000;
  53646. // 延时
  53647. this._delay = options.delay || 0;
  53648. // 开始时间
  53649. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  53650. // 结束时间
  53651. this._endTime = this._startTime + this._life * 1000;
  53652. // 是否循环
  53653. this.loop = typeof options.loop == 'undefined'
  53654. ? false : options.loop;
  53655. this.gap = options.gap || 0;
  53656. this.easing = options.easing || 'Linear';
  53657. this.onframe = options.onframe;
  53658. this.ondestroy = options.ondestroy;
  53659. this.onrestart = options.onrestart;
  53660. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  53661. }
  53662. /**
  53663. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.destroy
  53664. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  53665. */
  53666. destroy() {
  53667. }
  53668. step(time) {
  53669. var easing = new Easing();
  53670. var percent = (time - this._startTime) / this._life;
  53671. // 还没开始
  53672. if (percent < 0) {
  53673. return;
  53674. }
  53675. percent = Math.min(percent, 1);
  53676. var easingFunc = typeof this.easing == 'string'
  53677. ? easing[this.easing]
  53678. : this.easing;
  53679. var schedule = typeof easingFunc === 'function'
  53680. ? easingFunc(percent)
  53681. : percent;
  53682. this.fire('frame', schedule);
  53683. // 结束
  53684. if (percent == 1) {
  53685. if (this.loop) {
  53686. this.restart();
  53687. // 重新开始周期
  53688. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  53689. return 'restart';
  53690. }
  53691. // 动画完成将这个控制器标识为待删除
  53692. // 在Animation.update中进行批量删除
  53693. this._needsRemove = true;
  53694. return 'destroy';
  53695. }
  53696. return null;
  53697. }
  53698. restart() {
  53699. var time = new Date().getTime();
  53700. var remainder = (time - this._startTime) % this._life;
  53701. this._startTime = new Date().getTime() - remainder + this.gap;
  53702. }
  53703. fire(eventType, arg) {
  53704. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  53705. if (this['on' + eventType]) {
  53706. this['on' + eventType](this._targetPool[i], arg);
  53707. }
  53708. }
  53709. }
  53710. }
  53711. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  53712. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  53713. * This program are made available under the terms of the Apache License, Version 2.0
  53714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53715. /**
  53716. * @class SuperMap.LevelRenderer.Animation
  53717. * @classdesc 动画主类, 调度和管理所有动画控制器
  53718. * @category Visualization Theme
  53719. * @extends {SuperMap.LevelRenderer.Eventful}
  53720. * @private
  53721. */
  53722. class Animation extends Eventful {
  53723. /**
  53724. * @function SuperMap.LevelRenderer.Animation.prototype.constructor
  53725. * @description 构造函数。
  53726. * @param {Object} options - 动画参数。
  53727. * @param {Object} options.onframe - onframe。
  53728. * @param {Object} options.stage - stage。
  53729. * (start code)
  53730. * var animation = new SuperMap.LevelRenderer.Animation();
  53731. * var obj = {
  53732. * x: 100,
  53733. * y: 100
  53734. * };
  53735. * animation.animate(node.position)
  53736. * .when(1000, {
  53737. * x: 500,
  53738. * y: 500
  53739. * })
  53740. * .when(2000, {
  53741. * x: 100,
  53742. * y: 100
  53743. * })
  53744. * .start('spline');
  53745. * (end)
  53746. */
  53747. constructor(options) {
  53748. super(options);
  53749. options = options || {};
  53750. /**
  53751. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.stage
  53752. * @description stage。
  53753. */
  53754. this.stage = {};
  53755. /**
  53756. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.onframe
  53757. * @description onframe。
  53758. */
  53759. this.onframe = function () {
  53760. };
  53761. /**
  53762. * @member {Array} SuperMap.LevelRenderer.Animation.prototype._clips
  53763. * @description _clips。
  53764. */
  53765. this._clips = [];
  53766. /**
  53767. * @member {boolean} SuperMap.LevelRenderer.Animation.prototype._running
  53768. * @description _running。
  53769. */
  53770. this._running = false;
  53771. /**
  53772. * @member {number} SuperMap.LevelRenderer.Animation.prototype._time
  53773. * @description _time。
  53774. */
  53775. this._time = 0;
  53776. Util.extend(this, options);
  53777. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  53778. }
  53779. /**
  53780. * @function SuperMap.LevelRenderer.Animation.prototype.add
  53781. * @description 添加动画片段。
  53782. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  53783. */
  53784. add(clip) {
  53785. this._clips.push(clip);
  53786. }
  53787. /**
  53788. * @function SuperMap.LevelRenderer.Animation.prototype.remove
  53789. * @description 删除动画片段。
  53790. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  53791. */
  53792. remove(clip) {
  53793. var idx = new Util_Util().indexOf(this._clips, clip);
  53794. if (idx >= 0) {
  53795. this._clips.splice(idx, 1);
  53796. }
  53797. }
  53798. /**
  53799. * @function SuperMap.LevelRenderer.Animation.prototype.update
  53800. * @description 更新动画片段。
  53801. */
  53802. _update() {
  53803. var time = new Date().getTime();
  53804. var delta = time - this._time;
  53805. var clips = this._clips;
  53806. var len = clips.length;
  53807. var deferredEvents = [];
  53808. var deferredClips = [];
  53809. for (let i = 0; i < len; i++) {
  53810. var clip = clips[i];
  53811. var e = clip.step(time);
  53812. // Throw out the events need to be called after
  53813. // stage.update, like destroy
  53814. if (e) {
  53815. deferredEvents.push(e);
  53816. deferredClips.push(clip);
  53817. }
  53818. }
  53819. if (this.stage.update) {
  53820. this.stage.update();
  53821. }
  53822. // Remove the finished clip
  53823. for (let i = 0; i < len;) {
  53824. if (clips[i]._needsRemove) {
  53825. clips[i] = clips[len - 1];
  53826. clips.pop();
  53827. len--;
  53828. } else {
  53829. i++;
  53830. }
  53831. }
  53832. len = deferredEvents.length;
  53833. for (let i = 0; i < len; i++) {
  53834. deferredClips[i].fire(deferredEvents[i]);
  53835. }
  53836. this._time = time;
  53837. this.onframe(delta);
  53838. this.dispatch('frame', delta);
  53839. }
  53840. /**
  53841. * @function SuperMap.LevelRenderer.Animation.prototype.start
  53842. * @description 开始运行动画。
  53843. */
  53844. start() {
  53845. var requestAnimationFrame = window.requestAnimationFrame
  53846. || window.msRequestAnimationFrame
  53847. || window.mozRequestAnimationFrame
  53848. || window.webkitRequestAnimationFrame
  53849. || function (func) {
  53850. setTimeout(func, 16);
  53851. };
  53852. var self = this;
  53853. this._running = true;
  53854. function step() {
  53855. if (self._running) {
  53856. self._update();
  53857. requestAnimationFrame(step);
  53858. }
  53859. }
  53860. this._time = new Date().getTime();
  53861. requestAnimationFrame(step);
  53862. }
  53863. /**
  53864. * @function SuperMap.LevelRenderer.Animation.prototype.stop
  53865. * @description 停止运行动画。
  53866. */
  53867. stop() {
  53868. this._running = false;
  53869. }
  53870. /**
  53871. * @function SuperMap.LevelRenderer.Animation.prototype.clear
  53872. * @description 清除所有动画片段。
  53873. */
  53874. clear() {
  53875. this._clips = [];
  53876. }
  53877. /**
  53878. * @function SuperMap.LevelRenderer.Animation.prototype.animate
  53879. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  53880. * @param {Object} target - 目标对象。
  53881. * @param {Object} options - 动画参数选项。
  53882. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  53883. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  53884. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  53885. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator。
  53886. */
  53887. animate(target, options) {
  53888. options = options || {};
  53889. var deferred = new Animator(
  53890. target,
  53891. options.loop,
  53892. options.getter,
  53893. options.setter
  53894. );
  53895. deferred.animation = this;
  53896. return deferred;
  53897. }
  53898. static _interpolateNumber(p0, p1, percent) {
  53899. return (p1 - p0) * percent + p0;
  53900. }
  53901. static _interpolateArray(p0, p1, percent, out, arrDim) {
  53902. var len = p0.length;
  53903. if (arrDim == 1) {
  53904. for (let i = 0; i < len; i++) {
  53905. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  53906. }
  53907. } else {
  53908. var len2 = p0[0].length;
  53909. for (let i = 0; i < len; i++) {
  53910. for (let j = 0; j < len2; j++) {
  53911. out[i][j] = Animation._interpolateNumber(
  53912. p0[i][j], p1[i][j], percent
  53913. );
  53914. }
  53915. }
  53916. }
  53917. }
  53918. static _isArrayLike(data) {
  53919. switch (typeof data) {
  53920. case 'undefined':
  53921. case 'string':
  53922. return false;
  53923. }
  53924. return typeof data.length !== 'undefined';
  53925. }
  53926. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  53927. var len = p0.length;
  53928. if (arrDim == 1) {
  53929. for (let i = 0; i < len; i++) {
  53930. out[i] = Animation._catmullRomInterpolate(
  53931. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  53932. );
  53933. }
  53934. } else {
  53935. var len2 = p0[0].length;
  53936. for (let i = 0; i < len; i++) {
  53937. for (var j = 0; j < len2; j++) {
  53938. out[i][j] = Animation._catmullRomInterpolate(
  53939. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  53940. t, t2, t3
  53941. );
  53942. }
  53943. }
  53944. }
  53945. }
  53946. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  53947. var v0 = (p2 - p0) * 0.5;
  53948. var v1 = (p3 - p1) * 0.5;
  53949. return (2 * (p1 - p2) + v0 + v1) * t3
  53950. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  53951. + v0 * t + p1;
  53952. }
  53953. static _cloneValue(value) {
  53954. var arraySlice = Array.prototype.slice;
  53955. if (Animation._isArrayLike(value)) {
  53956. var len = value.length;
  53957. if (Animation._isArrayLike(value[0])) {
  53958. var ret = [];
  53959. for (var i = 0; i < len; i++) {
  53960. ret.push(arraySlice.call(value[i]));
  53961. }
  53962. return ret;
  53963. } else {
  53964. return arraySlice.call(value);
  53965. }
  53966. } else {
  53967. return value;
  53968. }
  53969. }
  53970. static rgba2String(rgba) {
  53971. rgba[0] = Math.floor(rgba[0]);
  53972. rgba[1] = Math.floor(rgba[1]);
  53973. rgba[2] = Math.floor(rgba[2]);
  53974. return 'rgba(' + rgba.join(',') + ')';
  53975. }
  53976. }
  53977. /**
  53978. * @class SuperMap.LevelRenderer.Animation.Animator
  53979. */
  53980. class Animator {
  53981. /**
  53982. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.animate
  53983. * @description 构造函数
  53984. * @param {Object} target - 目标对象。
  53985. * @param {Object} options - 动画参数选项。
  53986. * @param {boolean} [loop=false] - 是否循环播放动画。
  53987. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  53988. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  53989. */
  53990. constructor(target, loop, getter, setter) {
  53991. /**
  53992. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._tracks
  53993. * @description _tracks。
  53994. */
  53995. this._tracks = {};
  53996. /**
  53997. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._target
  53998. * @description _target。
  53999. */
  54000. this._target = target;
  54001. /**
  54002. * @member {boolean} SuperMap.LevelRenderer.Animation.Animator.prototype._loop
  54003. * @description _loop。
  54004. */
  54005. this._loop = loop || false;
  54006. /**
  54007. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._getter
  54008. * @description _getter。
  54009. */
  54010. this._getter = getter || _defaultGetter;
  54011. /**
  54012. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._setter
  54013. * @description _setter。
  54014. */
  54015. this._setter = setter || _defaultSetter;
  54016. /**
  54017. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._clipCount
  54018. * @description _clipCount。
  54019. */
  54020. this._clipCount = 0;
  54021. /**
  54022. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._delay
  54023. * @description _delay。
  54024. */
  54025. this._delay = 0;
  54026. /**
  54027. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._doneList
  54028. * @description _doneList。
  54029. */
  54030. this._doneList = [];
  54031. /**
  54032. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._onframeList
  54033. * @description _onframeList。
  54034. */
  54035. this._onframeList = [];
  54036. /**
  54037. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._clipList
  54038. * @description _clipList。
  54039. */
  54040. this._clipList = [];
  54041. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  54042. //Function
  54043. function _defaultGetter(target, key) {
  54044. return target[key];
  54045. }
  54046. function _defaultSetter(target, key, value) {
  54047. target[key] = value;
  54048. }
  54049. }
  54050. /**
  54051. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.when
  54052. * @description 设置动画关键帧
  54053. * @param {number} time - 关键帧时间,单位是ms
  54054. * @param {Object} props - 关键帧的属性值,key-value表示
  54055. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54056. */
  54057. when(time /* ms */, props) {
  54058. for (var propName in props) {
  54059. if (!this._tracks[propName]) {
  54060. this._tracks[propName] = [];
  54061. // If time is 0
  54062. // Then props is given initialize value
  54063. // Else
  54064. // Initialize value from current prop value
  54065. if (time !== 0) {
  54066. this._tracks[propName].push({
  54067. time: 0,
  54068. value: Animation._cloneValue(
  54069. this._getter(this._target, propName)
  54070. )
  54071. });
  54072. }
  54073. }
  54074. this._tracks[propName].push({
  54075. time: parseInt(time, 10),
  54076. value: props[propName]
  54077. });
  54078. }
  54079. return this;
  54080. }
  54081. /**
  54082. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.during
  54083. * @description 添加动画每一帧的回调函数
  54084. * @param {RequestCallback} callback - 回调函数
  54085. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54086. */
  54087. during(callback) {
  54088. this._onframeList.push(callback);
  54089. return this;
  54090. }
  54091. /**
  54092. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.start
  54093. * @description 开始执行动画
  54094. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link SuperMap.LevelRenderer.Animation.easing}>。
  54095. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54096. */
  54097. start(easing) {
  54098. var self = this;
  54099. var setter = this._setter;
  54100. var getter = this._getter;
  54101. var onFrameListLen = self._onframeList.length;
  54102. var useSpline = easing === 'spline';
  54103. var ondestroy = function () {
  54104. self._clipCount--;
  54105. if (self._clipCount === 0) {
  54106. // Clear all tracks
  54107. self._tracks = {};
  54108. var len = self._doneList.length;
  54109. for (var i = 0; i < len; i++) {
  54110. self._doneList[i].call(self);
  54111. }
  54112. }
  54113. };
  54114. var createTrackClip = function (keyframes, propName) {
  54115. var trackLen = keyframes.length;
  54116. if (!trackLen) {
  54117. return;
  54118. }
  54119. // Guess data type
  54120. var firstVal = keyframes[0].value;
  54121. var isValueArray = Animation._isArrayLike(firstVal);
  54122. var isValueColor = false;
  54123. // For vertices morphing
  54124. var arrDim = (
  54125. isValueArray
  54126. && Animation._isArrayLike(firstVal[0])
  54127. )
  54128. ? 2 : 1;
  54129. // Sort keyframe as ascending
  54130. keyframes.sort(function (a, b) {
  54131. return a.time - b.time;
  54132. });
  54133. var trackMaxTime = keyframes[trackLen - 1].time;
  54134. // Percents of each keyframe
  54135. var kfPercents = [];
  54136. // Value of each keyframe
  54137. var kfValues = [];
  54138. for (let i = 0; i < trackLen; i++) {
  54139. kfPercents.push(keyframes[i].time / trackMaxTime);
  54140. // Assume value is a color when it is a string
  54141. var value = keyframes[i].value;
  54142. if (typeof(value) == 'string') {
  54143. value = SUtil_SUtil.Util_color.toArray(value);
  54144. if (value.length === 0) { // Invalid color
  54145. value[0] = value[1] = value[2] = 0;
  54146. value[3] = 1;
  54147. }
  54148. isValueColor = true;
  54149. }
  54150. kfValues.push(value);
  54151. }
  54152. // Cache the key of last frame to speed up when
  54153. // animation playback is sequency
  54154. var cacheKey = 0;
  54155. var cachePercent = 0;
  54156. var start;
  54157. var i;
  54158. var w;
  54159. var p0;
  54160. var p1;
  54161. var p2;
  54162. var p3;
  54163. if (isValueColor) {
  54164. var rgba = [0, 0, 0, 0];
  54165. }
  54166. var onframe = function (target, percent) {
  54167. // Find the range keyframes
  54168. // kf1-----kf2---------current--------kf3
  54169. // find kf2 and kf3 and do interpolation
  54170. if (percent < cachePercent) {
  54171. // Start from next key
  54172. start = Math.min(cacheKey + 1, trackLen - 1);
  54173. for (i = start; i >= 0; i--) {
  54174. if (kfPercents[i] <= percent) {
  54175. break;
  54176. }
  54177. }
  54178. i = Math.min(i, trackLen - 2);
  54179. } else {
  54180. for (i = cacheKey; i < trackLen; i++) {
  54181. if (kfPercents[i] > percent) {
  54182. break;
  54183. }
  54184. }
  54185. i = Math.min(i - 1, trackLen - 2);
  54186. }
  54187. cacheKey = i;
  54188. cachePercent = percent;
  54189. var range = (kfPercents[i + 1] - kfPercents[i]);
  54190. if (range === 0) {
  54191. return;
  54192. } else {
  54193. w = (percent - kfPercents[i]) / range;
  54194. }
  54195. if (useSpline) {
  54196. p1 = kfValues[i];
  54197. p0 = kfValues[i === 0 ? i : i - 1];
  54198. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  54199. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  54200. if (isValueArray) {
  54201. Animation._catmullRomInterpolateArray(
  54202. p0, p1, p2, p3, w, w * w, w * w * w,
  54203. getter(target, propName),
  54204. arrDim
  54205. );
  54206. } else {
  54207. let value;
  54208. if (isValueColor) {
  54209. // value = SuperMap.LevelRenderer.Animation._catmullRomInterpolateArray(
  54210. // p0, p1, p2, p3, w, w * w, w * w * w,
  54211. // rgba, 1
  54212. // );
  54213. value = Animation.rgba2String(rgba);
  54214. } else {
  54215. value = Animation._catmullRomInterpolate(
  54216. p0, p1, p2, p3, w, w * w, w * w * w
  54217. );
  54218. }
  54219. setter(
  54220. target,
  54221. propName,
  54222. value
  54223. );
  54224. }
  54225. } else {
  54226. if (isValueArray) {
  54227. Animation._interpolateArray(
  54228. kfValues[i], kfValues[i + 1], w,
  54229. getter(target, propName),
  54230. arrDim
  54231. );
  54232. } else {
  54233. let value;
  54234. if (isValueColor) {
  54235. Animation._interpolateArray(
  54236. kfValues[i], kfValues[i + 1], w,
  54237. rgba, 1
  54238. );
  54239. value = Animation.rgba2String(rgba);
  54240. } else {
  54241. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  54242. }
  54243. setter(
  54244. target,
  54245. propName,
  54246. value
  54247. );
  54248. }
  54249. }
  54250. for (i = 0; i < onFrameListLen; i++) {
  54251. self._onframeList[i](target, percent);
  54252. }
  54253. };
  54254. var clip = new Clip({
  54255. target: self._target,
  54256. life: trackMaxTime,
  54257. loop: self._loop,
  54258. delay: self._delay,
  54259. onframe: onframe,
  54260. ondestroy: ondestroy
  54261. });
  54262. if (easing && easing !== 'spline') {
  54263. clip.easing = easing;
  54264. }
  54265. self._clipList.push(clip);
  54266. self._clipCount++;
  54267. self.animation.add(clip);
  54268. };
  54269. for (var propName in this._tracks) {
  54270. createTrackClip(this._tracks[propName], propName);
  54271. }
  54272. return this;
  54273. }
  54274. /**
  54275. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.stop
  54276. * @description 停止动画
  54277. */
  54278. stop() {
  54279. for (var i = 0; i < this._clipList.length; i++) {
  54280. var clip = this._clipList[i];
  54281. this.animation.remove(clip);
  54282. }
  54283. this._clipList = [];
  54284. }
  54285. /**
  54286. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.delay
  54287. * @description 设置动画延迟开始的时间
  54288. * @param {number} time - 时间,单位ms
  54289. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54290. */
  54291. delay(time) {
  54292. this._delay = time;
  54293. return this;
  54294. }
  54295. /**
  54296. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.done
  54297. * @description 添加动画结束的回调
  54298. * @param {function} cb - Function
  54299. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  54300. */
  54301. done(cb) {
  54302. if (cb) {
  54303. this._doneList.push(cb);
  54304. }
  54305. return this;
  54306. }
  54307. }
  54308. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  54309. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  54310. * This program are made available under the terms of the Apache License, Version 2.0
  54311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54312. /**
  54313. * @private
  54314. * @class SuperMap.LevelRenderer.Render
  54315. * @category Visualization Theme
  54316. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  54317. */
  54318. class Render {
  54319. /**
  54320. * @function SuperMap.LevelRenderer.Render.constructor
  54321. * @description 构造函数。
  54322. *
  54323. * @param {string} id - 唯一标识。
  54324. * @param {HTMLElement} dom - Dom 对象。
  54325. */
  54326. constructor(id, dom) {
  54327. /**
  54328. * @member {string} SuperMap.LevelRenderer.Render.prototype.id
  54329. * @description 唯一标识。
  54330. */
  54331. this.id = id;
  54332. /**
  54333. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Render.prototype.storage
  54334. * @description 图形仓库对象。
  54335. */
  54336. this.storage = new Storage();
  54337. /**
  54338. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Render.prototype.painter
  54339. * @description 绘制器对象。
  54340. *
  54341. */
  54342. this.painter = new Painter(dom, this.storage);
  54343. /**
  54344. * @member {SuperMap.LevelRenderer.Handler} SuperMap.LevelRenderer.Render.prototype.handler
  54345. * @description 事件处理对象。
  54346. *
  54347. */
  54348. this.handler = new Handler(dom, this.storage, this.painter);
  54349. /**
  54350. * @member {Array} SuperMap.LevelRenderer.Render.prototype.animatingElements
  54351. * @description 动画控制数组。
  54352. *
  54353. */
  54354. this.animatingElements = [];
  54355. /**
  54356. * @member {SuperMap.LevelRenderer.animation.Animation} SuperMap.LevelRenderer.Render.prototype.animation
  54357. * @description 动画对象。
  54358. *
  54359. */
  54360. this.animation = new Animation({
  54361. stage: {
  54362. update: Render.getFrameCallback(this)
  54363. }
  54364. });
  54365. /**
  54366. * @member {boolean} SuperMap.LevelRenderer.Render.prototype._needsRefreshNextFrame
  54367. * @description 是否需要刷新下一帧。
  54368. *
  54369. */
  54370. this._needsRefreshNextFrame = false;
  54371. this.animation.start();
  54372. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  54373. }
  54374. /**
  54375. * @function SuperMap.LevelRenderer.Render.prototype.destory
  54376. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  54377. */
  54378. destroy() {
  54379. this.id = null;
  54380. this.storage = null;
  54381. this.painter = null;
  54382. this.handler = null;
  54383. this.animatingElements = null;
  54384. this.animation = null;
  54385. this._needsRefreshNextFrame = null;
  54386. }
  54387. /**
  54388. * @function SuperMap.LevelRenderer.Render.prototype.getId
  54389. * @description 获取实例唯一标识。
  54390. * @return {string} 实例唯一标识。
  54391. */
  54392. getId() {
  54393. return this.id;
  54394. }
  54395. /**
  54396. * @function SuperMap.LevelRenderer.Render.prototype.addShape
  54397. * @description 添加图形形状到根节点。
  54398. *
  54399. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  54400. * @return {SuperMap.LevelRenderer.Render} this。
  54401. */
  54402. addShape(shape) {
  54403. this.storage.addRoot(shape);
  54404. return this;
  54405. }
  54406. /**
  54407. * @function SuperMap.LevelRenderer.Render.prototype.addGroup
  54408. * @description 添加组到根节点。
  54409. *
  54410. * (code)
  54411. * //添加组到根节点例子
  54412. * var render = new SuperMap.LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  54413. * render.clear();
  54414. * var g = new SuperMap.LevelRenderer.Group();
  54415. * g.addChild(new SuperMap.LevelRenderer.Shape.Circle({
  54416. * style: {
  54417. * x: 100,
  54418. * y: 100,
  54419. * r: 20,
  54420. * brushType: 'fill'
  54421. * }
  54422. * }));
  54423. * render.addGroup(g);
  54424. * render.render();
  54425. * (end)
  54426. *
  54427. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  54428. * @return {SuperMap.LevelRenderer.Render} this。
  54429. */
  54430. addGroup(group) {
  54431. this.storage.addRoot(group);
  54432. return this;
  54433. }
  54434. /**
  54435. * @function SuperMap.LevelRenderer.Render.prototype.delShape
  54436. * @description 从根节点删除图形形状。
  54437. *
  54438. * @param {string} shapeId - 图形对象唯一标识。
  54439. * @return {SuperMap.LevelRenderer.Render} this。
  54440. */
  54441. delShape(shapeId) {
  54442. this.storage.delRoot(shapeId);
  54443. return this;
  54444. }
  54445. /**
  54446. * @function SuperMap.LevelRenderer.Render.prototype.delGroup
  54447. * @description 从根节点删除组。
  54448. *
  54449. * @param {string} groupId - 组对象唯一标识。
  54450. * @return {SuperMap.LevelRenderer.Render} this。
  54451. */
  54452. delGroup(groupId) {
  54453. this.storage.delRoot(groupId);
  54454. return this;
  54455. }
  54456. /**
  54457. * @function SuperMap.LevelRenderer.Render.prototype.modShape
  54458. * @description 修改图形形状。
  54459. *
  54460. * @param {string} shapeId - 图形对象唯一标识。
  54461. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  54462. * @return {SuperMap.LevelRenderer.Render} this。
  54463. */
  54464. modShape(shapeId, shape) {
  54465. this.storage.mod(shapeId, shape);
  54466. return this;
  54467. }
  54468. /**
  54469. * @function SuperMap.LevelRenderer.Render.prototype.modGroup
  54470. * @description 修改组。
  54471. *
  54472. * @param {string} groupId - 组对象唯一标识。
  54473. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  54474. * @return {SuperMap.LevelRenderer.Render} this。
  54475. */
  54476. modGroup(groupId, group) {
  54477. this.storage.mod(groupId, group);
  54478. return this;
  54479. }
  54480. /**
  54481. * @function SuperMap.LevelRenderer.Render.prototype.modLayer
  54482. * @description 修改指定 zlevel 的绘制配置项。
  54483. *
  54484. * @param {string} zLevel - 组对象唯一标识。
  54485. * @param {Object} config - 配置对象。
  54486. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  54487. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  54488. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  54489. * @param {Array.<number>} position - 层的平移。
  54490. * @param {Array.<number>} rotation - 层的旋转。
  54491. * @param {Array.<number>} scale - 层的缩放。
  54492. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  54493. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  54494. * @return {SuperMap.LevelRenderer.Render} this。
  54495. */
  54496. modLayer(zLevel, config) {
  54497. this.painter.modLayer(zLevel, config);
  54498. return this;
  54499. }
  54500. /**
  54501. * @function SuperMap.LevelRenderer.Render.prototype.addHoverShape
  54502. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  54503. *
  54504. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  54505. * @return {SuperMap.LevelRenderer.Render} this。
  54506. */
  54507. addHoverShape(shape) {
  54508. this.storage.addHover(shape);
  54509. return this;
  54510. }
  54511. /**
  54512. * @function SuperMap.LevelRenderer.Render.prototype.render
  54513. * @description 渲染。
  54514. *
  54515. * @callback {Function} callback - 渲染结束后回调函数。
  54516. * @return {SuperMap.LevelRenderer.Render} this。
  54517. */
  54518. render(callback) {
  54519. this.painter.render(callback);
  54520. this._needsRefreshNextFrame = false;
  54521. return this;
  54522. }
  54523. /**
  54524. * @function SuperMap.LevelRenderer.Render.prototype.refresh
  54525. * @description 视图更新。
  54526. *
  54527. * @callback {Function} callback - 视图更新后回调函数。
  54528. * @return {SuperMap.LevelRenderer.Render} this。
  54529. */
  54530. refresh(callback) {
  54531. this.painter.refresh(callback);
  54532. this._needsRefreshNextFrame = false;
  54533. return this;
  54534. }
  54535. /**
  54536. * @function SuperMap.LevelRenderer.Render.prototype.refreshNextFrame
  54537. * @description 标记视图在浏览器下一帧需要绘制。
  54538. * @return {SuperMap.LevelRenderer.Render} this。
  54539. */
  54540. refreshNextFrame() {
  54541. this._needsRefreshNextFrame = true;
  54542. return this;
  54543. }
  54544. /**
  54545. * @function SuperMap.LevelRenderer.Render.prototype.refreshHover
  54546. * @description 绘制(视图更新)高亮层。
  54547. * @callback {Function} callback - 视图更新后回调函数。
  54548. * @return {SuperMap.LevelRenderer.Render} this。
  54549. */
  54550. refreshHover(callback) {
  54551. this.painter.refreshHover(callback);
  54552. return this;
  54553. }
  54554. /**
  54555. * @function SuperMap.LevelRenderer.Render.prototype.refreshShapes
  54556. * @description 视图更新。
  54557. *
  54558. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  54559. * @callback {Function} callback - 视图更新后回调函数。
  54560. * @return {SuperMap.LevelRenderer.Render} this。
  54561. */
  54562. refreshShapes(shapeList, callback) {
  54563. this.painter.refreshShapes(shapeList, callback);
  54564. return this;
  54565. }
  54566. /**
  54567. * @function SuperMap.LevelRenderer.Render.prototype.resize
  54568. * @description 调整视图大小。
  54569. * @return {SuperMap.LevelRenderer.Render} this。
  54570. */
  54571. resize() {
  54572. this.painter.resize();
  54573. return this;
  54574. }
  54575. /**
  54576. * @function SuperMap.LevelRenderer.Render.prototype.animate
  54577. * @description 动画。
  54578. *
  54579. * @example
  54580. * zr.animate(circle.id, 'style', false)
  54581. * .when(1000, {x: 10} )
  54582. * .done(function(){ // Animation done })
  54583. * .start()
  54584. *
  54585. *
  54586. * @param {Array.<(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)>} el - 动画对象。
  54587. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<SuperMap.LevelRenderer.Group>,path需为空字符串。
  54588. * @param {Function} loop - 动画是否循环。
  54589. * @return {SuperMap.LevelRenderer.animation.Animator} Animator。
  54590. */
  54591. animate(el, path, loop) {
  54592. if (typeof(el) === 'string') {
  54593. el = this.storage.get(el);
  54594. }
  54595. if (el) {
  54596. var target;
  54597. if (path) {
  54598. var pathSplitted = path.split('.');
  54599. var prop = el;
  54600. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  54601. if (!prop) {
  54602. continue;
  54603. }
  54604. prop = prop[pathSplitted[i]];
  54605. }
  54606. if (prop) {
  54607. target = prop;
  54608. }
  54609. } else {
  54610. target = el;
  54611. }
  54612. if (!target) {
  54613. SUtil_SUtil.Util_log(
  54614. 'Property "'
  54615. + path
  54616. + '" is not existed in element '
  54617. + el.id
  54618. );
  54619. return;
  54620. }
  54621. var animatingElements = this.animatingElements;
  54622. if (typeof el.__aniCount === 'undefined') {
  54623. // 正在进行的动画记数
  54624. el.__aniCount = 0;
  54625. }
  54626. if (el.__aniCount === 0) {
  54627. animatingElements.push(el);
  54628. }
  54629. el.__aniCount++;
  54630. return this.animation.animate(target, {loop: loop})
  54631. .done(function () {
  54632. el.__aniCount--;
  54633. if (el.__aniCount === 0) {
  54634. // 从animatingElements里移除
  54635. var idx = new Util_Util().indexOf(animatingElements, el);
  54636. animatingElements.splice(idx, 1);
  54637. }
  54638. });
  54639. } else {
  54640. SUtil_SUtil.Util_log('Element not existed');
  54641. }
  54642. }
  54643. /**
  54644. * @function SuperMap.LevelRenderer.Render.prototype.clearAnimation
  54645. * @description 停止所有动画。
  54646. *
  54647. */
  54648. clearAnimation() {
  54649. this.animation.clear();
  54650. }
  54651. /**
  54652. * @function SuperMap.LevelRenderer.Render.prototype.getWidth
  54653. * @description 获取视图宽度。
  54654. * @return {number} 视图宽度。
  54655. */
  54656. getWidth() {
  54657. return this.painter.getWidth();
  54658. }
  54659. /**
  54660. * @function SuperMap.LevelRenderer.Render.prototype.getHeight
  54661. * @description 获取视图高度。
  54662. * @return {number} 视图高度。
  54663. */
  54664. getHeight() {
  54665. return this.painter.getHeight();
  54666. }
  54667. /**
  54668. * @function SuperMap.LevelRenderer.Render.prototype.toDataURL
  54669. * @description 图像导出。
  54670. *
  54671. * @param {string} type - 类型。
  54672. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  54673. * @param {string} args - 参数。
  54674. * @return {string} 图片的 Base64 url。
  54675. */
  54676. toDataURL(type, backgroundColor, args) {
  54677. return this.painter.toDataURL(type, backgroundColor, args);
  54678. }
  54679. /**
  54680. * @function SuperMap.LevelRenderer.Render.prototype.shapeToImage
  54681. * @description 将常规 shape 转成 image shape。
  54682. *
  54683. * @param {SuperMap.LevelRenderer.Shape} e - 图形。
  54684. * @param {number} width - 宽度。
  54685. * @param {number} height - 高度。
  54686. * @return {Object} image shape。
  54687. */
  54688. shapeToImage(e, width, height) {
  54689. var id = Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  54690. return this.painter.shapeToImage(id, e, width, height);
  54691. }
  54692. /**
  54693. * @function SuperMap.LevelRenderer.Render.prototype.on
  54694. * @description 事件绑定。
  54695. *
  54696. * @param {string} eventName - 事件名称。
  54697. * @param {Function} eventHandler - 响应函数。
  54698. * @return {SuperMap.LevelRenderer.Render} this。
  54699. */
  54700. on(eventName, eventHandler) {
  54701. this.handler.on(eventName, eventHandler);
  54702. return this;
  54703. }
  54704. /**
  54705. * @function SuperMap.LevelRenderer.Render.prototype.un
  54706. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  54707. *
  54708. * @param {string} eventName - 事件名称。
  54709. * @param {Function} eventHandler - 响应函数。
  54710. * @return {SuperMap.LevelRenderer.Render} this。
  54711. */
  54712. un(eventName, eventHandler) {
  54713. this.handler.un(eventName, eventHandler);
  54714. return this;
  54715. }
  54716. /**
  54717. * @function SuperMap.LevelRenderer.Render.prototype.trigger
  54718. * @description 事件触发。
  54719. *
  54720. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  54721. * @param {event} event - event dom事件对象。
  54722. * @return {SuperMap.LevelRenderer.Render} this。
  54723. */
  54724. trigger(eventName, event) {
  54725. this.handler.trigger(eventName, event);
  54726. this.handler.dispatch(eventName, event);
  54727. return this;
  54728. }
  54729. /**
  54730. * @function SuperMap.LevelRenderer.Render.prototype.clear
  54731. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  54732. * @return {SuperMap.LevelRenderer.Render} this。
  54733. */
  54734. clear() {
  54735. this.storage.delRoot();
  54736. this.painter.clear();
  54737. return this;
  54738. }
  54739. /**
  54740. * @function SuperMap.LevelRenderer.Render.prototype.dispose
  54741. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  54742. */
  54743. dispose() {
  54744. this.animation.stop();
  54745. this.clear();
  54746. this.storage.dispose();
  54747. this.painter.dispose();
  54748. this.handler.dispose();
  54749. this.animation = null;
  54750. this.animatingElements = null;
  54751. this.storage = null;
  54752. this.painter = null;
  54753. this.handler = null;
  54754. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  54755. // zrender.delInstance(this.id);
  54756. }
  54757. // SMIC-方法扩展 - start
  54758. /**
  54759. * @function SuperMap.LevelRenderer.Render.prototype.updateHoverShapes
  54760. * @description 更新设置显示高亮图层。
  54761. *
  54762. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapes - 图形数组。
  54763. * @return {SuperMap.LevelRenderer.Render} this。
  54764. */
  54765. updateHoverShapes(shapes) {
  54766. this.painter.updateHoverLayer(shapes);
  54767. return this;
  54768. }
  54769. /**
  54770. * @function SuperMap.LevelRenderer.Render.prototype.getAllShapes
  54771. * @description 获取所有图形。
  54772. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  54773. */
  54774. getAllShapes() {
  54775. return this.storage._shapeList;
  54776. }
  54777. /**
  54778. * @function SuperMap.LevelRenderer.Render.prototype.clearAll
  54779. * @description 清除高亮和图形图层。
  54780. * @return {SuperMap.LevelRenderer.Render} this。
  54781. */
  54782. clearAll() {
  54783. this.clear();
  54784. this.painter.clearHover();
  54785. return this;
  54786. }
  54787. /**
  54788. * @function SuperMap.LevelRenderer.Render.prototype.getHoverOne
  54789. * @description 获取单个高亮图形,当前鼠标对应。
  54790. * @return {SuperMap.LevelRenderer.Shape} 高亮图形。
  54791. */
  54792. getHoverOne() {
  54793. return this.handler.getLastHoverOne();
  54794. }
  54795. static getFrameCallback(renderInstance) {
  54796. return function () {
  54797. var animatingElements = renderInstance.animatingElements;
  54798. //animatingElements instanceof Array 临时解决 destory 报错
  54799. if (animatingElements instanceof Array) {
  54800. for (var i = 0, l = animatingElements.length; i < l; i++) {
  54801. renderInstance.storage.mod(animatingElements[i].id);
  54802. }
  54803. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  54804. renderInstance.refresh();
  54805. }
  54806. }
  54807. };
  54808. }
  54809. // SMIC-方法扩展 - end
  54810. }
  54811. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  54812. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  54813. * This program are made available under the terms of the Apache License, Version 2.0
  54814. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54815. /**
  54816. * @class SuperMap.LevelRenderer
  54817. * @category Visualization Theme
  54818. * @classdesc LevelRenderer 渲染器
  54819. * @private
  54820. */
  54821. class LevelRenderer {
  54822. /**
  54823. * @function SuperMap.LevelRenderer.constructor
  54824. * @description 构造函数。
  54825. * @example
  54826. * //在渲染器上加上图形
  54827. * var levelRenderer = new SuperMap.LevelRenderer();
  54828. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  54829. * zr.clear();
  54830. * zr.addShape(new SuperMap.LevelRenderer.Shape.Circle({
  54831. * style:{
  54832. * x : 100,
  54833. * y : 100,
  54834. * r : 50,
  54835. * brushType: 'fill'
  54836. * }
  54837. * }));
  54838. * zr.render();
  54839. */
  54840. constructor() {
  54841. /**
  54842. * @member {Object} SuperMap.LevelRenderer.prototype._instances
  54843. * @description LevelRenderer 实例 map 索引
  54844. */
  54845. LevelRenderer._instances = {};
  54846. // 工具
  54847. LevelRenderer.Tool = {};
  54848. /**
  54849. * @member {string} SuperMap.LevelRenderer.prototype.version
  54850. * @description 版本。zRender(Baidu)的版本号
  54851. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  54852. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  54853. */
  54854. this.version = '2.0.4';
  54855. this.CLASS_NAME = "SuperMap.LevelRenderer";
  54856. }
  54857. /**
  54858. * @function SuperMap.LevelRenderer.prototype.destroy
  54859. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  54860. */
  54861. destroy() {
  54862. this.dispose();
  54863. this.version = null;
  54864. }
  54865. /**
  54866. * @function SuperMap.LevelRenderer.prototype.init
  54867. * @description 创建 LevelRenderer 实例。
  54868. * @param {HTMLElement} dom - 绘图容器。
  54869. * @returns {SuperMap.LevelRenderer} LevelRenderer 实例。
  54870. */
  54871. init(dom) {
  54872. var zr = new Render(Util.createUniqueID("LRenderer_"), dom);
  54873. LevelRenderer._instances[zr.id] = zr;
  54874. return zr;
  54875. }
  54876. /**
  54877. * @function SuperMap.LevelRenderer.prototype.dispose
  54878. * @description LevelRenderer 实例销毁。
  54879. * 可以通过 zrender.dispose(zr) 销毁指定 SuperMap.LevelRenderer.Render 实例。
  54880. * 也可以通过 zr.dispose() 直接销毁
  54881. * @param {SuperMap.LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  54882. * @returns {SuperMap.LevelRenderer} this。
  54883. */
  54884. dispose(zr) {
  54885. if (zr) {
  54886. zr.dispose();
  54887. this.delInstance(zr.id);
  54888. } else {
  54889. for (var key in LevelRenderer._instances) {
  54890. LevelRenderer._instances[key].dispose();
  54891. }
  54892. LevelRenderer._instances = {};
  54893. }
  54894. return this;
  54895. }
  54896. /**
  54897. * @function SuperMap.LevelRenderer.prototype.getInstance
  54898. * @description 获取 SuperMap.LevelRenderer.Render 实例。
  54899. * @param {string} id - ZRender对象索引。
  54900. * @returns {SuperMap.LevelRenderer.Render} SuperMap.LevelRenderer.Render 实例。
  54901. */
  54902. getInstance(id) {
  54903. return LevelRenderer._instances[id];
  54904. }
  54905. /**
  54906. * @function SuperMap.LevelRenderer.prototype.delInstance
  54907. * @description 删除 zrender 实例,SuperMap.LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  54908. * @param {string} id - ZRender对象索引。
  54909. * @param {string} id - SuperMap.LevelRenderer.Render 对象索引。
  54910. * @returns {SuperMap.LevelRenderer} this。
  54911. */
  54912. delInstance(id) {
  54913. delete LevelRenderer._instances[id];
  54914. return this;
  54915. }
  54916. }
  54917. SuperMap.LevelRenderer = LevelRenderer;
  54918. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  54919. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  54920. * This program are made available under the terms of the Apache License, Version 2.0
  54921. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54922. /**
  54923. * @private
  54924. * @class SuperMap.LevelRenderer.Shape.SmicEllipse
  54925. * @category Visualization Theme
  54926. * @classdesc 椭圆。
  54927. * @extends SuperMap.LevelRenderer.Shape
  54928. * @example
  54929. * var shape = new SuperMap.LevelRenderer.Shape.SmicEllipse({
  54930. * style: {
  54931. * x: 100,
  54932. * y: 100,
  54933. * a: 40,
  54934. * b: 20,
  54935. * brushType: 'both',
  54936. * color: 'blue',
  54937. * strokeColor: 'red',
  54938. * lineWidth: 3,
  54939. * text: 'SmicEllipse'
  54940. * }
  54941. * });
  54942. * levelRenderer.addShape(shape);
  54943. *
  54944. *
  54945. */
  54946. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  54947. /**
  54948. * @member {Object} SuperMap.LevelRenderer.Shape.SmicEllipse.style
  54949. * @description 绘制样式。
  54950. *
  54951. * @param {number} style.x - 圆心 x 坐标,必设参数。
  54952. * @param {number} style.y - 圆心 y 坐标,必设参数。
  54953. * @param {number} style.a - 横轴半径,必设参数。
  54954. * @param {number} style.b - 纵轴半径,必设参数。
  54955. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  54956. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  54957. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  54958. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  54959. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  54960. * @param {number} style.opacity - 绘制透明度。默认值:1。
  54961. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  54962. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  54963. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  54964. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  54965. * @param {string} style.text - 图形中的附加文本。默认值:""。
  54966. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  54967. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  54968. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  54969. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  54970. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  54971. */
  54972. //打开接口 style
  54973. /**
  54974. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.constructor
  54975. * @description 构造函数。
  54976. *
  54977. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  54978. *
  54979. */
  54980. constructor(options) {
  54981. super(options);
  54982. /**
  54983. * @member {string} SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.type
  54984. * @description 图形类型。
  54985. */
  54986. this.type = 'smicellipse';
  54987. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  54988. this.refOriginalPosition = [0, 0];
  54989. }
  54990. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  54991. }
  54992. /**
  54993. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.destroy
  54994. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  54995. */
  54996. destroy() {
  54997. this.type = null;
  54998. super.destroy();
  54999. }
  55000. /**
  55001. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  55002. * @description 构建椭圆的 Path。
  55003. *
  55004. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  55005. * @param {Object} style - style。
  55006. *
  55007. */
  55008. buildPath(ctx, style) {
  55009. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55010. this.refOriginalPosition = [0, 0];
  55011. }
  55012. var __OP = this.refOriginalPosition;
  55013. var k = 0.5522848;
  55014. var x = style.x + __OP[0];
  55015. var y = style.y + __OP[1];
  55016. var a = style.a;
  55017. var b = style.b;
  55018. var ox = a * k; // 水平控制点偏移量
  55019. var oy = b * k; // 垂直控制点偏移量
  55020. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  55021. ctx.moveTo(x - a, y);
  55022. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  55023. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  55024. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  55025. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  55026. ctx.closePath();
  55027. }
  55028. /**
  55029. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.getRect
  55030. * @description 计算返回椭圆包围盒矩形
  55031. *
  55032. * @param {Object} style - style
  55033. * @return {Object} 边框对象。包含属性:x,y,width,height。
  55034. *
  55035. */
  55036. getRect(style) {
  55037. if (style.__rect) {
  55038. return style.__rect;
  55039. }
  55040. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55041. this.refOriginalPosition = [0, 0];
  55042. }
  55043. var __OP = this.refOriginalPosition;
  55044. var lineWidth;
  55045. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  55046. lineWidth = style.lineWidth || 1;
  55047. } else {
  55048. lineWidth = 0;
  55049. }
  55050. style.__rect = {
  55051. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  55052. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  55053. width: style.a * 2 + lineWidth,
  55054. height: style.b * 2 + lineWidth
  55055. };
  55056. return style.__rect;
  55057. }
  55058. }
  55059. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  55060. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55061. * This program are made available under the terms of the Apache License, Version 2.0
  55062. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55063. /**
  55064. * @private
  55065. * @class SuperMap.LevelRenderer.Shape.SmicIsogon
  55066. * @category Visualization Theme
  55067. * @classdesc 正多边形。
  55068. * @extends SuperMap.LevelRenderer.Shape
  55069. */
  55070. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  55071. /**
  55072. * @member {Object} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.style
  55073. * @description 绘制样式。
  55074. *
  55075. * @param {number} x - 正 n 边形外接圆心 x 坐标,必设参数。
  55076. * @param {number} y - 正 n 边形外接圆心 y 坐标,必设参数。
  55077. * @param {number} r - 正n边形外接圆半径,必设参数。
  55078. * @param {number} n - 指明正几边形,必设参数(n>=3)。
  55079. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  55080. * @param {string} color - 填充颜色。默认值:"#000000'"。
  55081. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  55082. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  55083. * @param {number} lineWidth - 描边宽度。默认值:1。
  55084. * @param {number} opacity - 绘制透明度。默认值:1。
  55085. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  55086. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  55087. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  55088. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  55089. * @param {string} text - 图形中的附加文本。默认值:""。
  55090. * @param {string} textColor -文本颜色。默认值:"#000000'"。
  55091. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  55092. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  55093. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  55094. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  55095. */
  55096. //打开接口 style
  55097. /**
  55098. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.constructor
  55099. * @description 构造函数。
  55100. *
  55101. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  55102. *
  55103. */
  55104. constructor(options) {
  55105. super(options);
  55106. /**
  55107. * @member {string} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.type
  55108. * @description 图形类型。
  55109. */
  55110. this.type = 'smicisogon';
  55111. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55112. this.refOriginalPosition = [0, 0];
  55113. }
  55114. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  55115. }
  55116. /**
  55117. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.destroy
  55118. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55119. */
  55120. destroy() {
  55121. this.type = null;
  55122. super.destroy();
  55123. }
  55124. /**
  55125. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  55126. * @description 创建n角星(n>=3)路径。
  55127. *
  55128. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  55129. * @param {Object} style - style。
  55130. *
  55131. */
  55132. buildPath(ctx, style) {
  55133. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55134. this.refOriginalPosition = [0, 0];
  55135. }
  55136. var __OP = this.refOriginalPosition;
  55137. var sin = SUtil.Util_math.sin;
  55138. var cos = SUtil.Util_math.cos;
  55139. var PI = Math.PI;
  55140. var n = style.n;
  55141. if (!n || n < 2) {
  55142. return;
  55143. }
  55144. var x = style.x + __OP[0];
  55145. var y = style.y + __OP[1];
  55146. var r = style.r;
  55147. var dStep = 2 * PI / n;
  55148. var deg = -PI / 2;
  55149. var xStart = x + r * cos(deg);
  55150. var yStart = y + r * sin(deg);
  55151. deg += dStep;
  55152. // 记录边界点,用于判断insight
  55153. var pointList = style.pointList = [];
  55154. pointList.push([xStart, yStart]);
  55155. for (let i = 0, end = n - 1; i < end; i++) {
  55156. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  55157. deg += dStep;
  55158. }
  55159. pointList.push([xStart, yStart]);
  55160. // 绘制
  55161. ctx.moveTo(pointList[0][0], pointList[0][1]);
  55162. for (let i = 0; i < pointList.length; i++) {
  55163. ctx.lineTo(pointList[i][0], pointList[i][1]);
  55164. }
  55165. ctx.closePath();
  55166. return;
  55167. }
  55168. /**
  55169. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.getRect
  55170. * @description 计算返回正多边形的包围盒矩形。
  55171. *
  55172. * @param {Object} style - style
  55173. * @return {Object} 边框对象。包含属性:x,y,width,height。
  55174. */
  55175. getRect(style) {
  55176. if (style.__rect) {
  55177. return style.__rect;
  55178. }
  55179. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55180. this.refOriginalPosition = [0, 0];
  55181. }
  55182. var __OP = this.refOriginalPosition;
  55183. var lineWidth;
  55184. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  55185. lineWidth = style.lineWidth || 1;
  55186. } else {
  55187. lineWidth = 0;
  55188. }
  55189. style.__rect = {
  55190. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  55191. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  55192. width: style.r * 2 + lineWidth,
  55193. height: style.r * 2 + lineWidth
  55194. };
  55195. return style.__rect;
  55196. }
  55197. }
  55198. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  55199. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55200. * This program are made available under the terms of the Apache License, Version 2.0
  55201. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55202. /**
  55203. * @private
  55204. * @class SuperMap.LevelRenderer.Shape.SmicRing
  55205. * @category Visualization Theme
  55206. * @classdesc 圆环。
  55207. * @extends SuperMap.LevelRenderer.Shape
  55208. * @example
  55209. * var shape = new SuperMap.LevelRenderer.Shape.SmicRing({
  55210. * style: {
  55211. * x: 100,
  55212. * y: 100,
  55213. * r0: 30,
  55214. * r: 50
  55215. * }
  55216. * });
  55217. * levelRenderer.addShape(shape);
  55218. *
  55219. */
  55220. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  55221. /**
  55222. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRing.prototype.style
  55223. * @description 绘制样式。
  55224. *
  55225. * @param {number} x - 圆心 x 坐标,必设参数。
  55226. * @param {number} y - 圆心 y 坐标,必设参数。
  55227. * @param {number} r - 外圆半径,必设参数。
  55228. * @param {number} r0 - 内圆半径,必设参数。
  55229. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  55230. * @param {string} color - 填充颜色。默认值:"#000000'"。
  55231. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  55232. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  55233. * @param {number} lineWidth -描边宽度。默认值:1。
  55234. * @param {number} opacity - 绘制透明度。默认值:1。
  55235. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  55236. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  55237. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  55238. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  55239. * @param {string} text -图形中的附加文本。默认值:""。
  55240. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  55241. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  55242. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  55243. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  55244. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  55245. */
  55246. //打开接口 style
  55247. /**
  55248. * @function SuperMap.LevelRenderer.Shape.SmicRing.constructor
  55249. * @description 构造函数。
  55250. *
  55251. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  55252. */
  55253. constructor(options) {
  55254. super(options);
  55255. /**
  55256. * @member {string} SuperMap.LevelRenderer.Shape.SmicRing.prototype.type
  55257. * @description 图形类型。
  55258. */
  55259. this.type = 'smicring';
  55260. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55261. this.refOriginalPosition = [0, 0];
  55262. }
  55263. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  55264. }
  55265. /**
  55266. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.destroy
  55267. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55268. */
  55269. destroy() {
  55270. this.type = null;
  55271. super.destroy();
  55272. }
  55273. /**
  55274. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.buildPath
  55275. * @description 创建圆环路径。
  55276. *
  55277. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  55278. * @param {Object} style - style。
  55279. *
  55280. */
  55281. buildPath(ctx, style) {
  55282. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55283. this.refOriginalPosition = [0, 0];
  55284. }
  55285. var __OP = this.refOriginalPosition;
  55286. // 非零环绕填充优化
  55287. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  55288. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  55289. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  55290. return;
  55291. }
  55292. /**
  55293. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.getRect
  55294. * @description 计算返回圆环包围盒矩阵
  55295. *
  55296. * @param {Object} style - style
  55297. * @return {Object} 边框对象。包含属性:x,y,width,height。
  55298. */
  55299. getRect(style) {
  55300. if (style.__rect) {
  55301. return style.__rect;
  55302. }
  55303. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55304. this.refOriginalPosition = [0, 0];
  55305. }
  55306. var __OP = this.refOriginalPosition;
  55307. var lineWidth;
  55308. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  55309. lineWidth = style.lineWidth || 1;
  55310. } else {
  55311. lineWidth = 0;
  55312. }
  55313. style.__rect = {
  55314. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  55315. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  55316. width: style.r * 2 + lineWidth,
  55317. height: style.r * 2 + lineWidth
  55318. };
  55319. return style.__rect;
  55320. }
  55321. }
  55322. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  55323. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55324. * This program are made available under the terms of the Apache License, Version 2.0
  55325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55326. /**
  55327. * @private
  55328. * @class SuperMap.LevelRenderer.Shape.SmicStar
  55329. * @category Visualization Theme
  55330. * @classdesc n 角星(n>3)。
  55331. * @extends SuperMap.LevelRenderer.Shape
  55332. * @example
  55333. * var shape = new SuperMap.LevelRenderer.Shape.SmicStar({
  55334. * style: {
  55335. * x: 200,
  55336. * y: 100,
  55337. * r: 150,
  55338. * n: 5,
  55339. * text: '五角星'
  55340. * }
  55341. * });
  55342. * levelRenderer.addShape(shape);
  55343. *
  55344. *
  55345. */
  55346. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  55347. /**
  55348. * @member {Object} SuperMap.LevelRenderer.Shape.SmicStar.prototype.style
  55349. * @description 绘制样式。
  55350. *
  55351. * @param {number} style.x - n 角星外接圆心 x 坐标,必设参数。
  55352. * @param {number} style.y - n 角星外接圆心 y 坐标,必设参数。
  55353. * @param {number} style.r - n 角星外接圆半径,必设参数。
  55354. * @param {number} style.r0 - n 角星内部顶点(凹点)的外接圆半径。如果不指定此参数,则自动计算:取相隔外部顶点连线的交点作内部顶点。
  55355. * @param {number} style.n -指明几角星,必设参数。
  55356. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  55357. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  55358. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  55359. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  55360. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  55361. * @param {number} style.opacity - 绘制透明度。默认值:1。
  55362. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  55363. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  55364. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  55365. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  55366. * @param {string} style.text - 图形中的附加文本。默认值:""。
  55367. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  55368. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  55369. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  55370. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  55371. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  55372. */
  55373. //打开接口 style
  55374. /**
  55375. * @function SuperMap.LevelRenderer.Shape.SmicStar.constructor
  55376. * @description 构造函数。
  55377. *
  55378. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  55379. *
  55380. */
  55381. constructor(options) {
  55382. super(options);
  55383. /**
  55384. * @member {string} SuperMap.LevelRenderer.Shape.SmicStar.prototype.type
  55385. * @description 图形类型。
  55386. */
  55387. this.type = 'smicstar';
  55388. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55389. this.refOriginalPosition = [0, 0];
  55390. }
  55391. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  55392. }
  55393. /**
  55394. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.destroy
  55395. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55396. */
  55397. destroy() {
  55398. this.type = null;
  55399. super.destroy();
  55400. }
  55401. /**
  55402. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.buildPath
  55403. * @description 创建n 角星(n>3)路径。
  55404. *
  55405. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  55406. * @param {Object} style - style。
  55407. *
  55408. */
  55409. buildPath(ctx, style) {
  55410. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55411. this.refOriginalPosition = [0, 0];
  55412. }
  55413. var __OP = this.refOriginalPosition;
  55414. var n = style.n;
  55415. if (!n || n < 2) {
  55416. return;
  55417. }
  55418. var sin = SUtil.Util_math.sin;
  55419. var cos = SUtil.Util_math.cos;
  55420. var PI = Math.PI;
  55421. var x = style.x + __OP[0];
  55422. var y = style.y + __OP[1];
  55423. var r = style.r;
  55424. var r0 = style.r0;
  55425. // 如果未指定内部顶点外接圆半径,则自动计算
  55426. if (r0 == null) {
  55427. r0 = n > 4
  55428. // 相隔的外部顶点的连线的交点,
  55429. // 被取为内部交点,以此计算r0
  55430. ? r * cos(2 * PI / n) / cos(PI / n)
  55431. // 二三四角星的特殊处理
  55432. : r / 3;
  55433. }
  55434. var dStep = PI / n;
  55435. var deg = -PI / 2;
  55436. var xStart = x + r * cos(deg);
  55437. var yStart = y + r * sin(deg);
  55438. deg += dStep;
  55439. // 记录边界点,用于判断inside
  55440. var pointList = style.pointList = [];
  55441. pointList.push([xStart, yStart]);
  55442. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  55443. ri = i % 2 === 0 ? r0 : r;
  55444. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  55445. deg += dStep;
  55446. }
  55447. pointList.push([xStart, yStart]);
  55448. // 绘制
  55449. ctx.moveTo(pointList[0][0], pointList[0][1]);
  55450. for (let i = 0; i < pointList.length; i++) {
  55451. ctx.lineTo(pointList[i][0], pointList[i][1]);
  55452. }
  55453. ctx.closePath();
  55454. return;
  55455. }
  55456. /**
  55457. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.getRect
  55458. * @description 返回 n 角星包围盒矩形。
  55459. *
  55460. * @param {Object} style - style
  55461. * @return {Object} 边框对象。包含属性:x,y,width,height。
  55462. */
  55463. getRect(style) {
  55464. if (style.__rect) {
  55465. return style.__rect;
  55466. }
  55467. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  55468. this.refOriginalPosition = [0, 0];
  55469. }
  55470. var __OP = this.refOriginalPosition;
  55471. var lineWidth;
  55472. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  55473. lineWidth = style.lineWidth || 1;
  55474. } else {
  55475. lineWidth = 0;
  55476. }
  55477. style.__rect = {
  55478. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  55479. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  55480. width: style.r * 2 + lineWidth,
  55481. height: style.r * 2 + lineWidth
  55482. };
  55483. return style.__rect;
  55484. }
  55485. }
  55486. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  55487. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55488. * This program are made available under the terms of the Apache License, Version 2.0
  55489. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55490. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  55491. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55492. * This program are made available under the terms of the Apache License, Version 2.0
  55493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55494. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  55495. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55496. * This program are made available under the terms of the Apache License, Version 2.0
  55497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55498. /**
  55499. * 该文件用于存储一些公用常量
  55500. *
  55501. */
  55502. const CommonTypes_FileTypes = {
  55503. EXCEL: "EXCEL",
  55504. CSV: "CSV",
  55505. ISERVER: "ISERVER",
  55506. GEOJSON: "GEOJSON",
  55507. JSON: 'JSON'
  55508. };
  55509. const CommonTypes_FileConfig = {
  55510. fileMaxSize: 10 * 1024 * 1024
  55511. };
  55512. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  55513. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55514. * This program are made available under the terms of the Apache License, Version 2.0
  55515. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55516. /**
  55517. * @class SuperMap.FileModel
  55518. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  55519. * @category Components OpenFile
  55520. * @private
  55521. */
  55522. class FileModel {
  55523. constructor(options) {
  55524. this.FileTypes = FileTypes;
  55525. this.FileConfig = FileConfig;
  55526. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  55527. }
  55528. /**
  55529. * @function SuperMap.FileModel.prototype.set
  55530. * @description 设置属性值
  55531. * @param {string} key - 属性名称
  55532. * @param {string|Object} value - 属性值
  55533. */
  55534. set(key, value) {
  55535. this[key] = value;
  55536. }
  55537. /**
  55538. * @function SuperMap.FileModel.prototype.get
  55539. * @description 获取数据值
  55540. * @param {string} key - 属性名称
  55541. * @returns {string|Object} value - 返回属性值
  55542. */
  55543. get(key) {
  55544. return this[key];
  55545. }
  55546. }
  55547. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  55548. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55549. * This program are made available under the terms of the Apache License, Version 2.0
  55550. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55551. /**
  55552. * @class SuperMap.Components.MessageBox
  55553. * @version 9.1.1
  55554. * @classdesc 组件信息提示框。
  55555. * @category Components Common
  55556. */
  55557. class MessageBox {
  55558. constructor() {
  55559. this._initView();
  55560. }
  55561. _initView() {
  55562. //原生js形式
  55563. const messageBoxContainer = document.createElement("div");
  55564. messageBoxContainer.hidden = true;
  55565. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  55566. //图标
  55567. const iconContainer = document.createElement("div");
  55568. iconContainer.setAttribute("class", "icon");
  55569. this.icon = document.createElement("span");
  55570. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  55571. iconContainer.appendChild(this.icon);
  55572. messageBoxContainer.appendChild(iconContainer);
  55573. //内容:
  55574. const messageBox = document.createElement("div");
  55575. messageBox.setAttribute("class", "component-messagebox");
  55576. messageBox.innerHTML = "";
  55577. messageBoxContainer.appendChild(messageBox);
  55578. this.messageBox = messageBox;
  55579. //关闭按钮
  55580. const cancelContainer = document.createElement("div");
  55581. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  55582. const cancelBtn = document.createElement("button");
  55583. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  55584. cancelBtn.innerHTML = "x";
  55585. cancelBtn.onclick = this.closeView.bind(this);
  55586. cancelContainer.appendChild(cancelBtn);
  55587. messageBoxContainer.appendChild(cancelContainer);
  55588. this.messageBoxContainer = messageBoxContainer;
  55589. document.body.appendChild(this.messageBoxContainer);
  55590. }
  55591. /**
  55592. * @function SuperMap.Components.MessageBox.prototype.closeView
  55593. * @description 关闭提示框。
  55594. */
  55595. closeView() {
  55596. this.messageBoxContainer.hidden = true;
  55597. }
  55598. /**
  55599. * @function SuperMap.Components.MessageBox.prototype.showView
  55600. * @description 显示提示框。
  55601. * @param {string} message - 提示框显示内容。
  55602. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  55603. */
  55604. showView(message, type = 'warring') {
  55605. //设置提示框的样式:
  55606. if (type === "success") {
  55607. this.icon.setAttribute("class", "supermapol-icons-message-success");
  55608. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  55609. } else if (type === "failure") {
  55610. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  55611. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  55612. } else if (type === "warring") {
  55613. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  55614. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  55615. }
  55616. this.messageBox.innerHTML = message;
  55617. this.messageBoxContainer.hidden = false;
  55618. }
  55619. }
  55620. SuperMap.Components.MessageBox = MessageBox;
  55621. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  55622. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  55623. var external_function_try_return_echarts_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_echarts_catch_e_return_namespaceObject);
  55624. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  55625. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55626. * This program are made available under the terms of the Apache License, Version 2.0
  55627. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55628. /**
  55629. * @name Lang
  55630. * @memberOf SuperMap
  55631. * @namespace
  55632. * @category BaseTypes
  55633. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  55634. */
  55635. let Lang = {
  55636. /**
  55637. * @member {string} SuperMap.Lang.code
  55638. * @description 当前所使用的语言类型。
  55639. */
  55640. code: null,
  55641. /**
  55642. * @member {string} [SuperMap.Lang.defaultCode='en-US']
  55643. * @description 默认使用的语言类型。
  55644. */
  55645. defaultCode: "en-US",
  55646. /**
  55647. * @function SuperMap.Lang.getCode
  55648. * @description 获取当前的语言代码。
  55649. * @returns {string} 当前的语言代码。
  55650. */
  55651. getCode: function () {
  55652. if (!SuperMap.Lang.code) {
  55653. SuperMap.Lang.setCode();
  55654. }
  55655. return SuperMap.Lang.code;
  55656. },
  55657. /**
  55658. * @function SuperMap.Lang.setCode
  55659. * @description 设置语言代码。
  55660. * @param {string} code - 此参数遵循IETF规范。
  55661. */
  55662. setCode: function () {
  55663. var lang = this.getLanguageFromCookie();
  55664. if (lang) {
  55665. SuperMap.Lang.code = lang;
  55666. return;
  55667. }
  55668. lang = SuperMap.Lang.defaultCode;
  55669. if (navigator.appName === 'Netscape') {
  55670. lang = navigator.language;
  55671. } else {
  55672. lang = navigator.browserLanguage;
  55673. }
  55674. if (lang.indexOf('zh') === 0) {
  55675. lang = 'zh-CN';
  55676. }
  55677. if (lang.indexOf('en') === 0) {
  55678. lang = 'en-US';
  55679. }
  55680. SuperMap.Lang.code = lang;
  55681. },
  55682. /**
  55683. * @function SuperMap.Lang.getLanguageFromCookie
  55684. * @description 从 cookie 中获取语言类型。
  55685. */
  55686. getLanguageFromCookie() {
  55687. var name = 'language=';
  55688. var ca = document.cookie.split(';');
  55689. for (var i = 0; i < ca.length; i++) {
  55690. var c = ca[i];
  55691. while (c.charAt(0) === ' ') {
  55692. c = c.substring(1)
  55693. }
  55694. if (c.indexOf(name) !== -1) {
  55695. return c.substring(name.length, c.length)
  55696. }
  55697. }
  55698. return "";
  55699. },
  55700. /**
  55701. * @function SuperMap.Lang.i18n
  55702. * @description 从当前语言字符串的字典查找 key。
  55703. * @param {string} key - 字典中 i18n 字符串值的关键字。
  55704. * @returns {string} 国际化的字符串。
  55705. */
  55706. i18n: function (key) {
  55707. var dictionary = SuperMap.Lang[SuperMap.Lang.getCode()];
  55708. var message = dictionary && dictionary[key];
  55709. if (!message) {
  55710. // Message not found, fall back to message key
  55711. message = key;
  55712. }
  55713. return message;
  55714. }
  55715. };
  55716. SuperMap.Lang = Lang;
  55717. SuperMap.i18n = SuperMap.Lang.i18n;
  55718. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  55719. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  55720. var external_function_try_return_XLSX_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_XLSX_catch_e_return_namespaceObject);
  55721. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  55722. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55723. * This program are made available under the terms of the Apache License, Version 2.0
  55724. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55725. /**
  55726. * @class SuperMap.Components.FileReaderUtil
  55727. * @classdesc 组件读取文件工具类。
  55728. * @version 9.1.1
  55729. * @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(*, *=))}}
  55730. */
  55731. let FileReaderUtil = {
  55732. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  55733. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  55734. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  55735. /**
  55736. * @function SuperMap.Components.FileReaderUtil.prototype.readFile
  55737. * @description 读取文件
  55738. * @param {string} fileType - 当前读取的文件类型
  55739. *
  55740. * @param {Object} file - 读取回来的文件内容对象
  55741. * @param {function} success - 读取文件成功回调函数
  55742. * @param {function} failed - 读取文件失败回调函数
  55743. * @param {Object} context - 回调重定向对象
  55744. */
  55745. readFile(fileType, file, success, failed, context) {
  55746. if (CommonTypes_FileTypes.JSON === fileType || CommonTypes_FileTypes.GEOJSON === fileType) {
  55747. this.readTextFile(file, success, failed, context)
  55748. } else if (CommonTypes_FileTypes.EXCEL === fileType || CommonTypes_FileTypes.CSV === fileType) {
  55749. this.readXLSXFile(file, success, failed, context)
  55750. }
  55751. },
  55752. /**
  55753. * 读取文本文件
  55754. * @param file
  55755. * @param success
  55756. * @param failed
  55757. * @param {Object} context - 回调重定向对象
  55758. */
  55759. readTextFile(file, success, failed, context) {
  55760. let reader = new FileReader();
  55761. reader.onloadend = function (evt) {
  55762. success && success.call(context, evt.target.result);
  55763. };
  55764. reader.onerror = function (error) {
  55765. failed && failed.call(context, error)
  55766. };
  55767. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  55768. },
  55769. /**
  55770. * 读取excel或csv文件
  55771. * @param file
  55772. * @param success
  55773. * @param failed
  55774. * @param {Object} context - 回调重定向对象
  55775. */
  55776. readXLSXFile(file, success, failed, context) {
  55777. let reader = new FileReader();
  55778. reader.onloadend = function (evt) {
  55779. let xLSXData = new Uint8Array(evt.target.result);
  55780. let workbook = external_function_try_return_XLSX_catch_e_return_default().read(xLSXData, {type: "array"});
  55781. try {
  55782. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  55783. //暂时只读取第一个sheets的内容
  55784. let sheetName = workbook.SheetNames[0];
  55785. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_default().utils.sheet_to_csv(workbook.Sheets[sheetName]);
  55786. success && success.call(context, xLSXCSVString);
  55787. }
  55788. } catch (error) {
  55789. failed && failed.call(context, error);
  55790. }
  55791. };
  55792. reader.onerror = function (error) {
  55793. failed && failed.call(context, error)
  55794. };
  55795. this.rABF && reader.readAsArrayBuffer(file.file);
  55796. },
  55797. /**
  55798. * @function SuperMap.Components.FileReaderUtil.prototype.processDataToGeoJson
  55799. * @description 将读取回来得数据统一处理为 GeoJSON 格式
  55800. * @param {string} type - 文件类型
  55801. * @param {Object} data - 读取返回的数据对象
  55802. * @param {function} success - 数据处理成功的回调
  55803. * @param {function} failed - 数据处理失败的回调
  55804. * @param {Object} context - 回调重定向对象
  55805. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  55806. * @private
  55807. */
  55808. processDataToGeoJson(type, data, success, failed, context) {
  55809. let geojson = null;
  55810. if (type === "EXCEL" || type === "CSV") {
  55811. geojson = this.processExcelDataToGeoJson(data);
  55812. success && success.call(context, geojson);
  55813. } else if (type === 'JSON' || type === 'GEOJSON') {
  55814. let result = data;
  55815. //geojson、json未知,通过类容来判断
  55816. if ((typeof result) === "string") {
  55817. result = JSON.parse(result);
  55818. }
  55819. if (result.type === 'ISERVER') {
  55820. geojson = result.data.recordsets[0].features;
  55821. } else if (result.type === 'FeatureCollection') {
  55822. //geojson
  55823. geojson = result;
  55824. } else {
  55825. //不支持数据
  55826. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  55827. }
  55828. success && success.call(context, geojson);
  55829. } else {
  55830. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  55831. }
  55832. },
  55833. /**
  55834. * @function SuperMap.Components.FileReaderUtil.prototype.processExcelDataToGeoJson
  55835. * @description 表格文件数据处理
  55836. * @param {Object} data - 读取的表格文件数据
  55837. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  55838. * @private
  55839. */
  55840. processExcelDataToGeoJson(data) {
  55841. //处理为对象格式转化
  55842. let dataContent = this.string2Csv(data);
  55843. let fieldCaptions = dataContent.colTitles;
  55844. //位置属性处理
  55845. let xfieldIndex = -1,
  55846. yfieldIndex = -1;
  55847. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  55848. if (this.isXField(fieldCaptions[i])) {
  55849. xfieldIndex = i;
  55850. }
  55851. if (this.isYField(fieldCaptions[i])) {
  55852. yfieldIndex = i;
  55853. }
  55854. }
  55855. // feature 构建后期支持坐标系 4326/3857
  55856. let features = [];
  55857. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  55858. let row = dataContent.rows[i];
  55859. //if (featureFrom === "LonLat") {
  55860. let x = Number(row[xfieldIndex]),
  55861. y = Number(row[yfieldIndex]);
  55862. //属性信息
  55863. let attributes = {};
  55864. for (let index in dataContent.colTitles) {
  55865. let key = dataContent.colTitles[index];
  55866. attributes[key] = dataContent.rows[i][index];
  55867. }
  55868. //目前csv 只支持处理点,所以先生成点类型的 geojson
  55869. let feature = {
  55870. "type": "Feature",
  55871. "geometry": {
  55872. "type": "Point",
  55873. "coordinates": [x, y]
  55874. },
  55875. "properties": attributes
  55876. };
  55877. features.push(feature);
  55878. }
  55879. return features;
  55880. },
  55881. /**
  55882. * 判断是否地理X坐标
  55883. * @param data
  55884. */
  55885. isXField(data) {
  55886. var lowerdata = data.toLowerCase();
  55887. return (lowerdata === "x" || lowerdata === "smx" ||
  55888. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  55889. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  55890. },
  55891. /**
  55892. * 判断是否地理Y坐标
  55893. * @param data
  55894. */
  55895. isYField(data) {
  55896. var lowerdata = data.toLowerCase();
  55897. return (lowerdata === "y" || lowerdata === "smy" ||
  55898. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  55899. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  55900. },
  55901. /**
  55902. * 字符串转为dataEditor 支持的csv格式数据
  55903. * @param string
  55904. * @param withoutTitle
  55905. */
  55906. string2Csv(string, withoutTitle) {
  55907. // let rows = string.split('\r\n');
  55908. let rows = string.split('\n');
  55909. let result = {};
  55910. if (!withoutTitle) {
  55911. result["colTitles"] = rows[0].split(',');
  55912. } else {
  55913. result["colTitles"] = [];
  55914. }
  55915. result['rows'] = [];
  55916. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  55917. rows[i] && result['rows'].push(rows[i].split(','));
  55918. }
  55919. return result;
  55920. }
  55921. };
  55922. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  55923. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  55924. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55925. * This program are made available under the terms of the Apache License, Version 2.0
  55926. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55927. /**
  55928. * @class SuperMap.Components.ChartModel
  55929. * @classdesc 图表组件数据模型
  55930. * @private
  55931. * @param {Object} datasets - 数据来源。
  55932. * @category Components Chart
  55933. * @fires SuperMap.Components.ChartModel#getdatafailed
  55934. */
  55935. class ChartModel {
  55936. constructor(datasets) {
  55937. this.datasets = datasets;
  55938. this.EVENT_TYPES = ['getdatafailed'];
  55939. this.events = new Events(this, null, this.EVENT_TYPES);
  55940. }
  55941. /**
  55942. * @private
  55943. * @function SuperMap.Components.ChartModel.prototype.getDatasetInfo
  55944. * @description 获得数据集数据。
  55945. * @param {string} datasetUrl - 数据集资源地址。
  55946. */
  55947. getDatasetInfo(success) {
  55948. let datasetUrl = this.datasets.url;
  55949. let me = this;
  55950. FetchRequest.get(datasetUrl)
  55951. .then(function (response) {
  55952. return response.json();
  55953. })
  55954. .then(function (results) {
  55955. if (results.datasetInfo) {
  55956. let datasetInfo = results.datasetInfo;
  55957. me.datasetsInfo = {
  55958. dataSourceName: datasetInfo.dataSourceName,
  55959. datasetName: datasetInfo.name,
  55960. mapName: results.name
  55961. };
  55962. success({
  55963. result: me.datasetsInfo
  55964. });
  55965. }
  55966. })
  55967. .catch(function (error) {
  55968. console.log(error);
  55969. me._fireFailedEvent(error);
  55970. });
  55971. }
  55972. /**
  55973. * @private
  55974. * @function SuperMap.Components.ChartModel.prototype.getDataFeatures
  55975. * @description 请求数据集的数据信息
  55976. * @param {Object} results - 数据集信息。
  55977. * @param {function} success - 成功回调函数。
  55978. */
  55979. getDataFeatures(results, success) {
  55980. let datasetsInfo = results.result;
  55981. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  55982. let params = {
  55983. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  55984. };
  55985. Object.assign(params, this.datasets.queryInfo);
  55986. getFeatureParam = new SuperMap.FilterParameter(params);
  55987. getFeatureBySQLParams = new SuperMap.GetFeaturesBySQLParameters({
  55988. queryParameter: getFeatureParam,
  55989. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  55990. fromIndex: 0,
  55991. toIndex: 100000
  55992. });
  55993. getFeatureBySQLService = new SuperMap.GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  55994. eventListeners: {
  55995. processCompleted: success,
  55996. processFailed: function () {}
  55997. }
  55998. });
  55999. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  56000. }
  56001. /**
  56002. * @private
  56003. * @function SuperMap.Components.ChartModel.prototype.getLayerFeatures
  56004. * @description 请求图层要素的数据信息
  56005. * @param {Object} results - 数据集信息。
  56006. * @param {Callbacks} success - 成功回调函数。
  56007. */
  56008. getLayerFeatures(results, success) {
  56009. let datasetsInfo = results.result;
  56010. let queryParam, queryBySQLParams, queryBySQLService;
  56011. let params = {
  56012. name: datasetsInfo.mapName
  56013. };
  56014. Object.assign(params, this.datasets.queryInfo);
  56015. queryParam = new SuperMap.FilterParameter(params);
  56016. queryBySQLParams = new SuperMap.QueryBySQLParameters({
  56017. queryParams: [queryParam],
  56018. expectCount: 100000
  56019. });
  56020. queryBySQLService = new SuperMap.QueryBySQLService(datasetsInfo.dataUrl, {
  56021. eventListeners: {
  56022. processCompleted: success,
  56023. processFailed: function () {}
  56024. }
  56025. });
  56026. queryBySQLService.processAsync(queryBySQLParams);
  56027. }
  56028. /**
  56029. * @private
  56030. * @function SuperMap.Components.ChartModel.prototype.getDataInfoByIptl
  56031. * @description 用dataId获取iportal的数据。
  56032. * @param {Callbacks} success - getdatachart。
  56033. *
  56034. */
  56035. getDataInfoByIptl(success) {
  56036. // success是chart的回调
  56037. this.getServiceInfo(this.datasets.url, success);
  56038. }
  56039. /**
  56040. * @private
  56041. * @function SuperMap.Components.ChartModel.prototype.getServiceInfo
  56042. * @description 用iportal获取dataItemServices。
  56043. * @param {String} url
  56044. * @param {Callbacks} success - getdatachart。
  56045. * */
  56046. getServiceInfo(url, success) {
  56047. let me = this;
  56048. FetchRequest.get(url, null, {
  56049. withCredentials: this.datasets.withCredentials
  56050. })
  56051. .then((response) => {
  56052. return response.json();
  56053. })
  56054. .then((data) => {
  56055. if (data.succeed === false) {
  56056. //请求失败
  56057. me._fireFailedEvent(data);
  56058. return;
  56059. }
  56060. // 是否有rest服务
  56061. if (data.dataItemServices && data.dataItemServices.length > 0) {
  56062. let dataItemServices = data.dataItemServices,
  56063. resultData;
  56064. dataItemServices.forEach((item) => {
  56065. // 如果有restdata并且发布成功,就请求restdata服务
  56066. // 如果有restmap并且发布成功,就请求restmap服务
  56067. // 其他情况就请求iportal/content.json
  56068. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  56069. resultData = item;
  56070. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  56071. resultData = item;
  56072. } else {
  56073. me.getDatafromContent(url, success);
  56074. return;
  56075. }
  56076. });
  56077. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  56078. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  56079. } else {
  56080. me.getDatafromContent(url, success);
  56081. return;
  56082. }
  56083. })
  56084. .catch((error) => {
  56085. console.log(error);
  56086. me._fireFailedEvent(error);
  56087. });
  56088. }
  56089. /**
  56090. * @private
  56091. * @function SuperMap.Components.ChartModel.prototype.getDatafromURL
  56092. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  56093. * @param {String} url
  56094. * @param {Callbacks} success - getdatachart。
  56095. */
  56096. getDatafromContent(url, success) {
  56097. // 成功回调传入的results
  56098. let results = {
  56099. result: {}
  56100. },
  56101. me = this;
  56102. url += '/content.json?pageSize=9999999&currentPage=1';
  56103. // 获取图层数据
  56104. FetchRequest.get(url, null, {
  56105. withCredentials: this.datasets.withCredentials
  56106. })
  56107. .then((response) => {
  56108. return response.json();
  56109. })
  56110. .then((data) => {
  56111. if (data.succeed === false) {
  56112. //请求失败
  56113. me._fireFailedEvent(data);
  56114. return;
  56115. }
  56116. if (data.type) {
  56117. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  56118. // 将字符串转换成json
  56119. data.content = JSON.parse(data.content.trim());
  56120. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  56121. if (!data.content.features) {
  56122. //json格式解析失败
  56123. console.log(Lang.i18n('msg_jsonResolveFiled'));
  56124. return;
  56125. }
  56126. let features = this._formatGeoJSON(data.content);
  56127. results.result.features = {
  56128. type: data.content.type,
  56129. features
  56130. };
  56131. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  56132. let features = this._excelData2Feature(data.content);
  56133. results.result.features = {
  56134. type: 'FeatureCollection',
  56135. features
  56136. };
  56137. }
  56138. success(results, 'content');
  56139. }
  56140. }, this)
  56141. .catch((error) => {
  56142. console.log(error);
  56143. me._fireFailedEvent(error);
  56144. });
  56145. }
  56146. /**
  56147. * @private
  56148. * @function SuperMap.Components.ChartModel.prototype._getDataSource
  56149. * @description 获取数据源名和数据集名。
  56150. * @param {string} serviceType 服务类型
  56151. * @param {string} address 地址
  56152. * @param {Callbacks} success - getdatachart。
  56153. * @return{array} [数据源名:数据集名]
  56154. * @return{string} 图层名
  56155. */
  56156. getDatafromRest(serviceType, address, success) {
  56157. let me = this,
  56158. withCredentials = this.datasets.withCredentials;
  56159. if (serviceType === 'RESTDATA') {
  56160. let url = `${address}/data/datasources`,
  56161. sourceName,
  56162. datasetName;
  56163. // 请求获取数据源名
  56164. FetchRequest.get(url, null, {
  56165. withCredentials
  56166. })
  56167. .then((response) => {
  56168. return response.json();
  56169. })
  56170. .then((data) => {
  56171. sourceName = data.datasourceNames[0];
  56172. url = `${address}/data/datasources/${sourceName}/datasets`;
  56173. // 请求获取数据集名
  56174. FetchRequest.get(url, null, {
  56175. withCredentials
  56176. })
  56177. .then((response) => {
  56178. return response.json();
  56179. })
  56180. .then((data) => {
  56181. datasetName = data.datasetNames[0];
  56182. // 请求restdata服务
  56183. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  56184. return [sourceName + ':' + datasetName];
  56185. })
  56186. .catch(function (error) {
  56187. me._fireFailedEvent(error);
  56188. });
  56189. })
  56190. .catch(function (error) {
  56191. me._fireFailedEvent(error);
  56192. });
  56193. } else {
  56194. // 如果是地图服务
  56195. let url = `${address}/maps`,
  56196. mapName,
  56197. layerName,
  56198. path;
  56199. // 请求获取地图名
  56200. FetchRequest.get(url, null, {
  56201. withCredentials
  56202. })
  56203. .then((response) => {
  56204. return response.json();
  56205. })
  56206. .then((data) => {
  56207. mapName = data[0].name;
  56208. path = data[0].path;
  56209. url = url = `${address}/maps/${mapName}/layers`;
  56210. // 请求获取图层名
  56211. FetchRequest.get(url, null, {
  56212. withCredentials
  56213. })
  56214. .then((response) => {
  56215. return response.json();
  56216. })
  56217. .then((data) => {
  56218. layerName = data[0].subLayers.layers[0].caption;
  56219. // 请求restmap服务
  56220. me.getDatafromRestMap(layerName, path, success);
  56221. return layerName;
  56222. })
  56223. .catch(function (error) {
  56224. me._fireFailedEvent(error);
  56225. });
  56226. })
  56227. .catch(function (error) {
  56228. me._fireFailedEvent(error);
  56229. });
  56230. }
  56231. }
  56232. /**
  56233. * @private
  56234. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestData
  56235. * @description 请求restdata服务
  56236. * @param {String} url
  56237. * @param {Array<string>} dataSource [数据源名:数据集名]
  56238. * @param {Callbacks} success - getdatachart。
  56239. */
  56240. getDatafromRestData(url, dataSource, success) {
  56241. let me = this;
  56242. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  56243. this._getFeatureBySQL(
  56244. url,
  56245. dataSource,
  56246. this.datasets.queryInfo,
  56247. (results) => {
  56248. // 此时的features已经处理成geojson了
  56249. success(results, 'RESTDATA');
  56250. },
  56251. (error) => {
  56252. console.log(error);
  56253. me._fireFailedEvent(error);
  56254. }
  56255. );
  56256. }
  56257. /**
  56258. * @private
  56259. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestMap
  56260. * @description 请求restmap服务
  56261. * @param {String} dataSource layerName
  56262. * @param {String} path - map服务地址。
  56263. * @param {Callbacks} success - getdatachart。
  56264. */
  56265. getDatafromRestMap(dataSource, path, success) {
  56266. let me = this;
  56267. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  56268. this._queryFeatureBySQL(
  56269. path,
  56270. dataSource,
  56271. this.datasets.queryInfo,
  56272. null,
  56273. null,
  56274. (results) => {
  56275. // let features = result.result.recordsets[0].features;
  56276. success(results, 'RESTMAP');
  56277. },
  56278. (error) => {
  56279. console.log(error);
  56280. me._fireFailedEvent(error);
  56281. }
  56282. );
  56283. }
  56284. /**
  56285. * @private
  56286. * @function SuperMap.Components.ChartModel.prototype._getFeatureBySQL
  56287. * @description 通过 sql 方式查询数据。
  56288. */
  56289. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  56290. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  56291. let params = {
  56292. name: datasetNames.join().replace(':', '@')
  56293. };
  56294. Object.assign(params, queryInfo);
  56295. getFeatureParam = new FilterParameter(params);
  56296. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  56297. queryParameter: getFeatureParam,
  56298. datasetNames: datasetNames,
  56299. fromIndex: 0,
  56300. toIndex: 100000,
  56301. returnContent: true
  56302. });
  56303. let options = {
  56304. eventListeners: {
  56305. processCompleted: (getFeaturesEventArgs) => {
  56306. processCompleted && processCompleted(getFeaturesEventArgs);
  56307. },
  56308. processFailed: (e) => {
  56309. processFaild && processFaild(e);
  56310. }
  56311. }
  56312. };
  56313. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  56314. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  56315. }
  56316. /**
  56317. * @private
  56318. * @function SuperMap.Components.ChartModel.prototype._queryFeatureBySQL
  56319. * @description 通过 sql 方式查询数据。
  56320. */
  56321. _queryFeatureBySQL(
  56322. url,
  56323. layerName,
  56324. queryInfo,
  56325. fields,
  56326. epsgCode,
  56327. processCompleted,
  56328. processFaild,
  56329. startRecord,
  56330. recordLength,
  56331. onlyAttribute
  56332. ) {
  56333. var queryParam, queryBySQLParams;
  56334. var filterParams = {
  56335. name: layerName
  56336. };
  56337. Object.assign(filterParams, queryInfo);
  56338. queryParam = new FilterParameter(filterParams);
  56339. if (fields) {
  56340. queryParam.fields = fields;
  56341. }
  56342. var params = {
  56343. queryParams: [queryParam]
  56344. };
  56345. if (onlyAttribute) {
  56346. params.queryOption = QueryOption.ATTRIBUTE;
  56347. }
  56348. startRecord && (params.startRecord = startRecord);
  56349. recordLength && (params.expectCount = recordLength);
  56350. if (epsgCode) {
  56351. params.prjCoordSys = {
  56352. epsgCode: epsgCode
  56353. };
  56354. }
  56355. queryBySQLParams = new QueryBySQLParameters(params);
  56356. this._queryBySQL(url, queryBySQLParams, (data) => {
  56357. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  56358. });
  56359. }
  56360. /**
  56361. * @function SuperMap.Components.ChartModel.prototype._queryBySQL
  56362. * @description SQL 查询服务。
  56363. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  56364. * @param {RequestCallback} callback - 回调函数。
  56365. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  56366. */
  56367. _queryBySQL(url, params, callback, resultFormat) {
  56368. var me = this;
  56369. var queryBySQLService = new QueryBySQLService(url, {
  56370. eventListeners: {
  56371. scope: me,
  56372. processCompleted: callback,
  56373. processFailed: callback
  56374. },
  56375. format: me._processFormat(resultFormat)
  56376. });
  56377. queryBySQLService.processAsync(params);
  56378. }
  56379. /**
  56380. * @function SuperMap.Components.ChartModel.prototype._processFormat
  56381. * @description 将数据转换成geojson。
  56382. * @param {object} resultFormat - 返回结果集。
  56383. * @return {object} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  56384. */
  56385. _processFormat(resultFormat) {
  56386. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  56387. }
  56388. /**
  56389. * @private
  56390. * @function SuperMap.Components.ChartModel.prototype._formatGeoJSON
  56391. * @description 格式 GeoJSON。
  56392. * @param {GeoJSON} data - GeoJSON 数据。
  56393. */
  56394. _formatGeoJSON(data) {
  56395. let features = data.features;
  56396. features.forEach((row, index) => {
  56397. row.properties['index'] = index;
  56398. });
  56399. return features;
  56400. }
  56401. /**
  56402. * @private
  56403. * @description 将 csv 和 xls 文件内容转换成 geojson
  56404. * @function SuperMap.Components.ChartModel.prototype._excelData2Feature
  56405. * @param content 文件内容
  56406. * @param layerInfo 图层信息
  56407. * @returns {Array} feature的数组集合
  56408. */
  56409. _excelData2Feature(dataContent) {
  56410. let fieldCaptions = dataContent.colTitles;
  56411. //位置属性处理
  56412. let xfieldIndex = -1,
  56413. yfieldIndex = -1;
  56414. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  56415. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  56416. xfieldIndex = i;
  56417. }
  56418. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  56419. yfieldIndex = i;
  56420. }
  56421. }
  56422. // feature 构建后期支持坐标系 4326/3857
  56423. let features = [];
  56424. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  56425. let row = dataContent.rows[i];
  56426. let x = Number(row[xfieldIndex]),
  56427. y = Number(row[yfieldIndex]);
  56428. //属性信息
  56429. let attributes = {};
  56430. for (let index in dataContent.colTitles) {
  56431. let key = dataContent.colTitles[index];
  56432. attributes[key] = dataContent.rows[i][index];
  56433. }
  56434. attributes['index'] = i + '';
  56435. //目前csv 只支持处理点,所以先生成点类型的 geojson
  56436. let feature = {
  56437. type: 'Feature',
  56438. geometry: {
  56439. type: 'Point',
  56440. coordinates: [x, y]
  56441. },
  56442. properties: attributes
  56443. };
  56444. features.push(feature);
  56445. }
  56446. return features;
  56447. }
  56448. /**
  56449. * @private
  56450. * @description 请求数据失败的事件
  56451. * @function SuperMap.Components.ChartModel.prototype._fireFailedEvent
  56452. * @param {object} error 错误信息
  56453. */
  56454. _fireFailedEvent(error) {
  56455. let errorData = error
  56456. ? {
  56457. error,
  56458. message: Lang.i18n('msg_getdatafailed')
  56459. }
  56460. : {
  56461. message: Lang.i18n('msg_getdatafailed')
  56462. };
  56463. /**
  56464. * @event SuperMap.Components.Chart#getdatafailed
  56465. * @description 监听到获取数据失败事件后触发
  56466. * @property {Object} error - 事件对象。
  56467. */
  56468. this.events.triggerEvent('getdatafailed', errorData);
  56469. }
  56470. }
  56471. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  56472. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56473. * This program are made available under the terms of the Apache License, Version 2.0
  56474. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56475. /**
  56476. * @class SuperMap.Components.ChartViewModel
  56477. * @classdesc 图表组件功能类
  56478. * @category Components Chart
  56479. * @version 10.0.0
  56480. * @param {Object} options - 可选参数。
  56481. * @param {string} options.type - 图表类型。
  56482. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源。
  56483. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  56484. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  56485. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  56486. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  56487. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  56488. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  56489. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  56490. * @fires SuperMap.Components.ChartViewModel#getdatafailed
  56491. */
  56492. class ChartViewModel {
  56493. constructor(options) {
  56494. this.datasets = options.datasets;
  56495. this.xField = [];
  56496. this.yField = [];
  56497. this.grid = {
  56498. top: "50px",
  56499. bottom: "50px",
  56500. left: "50px",
  56501. right: "60px"
  56502. };
  56503. this.chartType = options.type || "bar";
  56504. this._initXYField(options.chartOptions);
  56505. this.EVENT_TYPES = ["getdatafailed"];
  56506. this.events = new Events(this, null, this.EVENT_TYPES);
  56507. }
  56508. /**
  56509. * @function SuperMap.Components.ChartViewModel.prototype._initXYField
  56510. * @description 初始化XY字段。
  56511. * @private
  56512. * @param {Object} chartOptions - options里的图表参数
  56513. */
  56514. _initXYField(chartOptions) {
  56515. let me = this;
  56516. if (chartOptions && chartOptions.length > 0) {
  56517. chartOptions.forEach(function (option) {
  56518. if (option.xAxis) {
  56519. me.xField.push({
  56520. field: option.xAxis.field,
  56521. name: option.xAxis.name
  56522. });
  56523. }
  56524. if (option.yAxis) {
  56525. me.yField.push({
  56526. field: option.yAxis.field,
  56527. name: option.yAxis.name
  56528. });
  56529. }
  56530. });
  56531. }
  56532. }
  56533. /**
  56534. * @function SuperMap.Components.ChartViewModel.prototype.getDatasetInfo
  56535. * @description 获得数据集数据。
  56536. * @param {function} success - 成功回调函数
  56537. */
  56538. getDatasetInfo(success) {
  56539. this.createChart = success;
  56540. if (this.datasets && this._checkUrl(this.datasets.url)) {
  56541. this.chartModel = new ChartModel(this.datasets);
  56542. if(this.datasets.type === 'iServer'){
  56543. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  56544. }else if(this.datasets.type === 'iPortal'){
  56545. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  56546. }
  56547. /**
  56548. * @event SuperMap.Components.ChartViewModel#getdatafailed
  56549. * @description 监听到获取数据失败事件后触发
  56550. * @property {Object} error - 事件对象。
  56551. */
  56552. this.chartModel.events.on({"getdatafailed": (error) => {
  56553. this.events.triggerEvent("getdatafailed", error)
  56554. }});
  56555. }
  56556. }
  56557. /**
  56558. * @function SuperMap.Components.ChartViewModel.prototype._getDatasetInfoSuccess
  56559. * @description 成功回调函数。
  56560. * @private
  56561. * @param {Object} results - 数据集信息
  56562. */
  56563. _getDatasetInfoSuccess(results) {
  56564. let datasetUrl = this.datasets.url;
  56565. //判断服务为地图服务 或者 数据服务
  56566. let restIndex = datasetUrl.indexOf("rest");
  56567. if (restIndex > 0) {
  56568. let index = datasetUrl.indexOf("/", restIndex + 5);
  56569. let type = datasetUrl.substring(restIndex + 5, index);
  56570. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  56571. if (type === "maps") {
  56572. let mapIndex = datasetUrl.indexOf("/", index + 1);
  56573. let mapName = datasetUrl.substring(index + 1, mapIndex);
  56574. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  56575. results.result.dataUrl = dataUrl;
  56576. this._getLayerFeatures(results);
  56577. } else if (type === "data") {
  56578. results.result.dataUrl = dataUrl;
  56579. this._getDataFeatures(results);
  56580. }
  56581. }
  56582. }
  56583. /**
  56584. * @function SuperMap.Components.ChartViewModel.prototype._getDataInfoSuccess
  56585. * @description 请求iportal数据成功之后的回调
  56586. * @private
  56587. */
  56588. _getDataInfoSuccess(results, type) {
  56589. let me = this;
  56590. if(type === 'RESTMAP'){
  56591. me._getChartDatasFromLayer(results);
  56592. }else{
  56593. me._getChartDatas(results);
  56594. }
  56595. }
  56596. /**
  56597. * @function SuperMap.Components.ChartViewModel.prototype._getDataFeatures
  56598. * @description 请求数据集的数据信息
  56599. * @private
  56600. * @param {Object} results - 数据集信息
  56601. */
  56602. _getDataFeatures(results) {
  56603. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  56604. }
  56605. /**
  56606. * @function SuperMap.Components.ChartViewModel.prototype._getLayerFeatures
  56607. * @description 请求图层的数据信息
  56608. * @private
  56609. * @param {Object} results - 数据集信息
  56610. */
  56611. _getLayerFeatures(results) {
  56612. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  56613. }
  56614. /**
  56615. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatas
  56616. * @description 将请求回来的数据转换为图表所需的数据格式
  56617. * @private
  56618. * @param {Object} results - 数据要素信息
  56619. */
  56620. _getChartDatas(results) {
  56621. if (results) {
  56622. // 数据来自restdata---results.result.features
  56623. this.features = results.result.features;
  56624. let features = this.features.features;
  56625. let data = {};
  56626. if (features.length) {
  56627. let feature = features[0];
  56628. let attrFields = [],
  56629. itemTypes = [];
  56630. for (let attr in feature.properties) {
  56631. attrFields.push(attr);
  56632. itemTypes.push(this._getDataType(feature.properties[attr]));
  56633. }
  56634. data = {
  56635. features,
  56636. fieldCaptions: attrFields,
  56637. fieldTypes: itemTypes,
  56638. fieldValues: []
  56639. }
  56640. for (let m in itemTypes) {
  56641. let fieldValue = [];
  56642. for (let j in features) {
  56643. let feature = features[j];
  56644. let caption = data.fieldCaptions[m];
  56645. let value = feature.properties[caption];
  56646. fieldValue.push(value);
  56647. }
  56648. data.fieldValues.push(fieldValue);
  56649. }
  56650. this.createChart(data);
  56651. }
  56652. }
  56653. }
  56654. /**
  56655. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatasFromLayer
  56656. * @description 将请求回来的数据转换为图表所需的数据格式
  56657. * @private
  56658. * @param {Object} results - 图层数据要素信息
  56659. */
  56660. _getChartDatasFromLayer(results) {
  56661. if (results.result.recordsets) {
  56662. let recordsets = results.result.recordsets[0];
  56663. let features = recordsets.features.features;
  56664. this.features = recordsets.features;
  56665. let data = {};
  56666. if (features.length) {
  56667. data = {
  56668. features: recordsets.features,
  56669. fieldCaptions: recordsets.fieldCaptions,
  56670. fieldTypes: recordsets.fieldTypes,
  56671. fieldValues: []
  56672. }
  56673. for (let m in data.fieldCaptions) {
  56674. let fieldValue = [];
  56675. for (let j in features) {
  56676. let feature = features[j];
  56677. let caption = data.fieldCaptions[m];
  56678. let value = feature.properties[caption];
  56679. fieldValue.push(value);
  56680. }
  56681. data.fieldValues.push(fieldValue);
  56682. }
  56683. this.createChart(data);
  56684. }
  56685. }
  56686. }
  56687. /**
  56688. * @function SuperMap.Components.ChartViewModel.prototype._createChartOptions
  56689. * @description 创建图表所需参数
  56690. * @private
  56691. * @param {Object} data - 图表数据
  56692. */
  56693. _createChartOptions(data) {
  56694. this.calculatedData = this._createChartDatas(data);
  56695. return this.updateChartOptions(this.chartType);
  56696. }
  56697. /**
  56698. * @function SuperMap.Components.ChartViewModel.prototype.changeType
  56699. * @description 改变图表类型
  56700. * @param {string} type - 图表类型
  56701. */
  56702. changeType(type) {
  56703. if (type !== this.chartType) {
  56704. this.chartType = type;
  56705. return this.updateChartOptions(this.chartType);
  56706. }
  56707. }
  56708. /**
  56709. * @function SuperMap.Components.ChartViewModel.prototype.updateData
  56710. * @description 改变图表类型
  56711. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  56712. * @param {function} success 成功回调函数
  56713. */
  56714. updateData(datasets, chartOption, success) {
  56715. this.updateChart = success;
  56716. this.xField = [];
  56717. this.yField = [];
  56718. this._initXYField(chartOption);
  56719. // type的设置默认值
  56720. datasets.type = datasets.type || 'iServer';
  56721. // withCredentials的设置默认值
  56722. datasets.withCredentials = datasets.withCredentials || false;
  56723. this.datasets = datasets;
  56724. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  56725. }
  56726. /**
  56727. * @function SuperMap.Components.ChartViewModel.prototype._updateDataSuccess
  56728. * @description 改变图表类型
  56729. * @private
  56730. * @param {Object} data - 图表数据
  56731. */
  56732. _updateDataSuccess(data) {
  56733. let options = this._createChartOptions(data);
  56734. this.updateChart(options);
  56735. }
  56736. /**
  56737. * @function SuperMap.Components.ChartViewModel.prototype.updateChartOptions
  56738. * @description 更新图表所需参数
  56739. * @param {string} type - 图表类型
  56740. * @param {Object} style - 图表样式
  56741. */
  56742. updateChartOptions(type, style) {
  56743. if (this.calculatedData) {
  56744. let grid = this.grid;
  56745. let series = this._createChartSeries(this.calculatedData, type);
  56746. let datas = [];
  56747. for (let i in this.calculatedData.XData) {
  56748. datas.push({
  56749. value: this.calculatedData.XData[i].fieldsData
  56750. });
  56751. }
  56752. let xAxis = {
  56753. type: "category",
  56754. name: this.xField[0].name || "X",
  56755. data: datas,
  56756. nameTextStyle: {
  56757. color: '#fff',
  56758. fontSize: 14
  56759. },
  56760. splitLine: {
  56761. show: false
  56762. },
  56763. axisLine: {
  56764. lineStyle: {
  56765. color: '#eee'
  56766. }
  56767. }
  56768. }
  56769. let yAxis = {
  56770. type: "value",
  56771. name: this.yFieldName || "Y",
  56772. data: {},
  56773. nameTextStyle: {
  56774. color: '#fff',
  56775. fontSize: 14
  56776. },
  56777. splitLine: {
  56778. show: false
  56779. },
  56780. axisLine: {
  56781. lineStyle: {
  56782. color: '#eee'
  56783. }
  56784. }
  56785. }
  56786. let tooltip = {
  56787. formatter: '{b0}: {c0}'
  56788. };
  56789. let backgroundColor = '#404a59';
  56790. if (style) {
  56791. if (style.grid) {
  56792. grid = style.grid;
  56793. }
  56794. if (style.tooltip) {
  56795. tooltip = style.tooltip;
  56796. }
  56797. if (style.backgroundColor) {
  56798. backgroundColor = style.backgroundColor;
  56799. }
  56800. }
  56801. return {
  56802. backgroundColor: backgroundColor,
  56803. grid: grid,
  56804. series: series,
  56805. xAxis: xAxis,
  56806. yAxis: yAxis,
  56807. tooltip: tooltip
  56808. }
  56809. }
  56810. }
  56811. /**
  56812. * @function SuperMap.Components.ChartViewModel.prototype._createChartDatas
  56813. * @description 构建图表数据
  56814. * @private
  56815. * @param {Object} data - 源数据
  56816. */
  56817. _createChartDatas(data) {
  56818. let fieldIndex = 0, yfieldIndexs = [];
  56819. let fieldCaptions = data.fieldCaptions;
  56820. let me = this;
  56821. //X
  56822. fieldCaptions.forEach(function (field, index) {
  56823. if (me.xField[0] && field === me.xField[0].field) {
  56824. fieldIndex = index;
  56825. }
  56826. });
  56827. //Y
  56828. this.yFieldName = "";
  56829. this.yField.forEach(function (value, index) {
  56830. if (index !== 0) {
  56831. me.yFieldName = me.yFieldName + ",";
  56832. }
  56833. me.yFieldName = me.yFieldName + value.name;
  56834. fieldCaptions.forEach(function (field, index) {
  56835. if (field === value.field) {
  56836. yfieldIndexs.push(index);
  56837. }
  56838. });
  56839. })
  56840. let datas = this._getAttrData(data, fieldIndex);
  56841. let yDatas = [];
  56842. if (yfieldIndexs.length > 0) {
  56843. yfieldIndexs.forEach(function (yfieldIndex) {
  56844. let yData = [];
  56845. for (let i in data.fieldValues[yfieldIndex]) {
  56846. yData.push({
  56847. value: data.fieldValues[yfieldIndex][i]
  56848. });
  56849. }
  56850. yDatas.push(yData);
  56851. });
  56852. } else { //未指定Y字段时,y轴计数
  56853. let YData = [],
  56854. XData = [],
  56855. len = datas.length;
  56856. //计算X轴,Y轴数据,并去重
  56857. for (let i = 0; i < len; i++) {
  56858. let isSame = false;
  56859. for (let j = 0, leng = XData.length; j < leng; j++) {
  56860. if (datas[i].fieldsData === XData[j].fieldsData) {
  56861. YData[j].value++;
  56862. XData[j].recordIndexs.push(i);
  56863. isSame = true;
  56864. break;
  56865. }
  56866. }
  56867. if (!isSame) {
  56868. if (datas[i].fieldsData) {
  56869. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  56870. YData.push({ value: 1 });
  56871. }
  56872. }
  56873. }
  56874. datas = XData;
  56875. yDatas = [YData];
  56876. }
  56877. return {
  56878. XData: datas,
  56879. YData: yDatas
  56880. }
  56881. }
  56882. /**
  56883. * @function SuperMap.Components.ChartViewModel.prototype._getAttrData
  56884. * @description 选中字段数据
  56885. * @private
  56886. * @param {Object} datacontent - 图表数据
  56887. * @param {number} index - 字段索引
  56888. */
  56889. _getAttrData(datacontent, index) {
  56890. if (index === 0) {
  56891. this.xField = [{
  56892. field: datacontent.fieldCaptions[index],
  56893. name: datacontent.fieldCaptions[index]
  56894. }];
  56895. }
  56896. let fieldsDatas = [];
  56897. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  56898. let value = datacontent.fieldValues[index][i];
  56899. fieldsDatas.push({
  56900. recordIndexs: i,
  56901. fieldsData: value
  56902. });
  56903. }
  56904. return fieldsDatas;
  56905. }
  56906. /**
  56907. * @function SuperMap.Components.ChartViewModel.prototype._createChartSeries
  56908. * @description 图表数据
  56909. * @private
  56910. * @param {Object} calculatedData - 图表数据
  56911. * @param {string} chartType - 图表类型
  56912. */
  56913. _createChartSeries(calculatedData, chartType) {
  56914. let series = [];
  56915. let yDatas = calculatedData.YData;
  56916. yDatas.forEach(function (yData) {
  56917. let value = 0;
  56918. let serieData = [];
  56919. for (let data of yData) {
  56920. value = data.value;
  56921. serieData.push({
  56922. value: value
  56923. });
  56924. }
  56925. let serie = {
  56926. type: chartType,
  56927. data: serieData,
  56928. name: "y"
  56929. };
  56930. series.push(serie);
  56931. });
  56932. return series;
  56933. }
  56934. /**
  56935. * @function SuperMap.Components.ChartViewModel.prototype._isDate
  56936. * @description 判断是否为日期
  56937. * @private
  56938. * @param {string} data - 字符串
  56939. */
  56940. _isDate(data) {
  56941. 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;
  56942. return reg.test(data);
  56943. }
  56944. /**
  56945. * @function SuperMap.Components.ChartViewModel.prototype._isNumber
  56946. * @description 判断是否为数值
  56947. * @private
  56948. * @param {string} data - 字符串
  56949. */
  56950. _isNumber(data) {
  56951. let mdata = Number(data);
  56952. if (mdata === 0) {
  56953. return true;
  56954. }
  56955. return !isNaN(mdata);
  56956. }
  56957. /**
  56958. * @function SuperMap.Components.ChartViewModel.prototype._getDataType
  56959. * @description 判断数据的类型
  56960. * @private
  56961. * @param {string} data - 字符串
  56962. */
  56963. _getDataType(data) {
  56964. if (data !== null && data !== undefined && data !== '') {
  56965. if (this._isDate(data)) {
  56966. return "DATE";
  56967. }
  56968. if (this._isNumber(data)) {
  56969. return "NUMBER";
  56970. }
  56971. }
  56972. return "STRING";
  56973. }
  56974. /**
  56975. * @function SuperMap.Components.ChartViewModel.prototype._checkUrl
  56976. * @description 检查url是否符合要求
  56977. * @private
  56978. * @param {string} url
  56979. */
  56980. _checkUrl(url) {
  56981. let match;
  56982. if (url === '' || !this._isMatchUrl(url)) {
  56983. match = false;
  56984. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  56985. //不是实际域名
  56986. match = false;
  56987. } else {
  56988. match = true;
  56989. }
  56990. return match;
  56991. }
  56992. /**
  56993. * @function SuperMap.Components.ChartViewModel.prototype._isMatchUrl
  56994. * @description 判断输入的地址是否符合地址格式
  56995. * @private
  56996. * @param {string} str - url
  56997. */
  56998. _isMatchUrl(str) {
  56999. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  57000. return reg.test(str);
  57001. }
  57002. /**
  57003. * @function SuperMap.Components.ChartViewModel.prototype.getStyle
  57004. * @description 获取图表样式。
  57005. */
  57006. getStyle() {
  57007. let style = {
  57008. grid: this.grid,
  57009. tooltip: this.tooltip,
  57010. backgroundColor: this.backgroundColor
  57011. }
  57012. return style;
  57013. }
  57014. /**
  57015. * @function SuperMap.Components.ChartViewModel.prototype.getFeatures
  57016. * @description 获取地图服务,数据服务请求返回的数据。
  57017. */
  57018. getFeatures() {
  57019. return this.features;
  57020. }
  57021. /**
  57022. * @function SuperMap.Components.ChartViewModel.prototype.setStyle
  57023. * @description 设置图表样式。
  57024. * @param {Object} style - 图表样式
  57025. */
  57026. setStyle(style) {
  57027. return this.updateChartOptions(this.chartType, style);
  57028. }
  57029. }
  57030. SuperMap.Components.ChartViewModel = ChartViewModel;
  57031. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  57032. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57033. * This program are made available under the terms of the Apache License, Version 2.0
  57034. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57035. /**
  57036. * @class SuperMap.Components.Chart
  57037. * @classdesc 图表组件
  57038. * @version 9.1.2
  57039. * @param {string} domID - 图表dom元素ID。
  57040. * @param {Object} options - 可选参数。
  57041. * @param {string} options.type - 图表类型。
  57042. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源
  57043. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  57044. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  57045. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  57046. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  57047. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  57048. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  57049. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  57050. * @category Components Chart
  57051. */
  57052. /**
  57053. * @typedef {Object} SuperMap.Components.Chart.Datasets - 数据来源
  57054. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  57055. * @property {string} url - 服务url地址。
  57056. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie
  57057. * @property {SuperMap.FilterParameter} queryInfo - 查询条件
  57058. */
  57059. class ChartView {
  57060. constructor(domID, options) {
  57061. this.domID = domID;
  57062. this.chartType = options.type || "bar";
  57063. // 设置options.datasets.type的默认值是iServer
  57064. options.datasets.type = options.datasets.type || 'iServer';
  57065. // 设置withCredentials的默认值为false
  57066. options.datasets.withCredentials = options.datasets.withCredentials || false;
  57067. this.viewModel = new ChartViewModel(options);
  57068. //添加控件。
  57069. this._fillDataToView();
  57070. }
  57071. /**
  57072. * @function SuperMap.Components.Chart.prototype.onAdd
  57073. * @description 创建图表之后成功回调
  57074. * @param {function} addChart - 回调函数
  57075. */
  57076. onAdd(addChart) {
  57077. this.addChart = addChart;
  57078. }
  57079. /**
  57080. * @function SuperMap.Components.Chart.prototype._fillDataToView
  57081. * @description 填充数据到 view。
  57082. * @private
  57083. */
  57084. _fillDataToView() {
  57085. let messageboxs = new MessageBox();
  57086. //iclient 绑定createChart事件成功回调
  57087. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  57088. this.viewModel.events.on({
  57089. "getdatafailed": (error) => {
  57090. messageboxs.showView(error.message);
  57091. }
  57092. });
  57093. }
  57094. /**
  57095. * @function SuperMap.Components.Chart.prototype.getStyle
  57096. * @description 获取图表样式。
  57097. */
  57098. getStyle() {
  57099. return this.viewModel.getStyle()
  57100. }
  57101. /**
  57102. * @function SuperMap.Components.Chart.prototype.getFeatures
  57103. * @description 获取地图服务,数据服务请求返回的数据。
  57104. */
  57105. getFeatures() {
  57106. return this.viewModel.getFeatures();
  57107. }
  57108. /**
  57109. * @function SuperMap.Components.Chart.prototype.setStyle
  57110. * @description 设置图表样式。
  57111. * @param {Object} style - 图表样式 参考Echarts-options样式设置
  57112. */
  57113. setStyle(style) {
  57114. let newOptions = this.viewModel.setStyle(style);
  57115. this._updateChart(newOptions);
  57116. }
  57117. /**
  57118. * @function SuperMap.Components.Chart.prototype.changeType
  57119. * @description 改变图表类型
  57120. * @param {string} type - 图表类型
  57121. */
  57122. changeType(type) {
  57123. if (this.chartType !== type) {
  57124. this.chartType = type;
  57125. let newOptions = this.viewModel.changeType(type);
  57126. this._updateChart(newOptions);
  57127. }
  57128. }
  57129. /**
  57130. * @function SuperMap.Components.Chart.prototype.updateData
  57131. * @description 更新图表数据
  57132. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  57133. * @param {Object} chartOption - X,Y轴信息
  57134. */
  57135. updateData(datasets, chartOption) {
  57136. let me = this;
  57137. this.viewModel.updateData(datasets, chartOption, function (options) {
  57138. me._updateChart(options);
  57139. if (me.addChart) {
  57140. me.addChart();
  57141. }
  57142. });
  57143. }
  57144. /**
  57145. * @function SuperMap.Components.Chart.prototype._createChart
  57146. * @description 创建图表
  57147. * @private
  57148. * @param {Object} data - 图表数据
  57149. */
  57150. _createChart(data) {
  57151. this.echart = external_function_try_return_echarts_catch_e_return_default().init(
  57152. document.getElementById(this.domID),
  57153. null, {
  57154. renderer: "canvas"
  57155. }
  57156. )
  57157. let options = this.viewModel._createChartOptions(data);
  57158. this.echart.setOption(options);
  57159. if (this.addChart) {
  57160. this.addChart();
  57161. }
  57162. }
  57163. /**
  57164. * @function SuperMap.Components.Chart.prototype._updateChart
  57165. * @description 更新图表
  57166. * @private
  57167. * @param {Object} options - 图表参数
  57168. */
  57169. _updateChart(options) {
  57170. if (this.echart) {
  57171. this.echart.clear();
  57172. this.echart.setOption(options);
  57173. }
  57174. }
  57175. }
  57176. SuperMap.Components.Chart = ChartView;
  57177. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  57178. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57179. * This program are made available under the terms of the Apache License, Version 2.0
  57180. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57181. /**
  57182. * @class SuperMap.Components.TemplateBase
  57183. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  57184. * @version 9.1.1
  57185. * @param {Object} options - 组件配置参数。
  57186. * @param {string} options.id - 组件 dom 元素 id。
  57187. * @category Components Common
  57188. */
  57189. class TemplateBase {
  57190. constructor(options) {
  57191. options = options ? options : {};
  57192. /**
  57193. * @member {string} [SuperMap.Components.TemplateBase.prototype.id=null]
  57194. * @description 组件 dom 元素 id。
  57195. */
  57196. this.id = options.id ? options.id : null;
  57197. /**
  57198. * @member {Element} [SuperMap.Components.TemplateBase.prototype.rootContainer=null]
  57199. * @description 组件 dom 元素对象。
  57200. */
  57201. this.rootContainer = null;
  57202. }
  57203. /**
  57204. * @function SuperMap.Components.TemplateBase.prototype.getElement
  57205. * @description 获取当前组件元素对象。
  57206. * @return {Element}
  57207. */
  57208. getElement() {
  57209. //todo 其实感觉再这里给组件设置不太合理
  57210. if (this.id) {
  57211. this.rootContainer.id = this.id;
  57212. }
  57213. return this.rootContainer;
  57214. }
  57215. /**
  57216. * @function SuperMap.Components.TemplateBase.prototype._initView
  57217. * @private
  57218. * @description 初始化模板。
  57219. */
  57220. _initView() {
  57221. //子类实现此方法
  57222. }
  57223. /**
  57224. * @function SuperMap.Components.TemplateBase.prototype.showView
  57225. * @description 显示组件。
  57226. */
  57227. showView() {
  57228. this.rootContainer.hidden = false;
  57229. }
  57230. /**
  57231. * @function SuperMap.Components.TemplateBase.prototype.closeView
  57232. * @description 隐藏组件。
  57233. */
  57234. closeView() {
  57235. this.rootContainer.hidden = true;
  57236. }
  57237. }
  57238. SuperMap.Components.TemplateBase = TemplateBase;
  57239. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  57240. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57241. * This program are made available under the terms of the Apache License, Version 2.0
  57242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57243. /**
  57244. * @class SuperMap.Components.CommonContainer
  57245. * @classdesc 组件统一外框。
  57246. * @version 9.1.1
  57247. * @param {Object} options - 组件可选参数。
  57248. * @param {string} options.id - 组件 dom 元素 id。
  57249. * @param {string} options.title - 标题。
  57250. * @category Components Common
  57251. * @extends {SuperMap.Components.TemplateBase}
  57252. */
  57253. class CommonContainer extends TemplateBase {
  57254. constructor(options) {
  57255. super(options);
  57256. let title = options.title ? options.title : "";
  57257. this._initView(title);
  57258. }
  57259. /**
  57260. * @private
  57261. * @override
  57262. */
  57263. _initView(title) {
  57264. const container = document.createElement("div");
  57265. container.setAttribute("class", "component-container");
  57266. //title
  57267. const titleContainer = document.createElement("div");
  57268. titleContainer.setAttribute("class", "component-title");
  57269. const titleContent = document.createElement("div");
  57270. titleContent.innerHTML = title;
  57271. titleContainer.appendChild(titleContent);
  57272. container.appendChild(titleContainer);
  57273. //container
  57274. const componentContent = document.createElement("div");
  57275. componentContent.setAttribute("class", "component-content");
  57276. container.appendChild(componentContent);
  57277. this.content = componentContent;
  57278. this.rootContainer = container;
  57279. return container;
  57280. }
  57281. /**
  57282. * @function SuperMap.Components.CommonContainer.prototype.getContentElement
  57283. * @description 获取内容元素容器
  57284. */
  57285. getContentElement() {
  57286. return this.content;
  57287. }
  57288. /**
  57289. * @function SuperMap.Components.CommonContainer.prototype.appendContent
  57290. * @description 填充内容元素
  57291. */
  57292. appendContent(element) {
  57293. this.content.appendChild(element);
  57294. }
  57295. }
  57296. SuperMap.Components.CommonContainer = CommonContainer;
  57297. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  57298. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57299. * This program are made available under the terms of the Apache License, Version 2.0
  57300. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57301. /**
  57302. * @class SuperMap.Components.Select
  57303. * @classdesc 组件统一的文字下拉框。
  57304. * @version 9.1.1
  57305. * @param {Array.<string|Array>} options - 需要创建的 Select 数据数组。
  57306. * @param {string} options.id - 组件 dom 元素 id。
  57307. * @param {string} [options.labelName] - label 名称。
  57308. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  57309. * @param {Function} [options.optionsClickCb] - option 点击事件回调函数。
  57310. * @extends {SuperMap.Components.TemplateBase}
  57311. * @category Components Common
  57312. */
  57313. class Select extends TemplateBase {
  57314. constructor(options) {
  57315. super(options);
  57316. this._initView(options);
  57317. }
  57318. _initView(options) {
  57319. let selectTool = this._createElement('div', "component-selecttool");
  57320. if (options.labelName) {
  57321. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  57322. label.innerHTML = options.labelName;
  57323. }
  57324. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  57325. chartSelect.setAttribute('tabindex', '1');
  57326. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  57327. selectName.title = options.optionsArr[0];
  57328. selectName.innerHTML = options.optionsArr[0];
  57329. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  57330. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  57331. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  57332. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  57333. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  57334. scrollareaContent.setAttribute('tabindex', '1');
  57335. this.createOptions(scrollareaContent, options.optionsArr);
  57336. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  57337. // 下拉框显示 & 隐藏事件
  57338. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  57339. this.rootContainer = selectTool;
  57340. }
  57341. /**
  57342. * @function SuperMap.Components.Select.prototype.createOptions
  57343. * @description 创建所属下拉框选项。
  57344. */
  57345. createOptions(container, optionsArr) {
  57346. for (let i in optionsArr) {
  57347. let option = this._createElement('div', 'component-selecttool__option', container);
  57348. option.title = optionsArr[i];
  57349. option.innerHTML = optionsArr[i];
  57350. }
  57351. }
  57352. /**
  57353. * @function SuperMap.Components.Select.prototype._selectClickEvent
  57354. * @description select 点击显示&隐藏事件。
  57355. * @private
  57356. */
  57357. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  57358. eventElement.onclick = function (e) {
  57359. if (contentElement.style.display === "block") {
  57360. contentElement.style.display = "none";
  57361. triangleBtn.className = "component-triangle-down-img";
  57362. } else {
  57363. contentElement.style.display = "block";
  57364. triangleBtn.className = "triangle-up-img";
  57365. }
  57366. e.preventDefault();
  57367. e.stopPropagation();
  57368. };
  57369. eventElement.onmousedown = function (evt) {
  57370. //console.log('dropdownbox onmousedown '+evt.target.className);
  57371. if (evt.target !== this) {
  57372. this.focus();
  57373. evt.preventDefault();
  57374. evt.stopPropagation()
  57375. }
  57376. };
  57377. eventElement.onblur = function () {
  57378. contentElement.style.display = "none";
  57379. triangleBtn.className = "component-triangle-down-img";
  57380. }
  57381. }
  57382. /**
  57383. * @function Select.prototype._createElement
  57384. * @description 通用创建元素。
  57385. * @private
  57386. */
  57387. _createElement(tagName, className, parentEle) {
  57388. let ele = document.createElement(tagName || 'div');
  57389. className && (ele.className = className);
  57390. parentEle && parentEle.appendChild(ele);
  57391. return ele;
  57392. }
  57393. /**
  57394. * @function SuperMap.Components.Select.prototype.optionClickEvent
  57395. * @description 下拉框的 option 的点击事件。
  57396. */
  57397. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  57398. for (let i = 0; i < optionEleArr.children.length; i++) {
  57399. let childEle = optionEleArr.children[i];
  57400. childEle.onclick = function () {
  57401. selectNameEle.innerHTML = childEle.innerHTML;
  57402. selectNameEle.title = childEle.title;
  57403. if (childEle.getAttribute('data-value')) {
  57404. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  57405. }
  57406. optionsClickCb && optionsClickCb(childEle);
  57407. }
  57408. }
  57409. }
  57410. }
  57411. SuperMap.Components.Select = Select;
  57412. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  57413. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57414. * This program are made available under the terms of the Apache License, Version 2.0
  57415. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57416. /**
  57417. * @class SuperMap.Components.DropDownBox
  57418. * @classdesc 组件统一的图片下拉框。
  57419. * @version 9.1.1
  57420. * @param {Array.<Object>} optionsArr - 需要创建的 option 数据数组。
  57421. * @param {string} optionsArr.id - 组件 dom 元素 id。
  57422. * @param {string} optionsArr.title - 下拉框 title。
  57423. * @param {string} optionsArr.remark - 下拉框解释标记文本。
  57424. * @param {string} optionsArr.icon - 下拉框图标。
  57425. * @param {string} [optionsArr.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  57426. * @param {string} [optionsArr.icon.className] - 下拉框图标类名。
  57427. * @param {string} [optionsArr.icon.background] - 下拉框图标背景 url。
  57428. * @category Components Common
  57429. * @extends {SuperMap.Components.TemplateBase}
  57430. */
  57431. class DropDownBox extends TemplateBase {
  57432. constructor(optionsArr) {
  57433. super(optionsArr);
  57434. this._initView(optionsArr);
  57435. }
  57436. /**
  57437. * @function SuperMap.Components.DropDownBox.prototype._initView
  57438. * @description 初始化下拉框。
  57439. * @private
  57440. * @override
  57441. */
  57442. _initView(optionsArr) {
  57443. let dropDownContainer = document.createElement('div');
  57444. dropDownContainer.className = 'component-dropdownbox--container';
  57445. let dropDownBox = document.createElement('div');
  57446. dropDownBox.setAttribute('tabindex', '1');
  57447. dropDownBox.className = "component-dropdownbox";
  57448. dropDownContainer.appendChild(dropDownBox);
  57449. let dropDownTopContainer = document.createElement('div');
  57450. dropDownBox.appendChild(dropDownTopContainer);
  57451. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  57452. let triangleBtnContainer = document.createElement('div');
  57453. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  57454. dropDownBox.appendChild(triangleBtnContainer);
  57455. let triangleBtn = document.createElement('div');
  57456. triangleBtn.className = 'component-triangle-down-img';
  57457. triangleBtnContainer.appendChild(triangleBtn);
  57458. let createDropDownBoxParam = {
  57459. "parentEle": dropDownBox,
  57460. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  57461. "scrollareaContent": 'component-selecttool__scrollarea__content',
  57462. "optionsArr": optionsArr,
  57463. "triangleBtn": triangleBtn,
  57464. "dropDownTopContainer": dropDownTopContainer
  57465. };
  57466. this._createDropDownBox(createDropDownBoxParam);
  57467. this.rootContainer = dropDownContainer;
  57468. }
  57469. /**
  57470. * @function SuperMap.Components.DropDownBox.prototype._createDropDownBox
  57471. * @description 创建下拉框。
  57472. * @private
  57473. */
  57474. _createDropDownBox(createDropDownBoxParam) {
  57475. let dropDownBox = createDropDownBoxParam.parentEle;
  57476. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  57477. let dropDownContent = document.createElement('div');
  57478. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  57479. dropDownBox.appendChild(dropDownContent);
  57480. let scrollareaContent = document.createElement('div');
  57481. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  57482. dropDownContent.appendChild(scrollareaContent);
  57483. let optionsArr = createDropDownBoxParam.optionsArr;
  57484. for (let i = 0; i < optionsArr.length; i++) {
  57485. this._createDropDownOption(optionsArr[i], scrollareaContent)
  57486. }
  57487. // 下拉框显示 & 隐藏事件
  57488. let triangleBtn = createDropDownBoxParam.triangleBtn;
  57489. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  57490. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  57491. // 下拉框 options 点击事件
  57492. let scrollareaOptions = scrollareaContent.children;
  57493. for (let i = 0; i < scrollareaOptions.length; i++) {
  57494. scrollareaOptions[i].onclick = function () {
  57495. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  57496. //evt.stopPropagation();
  57497. }
  57498. }
  57499. }
  57500. /**
  57501. * @function SuperMap.Components.DropDownBox.prototype._createDropDownOption
  57502. * @description 创建下拉框子元素。
  57503. * @private
  57504. */
  57505. _createDropDownOption(data, parentElement) {
  57506. let ele = document.createElement('div');
  57507. ele.className = 'component-dropdownbox__item';
  57508. let dataItem = data;
  57509. if (dataItem['dataValue']) {
  57510. ele.setAttribute('data-value', dataItem['dataValue']);
  57511. }
  57512. parentElement.appendChild(ele);
  57513. let imgContainer = document.createElement('div');
  57514. imgContainer.className = 'component-dropdownbox__item__img';
  57515. ele.appendChild(imgContainer);
  57516. let img = document.createElement('div');
  57517. if (dataItem.icon.className) {
  57518. img.className = dataItem.icon.className;
  57519. }
  57520. if (dataItem.icon.background) {
  57521. img.style.background = dataItem.icon.background;
  57522. }
  57523. imgContainer.appendChild(img);
  57524. let title = document.createElement('div');
  57525. title.className = 'component-dropdownbox__item__title';
  57526. title.title = dataItem.title;
  57527. title.innerHTML = dataItem.title;
  57528. ele.appendChild(title);
  57529. let remark = document.createElement('div');
  57530. remark.className = 'component-dropdownbox__item__remark';
  57531. remark.title = dataItem.remark;
  57532. remark.innerHTML = dataItem.remark;
  57533. ele.appendChild(remark);
  57534. }
  57535. /**
  57536. * @function SuperMap.Components.DropDownBox.prototype._dropDownClickEvent
  57537. * @description 下拉框点击事件。
  57538. * @private
  57539. */
  57540. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  57541. eventElement.onclick = function (e) {
  57542. if (contentElement.style.display === "block") {
  57543. contentElement.style.display = "none";
  57544. triangleBtn.className = "component-triangle-down-img";
  57545. } else {
  57546. contentElement.style.display = "block";
  57547. triangleBtn.className = "triangle-up-img";
  57548. }
  57549. e.preventDefault();
  57550. e.stopPropagation()
  57551. };
  57552. eventElement.onmousedown = function (evt) {
  57553. //console.log('dropdownbox onmousedown '+evt.target.className);
  57554. if (evt.target !== this) {
  57555. this.focus();
  57556. evt.preventDefault();
  57557. evt.stopPropagation()
  57558. }
  57559. }
  57560. }
  57561. /**
  57562. * @function SuperMap.Components.DropDownBox.prototype._eleOnblur
  57563. * @description 下拉框失焦事件。
  57564. * @private
  57565. */
  57566. _eleOnblur(eventElement, contentElement, triangleBtn) {
  57567. eventElement.onblur = function () {
  57568. contentElement.style.display = "none";
  57569. triangleBtn.className = "component-triangle-down-img";
  57570. }
  57571. }
  57572. /**
  57573. * @function SuperMap.Components.DropDownBox.prototype._createElement
  57574. * @description 通用创建元素。
  57575. * @private
  57576. */
  57577. _createElement(tagName, className, parentEle) {
  57578. let ele = document.createElement(tagName || 'div');
  57579. className && (ele.className = className);
  57580. parentEle && parentEle.appendChild(ele);
  57581. return ele;
  57582. }
  57583. }
  57584. SuperMap.Components.DropDownBox = DropDownBox;
  57585. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  57586. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57587. * This program are made available under the terms of the Apache License, Version 2.0
  57588. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57589. /**
  57590. * @class SuperMap.Components.PopContainer
  57591. * @classdesc 弹框组件。
  57592. * @version 9.1.1
  57593. * @param {Object} options - 组件配置参数。
  57594. * @param {string} options.id - 组件 dom 元素 id。
  57595. * @param {string} options.title - 弹框组件名称。
  57596. * @extends {SuperMap.Components.TemplateBase}
  57597. * @category Components Common
  57598. */
  57599. class PopContainer extends TemplateBase {
  57600. constructor(options) {
  57601. options = options ? options : {};
  57602. super(options);
  57603. options.title = options.title ? options.title : "";
  57604. this._initView(options.title);
  57605. }
  57606. /**
  57607. * @private
  57608. * @override
  57609. */
  57610. _initView(titile) {
  57611. const container = document.createElement("div");
  57612. container.setAttribute("class", "component-popcontainer");
  57613. //header
  57614. const header = document.createElement("div");
  57615. header.setAttribute("class", "component-popcontainer__header");
  57616. const title = document.createElement("label");
  57617. title.setAttribute("class", "component-popcontainer__header__title");
  57618. title.innerHTML = titile;
  57619. header.appendChild(title);
  57620. const closeBtn = document.createElement("span");
  57621. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  57622. closeBtn.onclick = this.closeView.bind(this);
  57623. container.appendChild(closeBtn);
  57624. container.appendChild(header);
  57625. //content
  57626. const content = document.createElement("div");
  57627. content.setAttribute("class", "component-popcontainer__content");
  57628. this.content = content;
  57629. container.appendChild(content);
  57630. this.rootContainer = container;
  57631. }
  57632. /**
  57633. * @function SuperMap.Components.PopContainer.prototype.appendContent
  57634. * @description 追加内容。
  57635. * @param {Element} dom - 内容元素。
  57636. */
  57637. appendContent(dom) {
  57638. this.content.appendChild(dom);
  57639. }
  57640. }
  57641. SuperMap.Components.PopContainer = PopContainer;
  57642. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  57643. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57644. * This program are made available under the terms of the Apache License, Version 2.0
  57645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57646. /**
  57647. * @class SuperMap.Components.AttributesPopContainer
  57648. * @classdesc 属性弹框组件
  57649. * @version 9.1.1
  57650. * @param {Object} options - 组件配置参数。
  57651. * @param {string} options.id - 组件 dom 元素 id。
  57652. * @param {Object} options.title - 属性弹框组件名称。
  57653. * @param {Object} options.attributes - 组件需要显示的属性内容。
  57654. * @extends {SuperMap.Components.PopContainer}
  57655. * @category Components Common
  57656. */
  57657. class AttributesPopContainer extends PopContainer {
  57658. constructor(options) {
  57659. //默认为属性:
  57660. options.title = options.title ? options.title : "属性";
  57661. super(options);
  57662. this.rootContainer.firstChild.hidden = true;
  57663. options.attributes = options.attributes ? options.attributes : [];
  57664. this._createAttributesTable(options.attributes);
  57665. }
  57666. _createAttributesTable(attributes) {
  57667. const table = document.createElement("table");
  57668. table.setAttribute("class", "component-popcontainer__content__table");
  57669. const tbody = document.createElement("tbody");
  57670. let single = true;
  57671. for (let name in attributes) {
  57672. const tr = document.createElement("tr");
  57673. if (single) {
  57674. tr.setAttribute("class", "component-popcontainer__content__td--color");
  57675. }
  57676. const title = document.createElement("td");
  57677. const titleSpan = document.createElement("Span");
  57678. titleSpan.innerHTML = name;
  57679. title.appendChild(titleSpan);
  57680. const value = document.createElement("td");
  57681. value.innerHTML = attributes[name];
  57682. tr.appendChild(title);
  57683. tr.appendChild(value);
  57684. tbody.appendChild(tr);
  57685. single = !single;
  57686. }
  57687. table.appendChild(tbody);
  57688. this.appendContent(table);
  57689. }
  57690. }
  57691. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  57692. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  57693. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57694. * This program are made available under the terms of the Apache License, Version 2.0
  57695. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57696. /**
  57697. * @class SuperMap.Components.IndexTabsPageContainer
  57698. * @description 标签索引组件。
  57699. * @version 9.1.1
  57700. * @param {Object} options - 可选参数。
  57701. * @param {string} options.id - 组件 dom 元素 id。
  57702. * @category Components Common
  57703. * @extends {SuperMap.Components.TemplateBase}
  57704. */
  57705. class IndexTabsPageContainer extends TemplateBase {
  57706. constructor(options) {
  57707. super(options);
  57708. this._initView();
  57709. }
  57710. /**
  57711. * @private
  57712. * @override
  57713. */
  57714. _initView() {
  57715. const container = document.createElement("div");
  57716. container.setAttribute("class", "component-tabpage");
  57717. const header = document.createElement("ul");
  57718. this.header = header;
  57719. const content = document.createElement("div");
  57720. content.setAttribute("class", "component-tabpage__content");
  57721. this.content = content;
  57722. container.appendChild(header);
  57723. container.appendChild(content);
  57724. this.rootContainer = container;
  57725. }
  57726. /**
  57727. * @function SuperMap.Components.IndexTabsPageContainer.prototype.setTabs
  57728. * @description 设置标签元素。
  57729. * @param {Array.<Element>} tabs
  57730. */
  57731. setTabs(tabs) {
  57732. this.removeAllTabs();
  57733. this.appendTabs(tabs);
  57734. }
  57735. /**
  57736. * @function SuperMap.Components.IndexTabsPageContainer.prototype.appendTabs
  57737. * @description 追加标签元素。
  57738. * @param {Array.<Element>} tabs
  57739. */
  57740. appendTabs(tabs) {
  57741. for (let i = 0; i < tabs.length; i++) {
  57742. let title = document.createElement("span");
  57743. title.index = i;
  57744. title.appendChild(document.createTextNode(tabs[i].title));
  57745. //绑定标签切换对应页面:
  57746. title.onclick = this._changeTabsPage.bind(this);
  57747. let content = tabs[i].content;
  57748. content.index = i;
  57749. content.hidden = true;
  57750. this.header.appendChild(title);
  57751. this.content.appendChild(content);
  57752. }
  57753. //todo 确认是否两个子元素的 index 相互对应
  57754. //默认显示第一个标签对象
  57755. this.header.firstChild.setAttribute("class", "on");
  57756. this.content.firstChild.hidden = false;
  57757. }
  57758. /**
  57759. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeTab
  57760. * @description 删除某个标签页面。
  57761. * @param {number} index - 标签索引号。
  57762. */
  57763. removeTab(index) {
  57764. this.header.removeChild(this.header.children[index]);
  57765. this.content.removeChild(this.content.children[index]);
  57766. }
  57767. /**
  57768. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeAllTabs
  57769. * @description 删除所有标签。
  57770. */
  57771. removeAllTabs() {
  57772. for (let i = this.header.children.length; i > 0; i--) {
  57773. this.header.removeChild(this.header.children[i]);
  57774. this.content.removeChild(this.content.children[i]);
  57775. }
  57776. }
  57777. _changeTabsPage(e) {
  57778. const index = e.target.index;
  57779. for (let i = 0; i < this.header.children.length; i++) {
  57780. this.header.children[i].setAttribute("class", "");
  57781. this.content.children[i].hidden = true;
  57782. if (i === index) {
  57783. this.header.children[i].setAttribute("class", "on");
  57784. this.content.children[i].hidden = false;
  57785. }
  57786. }
  57787. }
  57788. }
  57789. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  57790. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  57791. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57792. * This program are made available under the terms of the Apache License, Version 2.0
  57793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57794. /**
  57795. * @class SuperMap.Components.CityTabsPage
  57796. * @classdesc 城市地址匹配组件模板
  57797. * @version 9.1.1
  57798. * @param {Object} options - 组件配置参数。
  57799. * @param {string} options.id - 组件 dom 元素 id。
  57800. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  57801. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  57802. * @extends {SuperMap.Components.IndexTabsPageContainer}
  57803. * @category Components Common
  57804. */
  57805. class CityTabsPage extends IndexTabsPageContainer {
  57806. constructor(options) {
  57807. super(options);
  57808. //去掉默认的边框阴影样式:
  57809. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  57810. this.config = options.config;
  57811. //header,若 config为城市名称数组,则直接加载内容
  57812. if (Util.isArray(this.config)) {
  57813. this.header.hidden = true;
  57814. this._createCityItem("城市", this.config);
  57815. this.content.style.border = "none";
  57816. } else {
  57817. this._createTabs();
  57818. this.header.onclick = (e) => {
  57819. //关闭所有元素 是否有更简化的写法?
  57820. for (let i = 0; i < this.header.children.length; i++) {
  57821. this.header.children[i].setAttribute("class", "");
  57822. }
  57823. //打开点击内容元素
  57824. e.target.setAttribute("class", "on");
  57825. this._createCityContent(e.target.innerHTML);
  57826. };
  57827. }
  57828. }
  57829. /**
  57830. * @function SuperMap.Components.CityTabsPage.prototype._createTabs
  57831. * @description 创建 Tabs
  57832. * @private
  57833. */
  57834. _createTabs() {
  57835. //header
  57836. if (Util.isArray(this.config)) {
  57837. for (let i = 0; i < this.config.length; i++) {
  57838. let innerHTML = "";
  57839. for (const key in this.config[i]) {
  57840. innerHTML += key;
  57841. }
  57842. let li = document.createElement("li");
  57843. li.innerHTML = innerHTML;
  57844. this.header.appendChild(li);
  57845. }
  57846. } else {
  57847. for (const key in this.config) {
  57848. let li = document.createElement("li");
  57849. li.innerHTML = key;
  57850. this.header.appendChild(li);
  57851. }
  57852. }
  57853. this.header.firstChild.setAttribute("class", "on");
  57854. this._createCityContent(this.header.firstChild.innerHTML);
  57855. }
  57856. /**
  57857. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  57858. * @description 创建列表容器
  57859. * @private
  57860. */
  57861. _createCityContent(keyName) {
  57862. //清除元素:
  57863. for (let i = this.content.children.length; i > 0; i--) {
  57864. this.content.removeChild(this.content.children[i - 1]);
  57865. }
  57866. //创建对应元素
  57867. const cities = this.config[keyName];
  57868. for (let key in cities) {
  57869. this._createCityItem(key, cities[key]);
  57870. }
  57871. }
  57872. /**
  57873. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  57874. * @description 创建列表容器
  57875. * @private
  57876. */
  57877. _createCityItem(key, cities) {
  57878. const city = document.createElement("div");
  57879. const cityClass = document.createElement("div");
  57880. cityClass.setAttribute("class", "component-citytabpag__py-key");
  57881. cityClass.innerHTML = key;
  57882. city.appendChild(cityClass);
  57883. const cityContent = document.createElement("div");
  57884. cityContent.setAttribute("class", "component-citytabpag__content");
  57885. for (let i = 0; i < cities.length; i++) {
  57886. let span = document.createElement("span");
  57887. span.innerHTML = cities[i];
  57888. cityContent.appendChild(span);
  57889. }
  57890. //HOT 元素长度单独微调:
  57891. if (key === "HOT") {
  57892. cityContent.style.width = "428px";
  57893. }
  57894. city.appendChild(cityContent);
  57895. this.content.appendChild(city);
  57896. }
  57897. }
  57898. SuperMap.Components.CityTabsPage = CityTabsPage;
  57899. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  57900. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57901. * This program are made available under the terms of the Apache License, Version 2.0
  57902. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57903. /**
  57904. * @class SuperMap.Components.NavTabsPage
  57905. * @classdesc 标签页面组件。
  57906. * @version 9.1.1
  57907. * @param {Object} options - 组件配置参数。
  57908. * @param {string} optionsArr.id - 组件 dom 元素 id。
  57909. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  57910. * @extends {SuperMap.Components.TemplateBase}
  57911. * @category Components Common
  57912. */
  57913. // todo 思考拆分的控件应该以哪种方式使用
  57914. class NavTabsPage extends TemplateBase {
  57915. constructor(options) {
  57916. super(options);
  57917. this.navTabsTitle = null;
  57918. this.navTabsContent = null;
  57919. options.tabs = options.tabs ? options.tabs : [];
  57920. this._initView(options.tabs);
  57921. }
  57922. /**
  57923. * @override
  57924. * @private
  57925. */
  57926. _initView(tabs) {
  57927. const navTabsPage = document.createElement("div");
  57928. navTabsPage.setAttribute("class", "component-navtabspage");
  57929. //关闭按钮
  57930. const closeBtn = document.createElement("span");
  57931. closeBtn.setAttribute("class", "supermapol-icons-close");
  57932. closeBtn.onclick = this.closeView.bind(this);
  57933. navTabsPage.appendChild(closeBtn);
  57934. //标签
  57935. const navTabsTitle = document.createElement("div");
  57936. this.navTabsTitle = navTabsTitle;
  57937. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  57938. navTabsPage.appendChild(navTabsTitle);
  57939. //内容
  57940. const navTabsContent = document.createElement("div");
  57941. this.navTabsContent = navTabsContent;
  57942. navTabsContent.setAttribute("class", "component-navtabspage__content");
  57943. navTabsPage.appendChild(navTabsContent);
  57944. //若 tabs 初始传入值,则
  57945. if (tabs.length > 0) {
  57946. this.appendTabs(tabs);
  57947. }
  57948. this.rootContainer = navTabsPage;
  57949. }
  57950. /**
  57951. * @function SuperMap.Components.NavTabsPage.prototype.setTabs
  57952. * @description 设置标签。
  57953. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  57954. */
  57955. setTabs(tabs) {
  57956. this.removeAllTabs();
  57957. this.appendTabs(tabs);
  57958. }
  57959. /**
  57960. * @function SuperMap.Components.NavTabsPage.prototype.appendTabs
  57961. * @description 添加标签页面。
  57962. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  57963. */
  57964. appendTabs(tabs) {
  57965. for (let i = 0; i < tabs.length; i++) {
  57966. let title = document.createElement("span");
  57967. title.index = i;
  57968. title.appendChild(document.createTextNode(tabs[i].title));
  57969. //绑定标签切换对应页面:
  57970. title.onclick = this._changeTabsPage.bind(this);
  57971. let content = tabs[i].content;
  57972. content.index = i;
  57973. content.hidden = true;
  57974. this.navTabsTitle.appendChild(title);
  57975. this.navTabsContent.appendChild(content);
  57976. }
  57977. //todo 确认是否两个子元素的 index 相互对应
  57978. //默认显示第一个标签对象
  57979. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  57980. this.navTabsContent.firstChild.hidden = false;
  57981. }
  57982. /**
  57983. * @function SuperMap.Components.NavTabsPage.prototype.removeTab
  57984. * @description 删除某个标签页面。
  57985. * @param {number} index - 标签索引号。
  57986. */
  57987. removeTab(index) {
  57988. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  57989. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  57990. }
  57991. /**
  57992. * @function SuperMap.Components.NavTabsPage.prototype.removeAllTabs
  57993. * @description 删除所有标签。
  57994. */
  57995. removeAllTabs() {
  57996. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  57997. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  57998. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  57999. }
  58000. }
  58001. _changeTabsPage(e) {
  58002. const index = e.target.index;
  58003. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  58004. this.navTabsTitle.children[i].setAttribute("class", "");
  58005. this.navTabsContent.children[i].hidden = true;
  58006. if (i === index) {
  58007. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  58008. this.navTabsContent.children[i].hidden = false;
  58009. }
  58010. }
  58011. }
  58012. }
  58013. SuperMap.Components.NavTabsPage = NavTabsPage;
  58014. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  58015. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58016. * This program are made available under the terms of the Apache License, Version 2.0
  58017. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58018. /**
  58019. * @class SuperMap.Components.PaginationContainer
  58020. * @classdesc 分页组件模板。
  58021. * @version 9.1.1
  58022. * @param {Object} options - 组件配置参数。
  58023. * @param {string} optionsArr.id - 组件 dom 元素 id。
  58024. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  58025. * @param {number} options.pageCounts - 页数。
  58026. * @extends {SuperMap.Components.TemplateBase}
  58027. * @category Components Common
  58028. */
  58029. class PaginationContainer extends TemplateBase {
  58030. constructor(options) {
  58031. options = options ? options : {};
  58032. super(options);
  58033. this.currentPage = 0;
  58034. this.pageNumberLis = [];
  58035. this.currentPageNumberLis = [];
  58036. this.linkageEvent = null;
  58037. options.contents = options.contents ? options.contents : null;
  58038. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  58039. this._initView(options.contents, options.pageCounts);
  58040. }
  58041. /**
  58042. * @function SuperMap.Components.PaginationContainer.prototype.setLinkageEvent
  58043. * @description 设置页面联动方法。
  58044. * @param {function} linkageEvent - 联动方法,实现指定功能。
  58045. */
  58046. setLinkageEvent(linkageEvent) {
  58047. this.linkageEvent = linkageEvent;
  58048. }
  58049. /**
  58050. * @private
  58051. * @override
  58052. */
  58053. _initView(contents, pageCounts) {
  58054. const container = document.createElement("div");
  58055. container.setAttribute("class", "component-pagination");
  58056. //content
  58057. const content = document.createElement("div");
  58058. content.setAttribute("class", "component-pagination__content");
  58059. container.appendChild(content);
  58060. this.content = content;
  58061. //link
  58062. const link = document.createElement("ul");
  58063. link.setAttribute("class", "component-pagination__link");
  58064. link.onclick = this._changePageEvent.bind(this);
  58065. container.appendChild(link);
  58066. this._createLink(link);
  58067. this.link = link;
  58068. //填充内容:
  58069. if (contents) {
  58070. this.setContent(contents);
  58071. }
  58072. if (pageCounts !== 0) {
  58073. this.setPageLink(pageCounts);
  58074. }
  58075. this.rootContainer = container;
  58076. }
  58077. /**---------以下是页面相关操作 **/
  58078. /**
  58079. * @function SuperMap.Components.PaginationContainer.prototype.setContent
  58080. * @description 设置页面内容。
  58081. * @param {Element} element - 页面内容元素。
  58082. */
  58083. setContent(element) {
  58084. this.clearContent();
  58085. this.appendContent(element);
  58086. }
  58087. /**
  58088. * @function SuperMap.Components.PaginationContainer.prototype.appendContent
  58089. * @description 追加内容。
  58090. * @param {Element} element - 页面内容元素。
  58091. */
  58092. appendContent(element) {
  58093. this.content.appendChild(element);
  58094. }
  58095. /**
  58096. * @function SuperMap.Components.PaginationContainer.prototype.clearContent
  58097. * @description 清空内容元素。
  58098. */
  58099. clearContent() {
  58100. for (let i = this.content.children.length - 1; i >= 0; i--) {
  58101. this.content.removeChild(this.content.children[i]);
  58102. }
  58103. }
  58104. /** -----以下是页码相关的操作:**/
  58105. /**
  58106. * @function SuperMap.Components.PaginationContainer.prototype.setPageLink
  58107. * @description 设置页码数。
  58108. * @param {number} pageNumber - 页码数。
  58109. */
  58110. setPageLink(pageNumber) {
  58111. //清空当前页码
  58112. this.pageNumberLis = [];
  58113. this.currentPageNumberLis = [];
  58114. this.clearPageLink();
  58115. //创建页码
  58116. this._createPageLi(pageNumber);
  58117. //添加页码到页码列表
  58118. this._appendPageLink();
  58119. }
  58120. /**
  58121. * @description 创建页码。
  58122. * @param pageNumber
  58123. * @private
  58124. */
  58125. _createPageLi(pageNumber) {
  58126. for (let i = 0; i < pageNumber; i++) {
  58127. const pageLi = document.createElement("li");
  58128. pageLi.innerHTML = i + 1;
  58129. /*const liContent = document.createElement("span");
  58130. liContent.innerHTML = i + 1;*/
  58131. // pageLi.appendChild(liContent);
  58132. this.pageNumberLis.push(pageLi);
  58133. }
  58134. this.pageNumberLis[0].setAttribute("class", "active");
  58135. this.currentPage = 1;
  58136. if (pageNumber < 5) {
  58137. this.currentPageNumberLis = this.pageNumberLis;
  58138. } else {
  58139. for (let i = 0; i < 5; i++) {
  58140. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  58141. }
  58142. }
  58143. }
  58144. /**
  58145. * @description 添加页码到页码列表。
  58146. * @private
  58147. */
  58148. _appendPageLink() {
  58149. //todo 如何插入中间
  58150. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  58151. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  58152. }
  58153. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  58154. //清空 active 状态
  58155. this.currentPageNumberLis[i].setAttribute("class", "");
  58156. //给当前选中的 li 赋值 active 状态
  58157. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  58158. this.currentPageNumberLis[i].setAttribute("class", "active");
  58159. }
  58160. }
  58161. //根据 currentPage 改变按钮状态
  58162. this._changeDisableState();
  58163. if (this.linkageEvent) {
  58164. this.linkageEvent(this.currentPage);
  58165. }
  58166. }
  58167. /**
  58168. * @function SuperMap.Components.PaginationContainer.prototype.clearPageLink
  58169. * @description 清除页码列表。
  58170. */
  58171. clearPageLink() {
  58172. for (let i = this.link.children.length - 3; i > 1; i--) {
  58173. this.link.removeChild(this.link.children[i]);
  58174. }
  58175. }
  58176. /**
  58177. * @description 创建页码按钮。
  58178. * @param ul
  58179. * @private
  58180. */
  58181. _createLink(ul) {
  58182. for (let i = 0; i < 4; i++) {
  58183. const li = document.createElement("li");
  58184. li.setAttribute("class", "disable");
  58185. const liContent = document.createElement("span");
  58186. li.appendChild(liContent);
  58187. if (i === 0) {
  58188. liContent.id = "first";
  58189. liContent.setAttribute("class", "supermapol-icons-first");
  58190. } else if (i === 1) {
  58191. liContent.id = "prev";
  58192. liContent.setAttribute("class", "supermapol-icons-prev");
  58193. } else if (i === 2) {
  58194. liContent.id = "next";
  58195. liContent.setAttribute("class", "supermapol-icons-next");
  58196. } else if (i === 3) {
  58197. liContent.id = "last";
  58198. liContent.setAttribute("class", "supermapol-icons-last");
  58199. }
  58200. ul.appendChild(li);
  58201. }
  58202. }
  58203. /**
  58204. * @description 点击页码事件。
  58205. * @param e
  58206. * @private
  58207. */
  58208. _changePageEvent(e) {
  58209. //todo
  58210. const trigger = e.target;
  58211. //若列表禁用,点击无效
  58212. if (trigger.parentElement.classList[0] === "disable") {
  58213. return;
  58214. }
  58215. let targetLi;
  58216. if (trigger.id) {
  58217. targetLi = trigger.id;
  58218. } else if (Number(trigger.innerHTML)) {
  58219. targetLi = Number(trigger.innerHTML);
  58220. } else {
  58221. return;
  58222. }
  58223. //页码预处理:
  58224. this._prePageNum(targetLi);
  58225. //根据 currentPageNumberLis 创建页码列表
  58226. this.clearPageLink();
  58227. this._appendPageLink();
  58228. }
  58229. /**
  58230. * @description 根据 currentPage 改变按钮状态。
  58231. * @private
  58232. */
  58233. _changeDisableState() {
  58234. this.link.children[0].setAttribute("class", "");
  58235. this.link.children[1].setAttribute("class", "");
  58236. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  58237. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  58238. if (this.currentPage === 1) {
  58239. this.link.children[0].setAttribute("class", "disable");
  58240. this.link.children[1].setAttribute("class", "disable");
  58241. }
  58242. if (this.currentPage === this.pageNumberLis.length) {
  58243. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  58244. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  58245. }
  58246. }
  58247. /**
  58248. * @description 根据点击页码列表事件准备需展现的页码列表。
  58249. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  58250. * @private
  58251. */
  58252. _prePageNum(targetLi) {
  58253. const currentPageNumberLis = [];
  58254. if (targetLi === "first") {
  58255. this.currentPage = 1;
  58256. } else if (targetLi === "last") {
  58257. this.currentPage = this.pageNumberLis.length;
  58258. } else if (targetLi === "prev") {
  58259. this.currentPage = this.currentPage - 1;
  58260. } else if (targetLi === "next") {
  58261. this.currentPage = this.currentPage + 1;
  58262. } else {
  58263. this.currentPage = targetLi;
  58264. }
  58265. if (this.pageNumberLis.length <= 5) {
  58266. for (let i = 0; i < this.pageNumberLis.length; i++) {
  58267. currentPageNumberLis.push(this.pageNumberLis[i]);
  58268. }
  58269. } else {
  58270. //当前点击前三,都取前五
  58271. if (this.currentPage <= 3) {
  58272. for (let i = 0; i < 5; i++) {
  58273. currentPageNumberLis.push(this.pageNumberLis[i]);
  58274. }
  58275. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  58276. //点击后三,都取后5
  58277. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  58278. currentPageNumberLis.push(this.pageNumberLis[i]);
  58279. }
  58280. } else {
  58281. //其他,取中间:
  58282. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  58283. currentPageNumberLis.push(this.pageNumberLis[i]);
  58284. }
  58285. }
  58286. }
  58287. if (currentPageNumberLis.length > 0) {
  58288. this.currentPageNumberLis = currentPageNumberLis;
  58289. }
  58290. }
  58291. }
  58292. SuperMap.Components.PaginationContainer = PaginationContainer;
  58293. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  58294. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58295. * This program are made available under the terms of the Apache License, Version 2.0
  58296. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58297. let ComponentsUtil = {
  58298. /**
  58299. * 获取上传文件类型
  58300. * @param fileName
  58301. */
  58302. getFileType(fileName) {
  58303. let regCSV = /^.*\.(?:csv)$/i;
  58304. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  58305. let regGeojson = /^.*\.(?:geojson|json)$/i;
  58306. if (regExcel.test(fileName)) { //校验不通过
  58307. return CommonTypes_FileTypes.EXCEL;
  58308. } else if (regCSV.test(fileName)) {
  58309. return CommonTypes_FileTypes.CSV;
  58310. } else if (regGeojson.test(fileName)) {
  58311. return CommonTypes_FileTypes.GEOJSON;
  58312. }
  58313. return null;
  58314. }
  58315. };
  58316. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  58317. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58318. * This program are made available under the terms of the Apache License, Version 2.0
  58319. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58320. ;// CONCATENATED MODULE: ./src/common/components/index.js
  58321. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58322. * This program are made available under the terms of the Apache License, Version 2.0
  58323. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58324. //数据
  58325. //组件
  58326. //提示框组件
  58327. //图表组件
  58328. //公用模板:
  58329. //工具类
  58330. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  58331. 
  58332. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58333. * This program are made available under the terms of the Apache License, Version 2.0
  58334. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58335. /**
  58336. * Namespace: SuperMap.Lang["en"]
  58337. * Dictionary for English. Keys for entries are used in calls to
  58338. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  58339. * strings formatted for use with <SuperMap.String.format> calls.
  58340. */
  58341. let en = {
  58342. 'title_dataFlowService': 'Data Flow Service',
  58343. 'title_distributedAnalysis': 'Distributed Analysis',
  58344. 'title_clientComputing': 'Client Computing',
  58345. 'title_dataServiceQuery': 'Data Service Query',
  58346. 'title_searchCity':'Search city',
  58347. 'title_searchLayer':' Search layer',
  58348. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  58349. 'text_displayFeaturesInfo': 'Display feature information',
  58350. 'text_subscribe': 'subscribe',
  58351. 'text_cancelSubscribe': 'unsubscribe',
  58352. 'text_densityAnalysis': 'Density Analysis',
  58353. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  58354. 'text_option_selectDataset':'Please select a dataset',
  58355. 'text_label_dataset': 'Dataset',
  58356. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  58357. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  58358. 'text_label_analyticalMethod': 'Analytical method',
  58359. 'text_option_quadrilateral': 'Quadrilateral',
  58360. 'text_option_hexagon': 'hexagon',
  58361. 'text_label_meshType': 'Mesh type',
  58362. 'text_option_notSet': 'Not set',
  58363. 'text_label_weightField': 'Weight field',
  58364. 'text_label_gridSizeInMeters': 'Grid size',
  58365. 'text_label_searchRadius': 'Search radius',
  58366. 'text_label_queryRange': 'Scope of analysis',
  58367. 'text_label_areaUnit': 'Area unit',
  58368. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  58369. 'text_option_logarithm': 'Logarithm',
  58370. 'text_option_equalCountingSegment': 'Equal counting segment',
  58371. 'text_option_squareRootSegmentation': 'Square root segmentation',
  58372. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  58373. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  58374. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  58375. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  58376. 'text_option_rainbowGradient': 'Rainbow gradient',
  58377. 'text_option_spectralGradient': 'Spectral gradient',
  58378. 'text_option_terrainGradient': 'Terrain gradient',
  58379. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  58380. 'text_label_resultLayerName': 'Result layer name',
  58381. 'text_chooseFile': 'Open File',
  58382. 'text_isoline': 'Isoline',
  58383. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  58384. 'text_buffer': 'Buffer',
  58385. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  58386. 'text_label_analysisLayer': 'Analysis layer',
  58387. 'text_label_extractField': 'Extract field',
  58388. 'text_label_extractedValue': 'Extracted value',
  58389. 'text_label_distanceAttenuation': 'Distance attenuation',
  58390. 'text_label_gridSize': 'gridSize',
  58391. 'text_label_bufferRadius': 'Buffer radius',
  58392. 'text_label_defaultkilometers': 'Default 10 kilometers',
  58393. 'text_label_kilometer': 'kilometer',
  58394. 'text_label_unit': 'unit',
  58395. 'text_retainOriginal': 'Retain original object field',
  58396. 'text_mergeBuffer': 'Merge buffer',
  58397. 'text_label_color': 'Color',
  58398. 'text_label_buffer': '[Buffer]',
  58399. 'text_label_isolines': '[Isolines]',
  58400. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  58401. 'text_label_queryModel': 'Query mode',
  58402. 'text_label_IDArrayOfFeatures': 'ID array of features',
  58403. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  58404. 'text_label_bufferDistance': 'Buffer distance',
  58405. 'text_label_queryRange1': 'Query range',
  58406. 'text_label_spatialQueryMode': 'Spatial query mode',
  58407. 'text_label_featureFilter': 'Feature filter',
  58408. 'text_label_geometricObject': 'Geometric object',
  58409. 'text_label_queryMode': 'Query mode',
  58410. 'text_label_searchTips': 'Search for city locations or layer features',
  58411. 'text_label_chooseSearchLayers': 'Select a query layer',
  58412. 'text_loadSearchCriteria': 'Load search criteria',
  58413. 'text_saveSearchCriteria': 'Save search criteria',
  58414. "btn_analyze": "Analyze",
  58415. "btn_analyzing": "Analyzing",
  58416. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  58417. "btn_cancelAnalysis": "Cancel",
  58418. "btn_query": "Query",
  58419. "btn_querying": "Querying",
  58420. "btn_emptyTheRresultLayer": "Clear all result layers",
  58421. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  58422. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  58423. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  58424. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  58425. 'msg_selectDataset': 'Please select a data set!',
  58426. 'msg_setTheWeightField': 'Please set the weight field!',
  58427. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  58428. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  58429. 'msg_openFileFail': 'Failed to open file!',
  58430. 'msg_fileTypeUnsupported': 'File format is not supported!',
  58431. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  58432. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  58433. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  58434. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  58435. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  58436. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  58437. 'msg_getFeatureField':"No related vector features found!",
  58438. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  58439. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  58440. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  58441. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  58442. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  58443. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  58444. 'msg_getdatafailed': 'Failed to get data!'
  58445. };
  58446. SuperMap.Lang["en-US"] = en;
  58447. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  58448. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58449. * This program are made available under the terms of the Apache License, Version 2.0
  58450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58451. /**
  58452. * Namespace: SuperMap.Lang["zh-CN"]
  58453. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  58454. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  58455. * strings formatted for use with <SuperMap.String.format> calls.
  58456. */
  58457. let zh = {
  58458. 'title_dataFlowService': '数据流服务',
  58459. 'title_distributedAnalysis': '分布式分析',
  58460. 'title_clientComputing': '客户端计算',
  58461. 'title_dataServiceQuery': '数据服务查询',
  58462. 'title_searchCity':'搜索城市',
  58463. 'title_searchLayer':'搜索图层',
  58464. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  58465. 'text_displayFeaturesInfo': '显示要素信息',
  58466. 'text_subscribe': '订阅',
  58467. 'text_cancelSubscribe': '取消订阅',
  58468. 'text_densityAnalysis': '密度分析',
  58469. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  58470. 'text_option_selectDataset':'请选择数据集',
  58471. 'text_label_dataset': '数据集',
  58472. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  58473. 'text_option_nuclearDensityAnalysis': '核密度分析',
  58474. 'text_label_analyticalMethod': '分析方法',
  58475. 'text_option_quadrilateral': '四边形',
  58476. 'text_option_hexagon': '六边形',
  58477. 'text_label_meshType': '网格面类型',
  58478. 'text_option_notSet': '未设置',
  58479. 'text_label_weightField': '权重字段',
  58480. 'text_label_gridSizeInMeters': '网格大小',
  58481. 'text_label_searchRadius': '搜索半径',
  58482. 'text_label_queryRange': '分析范围',
  58483. 'text_label_areaUnit': '面积单位',
  58484. 'text_option_equidistantSegmentation': '等距离分段',
  58485. 'text_option_logarithm': '对数',
  58486. 'text_option_equalCountingSegment': '等计数分段',
  58487. 'text_option_squareRootSegmentation': '平方根分段',
  58488. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  58489. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  58490. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  58491. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  58492. 'text_option_rainbowGradient': '彩虹渐变',
  58493. 'text_option_spectralGradient': '光谱渐变',
  58494. 'text_option_terrainGradient': '地形渐变',
  58495. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  58496. 'text_label_resultLayerName': '结果图层名称',
  58497. 'text_chooseFile': '选择文件',
  58498. 'text_isoline': '等值线',
  58499. 'text_extractDiscreteValue': '提取离散值生成曲线',
  58500. 'text_buffer': '缓冲区',
  58501. 'text_specifyTheDistance': '指定距离创建周边区域',
  58502. 'text_label_analysisLayer': '分析图层',
  58503. 'text_label_extractField': '提取字段',
  58504. 'text_label_extractedValue': '提取值',
  58505. 'text_label_distanceAttenuation': '距离衰减',
  58506. 'text_label_gridSize': '栅格大小',
  58507. 'text_label_bufferRadius': '缓冲半径',
  58508. 'text_label_defaultkilometers': '默认10千米',
  58509. 'text_option_kilometer': '千米',
  58510. 'text_label_unit': '单位',
  58511. 'text_retainOriginal': '保留原对象字段属性',
  58512. 'text_mergeBuffer': '合并缓冲区',
  58513. 'text_label_color': '颜色',
  58514. 'text_label_buffer': '[缓冲区]',
  58515. 'text_label_isolines': '[等值线]',
  58516. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  58517. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  58518. 'text_label_maxFeatures': '最多可返回的要素数量',
  58519. 'text_label_bufferDistance': '缓冲区距离',
  58520. 'text_label_queryRange1': '查询范围',
  58521. 'text_label_spatialQueryMode': '空间查询模式',
  58522. 'text_label_featureFilter': '要素过滤器',
  58523. 'text_label_geometricObject': '几何对象',
  58524. 'text_label_queryMode': '查询模式',
  58525. 'text_label_searchTips': '搜索城市地点或图层要素',
  58526. 'text_label_chooseSearchLayers': '选择查询图层',
  58527. 'text_loadSearchCriteria': '加载搜索条件',
  58528. 'text_saveSearchCriteria': '保存搜索条件',
  58529. "btn_analyze": "分析",
  58530. "btn_analyzing": "分析中",
  58531. "btn_emptyTheAnalysisLayer": "清空分析图层",
  58532. "btn_cancelAnalysis": "取消",
  58533. "btn_query": "查询",
  58534. "btn_querying": "查询中",
  58535. "btn_emptyTheRresultLayer": "清除所有结果图层",
  58536. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  58537. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  58538. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  58539. 'msg_selectDataset': '请选择数据集!',
  58540. 'msg_setTheWeightField': '请设置权重字段!',
  58541. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  58542. 'msg_resultIsEmpty': '分析的结果为空!',
  58543. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  58544. 'msg_openFileFail': '打开文件失败!',
  58545. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  58546. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  58547. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  58548. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  58549. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  58550. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  58551. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  58552. 'msg_getFeatureField':"未查找到相关矢量要素!",
  58553. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  58554. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  58555. 'msg_crsunsupport':'不支持当前地图的坐标系',
  58556. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  58557. 'msg_jsonResolveFiled': 'json格式解析失败!',
  58558. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  58559. 'msg_getdatafailed': '获取数据失败!'
  58560. };
  58561. SuperMap.Lang["zh-CN"] = zh;
  58562. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  58563. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58564. * This program are made available under the terms of the Apache License, Version 2.0
  58565. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58566. ;// CONCATENATED MODULE: ./src/common/index.js
  58567. /* Copyright© 2000 - 2021 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. ;// CONCATENATED MODULE: external "mapboxgl"
  58571. const external_mapboxgl_namespaceObject = mapboxgl;
  58572. var external_mapboxgl_default = /*#__PURE__*/__webpack_require__.n(external_mapboxgl_namespaceObject);
  58573. ;// CONCATENATED MODULE: ./src/mapboxgl/core/MapExtend.js
  58574. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58575. * This program are made available under the terms of the Apache License, Version 2.0
  58576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58577. /**
  58578. * @function mapboxgl.supermap.MapExtend
  58579. * @description 扩展了 mapboxgl.Map 对图层相关的操作。
  58580. * @private
  58581. */
  58582. var MapExtend = function () {
  58583. (external_mapboxgl_default()).Map.prototype.overlayLayersManager = {};
  58584. if ((external_mapboxgl_default()).Map.prototype.addLayerBak === undefined) {
  58585. (external_mapboxgl_default()).Map.prototype.addLayerBak = (external_mapboxgl_default()).Map.prototype.addLayer;
  58586. (external_mapboxgl_default()).Map.prototype.addLayer = function (layer, before) {
  58587. if (layer.source || layer.type === 'custom' || layer.type === 'background') {
  58588. this.addLayerBak(layer, before);
  58589. return this;
  58590. }
  58591. if (this.overlayLayersManager[layer.id] || this.style._layers[layer.id]) {
  58592. this.fire('error', {
  58593. error: new Error('A layer with this id already exists.')
  58594. });
  58595. return;
  58596. }
  58597. addLayer(layer, this);
  58598. this.overlayLayersManager[layer.id] = layer;
  58599. return this;
  58600. };
  58601. }
  58602. (external_mapboxgl_default()).Map.prototype.getLayer = function (id) {
  58603. if (this.overlayLayersManager[id]) {
  58604. return this.overlayLayersManager[id];
  58605. }
  58606. return this.style.getLayer(id);
  58607. };
  58608. (external_mapboxgl_default()).Map.prototype.moveLayer = function (id, beforeId) {
  58609. if (this.overlayLayersManager[id]) {
  58610. moveLayer(id, beforeId);
  58611. return this;
  58612. }
  58613. if (this.style._layers[id]) {
  58614. this.style.moveLayer(id, beforeId);
  58615. this._update(true);
  58616. return this;
  58617. }
  58618. };
  58619. (external_mapboxgl_default()).Map.prototype.removeLayer = function (id) {
  58620. if (this.overlayLayersManager[id]) {
  58621. removeLayer(this.overlayLayersManager[id]);
  58622. delete this.overlayLayersManager[id];
  58623. return this;
  58624. }
  58625. this.style.removeLayer(id);
  58626. this._update(true);
  58627. return this;
  58628. };
  58629. //目前扩展的overlayer,只支持显示或隐藏图层操作
  58630. (external_mapboxgl_default()).Map.prototype.setLayoutProperty = function (layerID, name, value) {
  58631. if (this.overlayLayersManager[layerID]) {
  58632. if (name === "visibility") {
  58633. if (value === "visible") {
  58634. value = true;
  58635. } else {
  58636. value = false;
  58637. }
  58638. setVisibility(this.overlayLayersManager[layerID], value);
  58639. this.style.fire('data', {dataType: 'style'});
  58640. }
  58641. return this;
  58642. }
  58643. this.style.setLayoutProperty(layerID, name, value);
  58644. this._update(true);
  58645. return this;
  58646. };
  58647. ;(external_mapboxgl_default()).Map.prototype.updateTransform = function (units, originX, originY, centerX, centerY, width, height) {
  58648. this.transform.units = units;
  58649. var mercatorZfromAltitude = this.mercatorZfromAltitude;
  58650. (external_mapboxgl_default()).MercatorCoordinate.fromLngLat = function (lngLatLike, altitude) {
  58651. altitude = altitude || 0;
  58652. const lngLat = external_mapboxgl_default().LngLat.convert(lngLatLike);
  58653. return new (external_mapboxgl_default()).MercatorCoordinate(
  58654. (lngLat.lng - originX) / width,
  58655. (originY - lngLat.lat) / height,
  58656. mercatorZfromAltitude(altitude, lngLat.lat));
  58657. };
  58658. (external_mapboxgl_default()).MercatorCoordinate.prototype.toLngLat = function () {
  58659. return new (external_mapboxgl_default()).LngLat(
  58660. this.x * width + originX,
  58661. originY - this.y * height);
  58662. };
  58663. 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"}));
  58664. }
  58665. function addLayer(layer, map) {
  58666. layer.onAdd && layer.onAdd(map);
  58667. }
  58668. /**
  58669. * @function mapboxgl.supermap.MapExtend.prototype.removeFromMap
  58670. * @description 移除事件。
  58671. */
  58672. function removeLayer(layer) {
  58673. layer.removeFromMap && layer.removeFromMap();
  58674. }
  58675. /**
  58676. * @function mapboxgl.supermap.MapExtend.prototype.setVisibility
  58677. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  58678. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  58679. */
  58680. function setVisibility(layer, visibility) {
  58681. layer.setVisibility && layer.setVisibility(visibility);
  58682. }
  58683. /**
  58684. * @function mapboxgl.supermap.MapExtend.prototype.moveTo
  58685. * @description 将图层移动到某个图层之前。
  58686. * @param {string} layerID -待插入的图层 ID。
  58687. * @param {boolean} [beforeLayerID] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  58688. */
  58689. function moveLayer(layerID, beforeLayerID) {
  58690. var layer = document.getElementById(layerID);
  58691. // var beforeLayer;
  58692. if (beforeLayerID) {
  58693. var beforeLayer = document.getElementById(beforeLayerID);
  58694. if (!beforeLayer) {
  58695. external_mapboxgl_default().Evented.prototype.fire("error", {
  58696. error: new Error(`Layer with id "${beforeLayerID}" does not exist on this document.`)
  58697. });
  58698. }
  58699. }
  58700. if (layer && beforeLayer) {
  58701. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  58702. } else {
  58703. //当没有传入beforeLayerID ,则默认将图层移动到最上面
  58704. layer.parentNode.appendChild(layer);
  58705. }
  58706. }
  58707. }();
  58708. ;// CONCATENATED MODULE: ./src/mapboxgl/core/Base.js
  58709. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58710. * This program are made available under the terms of the Apache License, Version 2.0
  58711. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58712. /**
  58713. * SuperMap mapboxgl基类
  58714. * 定义命名空间
  58715. */
  58716. /**
  58717. * @namespace mapboxgl
  58718. * @category BaseTypes Namespace
  58719. */
  58720. /**
  58721. * @namespace mapboxgl.supermap
  58722. * @category BaseTypes Namespace
  58723. */
  58724. (external_mapboxgl_default()).supermap = (external_mapboxgl_default()).supermap || {};
  58725. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  58726. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58727. * This program are made available under the terms of the Apache License, Version 2.0
  58728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58729. 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=";
  58730. ;// CONCATENATED MODULE: ./src/mapboxgl/control/Logo.js
  58731. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58732. * This program are made available under the terms of the Apache License, Version 2.0
  58733. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58734. /**
  58735. * @class mapboxgl.supermap.LogoControl
  58736. * @category Control
  58737. * @classdesc Logo 控件。默认不显示。
  58738. *
  58739. * @example
  58740. * (start code)
  58741. * map.addControl(new mapboxgl.supermap.LogoControl(),'bottom-right');
  58742. * (end)
  58743. * @param {Object} options - logo 控件配置项。
  58744. * @param {string} [options.imageUrl] - logo 图片地址。
  58745. * @param {string} [options.width] - logo 图片宽。
  58746. * @param {string} [options.height] - logo 图片高。
  58747. * @param {string} [options.link] - logo 图片跳转链接。
  58748. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  58749. */
  58750. class Logo {
  58751. constructor(options) {
  58752. //logo图片地址
  58753. this.imageUrl = null;
  58754. //跳转链接
  58755. this.link = null;
  58756. //logo图片宽
  58757. this.width = null;
  58758. //logo图片高
  58759. this.height = null;
  58760. //logo图片失效时显示文本
  58761. this.alt = "SuperMap iClient";
  58762. this._extend(this, options)
  58763. }
  58764. /**
  58765. * @function mapboxgl.supermap.LogoControl.prototype.onAdd
  58766. * @description 添加一个 logo。
  58767. * @returns {HTMLElement} 返回创建的 logo 元素。
  58768. */
  58769. onAdd(map) {
  58770. this._map = map;
  58771. this._container = document.createElement('div');
  58772. this._container.className = 'mapboxgl-ctrl iclient-logo';
  58773. this._container.style.marginTop = 0;
  58774. this._container.style.marginBottom = 0;
  58775. this._container.style.marginLeft = 0;
  58776. this._container.style.marginRight = 0;
  58777. var imgSrc = LogoBase64;
  58778. if (this.imageUrl) {
  58779. imgSrc = this.imageUrl;
  58780. }
  58781. var alt = this.alt;
  58782. var imageWidth = "94px";
  58783. var imageHeight = "29px";
  58784. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  58785. if (this.imageUrl) {
  58786. imageWidth = this.width;
  58787. imageHeight = this.height;
  58788. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  58789. if (!imageWidth || !imageHeight) {
  58790. styleSize = "";
  58791. }
  58792. }
  58793. var link = this.link || "https://iclient.supermap.io";
  58794. this._container.innerHTML = "<a href='" + link + "' target='_blank'>" +
  58795. "<img src=" + imgSrc + " alt='" + alt + "' style='" + styleSize + "margin-bottom: 2px'></a>";
  58796. this._createStyleSheet();
  58797. return this._container;
  58798. }
  58799. _createStyleSheet() {
  58800. var style = document.createElement('style');
  58801. style.type = 'text/css';
  58802. style.innerHTML = ".iclient-logo{" +
  58803. "margin:0 !important;" +
  58804. "}" +
  58805. ".iclient-logo a{" +
  58806. "border: none;" +
  58807. "display: block;" +
  58808. "height:31px;" +
  58809. "}" +
  58810. ".iclient-logo img{" +
  58811. "border: none;" +
  58812. "white-space: nowrap" +
  58813. "}";
  58814. document.getElementsByTagName('head')[0].appendChild(style);
  58815. }
  58816. _extend(dest) {
  58817. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  58818. var arg = Object.getOwnPropertyNames(arguments)[index];
  58819. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  58820. continue;
  58821. }
  58822. var obj = arguments[arg];
  58823. if (obj) {
  58824. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  58825. var key = Object.getOwnPropertyNames(obj)[j];
  58826. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  58827. continue;
  58828. }
  58829. dest[key] = obj[key];
  58830. }
  58831. }
  58832. }
  58833. return dest;
  58834. }
  58835. }
  58836. (external_mapboxgl_default()).supermap.LogoControl = Logo;
  58837. ;// CONCATENATED MODULE: ./src/mapboxgl/control/index.js
  58838. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58839. * This program are made available under the terms of the Apache License, Version 2.0
  58840. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58841. ;// CONCATENATED MODULE: ./src/mapboxgl/core/Util.js
  58842. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58843. * This program are made available under the terms of the Apache License, Version 2.0
  58844. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58845. /**
  58846. * @class mapboxgl.supermap.Util
  58847. * @category BaseTypes Util
  58848. * @classdesc 工具类。
  58849. */
  58850. class core_Util_Util {
  58851. /**
  58852. * @function mapboxgl.supermap.Util.toSuperMapGeometry
  58853. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  58854. * @param {GeoJSONObject} geoJSON - GeoJSON 对象。
  58855. * @returns {SuperMap.Geometry}
  58856. */
  58857. static toSuperMapGeometry(geoJSON) {
  58858. if (geoJSON && geoJSON.type) {
  58859. var format = new GeoJSON();
  58860. var result = format.read(geoJSON, "FeatureCollection");
  58861. return result[0].geometry;
  58862. }
  58863. }
  58864. static toSuperMapBounds(bounds) {
  58865. if (this.isArray(bounds)) {
  58866. //左下右上
  58867. return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  58868. }
  58869. return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
  58870. }
  58871. static toSuperMapPoint(lnglat) {
  58872. //客户端可传入 geojson 对象 或者 mapboxgl lnglat 点对象,或者是点数组
  58873. if (this.isArray(lnglat)) {
  58874. return new Point(lnglat[0], lnglat[1]);
  58875. } else if (lnglat.lng && lnglat.lat) {
  58876. return new Point(lnglat.lng, lnglat.lat);
  58877. }
  58878. return new Point(lnglat.geometry.coordinates[0], lnglat.geometry.coordinates[1]);
  58879. }
  58880. /**
  58881. * @function mapboxgl.supermap.Util.toSuperMapPolygon
  58882. * @description 将 Mapbox GL LngLatbounds 对象转为 SuperMap 几何图形。
  58883. * @param {Mapboxgl.LngLatBounds} lnglatBounds - Mapbox GL LngLatbounds对象。
  58884. * @returns {SuperMap.Geometry.Polygon}
  58885. */
  58886. static toSuperMapPolygon(lnglatBounds) {
  58887. const west = lnglatBounds.getWest();
  58888. const east = lnglatBounds.getEast();
  58889. const sourth = lnglatBounds.getSouth();
  58890. const north = lnglatBounds.getNorth();
  58891. return new Polygon([
  58892. new LinearRing([
  58893. new Point(west, sourth),
  58894. new Point(east, sourth),
  58895. new Point(east, north),
  58896. new Point(west, north)
  58897. ])
  58898. ]);
  58899. }
  58900. /**
  58901. * @function mapboxgl.supermap.Util.isArray
  58902. * @description 判断是否为数组格式。
  58903. * @param {Object} obj - 待判断对象。
  58904. * @returns {boolean} 是否是数组。
  58905. */
  58906. static isArray(obj) {
  58907. return Object.prototype.toString.call(obj) == "[object Array]";
  58908. }
  58909. /**
  58910. * @function mapboxgl.supermap.Util.toGeoJSON
  58911. * @description 将传入对象转为 GeoJSON 格式。
  58912. * @param {Object} smObj - 待转参数。
  58913. */
  58914. static toGeoJSON(smObj) {
  58915. if (smObj) {
  58916. var format = new GeoJSON();
  58917. return format.toGeoJSON(smObj);
  58918. }
  58919. }
  58920. /**
  58921. * @function mapboxgl.supermap.Util.toProcessingParam
  58922. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  58923. * @param {Array} points - Region 各个节点数组。
  58924. * @returns {Object} processing 服务裁剪、查询分析的分析参数。
  58925. */
  58926. static toProcessingParam(points) {
  58927. var geometryParam = {};
  58928. if (points.length < 1) {
  58929. geometryParam = "";
  58930. } else {
  58931. var results = [];
  58932. for (var i = 0; i < points.length; i++) {
  58933. var point = {};
  58934. point.x = points[i][0];
  58935. point.y = points[i][1];
  58936. results.push(point);
  58937. }
  58938. geometryParam.type = "REGION";
  58939. geometryParam.points = results;
  58940. }
  58941. return geometryParam;
  58942. }
  58943. /**
  58944. * @function mapboxgl.supermap.Util.extend
  58945. * @description 对象拷贝赋值。
  58946. * @param {Object} dest - 目标对象。
  58947. * @param {Object} arguments - 待拷贝的对象。
  58948. * @returns {Object} 赋值后的目标对象。
  58949. */
  58950. static extend(dest) {
  58951. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  58952. var arg = Object.getOwnPropertyNames(arguments)[index];
  58953. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  58954. continue;
  58955. }
  58956. var obj = arguments[arg];
  58957. if (obj) {
  58958. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  58959. var key = Object.getOwnPropertyNames(obj)[j];
  58960. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  58961. continue;
  58962. }
  58963. dest[key] = obj[key];
  58964. }
  58965. }
  58966. }
  58967. return dest;
  58968. }
  58969. /**
  58970. * 检测数据是否为number
  58971. * @param value 值,未知数据类型
  58972. * @returns {boolean}
  58973. */
  58974. static isNumber(value) {
  58975. if (value === "") {
  58976. return false;
  58977. }
  58978. let mdata = Number(value);
  58979. if (mdata === 0) {
  58980. return true;
  58981. }
  58982. return !isNaN(mdata);
  58983. }
  58984. static isString(str) {
  58985. return (typeof str === 'string') && str.constructor === String;
  58986. }
  58987. /**
  58988. * 随机生成id
  58989. * @param attr
  58990. * @returns {string}
  58991. */
  58992. static newGuid(attr) {
  58993. let len = attr || 32;
  58994. let guid = "";
  58995. for (let i = 1; i < len; i++) {
  58996. let n = Math.floor(Math.random() * 16.0).toString(16);
  58997. guid += n;
  58998. }
  58999. return guid;
  59000. }
  59001. /**
  59002. * @description 十六进制转 RGBA 格式。
  59003. * @param {Object} hex - 十六进制格式参数。
  59004. * @param {number} opacity -Alpha 参数。
  59005. * @returns {string} 生成的 RGBA 格式。
  59006. */
  59007. static hexToRgba(hex, opacity) {
  59008. var color = [],
  59009. rgba = [];
  59010. hex = hex.replace(/#/, "");
  59011. if (hex.length == 3) {
  59012. var tmp = [];
  59013. for (let i = 0; i < 3; i++) {
  59014. tmp.push(hex.charAt(i) + hex.charAt(i));
  59015. }
  59016. hex = tmp.join("");
  59017. }
  59018. for (let i = 0; i < 6; i += 2) {
  59019. color[i] = "0x" + hex.substr(i, 2);
  59020. rgba.push(parseInt(Number(color[i])));
  59021. }
  59022. rgba.push(opacity);
  59023. return "rgba(" + rgba.join(",") + ")";
  59024. }
  59025. /**
  59026. * @param {string} featureName 原始数据中的地名
  59027. * @param {string} fieldName 需要匹配的地名
  59028. * @returns {boolean} 是否匹配
  59029. */
  59030. static isMatchAdministrativeName(featureName, fieldName) {
  59031. if (this.isString(fieldName)) {
  59032. let shortName = featureName.substr(0, 2);
  59033. // 张家口市和张家界市 特殊处理
  59034. if (shortName === '张家') {
  59035. shortName = featureName.substr(0, 3);
  59036. }
  59037. return !!fieldName.match(new RegExp(shortName));
  59038. }
  59039. return false;
  59040. }
  59041. }
  59042. (external_mapboxgl_default()).supermap.Util = core_Util_Util;
  59043. ;// CONCATENATED MODULE: ./src/mapboxgl/core/index.js
  59044. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59045. * This program are made available under the terms of the Apache License, Version 2.0
  59046. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59047. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/ThemeFeature.js
  59048. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59049. * This program are made available under the terms of the Apache License, Version 2.0
  59050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59051. /**
  59052. * @class mapboxgl.supermap.ThemeFeature
  59053. * @category Visualization Theme
  59054. * @classdesc 专题图要素类。
  59055. * @param {GeoJSONObject} geometry - 专题图要素几何对象。
  59056. * @param {Object} [attributes] - 几何对象属性。
  59057. */
  59058. class ThemeFeature {
  59059. constructor(geometry, attributes) {
  59060. this.geometry = geometry;
  59061. this.attributes = attributes;
  59062. }
  59063. /**
  59064. * @function mapboxgl.supermap.ThemeFeature.prototype.toFeature
  59065. * @description 转为矢量要素。
  59066. */
  59067. toFeature() {
  59068. var geometry = core_Util_Util.toSuperMapGeometry(this.geometry);
  59069. var points = [];
  59070. if (this.geometry instanceof (external_mapboxgl_default()).LngLat) {
  59071. points = [this.geometry.lng, this.geometry.lat];
  59072. } else if (this.geometry instanceof (external_mapboxgl_default()).Point) {
  59073. points = [this.geometry.x, this.geometry.y];
  59074. } else if (this.geometry.length === 3) {
  59075. geometry = new GeoText(this.geometry[0], this.geometry[1], this.geometry[2]);
  59076. }
  59077. if (points.length > 1) {
  59078. geometry = new Point(points[0], points[1]);
  59079. }
  59080. return new Vector(geometry, this.attributes);
  59081. }
  59082. }
  59083. (external_mapboxgl_default()).supermap.ThemeFeature = ThemeFeature;
  59084. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/ThemeLayer.js
  59085. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59086. * This program are made available under the terms of the Apache License, Version 2.0
  59087. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59088. /**
  59089. * @class mapboxgl.supermap.ThemeLayer
  59090. * @category Visualization Theme
  59091. * @classdesc 专题图基类。
  59092. * @param {string} name - 专题图图层名。
  59093. * @param {Object} options -可选参数。
  59094. * @param {mapboxgl.Map} options.map - 当前 mapboxgl map 对象,将在下个版本弃用,请用 map.addLayer()方法添加图层。
  59095. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  59096. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  59097. * @param {boolean} [options.visibility=true] - 图层是否可见。
  59098. * @param {number} [options.opacity=1] - 图层透明度。
  59099. * @fires mapboxgl.supermap.ThemeLayer#changelayer
  59100. * @fires mapboxgl.supermap.ThemeLayer#featuresremoved
  59101. */
  59102. class ThemeLayer_Theme {
  59103. constructor(name, opt_options) {
  59104. var options = opt_options ? opt_options : {};
  59105. /**
  59106. * @member {string} mapboxgl.supermap.ThemeLayer.prototype.name
  59107. * @description 专题图图层名称。
  59108. */
  59109. this.name = name;
  59110. /**
  59111. * @member {string} [mapboxgl.supermap.ThemeLayer.prototype.id]
  59112. * @description 专题图图层 id。
  59113. */
  59114. this.id = options.id ? options.id : Util.createUniqueID("themeLayer_");
  59115. /**
  59116. * @member {float} [mapboxgl.supermap.ThemeLayer.prototype.opacity=1]
  59117. * @description 图层透明度。
  59118. */
  59119. this.opacity = options.opacity ? options.opacity : 1;
  59120. /**
  59121. * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.visibility=true]
  59122. * @description 图层是否可见。
  59123. */
  59124. this.visibility = true;
  59125. /**
  59126. * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.loadWhileAnimating=true]
  59127. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为 false)。
  59128. */
  59129. this.loadWhileAnimating = options.loadWhileAnimating === undefined ? true : options.loadWhileAnimating;
  59130. /**
  59131. * @member {mapboxgl.Map} mapboxgl.supermap.ThemeLayer.prototype.map
  59132. * @description map 对象。
  59133. */
  59134. this.map = options.map ? options.map : null;
  59135. this.features = [];
  59136. this.TFEvents = [];
  59137. //todo 保留之前创建图层同时添加到图层的用法,在下个版本遗弃
  59138. if (this.map) {
  59139. this.map.addLayer(this);
  59140. }
  59141. }
  59142. /**
  59143. * @function mapboxgl.supermap.ThemeLayer.prototype.onAdd
  59144. * @description 向底图添加该图层。
  59145. */
  59146. onAdd(map) {
  59147. this.map = map;
  59148. this._createCanvasContainer();
  59149. //处理用户预先(在图层添加到 map 前)监听的事件
  59150. this.addTFEvents();
  59151. this.map.on('resize', this.resizeEvent.bind(this));
  59152. this.map.on('zoomstart', this.zoomStartEvent.bind(this));
  59153. this.map.on('zoomend', this.zoomEndEvent.bind(this));
  59154. this.map.on('rotatestart', this.rotateStartEvent.bind(this));
  59155. this.map.on('rotate', this.rotateEvent.bind(this));
  59156. this.map.on('rotateend', this.rotateEndEvent.bind(this));
  59157. this.map.on('dragend', this.dragEndEvent.bind(this));
  59158. this.map.on('movestart', this.moveStartEvent.bind(this));
  59159. this.map.on('move', this.moveEvent.bind(this));
  59160. this.map.on('moveend', this.moveEndEvent.bind(this));
  59161. this.map.on('remove', this.removeFromMap.bind(this));
  59162. this.refresh();
  59163. }
  59164. /**
  59165. * @function mapboxgl.supermap.HeatMapLayer.prototype.refresh
  59166. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  59167. */
  59168. refresh() {
  59169. if (this.features.length === 0) {
  59170. return;
  59171. }
  59172. if (this.map) {
  59173. this.redrawThematicFeatures(this.map.getBounds());
  59174. }
  59175. }
  59176. _createCanvasContainer() {
  59177. this.movingOffset = [0, 0];
  59178. this.mapContainer = this.map.getCanvasContainer();
  59179. this.div = document.createElement('div');
  59180. this.div.id = this.id;
  59181. this.div.style.position = 'absolute';
  59182. var container = this.map.getCanvasContainer();
  59183. var canvas = this.map.getCanvas();
  59184. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  59185. this.div.style.width = canvas.style.width;
  59186. this.div.style.height = canvas.style.height;
  59187. this.div.className = "themeLayer";
  59188. this.div.width = parseInt(canvas.width);
  59189. this.div.height = parseInt(canvas.height);
  59190. container.appendChild(this.div);
  59191. this.setOpacity(this.opacity);
  59192. this.levelRenderer = new LevelRenderer();
  59193. this.renderer = this.levelRenderer.init(this.div);
  59194. this.renderer.clear();
  59195. }
  59196. /**
  59197. * @function mapboxgl.supermap.ThemeLayer.prototype.destroyFeatures
  59198. * @description 销毁某个要素。
  59199. * @param {SuperMap.Feature.Vector} features - 将被销毁的要素。
  59200. */
  59201. destroyFeatures(features) {
  59202. var all = (features == undefined);
  59203. if (all) {
  59204. features = this.features;
  59205. }
  59206. if (features) {
  59207. this.removeFeatures(features);
  59208. for (var i = features.length - 1; i >= 0; i--) {
  59209. features[i].destroy();
  59210. }
  59211. }
  59212. }
  59213. /**
  59214. * @function mapboxgl.supermap.ThemeLayer.prototype.setVisibility
  59215. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  59216. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  59217. */
  59218. setVisibility(visibility) {
  59219. if (visibility !== this.visibility) {
  59220. this.visibility = visibility;
  59221. this.display(visibility);
  59222. this.redrawThematicFeatures(this.map.getBounds());
  59223. }
  59224. }
  59225. /**
  59226. * @function mapboxgl.supermap.ThemeLayer.prototype.display
  59227. * @description 临时隐藏或者显示图层。通过对 CSS 控制产生即时效果,重新渲染失效。一般用 setVisibility 方法来动态控制图层的显示和隐藏。
  59228. * @param {boolean} [display] - 是否显示图层。
  59229. */
  59230. display(display) {
  59231. this.div.style.display = display ? "block" : "none";
  59232. }
  59233. /**
  59234. * @function mapboxgl.supermap.ThemeLayer.prototype.setOpacity
  59235. * @description 设置图层的不透明度,取值[0-1]之间。
  59236. * @param {number} [opacity] - 不透明度。
  59237. */
  59238. setOpacity(opacity) {
  59239. if (opacity !== this.opacity) {
  59240. this.opacity = opacity;
  59241. var element = this.div;
  59242. Util.modifyDOMElement(element, null, null, null,
  59243. null, null, null, opacity);
  59244. if (this.map !== null) {
  59245. /**
  59246. * @event mapboxgl.supermap.ThemeLayer#changelayer
  59247. * @description 图层属性改变之后触发。
  59248. * @property {Object} layer - 图层。
  59249. * @property {string} property - 被改变的属性。
  59250. */
  59251. external_mapboxgl_default().Evented.prototype.fire('changelayer', {layer: this, property: "opacity"});
  59252. }
  59253. }
  59254. }
  59255. /**
  59256. * @function mapboxgl.supermap.ThemeLayer.prototype.addFeatures
  59257. * @param {mapboxgl.supermap.ThemeFeature|SuperMap.ServerFeature|GeoJSONObject} features - 待添加要素。
  59258. * @description 抽象方法,可实例化子类必须实现此方法。向专题图图层中添加数据 ,
  59259. */
  59260. addFeatures(features) { // eslint-disable-line no-unused-vars
  59261. }
  59262. /**
  59263. * @function mapboxgl.supermap.ThemeLayer.prototype.removeFeatures
  59264. * @param {Array.<SuperMap.Feature.Vector>} features - 要删除 feature 的数组。
  59265. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  59266. * 参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature,
  59267. * 如果无法确定 feature 数组,则可以调用 removeAllFeatures 来删除所有 feature。
  59268. * 如果要删除的 feature 数组中的元素特别多,推荐使用 removeAllFeatures,
  59269. * 删除所有 feature 后再重新添加。这样效率会更高。
  59270. */
  59271. removeFeatures(features) {
  59272. if (!features || features.length === 0) {
  59273. return;
  59274. }
  59275. if (features === this.features) {
  59276. return this.removeAllFeatures();
  59277. }
  59278. if (!(Util.isArray(features))) {
  59279. features = [features];
  59280. }
  59281. var featuresFailRemoved = [];
  59282. for (var i = features.length - 1; i >= 0; i--) {
  59283. var feature = features[i];
  59284. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  59285. //并将其放入未删除的数组中。
  59286. var findex = Util.indexOf(this.features, feature);
  59287. if (findex === -1) {
  59288. featuresFailRemoved.push(feature);
  59289. continue;
  59290. }
  59291. this.features.splice(findex, 1);
  59292. }
  59293. var drawFeatures = [];
  59294. for (var hex = 0, len = this.features.length; hex < len; hex++) {
  59295. feature = this.features[hex];
  59296. drawFeatures.push(feature);
  59297. }
  59298. this.features = [];
  59299. this.addFeatures(drawFeatures);
  59300. //绘制专题要素
  59301. if (this.renderer) {
  59302. this.redrawThematicFeatures(this.map.getBounds());
  59303. }
  59304. var succeed = featuresFailRemoved.length == 0 ? true : false;
  59305. /**
  59306. * @event mapboxgl.supermap.ThemeLayer#featuresremoved
  59307. * @description 要素删除之后触发。
  59308. * @property {Array.<SuperMap.Feature.Vector>} features - 未被成功删除的要素。
  59309. * @property {boolean} succeed - 删除成功与否。
  59310. */
  59311. external_mapboxgl_default().Evented.prototype.fire("featuresremoved", {features: featuresFailRemoved, succeed: succeed});
  59312. }
  59313. /**
  59314. * @function mapboxgl.supermap.ThemeLayer.prototype.removeAllFeatures
  59315. * @description 清除当前图层所有的矢量要素。
  59316. */
  59317. removeAllFeatures() {
  59318. if (this.renderer) {
  59319. this.renderer.clear();
  59320. }
  59321. this.features = [];
  59322. external_mapboxgl_default().Evented.prototype.fire('featuresremoved', {features: [], succeed: true});
  59323. }
  59324. /**
  59325. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeatures
  59326. * @description 查看当前图层中的有效数据。
  59327. * @returns {SuperMap.Feature.Vector} 用户加入图层的有效数据。
  59328. */
  59329. getFeatures() {
  59330. var len = this.features.length;
  59331. var clonedFeatures = new Array(len);
  59332. for (var i = 0; i < len; ++i) {
  59333. clonedFeatures[i] = this.features[i];
  59334. }
  59335. return clonedFeatures;
  59336. }
  59337. /**
  59338. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeatureBy
  59339. * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,
  59340. * 返回此 feature(并且只返回第一个)。
  59341. * @param {string} property - feature 的某个属性名称。
  59342. * @param {string} value - property 所对应的值。
  59343. * @returns {SuperMap.Feature.Vector} 第一个匹配属性和值的矢量要素。
  59344. */
  59345. getFeatureBy(property, value) {
  59346. var feature = null;
  59347. for (var id in this.features) {
  59348. if (this.features[id][property] === value) {
  59349. feature = this.features[id];
  59350. break;
  59351. }
  59352. }
  59353. return feature;
  59354. }
  59355. /**
  59356. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeatureById
  59357. * @description 通过给定一个 id,返回对应的矢量要素。
  59358. * @param {string} featureId - 矢量要素的属性 id。
  59359. * @returns {SuperMap.Feature.Vector} 对应 id 的 feature,如果不存在则返回 null。
  59360. */
  59361. getFeatureById(featureId) {
  59362. return this.getFeatureBy('id', featureId);
  59363. }
  59364. /**
  59365. * @function mapboxgl.supermap.ThemeLayer.prototype.getFeaturesByAttribute
  59366. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  59367. * @param {string} attrName - 属性的 key。
  59368. * @param {string} attrValue - 矢量要素的属性 id。
  59369. * @returns {Array.<SuperMap.Feature.Vector>} 一个匹配的 feature 数组。
  59370. */
  59371. getFeaturesByAttribute(attrName, attrValue) {
  59372. var feature,
  59373. foundFeatures = [];
  59374. for (var id in this.features) {
  59375. feature = this.features[id];
  59376. if (feature && feature.attributes) {
  59377. if (feature.attributes[attrName] === attrValue) {
  59378. foundFeatures.push(feature);
  59379. }
  59380. }
  59381. }
  59382. return foundFeatures;
  59383. }
  59384. /**
  59385. * @function mapboxgl.supermap.ThemeLayer.prototype.redrawThematicFeatures
  59386. * @description 抽象方法,可实例化子类必须实现此方法。重绘专题要素。
  59387. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  59388. */
  59389. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  59390. }
  59391. /**
  59392. * @function mapboxgl.supermap.ThemeLayer.prototype.on
  59393. * @description 添加专题要素事件监听。添加专题要素事件监听。
  59394. * @param {Event} event - 监听事件。
  59395. * @param {function} callback - 回调函数。
  59396. * @param {string} context - 信息。
  59397. */
  59398. on(event, callback, context) { // eslint-disable-line no-unused-vars
  59399. if (this.renderer) {
  59400. this.renderer.on(event, callback);
  59401. } else {
  59402. this.map.on(event, callback);
  59403. }
  59404. return this;
  59405. }
  59406. /**
  59407. * @function mapboxgl.supermap.ThemeLayer.prototype.off
  59408. * @description 移除专题要素事件监听。
  59409. * @param {Event} event - 监听事件。
  59410. * @param {function} callback - 回调函数。
  59411. * @param {string} context - 信息。
  59412. */
  59413. off(event, callback, context) { // eslint-disable-line no-unused-vars
  59414. var me = this;
  59415. if (me.renderer) {
  59416. me.renderer.off(event, callback);
  59417. } else {
  59418. this.map.off(event, callback);
  59419. }
  59420. return this;
  59421. }
  59422. /**
  59423. * @function mapboxgl.supermap.ThemeLayer.prototype.addTFEvents
  59424. * @description 将图层添加到地图上之前用户要求添加的事件监听添加到图层。
  59425. * @private
  59426. */
  59427. addTFEvents() {
  59428. var tfEs = this.TFEvents;
  59429. var len = tfEs.length;
  59430. for (var i = 0; i < len; i++) {
  59431. this.renderer.on(tfEs[i][0], tfEs[i][1]);
  59432. }
  59433. }
  59434. /**
  59435. * @function mapboxgl.supermap.ThemeLayer.prototype.getLocalXY
  59436. * @description 地理坐标转为像素坐标。
  59437. * @param {Object} [coordinate] - 坐标位置。
  59438. */
  59439. getLocalXY(coordinate) {
  59440. var pixelP, map = this.map;
  59441. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  59442. let tempPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate.x, coordinate.y));
  59443. pixelP = [tempPoint.x, tempPoint.y];
  59444. }
  59445. if (coordinate instanceof LonLat) {
  59446. let tempPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate.lon, coordinate.lat));
  59447. pixelP = [tempPoint.x, tempPoint.y];
  59448. }
  59449. return pixelP;
  59450. }
  59451. /**
  59452. * @function mapboxgl.supermap.ThemeLayer.prototype.toFeature
  59453. * @description 转为 iClient 要素。
  59454. * @param {mapboxgl.supermap.ThemeFeature|GeoJSONObject} features - 待转要素。
  59455. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素。
  59456. */
  59457. toiClientFeature(features) {
  59458. if (!Util.isArray(features)) {
  59459. features = [features];
  59460. }
  59461. let featuresTemp = [];
  59462. for (let i = 0; i < features.length; i++) {
  59463. //mapboxgl.supermap.ThemeFeature 类型
  59464. if (features[i] instanceof ThemeFeature) {
  59465. featuresTemp.push(features[i].toFeature());
  59466. } else if (features[i] instanceof Vector) {
  59467. // 若是 GeometryVector 直接返回
  59468. featuresTemp.push(features[i]);
  59469. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  59470. //GeoJSON 规范数据类型
  59471. let format = new GeoJSON();
  59472. featuresTemp = featuresTemp.concat(format.read(features[i]));
  59473. } else if (features[i].geometry && features[i].geometry.parts) {
  59474. //iServer服务器返回数据格式
  59475. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  59476. } else {
  59477. throw new Error(`features's type is not be supported.`);
  59478. }
  59479. }
  59480. return featuresTemp;
  59481. }
  59482. /**
  59483. * @function mapboxgl.supermap.ThemeLayer.prototype.toFeature
  59484. * @deprecated
  59485. * @description 转为 iClient 要素,该方法将被弃用,由 {@link mapboxgl.supermap.ThemeLayer#toiClientFeature} 代替。
  59486. * @param {mapboxgl.supermap.ThemeFeature|GeoJSONObject} features - 待转要素。
  59487. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素。
  59488. */
  59489. toFeature(features) {
  59490. return this.toiClientFeature(features);
  59491. }
  59492. moveEndEvent() {
  59493. if (this.loadWhileAnimating || !this.visibility) {
  59494. return;
  59495. }
  59496. this.div.style.transform = '';
  59497. this.redrawThematicFeatures(this.map.getBounds());
  59498. this._show();
  59499. }
  59500. moveStartEvent() {
  59501. if (this.loadWhileAnimating || !this.visibility) {
  59502. return;
  59503. }
  59504. this.startPitch = this.map.getPitch();
  59505. this.startBearing = this.map.getBearing();
  59506. var startMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  59507. this.startMoveX = startMovePoint.x;
  59508. this.startMoveY = startMovePoint.y;
  59509. }
  59510. moveEvent() {
  59511. if (this.loadWhileAnimating || !this.visibility) {
  59512. this.redrawThematicFeatures(this.map.getBounds());
  59513. return;
  59514. }
  59515. if (this.rotating || this.zooming) {
  59516. return;
  59517. }
  59518. if (this.map.getPitch() !== 0) {
  59519. this._hide();
  59520. }
  59521. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  59522. var tPitch = this.map.getPitch() - this.startPitch;
  59523. var tBearing = -this.map.getBearing() + this.startBearing;
  59524. var endMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  59525. var tMoveX = endMovePoint.x - this.startMoveX;
  59526. var tMoveY = endMovePoint.y - this.startMoveY;
  59527. this.div.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)' + ' translate3d(' + tMoveX + 'px, ' + tMoveY + 'px, 0px)';
  59528. }
  59529. zoomStartEvent() {
  59530. if (this.loadWhileAnimating || !this.visibility) {
  59531. return;
  59532. }
  59533. this.zooming = true;
  59534. this._hide();
  59535. }
  59536. zoomEndEvent() {
  59537. if (this.loadWhileAnimating || !this.visibility) {
  59538. return;
  59539. }
  59540. this.zooming = false;
  59541. this._show();
  59542. }
  59543. rotateStartEvent() {
  59544. if (this.loadWhileAnimating || !this.visibility) {
  59545. return;
  59546. }
  59547. this.rotating = true;
  59548. }
  59549. rotateEvent() {
  59550. if (this.loadWhileAnimating || !this.visibility) {
  59551. return;
  59552. }
  59553. if (this.map.getPitch() !== 0) {
  59554. this._hide();
  59555. }
  59556. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  59557. var tPitch = this.map.getPitch() - this.startPitch;
  59558. var tBearing = -this.map.getBearing() + this.startBearing;
  59559. this.div.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)'
  59560. }
  59561. rotateEndEvent() {
  59562. if (this.loadWhileAnimating || !this.visibility) {
  59563. return;
  59564. }
  59565. this.rotating = false;
  59566. this._show();
  59567. }
  59568. dragEndEvent() {
  59569. if (this.loadWhileAnimating || !this.visibility) {
  59570. return;
  59571. }
  59572. this._hide();
  59573. }
  59574. resizeEvent() {
  59575. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  59576. var canvas = this.map.getCanvas();
  59577. this.div.style.width = canvas.style.width;
  59578. this.div.style.height = canvas.style.height;
  59579. this.div.width = parseInt(canvas.width);
  59580. this.div.height = parseInt(canvas.height);
  59581. this.renderer.resize();
  59582. }
  59583. /**
  59584. * @function mapboxgl.supermap.ThemeLayer.prototype.removeFromMap
  59585. * @description 移除图层。
  59586. */
  59587. removeFromMap() {
  59588. this.mapContainer.removeChild(this.div);
  59589. this.removeAllFeatures();
  59590. }
  59591. /**
  59592. * @function mapboxgl.supermap.ThemeLayer.prototype.moveTo
  59593. * @description 将图层移动到某个图层之前。
  59594. * @param {string} layerID - 待插入的图层 ID。
  59595. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  59596. */
  59597. moveTo(layerID, before) {
  59598. const layer = document.getElementById(this.div.id);
  59599. before = before !== undefined ? before : true;
  59600. if (before) {
  59601. const beforeLayer = document.getElementById(layerID);
  59602. if (layer && beforeLayer) {
  59603. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  59604. }
  59605. return;
  59606. }
  59607. const nextLayer = document.getElementById(layerID);
  59608. if (layer) {
  59609. if (nextLayer.nextSibling) {
  59610. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  59611. return;
  59612. }
  59613. nextLayer.parentNode.appendChild(layer);
  59614. }
  59615. }
  59616. _hide() {
  59617. this.renderer.painter.root.style.display = 'none';
  59618. }
  59619. _show() {
  59620. this.renderer.painter.root.style.display = 'block';
  59621. }
  59622. }
  59623. (external_mapboxgl_default()).supermap.ThemeLayer = ThemeLayer_Theme;
  59624. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphThemeLayer.js
  59625. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59626. * This program are made available under the terms of the Apache License, Version 2.0
  59627. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59628. /**
  59629. * @class mapboxgl.supermap.GraphThemeLayer
  59630. * @category Visualization Theme
  59631. * @classdesc 统计专题图层。
  59632. * @param {string} name - 图层名。
  59633. * @param {string} chartsType - 图表类别。
  59634. * @param {Object} opt_options - 参数。
  59635. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  59636. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  59637. * @param {mapboxgl.Map} opt_options.map - 当前mapboxgl map对象。
  59638. * @param {number} [opt_options.opacity=1] - 图层透明度。
  59639. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  59640. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  59641. * @param {string} [opt_options.chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  59642. * @param {Object} opt_options.chartsSetting - 符号 Circle 配置对象。
  59643. * @param {Array.<number>} opt_options.chartsSetting.codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  59644. * @param {number} [opt_options.chartsSetting.maxR] - 圆形的最大半径。
  59645. * @param {number} [opt_options.chartsSetting.minR] - 圆形的最小半径。
  59646. * @param {string} opt_options.chartsSetting.fillColor - 圆形的填充色,如:fillColor: "#FFB980"。
  59647. * @param {Object} opt_options.chartsSetting.circleStyle - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  59648. * @param {number} opt_options.chartsSetting.decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  59649. * @param {Object} opt_options.chartsSetting.circleHoverStyle - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  59650. * @param {boolean} [opt_options.chartsSetting.circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  59651. * @param {boolean} [opt_options.chartsSetting.circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  59652. * @extends {mapboxgl.supermap.ThemeLayer}
  59653. * @fires mapboxgl.supermap.GraphThemeLayer#beforefeaturesadded
  59654. */
  59655. class GraphThemeLayer_Graph extends ThemeLayer_Theme {
  59656. constructor(name, chartsType, opt_options) {
  59657. super(name, opt_options);
  59658. this.chartsSetting = opt_options.chartsSetting || {};
  59659. this.themeFields = opt_options.themeFields || null;
  59660. this.overlayWeightField = opt_options.overlayWeightField || null;
  59661. this.isOverLay = opt_options.isOverLay === undefined ? true : opt_options.isOverLay;
  59662. this.charts = opt_options.charts || [];
  59663. this.cache = opt_options.cache || {};
  59664. this.chartsType = chartsType;
  59665. }
  59666. /**
  59667. * @function mapboxgl.supermap.GraphThemeLayer.prototype.setChartsType
  59668. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。
  59669. * @param {string} [chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  59670. */
  59671. setChartsType(chartsType) {
  59672. this.chartsType = chartsType;
  59673. this.redraw();
  59674. }
  59675. /**
  59676. * @function mapboxgl.supermap.GraphThemeLayer.prototype.addFeatures
  59677. * @description 向专题图图层中添加数据,支持的 feature 类型为:iServer 返回的 feature JSON 对象。
  59678. * @param {SuperMap.ServerFeature} features - 待添加的要素。
  59679. */
  59680. addFeatures(features) {
  59681. /**
  59682. * @event mapboxgl.supermap.GraphThemeLayer#beforefeaturesadded
  59683. * @description 要素添加之前触发。
  59684. * @property {SuperMap.ServerFeature} features - 要被添加的要素。
  59685. */
  59686. var ret = external_mapboxgl_default().Evented.prototype.fire('beforefeaturesadded', {
  59687. features: features
  59688. });
  59689. if (ret === false) {
  59690. return;
  59691. }
  59692. //转换 features 形式
  59693. this.features = this.toiClientFeature(features);
  59694. //绘制专题要素
  59695. if (this.renderer) {
  59696. this.redrawThematicFeatures(this.map.getBounds());
  59697. }
  59698. }
  59699. /**
  59700. * @function mapboxgl.supermap.GraphThemeLayer.prototype.redrawThematicFeatures
  59701. * @description 重绘所有专题要素。
  59702. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  59703. * 地图漫游时调用此方法进行图层刷新。
  59704. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  59705. */
  59706. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  59707. this.clearCache();
  59708. //清除当前所有可视元素
  59709. this.renderer.clearAll();
  59710. var features = this.features;
  59711. for (var i = 0, len = features.length; i < len; i++) {
  59712. var feature = features[i];
  59713. // // 要素范围判断
  59714. // var feaBounds = feature.geometry.getBounds();
  59715. // //剔除当前视图(地理)范围以外的数据
  59716. // if (extent) {
  59717. // var bounds = new SuperMap.Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  59718. // // if (!bounds.intersectsBounds(feaBounds)) continue;
  59719. // }
  59720. var cache = this.cache;
  59721. // 用 feature id 做缓存标识
  59722. var cacheField = feature.id;
  59723. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  59724. if (cache[cacheField]) {
  59725. continue;
  59726. }
  59727. cache[cacheField] = cacheField;
  59728. var chart = this.createThematicFeature(feature);
  59729. // 压盖处理权重值
  59730. if (chart && this.overlayWeightField) {
  59731. if (feature.attributes[this.overlayWeightField] && !isNaN(feature.attributes[this.overlayWeightField])) {
  59732. chart["__overlayWeight"] = feature.attributes[this.overlayWeightField];
  59733. }
  59734. }
  59735. if (chart) {
  59736. this.charts.push(chart);
  59737. }
  59738. }
  59739. this.drawCharts();
  59740. }
  59741. /**
  59742. * @function mapboxgl.supermap.GraphThemeLayer.prototype.createThematicFeature
  59743. * @description 向专题图图层中添加数据, 支持的 feature 类型为:iServer 返回的 feature json 对象。
  59744. * @param {Object} feature - 待添加的要素。
  59745. *
  59746. */
  59747. createThematicFeature(feature) {
  59748. var thematicFeature;
  59749. // 检查图表创建条件并创建图形
  59750. if (Theme_Theme[this.chartsType] && this.themeFields && this.chartsSetting) {
  59751. thematicFeature = new Theme_Theme[this.chartsType](feature, this, this.themeFields, this.chartsSetting);
  59752. }
  59753. // thematicFeature 是否创建成功
  59754. if (!thematicFeature) {
  59755. return false;
  59756. }
  59757. // 对专题要素执行图形装载
  59758. thematicFeature.assembleShapes();
  59759. return thematicFeature;
  59760. }
  59761. /**
  59762. * @function mapboxgl.supermap.GraphThemeLayer.prototype.drawCharts
  59763. * @description 绘制图表。包含压盖处理。
  59764. *
  59765. */
  59766. drawCharts() {
  59767. // 判断 rendere r就绪
  59768. if (!this.renderer) {
  59769. return;
  59770. }
  59771. var charts = this.charts;
  59772. // 图表权重值处理des
  59773. if (this.overlayWeightField) {
  59774. charts.sort(function (cs, ce) {
  59775. if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  59776. return 0;
  59777. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  59778. return -1;
  59779. } else if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  59780. return 1;
  59781. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  59782. if (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) {
  59783. return 1;
  59784. } else {
  59785. return -1;
  59786. }
  59787. }
  59788. return 0;
  59789. });
  59790. }
  59791. // 不进行避让
  59792. if (!this.isOverLay) {
  59793. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  59794. var chart_m = charts[m];
  59795. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  59796. var shapeROP_m = chart_m.resetLocation();
  59797. // 添加图形
  59798. var shapes_m = chart_m.shapes;
  59799. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  59800. shapes_m[n].refOriginalPosition = shapeROP_m;
  59801. this.renderer.addShape(shapes_m[n]);
  59802. }
  59803. }
  59804. } else {
  59805. // 压盖判断所需 chartsBounds 集合
  59806. var chartsBounds = [];
  59807. //var extent = this.map.getBounds();
  59808. //var mapBounds = new Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  59809. // 获取地图像素 bounds
  59810. //var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  59811. //var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  59812. //var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  59813. // 压盖处理 & 添加图形
  59814. for (let i = 0, len = charts.length; i < len; i++) {
  59815. var chart = charts[i];
  59816. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  59817. var shapeROP = chart.resetLocation();
  59818. // 图表框
  59819. var cbs = chart.chartBounds;
  59820. var cBounds = [{
  59821. "x": cbs.left,
  59822. "y": cbs.top
  59823. }, {
  59824. "x": cbs.left,
  59825. "y": cbs.bottom
  59826. }, {
  59827. "x": cbs.right,
  59828. "y": cbs.bottom
  59829. }, {
  59830. "x": cbs.right,
  59831. "y": cbs.top
  59832. }, {
  59833. "x": cbs.left,
  59834. "y": cbs.top
  59835. }];
  59836. // // 地图范围外不绘制
  59837. // if (mBounds) {
  59838. // // if (!this.isChartInMap(mBounds, cBounds)) continue;
  59839. // }
  59840. // 是否压盖
  59841. var isOL = false;
  59842. if (i !== 0) {
  59843. for (let j = 0; j < chartsBounds.length; j++) {
  59844. //压盖判断
  59845. if (this.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  59846. isOL = true;
  59847. break;
  59848. }
  59849. }
  59850. }
  59851. if (isOL) {
  59852. continue;
  59853. } else {
  59854. chartsBounds.push(cBounds);
  59855. }
  59856. // 添加图形
  59857. var shapes = chart.shapes;
  59858. for (let j = 0, slen = shapes.length; j < slen; j++) {
  59859. shapes[j].refOriginalPosition = shapeROP;
  59860. this.renderer.addShape(shapes[j]);
  59861. }
  59862. }
  59863. }
  59864. // 绘制图形
  59865. this.renderer.render();
  59866. }
  59867. /**
  59868. * @function mapboxgl.supermap.GraphThemeLayer.prototype.getShapesByFeatureID
  59869. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  59870. * @param {number} featureID - 要素 ID。
  59871. */
  59872. getShapesByFeatureID(featureID) {
  59873. var list = [];
  59874. var shapeList = this.renderer.getAllShapes();
  59875. if (!featureID) {
  59876. return shapeList
  59877. }
  59878. for (var i = 0, len = shapeList.length; i < len; i++) {
  59879. var si = shapeList[i];
  59880. if (si.refDataID && featureID === si.refDataID) {
  59881. list.push(si);
  59882. }
  59883. }
  59884. return list;
  59885. }
  59886. /**
  59887. * @function mapboxgl.supermap.GraphThemeLayer.prototype.isQuadrilateralOverLap
  59888. * @description 判断两个四边形是否有压盖。
  59889. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  59890. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  59891. */
  59892. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  59893. var quadLen = quadrilateral.length,
  59894. quad2Len = quadrilateral2.length;
  59895. if (quadLen !== 5 || quad2Len !== 5) {
  59896. return null;
  59897. } //不是四边形
  59898. var OverLap = false;
  59899. //如果两四边形互不包含对方的节点,则两个四边形不相交
  59900. for (let i = 0; i < quadLen; i++) {
  59901. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  59902. OverLap = true;
  59903. break;
  59904. }
  59905. }
  59906. for (let i = 0; i < quad2Len; i++) {
  59907. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  59908. OverLap = true;
  59909. break;
  59910. }
  59911. }
  59912. //加上两矩形十字相交的情况
  59913. for (let i = 0; i < quadLen - 1; i++) {
  59914. if (OverLap) {
  59915. break;
  59916. }
  59917. for (let j = 0; j < quad2Len - 1; j++) {
  59918. var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  59919. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  59920. OverLap = true;
  59921. break;
  59922. }
  59923. }
  59924. }
  59925. return OverLap;
  59926. }
  59927. /**
  59928. * @function mapboxgl.supermap.GraphThemeLayer.prototype.isPointInPoly
  59929. * @description 判断一个点是否在多边形里面。(射线法)
  59930. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x (横坐标),属性 y (纵坐标)。
  59931. * @param {Array.<Object>} poly - 多边形节点数组。
  59932. */
  59933. isPointInPoly(pt, poly) {
  59934. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  59935. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  59936. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  59937. (isIn = !isIn);
  59938. }
  59939. return isIn;
  59940. }
  59941. /**
  59942. * @function mapboxgl.supermap.GraphThemeLayer.prototype.isChartInMap
  59943. * @description 判断图表是否在地图里。
  59944. * @param {SuperMap.Bounds} mapPxBounds - 地图像素范围。
  59945. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  59946. */
  59947. isChartInMap(mapPxBounds, chartPxBounds) {
  59948. var mb = mapPxBounds;
  59949. var isIn = false;
  59950. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  59951. var cb = chartPxBounds[i];
  59952. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  59953. isIn = true;
  59954. break;
  59955. }
  59956. }
  59957. return isIn;
  59958. }
  59959. /**
  59960. * @function mapboxgl.supermap.GraphThemeLayer.prototype.clearCache
  59961. * @description 清除缓存
  59962. */
  59963. clearCache() {
  59964. this.cache = {};
  59965. this.charts = [];
  59966. }
  59967. /**
  59968. * @function mapboxgl.supermap.GraphThemeLayer.prototype.removeFeatures
  59969. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  59970. * @param {SuperMap.Feature.Vector} features - 要删除的要素。
  59971. */
  59972. removeFeatures(features) {
  59973. this.clearCache();
  59974. super.removeFeatures(features);
  59975. }
  59976. /**
  59977. * @function mapboxgl.supermap.GraphThemeLayer.prototype.removeAllFeatures
  59978. * @description 移除所有的要素。
  59979. */
  59980. removeAllFeatures() {
  59981. this.clearCache();
  59982. super.removeAllFeatures();
  59983. }
  59984. /**
  59985. * @function mapboxgl.supermap.GraphThemeLayer.prototype.redraw
  59986. * @description 重绘该图层。
  59987. */
  59988. redraw() {
  59989. this.clearCache();
  59990. if (this.renderer) {
  59991. this.redrawThematicFeatures(this.map.getBounds());
  59992. return true;
  59993. }
  59994. return false
  59995. }
  59996. /**
  59997. * @function mapboxgl.supermap.GraphThemeLayer.prototype.clear
  59998. * @description 清除的内容包括数据(features) 、专题要素、缓存。
  59999. */
  60000. clear() {
  60001. if (this.renderer) {
  60002. this.renderer.clearAll();
  60003. this.renderer.refresh();
  60004. }
  60005. this.removeAllFeatures();
  60006. this.clearCache();
  60007. }
  60008. }
  60009. (external_mapboxgl_default()).supermap.GraphThemeLayer = GraphThemeLayer_Graph;
  60010. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/GeoFeatureThemeLayer.js
  60011. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60012. * This program are made available under the terms of the Apache License, Version 2.0
  60013. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60014. /**
  60015. * @class mapboxgl.supermap.GeoFeatureThemeLayer
  60016. * @category Visualization Theme
  60017. * @classdesc 地理几何专题要素型专题图层。
  60018. * @param {string} name - 图层名。
  60019. * @param {Object} opt_options - 参数。
  60020. * @param {mapboxgl.Map} opt_options.map - 当前 mapboxgl map 对象。
  60021. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  60022. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  60023. * @param {number} [opt_options.nodesClipPixel=2] - 节点抽稀像素距离。
  60024. * @param {boolean} [opt_options.isHoverAble=false] - 图形是否在 hover 时高亮。
  60025. * @param {boolean} [opt_options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  60026. * @param {boolean} [opt_options.isClickAble=true] - 图形是否可点击。
  60027. * @param {boolean} [opt_options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  60028. * 禁止对专题要素使用数据(feature)的 style。
  60029. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  60030. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  60031. * @param {number} [opt_options.opacity=1] - 图层透明度。
  60032. * @extends {mapboxgl.supermap.ThemeLayer}
  60033. * @fires mapboxgl.supermap.GeoFeatureThemeLayer#beforefeaturesadded
  60034. */
  60035. class GeoFeature extends ThemeLayer_Theme {
  60036. constructor(name, opt_options) {
  60037. super(name, opt_options);
  60038. /**
  60039. * @member {string} mapboxgl.supermap.GeoFeatureThemeLayer.prototype.name
  60040. * @description 专题图图层名称。
  60041. */
  60042. this.name = null;
  60043. /**
  60044. * @member {SuperMap.ThemeStyle} mapboxgl.supermap.GeoFeatureThemeLayer.prototype.style
  60045. * @description 专题图图层全局样式。
  60046. */
  60047. this.style = null;
  60048. /**
  60049. * @member {SuperMap.ThemeStyle} mapboxgl.supermap.GeoFeatureThemeLayer.prototype.highlightStyle
  60050. * @description 专题图图层高亮样式。
  60051. */
  60052. this.highlightStyle = null;
  60053. /**
  60054. * @member {number} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.nodesClipPixel=2]
  60055. * @description 节点抽稀像素距离。
  60056. */
  60057. this.nodesClipPixel = 2;
  60058. /**
  60059. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isHoverAble=false]
  60060. * @description 图形是否在 hover 时高亮。
  60061. */
  60062. this.isHoverAble = false;
  60063. /**
  60064. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isMultiHover=false]
  60065. * @description 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  60066. */
  60067. this.isMultiHover = false;
  60068. /**
  60069. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isClickAble=true]
  60070. * @description 图形是否可点击。
  60071. */
  60072. this.isClickAble = true;
  60073. /**
  60074. * @member {boolean} [mapboxgl.supermap.GeoFeatureThemeLayer.prototype.isAllowFeatureStyle=false]
  60075. * @description 是否允许 feature 样式(style) 中的有效属性应用到专题图层。</br>
  60076. * 禁止对专题要素使用数据(feature)的 style。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  60077. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  60078. */
  60079. this.isAllowFeatureStyle = false;
  60080. Util.extend(this, opt_options);
  60081. this.cache = opt_options.cache || {};
  60082. this.cacheFields = opt_options.cacheFields || [];
  60083. this.maxCacheCount = opt_options.maxCacheCount || 0;
  60084. this.isCustomSetMaxCacheCount = opt_options.isCustomSetMaxCacheCount === undefined ? false : opt_options.isCustomSetMaxCacheCount;
  60085. }
  60086. /**
  60087. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.addFeatures
  60088. * @description 添加要素。
  60089. * @param {mapboxgl.supermap.ThemeFeature|SuperMap.ServerFeature} features - 要素对象。
  60090. */
  60091. addFeatures(features) {
  60092. /**
  60093. * @event mapboxgl.supermap.GeoFeatureThemeLayer#beforefeaturesadded
  60094. * @description 要素添加之前触发。
  60095. * @property {mapboxgl.supermap.ThemeFeature|SuperMap.ServerFeature} features - 被添加的要素。
  60096. */
  60097. external_mapboxgl_default().Evented.prototype.fire('beforefeaturesadded', {features: features});
  60098. //转换 features 形式
  60099. this.features = this.toiClientFeature(features);
  60100. if (!this.isCustomSetMaxCacheCount) {
  60101. this.maxCacheCount = this.features.length * 5;
  60102. }
  60103. //绘制专题要素
  60104. if (this.renderer) {
  60105. this.redrawThematicFeatures(this.map.getBounds());
  60106. }
  60107. }
  60108. /**
  60109. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.removeFeatures
  60110. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  60111. * @param {SuperMap.Feature.Vector} features - 要删除的要素对象。
  60112. */
  60113. removeFeatures(features) { // eslint-disable-line no-unused-vars
  60114. this.clearCache();
  60115. ThemeLayer_Theme.prototype.removeFeatures.apply(this, arguments);
  60116. }
  60117. /**
  60118. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.removeAllFeatures
  60119. * @description 清除当前图层所有的矢量要素。
  60120. */
  60121. removeAllFeatures() {
  60122. this.clearCache();
  60123. ThemeLayer_Theme.prototype.removeAllFeatures.apply(this, arguments);
  60124. }
  60125. /**
  60126. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.redrawThematicFeatures
  60127. * @description 重绘所有专题要素。
  60128. * @param {mapboxgl.LngLatBounds} extent - 重绘的范围。
  60129. */
  60130. redrawThematicFeatures(extent) { // eslint-disable-line no-unused-vars
  60131. this.clearCache();
  60132. //获取高亮专题要素对应的用户 id
  60133. var hoverone = this.renderer.getHoverOne();
  60134. var hoverFid = null;
  60135. if (hoverone && hoverone.refDataID) {
  60136. hoverFid = hoverone.refDataID;
  60137. }
  60138. //清除当前所有可视元素
  60139. this.renderer.clearAll();
  60140. var features = this.features;
  60141. var cache = this.cache;
  60142. var cacheFields = this.cacheFields;
  60143. var cmZoom = this.map.getZoom();
  60144. var maxCC = this.maxCacheCount;
  60145. for (var i = 0, len = features.length; i < len; i++) {
  60146. var feature = features[i];
  60147. // var feaBounds = feature.geometry.getBounds();
  60148. //
  60149. // //剔除当前视图(地理)范围以外的数据
  60150. // if (extent) {
  60151. // var bounds = new SuperMap.Bounds(extent.getWest(), extent.getSouth(), extent.getEast(), extent.getNorth());
  60152. // // if (!bounds.intersectsBounds(feaBounds)) continue;
  60153. // }
  60154. //缓存字段
  60155. var fields = feature.id + "_zoom_" + cmZoom.toString();
  60156. var thematicFeature;
  60157. //判断专题要素缓存是否存在
  60158. if (cache[fields]) {
  60159. cache[fields].updateAndAddShapes();
  60160. } else {
  60161. //如果专题要素缓存不存在,创建专题要素
  60162. thematicFeature = this.createThematicFeature(features[i]);
  60163. //检查 thematicFeature 是否有可视化图形
  60164. if (thematicFeature.getShapesCount() < 1) {
  60165. continue;
  60166. }
  60167. //加入缓存
  60168. cache[fields] = thematicFeature;
  60169. cacheFields.push(fields);
  60170. //缓存数量限制
  60171. if (cacheFields.length > maxCC) {
  60172. var fieldsTemp = cacheFields[0];
  60173. cacheFields.splice(0, 1);
  60174. delete cache[fieldsTemp];
  60175. }
  60176. }
  60177. }
  60178. this.renderer.render();
  60179. //地图漫游后,重新高亮图形
  60180. if (hoverFid && this.isHoverAble && this.isMultiHover) {
  60181. var hShapes = this.getShapesByFeatureID(hoverFid);
  60182. this.renderer.updateHoverShapes(hShapes);
  60183. }
  60184. }
  60185. /**
  60186. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.createThematicFeature
  60187. * @description 创建专题要素。
  60188. * @param {SuperMap.Feature.Vector} feature - 要素对象。
  60189. */
  60190. createThematicFeature(feature) {
  60191. var style = Util.copyAttributesWithClip(this.style);
  60192. if (feature.style && this.isAllowFeatureStyle === true) {
  60193. style = Util.copyAttributesWithClip(feature.style);
  60194. }
  60195. //创建专题要素时的可选参数
  60196. var options = {};
  60197. options.nodesClipPixel = this.nodesClipPixel;
  60198. options.isHoverAble = this.isHoverAble;
  60199. options.isMultiHover = this.isMultiHover;
  60200. options.isClickAble = this.isClickAble;
  60201. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  60202. //将数据转为专题要素(Vector)
  60203. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  60204. //直接添加图形到渲染器
  60205. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  60206. this.renderer.addShape(thematicFeature.shapes[m]);
  60207. }
  60208. return thematicFeature;
  60209. }
  60210. /**
  60211. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.clearCache
  60212. * @description 清除缓存。
  60213. */
  60214. clearCache() {
  60215. this.cache = {};
  60216. this.cacheFields = [];
  60217. }
  60218. /**
  60219. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.clear
  60220. * @description 清除的内容包括数据(features)、专题要素和缓存。
  60221. */
  60222. clear() {
  60223. this.renderer.clearAll();
  60224. this.renderer.refresh();
  60225. this.removeAllFeatures();
  60226. this.clearCache();
  60227. }
  60228. /**
  60229. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.getCacheCount
  60230. * @description 获取当前缓存数量。
  60231. * @returns {number} 当前缓存数量。
  60232. */
  60233. getCacheCount() {
  60234. return this.cacheFields.length;
  60235. }
  60236. /**
  60237. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.setMaxCacheCount
  60238. * @param {number} [cacheCount] - 缓存总数。
  60239. * @description 设置最大缓存条数。
  60240. */
  60241. setMaxCacheCount(cacheCount) {
  60242. if (!isNaN(cacheCount)) {
  60243. this.maxCacheCount = cacheCount;
  60244. this.isCustomSetMaxCacheCount = true;
  60245. }
  60246. }
  60247. /**
  60248. * @function mapboxgl.supermap.GeoFeatureThemeLayer.prototype.setMaxCacheCount
  60249. * @param {number} [featureID=si.refDataID] - 要素 ID。
  60250. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  60251. */
  60252. getShapesByFeatureID(featureID) {
  60253. var list = [];
  60254. var shapeList = this.renderer.getAllShapes();
  60255. if (!featureID) {
  60256. return shapeList
  60257. }
  60258. for (var i = 0, len = shapeList.length; i < len; i++) {
  60259. var si = shapeList[i];
  60260. if (si.refDataID && featureID === si.refDataID) {
  60261. list.push(si);
  60262. }
  60263. }
  60264. return list;
  60265. }
  60266. }
  60267. (external_mapboxgl_default()).supermap.GeoFeatureThemeLayer = GeoFeature;
  60268. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/LabelThemeLayer.js
  60269. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60270. * This program are made available under the terms of the Apache License, Version 2.0
  60271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60272. /**
  60273. * @class mapboxgl.supermap.LabelThemeLayer
  60274. * @category Visualization Theme
  60275. * @classdesc 标签专题图层。
  60276. * @param {string} name - 图层名。
  60277. * @param {Object} opt_options - 参数。
  60278. * @param {mapboxgl.Map} opt_options.map - 当前mapboxgl map 对象。
  60279. * @param {string} opt_options.themeField - 指定创建专题图字段。
  60280. * @param {Object} opt_options.style - 专题图样式。
  60281. * @param {Object} opt_options.styleGroups - 各专题类型样式组。
  60282. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  60283. * @param {string} [opt_options.id] - 专题图层 ID。专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  60284. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  60285. * @param {number} [opt_options.opacity=1] - 图层透明度。
  60286. * @param {boolean} [options.isAvoid=true] - 是否进行地图边缘的避让处理。
  60287. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  60288. * @param {boolean} [opt_options.isHoverAble] - 是否开启 hover 事件。
  60289. * @extends {mapboxgl.supermap.GeoFeatureThemeLayer}
  60290. */
  60291. class LabelThemeLayer_Label extends GeoFeature {
  60292. constructor(name, opt_options) {
  60293. super(name, opt_options);
  60294. /**
  60295. * @member {boolean} [mapboxgl.supermap.LabelThemeLayer.prototype.isOverLay=true]
  60296. * @description 是否进行压盖处理,如果设为 true,将隐藏被压盖的标签。
  60297. */
  60298. this.isOverLay = true;
  60299. /**
  60300. * @member {boolean} [mapboxgl.supermap.LabelThemeLayer.prototype.isAvoid=true]
  60301. * @description 是否进行地图边缘的避让处理,如果设为 true,将把与地图边缘相交的标签移到地图范围内,在地图边缘处做避让处理。
  60302. */
  60303. this.isAvoid = true;
  60304. /**
  60305. * @member {string} mapboxgl.supermap.LabelThemeLayer.prototype.themeField
  60306. * @description 用于指定专题要素样式的属性字段名称。</br>
  60307. * 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。</br>
  60308. * 使用标签分组显示还需要设置 styleGroups 属性。
  60309. */
  60310. this.themeField = null;
  60311. /**
  60312. * @member {Array.<Object>} mapboxgl.supermap.LabelThemeLayer.prototype.styleGroups
  60313. * @description 分组样式。使用此属性需要设置 themeField 属性。</br>
  60314. * 1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;</br>
  60315. * 2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;</br>
  60316. * &nbsp;&nbsp;a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。</br>
  60317. * &nbsp;&nbsp;b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。</br>
  60318. * 此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  60319. */
  60320. this.styleGroups = null;
  60321. Util.extend(this, opt_options);
  60322. this.defaultStyle = {
  60323. //默认文本样式
  60324. fontColor: "#000000",
  60325. fontOpacity: 1,
  60326. fontSize: "12px",
  60327. fontStyle: "normal",
  60328. fontWeight: "normal",
  60329. labelAlign: "cm",
  60330. labelXOffset: 0,
  60331. labelYOffset: 0,
  60332. labelRotation: 0,
  60333. //默认样式
  60334. fill: false,
  60335. fillColor: "#ee9900",
  60336. fillOpacity: 0.4,
  60337. stroke: false,
  60338. strokeColor: "#ee9900",
  60339. strokeOpacity: 1,
  60340. strokeWidth: 1,
  60341. strokeLinecap: "round",
  60342. strokeDashstyle: "solid",
  60343. //默认显示背景框
  60344. labelRect: true,
  60345. //对用户隐藏但必须保持此值的属性
  60346. //cursor: "pointer",
  60347. labelSelect: true,
  60348. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  60349. _isGeoTextStrategyStyle: true
  60350. };
  60351. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  60352. this.getPxBoundsMode = 0;
  60353. this.labelFeatures = [];
  60354. }
  60355. /**
  60356. * @function mapboxgl.supermap.LabelThemeLayer.prototype.redrawThematicFeatures
  60357. * @description 重绘所有专题要素。</br>
  60358. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。</br>
  60359. * 地图漫游时调用此方法进行图层刷新。
  60360. * @param {mapboxgl.LngLatBounds} bounds - 重绘范围。
  60361. */
  60362. redrawThematicFeatures(bounds) {
  60363. if (this.features.length > 0 && this.labelFeatures.length == 0) {
  60364. var feats = this.setLabelsStyle(this.features);
  60365. for (var i = 0, len = feats.length; i < len; i++) {
  60366. this.labelFeatures.push(feats[i]);
  60367. }
  60368. }
  60369. this.features = this.getDrawnLabels(this.labelFeatures);
  60370. super.redrawThematicFeatures.call(this, bounds);
  60371. }
  60372. /**
  60373. * @function mapboxgl.supermap.LabelThemeLayer.prototype.removeFeatures
  60374. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  60375. * @param {SuperMap.Feature.Vector} features - 要删除的要素对象。
  60376. */
  60377. removeFeatures(features) { // eslint-disable-line no-unused-vars
  60378. this.labelFeatures = [];
  60379. super.removeFeatures.call(this, arguments);
  60380. }
  60381. /**
  60382. * @function mapboxgl.supermap.LabelThemeLayer.prototype.removeAllFeatures
  60383. * @description 清除当前图层所有的矢量要素。
  60384. */
  60385. removeAllFeatures() {
  60386. this.labelFeatures = [];
  60387. super.removeAllFeatures.call(this, arguments);
  60388. }
  60389. /**
  60390. * @function mapboxgl.supermap.LabelThemeLayer.prototype.createThematicFeature
  60391. * @description 创建专题图要素。
  60392. * @param {Object} feature - 要创建的专题图形要素。
  60393. */
  60394. createThematicFeature(feature) {
  60395. //赋 style
  60396. var style = this.getStyleByData(feature);
  60397. //创建专题要素时的可选参数
  60398. var options = {};
  60399. options.nodesClipPixel = this.nodesClipPixel;
  60400. options.isHoverAble = this.isHoverAble;
  60401. options.isMultiHover = this.isMultiHover;
  60402. options.isClickAble = this.isClickAble;
  60403. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  60404. //将数据转为专题要素(Vector)
  60405. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  60406. //直接添加图形到渲染器
  60407. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  60408. this.renderer.addShape(thematicFeature.shapes[m]);
  60409. }
  60410. return thematicFeature;
  60411. }
  60412. /**
  60413. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getDrawnLabels
  60414. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  60415. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 所有标签要素的数组。
  60416. * @returns {Array.<SuperMap.Feature.Vector>} 最终要绘制的标签要素数组。
  60417. */
  60418. getDrawnLabels(labelFeatures) {
  60419. var feas = [], //最终要绘制的标签要素集
  60420. fea, //最终要绘制的标签要素
  60421. fi, //临时标签要素,用户的第i个标签
  60422. labelsB = [], //不产生压盖的标签要素范围集
  60423. styTmp, //用于临时存储要素style的变量
  60424. feaSty, //标签要素最终的style
  60425. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  60426. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  60427. styleTemp = {
  60428. labelAlign: "cm",
  60429. labelXOffset: 0,
  60430. labelYOffset: 0
  60431. };
  60432. var map = this.map;
  60433. var zoom = map.getZoom();
  60434. var canvas = map.getCanvas();
  60435. var mapSize = {
  60436. x: parseFloat(canvas.style.width),
  60437. y: parseFloat(canvas.style.height)
  60438. };
  60439. //对用户的每个标签要素进行处理与判断
  60440. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  60441. fi = labelFeatures[i];
  60442. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  60443. if (fi.isStyleChange || fi.isStyleChange === undefined) {
  60444. fi = this.setStyle(fi);
  60445. }
  60446. //标签最终的中心点像素位置 (偏移后)
  60447. var loc = this.getLabelPxLocation(fi);
  60448. //过滤掉地图范围外的标签 (偏移后)
  60449. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  60450. //根据当前地图缩放级别过滤标签
  60451. if (fi.style.minZoomLevel > -1) {
  60452. if (zoom <= fi.style.minZoomLevel) {
  60453. continue;
  60454. }
  60455. }
  60456. if (fi.style.maxZoomLevel > -1) {
  60457. if (zoom > fi.style.maxZoomLevel) {
  60458. continue;
  60459. }
  60460. }
  60461. //计算标签bounds
  60462. var boundsQuad = null;
  60463. if (fi.isStyleChange) {
  60464. fi.isStyleChange = null;
  60465. boundsQuad = this.calculateLabelBounds(fi, loc);
  60466. } else {
  60467. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  60468. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  60469. boundsQuad = this.calculateLabelBounds2(fi, loc);
  60470. } else {
  60471. boundsQuad = this.calculateLabelBounds(fi, loc);
  60472. }
  60473. }
  60474. //避让处理 -start
  60475. var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  60476. quadlen = boundsQuad.length;
  60477. if (this.isAvoid) {
  60478. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  60479. if (avoidInfo) {
  60480. //横向(x方向)上的避让
  60481. if (avoidInfo.aspectW === "left") {
  60482. fi.style.labelXOffset += avoidInfo.offsetX;
  60483. for (let j = 0; j < quadlen; j++) {
  60484. boundsQuad[j].x += avoidInfo.offsetX;
  60485. }
  60486. } else if (avoidInfo.aspectW === "right") {
  60487. fi.style.labelXOffset += (-avoidInfo.offsetX);
  60488. for (let j = 0; j < quadlen; j++) {
  60489. boundsQuad[j].x += (-avoidInfo.offsetX);
  60490. }
  60491. }
  60492. //纵向(y方向)上的避让
  60493. if (avoidInfo.aspectH === "top") {
  60494. fi.style.labelYOffset += avoidInfo.offsetY;
  60495. for (let j = 0; j < quadlen; j++) {
  60496. boundsQuad[j].y += avoidInfo.offsetY;
  60497. }
  60498. } else if (avoidInfo.aspectH === "bottom") {
  60499. fi.style.labelYOffset += (-avoidInfo.offsetY);
  60500. for (let j = 0; j < quadlen; j++) {
  60501. boundsQuad[j].y += (-avoidInfo.offsetY);
  60502. }
  60503. }
  60504. //如果style发生变化,记录下来
  60505. fi.isStyleChange = true;
  60506. }
  60507. }
  60508. //避让处理 -end
  60509. //压盖处理 -start
  60510. if (this.isOverLay) {
  60511. //是否压盖
  60512. var isOL = false;
  60513. if (i != 0) {
  60514. for (let j = 0; j < labelsB.length; j++) {
  60515. //压盖判断
  60516. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  60517. isOL = true;
  60518. break;
  60519. }
  60520. }
  60521. }
  60522. if (isOL) {
  60523. continue;
  60524. } else {
  60525. labelsB.push(boundsQuad);
  60526. }
  60527. }
  60528. //压盖处理 -end
  60529. //背景(事件)-start
  60530. //将标签像素范围转为地理范围
  60531. var geoBs = [];
  60532. for (let j = 0; j < quadlen - 1; j++) {
  60533. geoBs.push(map.unproject(boundsQuad[j]));
  60534. }
  60535. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  60536. var leftBottom = geoBs[3];
  60537. var rightTop = geoBs[1];
  60538. var bounds = new Bounds(leftBottom.lng, leftBottom.lat, rightTop.lng, rightTop.lat);
  60539. var center = bounds.getCenterLonLat();
  60540. var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  60541. label.calculateBounds();
  60542. styTmp = Util.cloneObject(fi.style);
  60543. feaSty = Util.cloneObject(Util.copyAttributes(styTmp, styleTemp));
  60544. fea = new Vector(label, fi.attributes, feaSty);
  60545. //赋予id
  60546. fea.id = fi.id;
  60547. fea.fid = fi.fid;
  60548. feas.push(fea);
  60549. }
  60550. }
  60551. //返回最终要绘制的标签要素
  60552. return feas;
  60553. }
  60554. /**
  60555. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getStyleByData
  60556. * @description 根据用户数据(feature)设置专题要素的 Style。
  60557. * @param {SuperMap.Feature.Vector} feat - 矢量要素对象。
  60558. * @returns {Array.<SuperMap.ThemeStyle>} 专题要素的 Style。
  60559. */
  60560. getStyleByData(feat) {
  60561. var feature = feat;
  60562. feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  60563. //将style赋给标签
  60564. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  60565. this.style.fontSize = "12px";
  60566. }
  60567. feature.style = Util.copyAttributes(feature.style, this.style);
  60568. if (this.themeField && this.styleGroups && feature.attributes) {
  60569. var Sf = this.themeField;
  60570. var attributes = feature.attributes;
  60571. var groups = this.styleGroups;
  60572. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  60573. var attr = null; //属性值
  60574. for (var property in attributes) {
  60575. if (Sf === property) {
  60576. isSfInAttrs = true;
  60577. attr = attributes[property];
  60578. break;
  60579. }
  60580. }
  60581. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  60582. if (isSfInAttrs) {
  60583. for (var i = 0, len = groups.length; i < len; i++) {
  60584. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  60585. var sty1 = groups[i].style;
  60586. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  60587. sty1.fontSize = "12px";
  60588. }
  60589. feature.style = Util.copyAttributes(feature.style, sty1);
  60590. }
  60591. }
  60592. }
  60593. feature.style.label = feature.attributes[this.themeField]
  60594. }
  60595. return feature.style;
  60596. }
  60597. /**
  60598. * @function mapboxgl.supermap.LabelThemeLayer.prototype.setLabelsStyle
  60599. * @description 设置标签要素的 Style。
  60600. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 需要设置 Style 的标签要素数组。
  60601. * @returns {Array.<SuperMap.Feature.Vector>} 赋予 Style 后的标签要素数组。
  60602. */
  60603. setLabelsStyle(labelFeatures) {
  60604. var fea, labelFeas = [];
  60605. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  60606. var feature = labelFeatures[i];
  60607. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  60608. //设置标签的Style
  60609. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  60610. feature.geometry.bsInfo.w = null;
  60611. feature.geometry.bsInfo.h = null;
  60612. feature.geometry.labelWTmp = null;
  60613. }
  60614. fea = this.setStyle(feature);
  60615. //为标签要素指定图层
  60616. fea.layer = this.layer;
  60617. labelFeas.push(fea);
  60618. } else {
  60619. return labelFeatures;
  60620. }
  60621. }
  60622. return labelFeas;
  60623. }
  60624. /**
  60625. * @function mapboxgl.supermap.LabelThemeLayer.prototype.setStyle
  60626. * @description 设置标签要素的Style。
  60627. * @param {SuperMap.Feature.Vector} feat - 需要赋予 style 的要素。
  60628. */
  60629. setStyle(feat) {
  60630. var feature = feat;
  60631. feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  60632. //将style赋给标签
  60633. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  60634. this.style.fontSize = "12px";
  60635. }
  60636. feature.style = Util.copyAttributes(feature.style, this.style);
  60637. if (this.groupField && this.styleGroups && feature.attributes) {
  60638. var Sf = this.groupField;
  60639. var Attrs = feature.attributes;
  60640. var Gro = this.styleGroups;
  60641. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  60642. var attr = null; //属性值
  60643. for (var property in Attrs) {
  60644. if (Sf === property) {
  60645. isSfInAttrs = true;
  60646. attr = Attrs[property];
  60647. break;
  60648. }
  60649. }
  60650. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  60651. if (isSfInAttrs) {
  60652. for (var i = 0, len = Gro.length; i < len; i++) {
  60653. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  60654. //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  60655. var sty1 = Gro[i].style;
  60656. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  60657. sty1.fontSize = "12px";
  60658. }
  60659. feature.style = Util.copyAttributes(feature.style, sty1);
  60660. }
  60661. }
  60662. }
  60663. }
  60664. //将文本内容赋到标签要素的style上
  60665. feature.style.label = feature.geometry.text;
  60666. return feature;
  60667. }
  60668. /**
  60669. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getLabelPxLocation
  60670. * @description 获取标签要素的像素坐标。
  60671. * @param {SuperMap.Feature.Vector} feature - 标签要素。
  60672. * @returns {mapboxgl.Point} 标签位置。
  60673. */
  60674. getLabelPxLocation(feature) {
  60675. var geoText = feature.geometry;
  60676. var styleTmp = feature.style;
  60677. //将标签的地理位置转为像素位置
  60678. var locationTmp = geoText.getCentroid();
  60679. var locTmp = this.map.project(new (external_mapboxgl_default()).LngLat(locationTmp.x, locationTmp.y));
  60680. var loc = new (external_mapboxgl_default()).Point(locTmp.x, locTmp.y);
  60681. //偏移处理
  60682. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  60683. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  60684. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  60685. var point = loc.add(new (external_mapboxgl_default()).Point(xOffset, -yOffset));
  60686. return new (external_mapboxgl_default()).Point(point.x, point.y);
  60687. } else {
  60688. return new (external_mapboxgl_default()).Point(loc.x, loc.y);
  60689. }
  60690. }
  60691. /**
  60692. * @function mapboxgl.supermap.LabelThemeLayer.prototype.calculateLabelBounds
  60693. * @description 获得标签要素的最终范围。
  60694. *
  60695. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  60696. * @param {mapboxgl.Point} loc - 标签位置。
  60697. *
  60698. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  60699. */
  60700. calculateLabelBounds(feature, loc) {
  60701. var geoText = feature.geometry;
  60702. //标签范围(未旋转前)
  60703. var labB = null;
  60704. var labelInfo = null;
  60705. //获取bounds的方式
  60706. if (this.getPxBoundsMode == 0) {
  60707. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  60708. } else if (this.getPxBoundsMode === 1) {
  60709. //canvas
  60710. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  60711. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  60712. } else {
  60713. return null;
  60714. }
  60715. //旋转Bounds
  60716. var boundsQuad = [];
  60717. if ((feature.style.labelRotation % 180) == 0) {
  60718. boundsQuad = [{
  60719. "x": labB.left,
  60720. "y": labB.top
  60721. },
  60722. {
  60723. "x": labB.right,
  60724. "y": labB.top
  60725. },
  60726. {
  60727. "x": labB.right,
  60728. "y": labB.bottom
  60729. },
  60730. {
  60731. "x": labB.left,
  60732. "y": labB.bottom
  60733. },
  60734. {
  60735. "x": labB.left,
  60736. "y": labB.top
  60737. }
  60738. ];
  60739. } else {
  60740. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  60741. }
  60742. //重置GeoText的bounds
  60743. geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  60744. return boundsQuad;
  60745. }
  60746. /**
  60747. * @function mapboxgl.supermap.LabelThemeLayer.prototype.calculateLabelBounds2
  60748. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  60749. *
  60750. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  60751. * @param {mapboxgl.Point} loc - 标签位置。
  60752. *
  60753. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  60754. */
  60755. calculateLabelBounds2(feature, loc) {
  60756. var labB, left, bottom, top, right;
  60757. var labelSize = feature.geometry.bsInfo;
  60758. var style = feature.style;
  60759. var locationPx = Util.cloneObject(loc);
  60760. //处理文字对齐
  60761. if (style.labelAlign && style.labelAlign !== "cm") {
  60762. switch (style.labelAlign) {
  60763. case "lt":
  60764. locationPx.x += labelSize.w / 2;
  60765. locationPx.y += labelSize.h / 2;
  60766. break;
  60767. case "lm":
  60768. locationPx.x += labelSize.w / 2;
  60769. break;
  60770. case "lb":
  60771. locationPx.x += labelSize.w / 2;
  60772. locationPx.y -= labelSize.h / 2;
  60773. break;
  60774. case "ct":
  60775. locationPx.y += labelSize.h / 2;
  60776. break;
  60777. case "cb":
  60778. locationPx.y -= labelSize.h / 2;
  60779. break;
  60780. case "rt":
  60781. locationPx.x -= labelSize.w / 2;
  60782. locationPx.y += labelSize.h / 2;
  60783. break;
  60784. case "rm":
  60785. locationPx.x -= labelSize.w / 2;
  60786. break;
  60787. case "rb":
  60788. locationPx.x -= labelSize.w / 2;
  60789. locationPx.y -= labelSize.h / 2;
  60790. break;
  60791. default:
  60792. break;
  60793. }
  60794. }
  60795. left = locationPx.x - labelSize.w / 2;
  60796. bottom = locationPx.y + labelSize.h / 2;
  60797. //处理斜体字
  60798. if (style.fontStyle && style.fontStyle === "italic") {
  60799. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  60800. } else {
  60801. right = locationPx.x + labelSize.w / 2;
  60802. }
  60803. top = locationPx.y - labelSize.h / 2;
  60804. labB = new Bounds(left, bottom, right, top);
  60805. //旋转Bounds
  60806. var boundsQuad = [];
  60807. if ((style.labelRotation % 180) == 0) {
  60808. boundsQuad = [{
  60809. "x": labB.left,
  60810. "y": labB.top
  60811. },
  60812. {
  60813. "x": labB.right,
  60814. "y": labB.top
  60815. },
  60816. {
  60817. "x": labB.right,
  60818. "y": labB.bottom
  60819. },
  60820. {
  60821. "x": labB.left,
  60822. "y": labB.bottom
  60823. },
  60824. {
  60825. "x": labB.left,
  60826. "y": labB.top
  60827. }
  60828. ];
  60829. } else {
  60830. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  60831. }
  60832. //重置GeoText的bounds
  60833. feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  60834. return boundsQuad;
  60835. }
  60836. /**
  60837. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getLabelInfo
  60838. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  60839. * @returns {Object} 绘制后的标签信息。
  60840. */
  60841. getLabelInfo(location, style) {
  60842. var LABEL_ALIGN = {
  60843. "l": "left",
  60844. "r": "right",
  60845. "t": "top",
  60846. "b": "bottom"
  60847. },
  60848. LABEL_FACTOR = {
  60849. "l": 0,
  60850. "r": -1,
  60851. "t": 0,
  60852. "b": -1
  60853. };
  60854. style = Util.extend({
  60855. fontColor: "#000000",
  60856. labelAlign: "cm"
  60857. }, style);
  60858. var pt = this.getLocalXY(location);
  60859. var labelWidth = 0;
  60860. if (style.labelXOffset || style.labelYOffset) {
  60861. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  60862. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  60863. pt[0] += xOffset;
  60864. pt[1] -= yOffset;
  60865. }
  60866. var canvas = document.createElement('canvas');
  60867. canvas.globalAlpha = 0;
  60868. canvas.lineWidth = 1;
  60869. var ctx = canvas.getContext("2d");
  60870. ctx.fillStyle = style.fontColor;
  60871. ctx.globalAlpha = style.fontOpacity || 1.0;
  60872. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  60873. "normal",
  60874. style.fontWeight ? style.fontWeight : "normal",
  60875. style.fontSize ? style.fontSize : "1em",
  60876. style.fontFamily ? style.fontFamily : "sans-serif"
  60877. ].join(" ");
  60878. var labelRows = style.label.split('\n');
  60879. var numRows = labelRows.length;
  60880. var vfactor, lineHeight, labelWidthTmp;
  60881. if (ctx.fillText) {
  60882. // HTML5
  60883. ctx.font = fontStyle;
  60884. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  60885. "center";
  60886. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  60887. "middle";
  60888. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  60889. if (vfactor == null) {
  60890. vfactor = -.5;
  60891. }
  60892. lineHeight = ctx.measureText('Mg').height ||
  60893. ctx.measureText('xx').width;
  60894. pt[1] += lineHeight * vfactor * (numRows - 1);
  60895. for (let i = 0; i < numRows; i++) {
  60896. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  60897. if (labelWidth < labelWidthTmp) {
  60898. labelWidth = labelWidthTmp;
  60899. }
  60900. }
  60901. } else if (ctx.mozDrawText) {
  60902. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  60903. ctx.mozTextStyle = fontStyle;
  60904. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  60905. if (vfactor == null) {
  60906. vfactor = -.5;
  60907. }
  60908. lineHeight = ctx.mozMeasureText('xx');
  60909. pt[1] += lineHeight * (1 + (vfactor * numRows));
  60910. for (let i = 0; i < numRows; i++) {
  60911. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  60912. if (labelWidth < labelWidthTmp) {
  60913. labelWidth = labelWidthTmp;
  60914. }
  60915. }
  60916. }
  60917. var labelInfo = {}; //标签信息
  60918. if (labelWidth) {
  60919. labelInfo.w = labelWidth; //标签的宽
  60920. } else {
  60921. return null;
  60922. }
  60923. labelInfo.h = style.fontSize; //一行标签的高
  60924. labelInfo.rows = labelRows.length; //标签的行数
  60925. return labelInfo;
  60926. }
  60927. /**
  60928. * @function mapboxgl.supermap.LabelThemeLayer.prototype.rotationBounds
  60929. * @description 旋转 bounds。
  60930. *
  60931. * @param {SuperMap.Bounds} bounds - 要旋转的 bounds。
  60932. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性X(横坐标),属性Y(纵坐标)。
  60933. * @param {number} angle - 旋转角度(顺时针)。
  60934. *
  60935. * @returns {Array.<Object>} bounds 旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]
  60936. */
  60937. rotationBounds(bounds, rotationCenterPoi, angle) {
  60938. var ltPoi = new (external_mapboxgl_default()).Point(bounds.left, bounds.top);
  60939. var rtPoi = new (external_mapboxgl_default()).Point(bounds.right, bounds.top);
  60940. var rbPoi = new (external_mapboxgl_default()).Point(bounds.right, bounds.bottom);
  60941. var lbPoi = new (external_mapboxgl_default()).Point(bounds.left, bounds.bottom);
  60942. var ver = [];
  60943. ver.push(this.getRotatedLocation(ltPoi.x, ltPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  60944. ver.push(this.getRotatedLocation(rtPoi.x, rtPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  60945. ver.push(this.getRotatedLocation(rbPoi.x, rbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  60946. ver.push(this.getRotatedLocation(lbPoi.x, lbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  60947. //bounds旋转后形成的多边形节点数组
  60948. var quad = [];
  60949. for (var i = 0; i < ver.length; i++) {
  60950. quad.push({
  60951. "x": ver[i].x,
  60952. "y": ver[i].y
  60953. });
  60954. }
  60955. quad.push({
  60956. "x": ver[0].x,
  60957. "y": ver[0].y
  60958. });
  60959. return quad;
  60960. }
  60961. /**
  60962. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getRotatedLocation
  60963. * @description 获取一个点绕旋转中心顺时针旋转后的位置(此方法用于屏幕坐标)。
  60964. *
  60965. * @param {number} x - 旋转点横坐标。
  60966. * @param {number} y - 旋转点纵坐标。
  60967. * @param {number} rx - 旋转中心点横坐标。
  60968. * @param {number} ry - 旋转中心点纵坐标。
  60969. * @param {number} angle - 旋转角度。
  60970. *
  60971. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性X(横坐标),属性Y(纵坐标)。
  60972. */
  60973. getRotatedLocation(x, y, rx, ry, angle) {
  60974. var loc = {},
  60975. x0, y0;
  60976. y = -y;
  60977. ry = -ry;
  60978. angle = -angle; //顺时针旋转
  60979. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  60980. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  60981. loc.x = x0;
  60982. loc.y = -y0;
  60983. return loc;
  60984. }
  60985. /**
  60986. * @function mapboxgl.supermap.LabelThemeLayer.prototype.getAvoidInfo
  60987. * @description 获取避让的信息。
  60988. *
  60989. * @param {SuperMap.Bounds} bounds - 地图像素范围。
  60990. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  60991. *
  60992. * @returns {Object} 避让的信息。
  60993. */
  60994. getAvoidInfo(bounds, quadrilateral) {
  60995. if (quadrilateral.length !== 5) {
  60996. return null;
  60997. } //不是四边形
  60998. //将bound序列化为点数组形式
  60999. var bounddQuad = [{
  61000. "x": bounds.left,
  61001. "y": bounds.top
  61002. },
  61003. {
  61004. "x": bounds.right,
  61005. "y": bounds.top
  61006. },
  61007. {
  61008. "x": bounds.right,
  61009. "y": bounds.bottom
  61010. },
  61011. {
  61012. "x": bounds.left,
  61013. "y": bounds.bottom
  61014. },
  61015. {
  61016. "x": bounds.left,
  61017. "y": bounds.top
  61018. }
  61019. ];
  61020. var isIntersection = false,
  61021. bqLen = bounddQuad.length,
  61022. quadLen = quadrilateral.length;
  61023. var offsetX = 0,
  61024. offsetY = 0,
  61025. aspectH = "",
  61026. aspectW = "";
  61027. for (var i = 0; i < bqLen - 1; i++) {
  61028. for (var j = 0; j < quadLen - 1; j++) {
  61029. var isLineIn = Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  61030. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  61031. //设置避让信息
  61032. setInfo(quadrilateral[j]);
  61033. setInfo(quadrilateral[j + 1]);
  61034. isIntersection = true;
  61035. }
  61036. }
  61037. }
  61038. if (isIntersection) {
  61039. //组织避让操作所需的信息
  61040. return {
  61041. "aspectW": aspectW,
  61042. "aspectH": aspectH,
  61043. "offsetX": offsetX,
  61044. "offsetY": offsetY
  61045. };
  61046. } else {
  61047. return null;
  61048. }
  61049. //内部函数:设置避让信息
  61050. //参数:{Object} vec- quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  61051. function setInfo(vec) {
  61052. //四边形不在bounds内的节点
  61053. if (!bounds.contains(vec.x, vec.y)) {
  61054. //bounds的Top边
  61055. if (vec.y < bounds.top) {
  61056. let oY = Math.abs(bounds.top - vec.y);
  61057. if (oY > offsetY) {
  61058. offsetY = oY;
  61059. aspectH = "top";
  61060. }
  61061. }
  61062. //bounds的Bottom边
  61063. if (vec.y > bounds.bottom) {
  61064. let oY = Math.abs(vec.y - bounds.bottom);
  61065. if (oY > offsetY) {
  61066. offsetY = oY;
  61067. aspectH = "bottom";
  61068. }
  61069. }
  61070. //bounds的left边
  61071. if (vec.x < bounds.left) {
  61072. let oX = Math.abs(bounds.left - vec.x);
  61073. if (oX > offsetX) {
  61074. offsetX = oX;
  61075. aspectW = "left";
  61076. }
  61077. }
  61078. //bounds的right边
  61079. if (vec.x > bounds.right) {
  61080. let oX = Math.abs(vec.x - bounds.right);
  61081. if (oX > offsetX) {
  61082. offsetX = oX;
  61083. aspectW = "right";
  61084. }
  61085. }
  61086. }
  61087. }
  61088. }
  61089. /**
  61090. * @function mapboxgl.supermap.LabelThemeLayer.prototype.isQuadrilateralOverLap
  61091. * @description 判断两个四边形是否有压盖。
  61092. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  61093. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  61094. * @returns {boolean} 是否压盖,true 表示压盖。
  61095. */
  61096. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  61097. var quadLen = quadrilateral.length,
  61098. quad2Len = quadrilateral2.length;
  61099. if (quadLen !== 5 || quad2Len !== 5) {
  61100. return null;
  61101. } //不是四边形
  61102. var OverLap = false;
  61103. //如果两四边形互不包含对方的节点,则两个四边形不相交
  61104. for (let i = 0; i < quadLen; i++) {
  61105. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  61106. OverLap = true;
  61107. break;
  61108. }
  61109. }
  61110. for (let i = 0; i < quad2Len; i++) {
  61111. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  61112. OverLap = true;
  61113. break;
  61114. }
  61115. }
  61116. //加上两矩形十字相交的情况
  61117. for (let i = 0; i < quadLen - 1; i++) {
  61118. if (OverLap) {
  61119. break;
  61120. }
  61121. for (var j = 0; j < quad2Len - 1; j++) {
  61122. var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  61123. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  61124. OverLap = true;
  61125. break;
  61126. }
  61127. }
  61128. }
  61129. return OverLap;
  61130. }
  61131. /**
  61132. * @function mapboxgl.supermap.LabelThemeLayer.prototype.isPointInPoly
  61133. * @description 判断一个点是否在多边形里面。(射线法)
  61134. *
  61135. * @param {Object} pt - 需要判定的点对象,该对象含有属性x(横坐标),属性y(纵坐标)。
  61136. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]
  61137. * @returns {boolean} 点是否在多边形内。
  61138. */
  61139. isPointInPoly(pt, poly) {
  61140. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  61141. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  61142. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  61143. (isIn = !isIn);
  61144. }
  61145. return isIn;
  61146. }
  61147. }
  61148. (external_mapboxgl_default()).supermap.LabelThemeLayer = LabelThemeLayer_Label;
  61149. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  61150. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  61151. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapvRenderer.js
  61152. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61153. * This program are made available under the terms of the Apache License, Version 2.0
  61154. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61155. var BaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  61156. /**
  61157. * @private
  61158. * @class MapvRenderer
  61159. * @classdesc MapV图层渲染。
  61160. * @param {Object} map - 地图。
  61161. * @param {Object} layer - 图层。
  61162. * @param {MapV.DataSet} dataSet - 数据集。
  61163. * @param {Object} options - 交互时所需可选参数。
  61164. * @extends {MapV.BaseLayer}
  61165. *
  61166. */
  61167. class MapvRenderer extends BaseLayer {
  61168. constructor(map, layer, dataSet, options) {
  61169. super(map, dataSet, options);
  61170. if (!BaseLayer) {
  61171. return;
  61172. }
  61173. this.map = map;
  61174. var self = this;
  61175. options = options || {};
  61176. self.init(options);
  61177. self.argCheck(options);
  61178. this.canvasLayer = layer;
  61179. this.stopAniamation = false;
  61180. this.animation = options.animation;
  61181. this.clickEvent = this.clickEvent.bind(this);
  61182. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  61183. this.bindMapEvent();
  61184. this.bindEvent();
  61185. this._expectShow = true;
  61186. }
  61187. /**
  61188. * @function MapvRenderer.prototype.clickEvent
  61189. * @description 点击绑定事件。
  61190. * @param {Object} e - 事件。
  61191. */
  61192. clickEvent(e) {
  61193. var pixel = e.point;
  61194. super.clickEvent(pixel, e);
  61195. }
  61196. /**
  61197. * @function MapvRenderer.prototype.mousemoveEvent
  61198. * @description 鼠标移动事件。
  61199. * @param {Object} e - 事件。
  61200. */
  61201. mousemoveEvent(e) {
  61202. var pixel = e.point;
  61203. super.mousemoveEvent(pixel, e);
  61204. }
  61205. /**
  61206. * @function MapvRenderer.prototype.bindEvent
  61207. * @description 绑定事件。
  61208. */
  61209. bindEvent() {
  61210. var map = this.map;
  61211. if (this.options.methods) {
  61212. if (this.options.methods.click) {
  61213. map.on('click', this.clickEvent);
  61214. }
  61215. if (this.options.methods.mousemove) {
  61216. map.on('mousemove', this.mousemoveEvent);
  61217. }
  61218. }
  61219. }
  61220. /**
  61221. * @function MapvRenderer.prototype.unbindEvent
  61222. * @description 解绑事件。
  61223. */
  61224. unbindEvent() {
  61225. var map = this.map;
  61226. if (this.options.methods) {
  61227. if (this.options.methods.click) {
  61228. map.off('click', this.clickEvent);
  61229. }
  61230. if (this.options.methods.mousemove) {
  61231. map.off('mousemove', this.mousemoveEvent);
  61232. }
  61233. }
  61234. }
  61235. /**
  61236. * @function MapvRenderer.prototype.getContext
  61237. * @description 获取信息。
  61238. */
  61239. getContext() {
  61240. return this.canvasLayer.canvas.getContext(this.context);
  61241. }
  61242. /**
  61243. * @function MapvRenderer.prototype.addData
  61244. * @description 添加数据。
  61245. * @param {oject} data - 待添加的数据。
  61246. * @param {oject} options - 待添加的数据信息。
  61247. */
  61248. addData(data, options) {
  61249. var _data = data;
  61250. if (data && data.get) {
  61251. _data = data.get();
  61252. }
  61253. this.dataSet.add(_data);
  61254. this.update({
  61255. options: options
  61256. });
  61257. }
  61258. /**
  61259. * @function MapvRenderer.prototype.update
  61260. * @description 更新图层。
  61261. * @param {Object} opt - 待更新的数据。
  61262. * @param {Object} opt.data - mapv 数据集。
  61263. * @param {Object} opt.options - mapv 绘制参数。
  61264. */
  61265. update(opt) {
  61266. var update = opt || {};
  61267. var _data = update.data;
  61268. if (_data && _data.get) {
  61269. _data = _data.get();
  61270. }
  61271. if (_data != undefined) {
  61272. this.dataSet.set(_data);
  61273. }
  61274. super.update({
  61275. options: update.options
  61276. });
  61277. }
  61278. /**
  61279. * @function MapvRenderer.prototype.getData
  61280. * @description 获取数据。
  61281. */
  61282. getData() {
  61283. return this.dataSet;
  61284. }
  61285. /**
  61286. * @function MapvRenderer.prototype.removeData
  61287. * @description 删除符合过滤条件的数据。
  61288. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为true,表示删除该元素;否则表示不删除。
  61289. */
  61290. removeData(filter) {
  61291. if (!this.dataSet) {
  61292. return;
  61293. }
  61294. var newData = this.dataSet.get({
  61295. filter: function (data) {
  61296. return filter != null && typeof filter === 'function' ? !filter(data) : true;
  61297. }
  61298. });
  61299. this.dataSet.set(newData);
  61300. this.update({
  61301. options: null
  61302. });
  61303. }
  61304. /**
  61305. * @function MapVRenderer.prototype.clearData
  61306. * @description 清除数据。
  61307. */
  61308. clearData() {
  61309. this.dataSet && this.dataSet.clear();
  61310. this.update({
  61311. options: null
  61312. });
  61313. }
  61314. /**
  61315. * @function MapVRenderer.prototype.updateData
  61316. * @param {Object} dataSet - 数据集。
  61317. * @param {Object} options - 数据项配置。
  61318. * @description 更新数据。
  61319. */
  61320. updateData(dataSet, options) {
  61321. if (dataSet && dataSet.get) {
  61322. this.dataSet.set(dataSet.get());
  61323. }
  61324. this.update({
  61325. options: options
  61326. });
  61327. }
  61328. _canvasUpdate(time) {
  61329. var map = this.map;
  61330. if (!this.canvasLayer || this.stopAniamation) {
  61331. return;
  61332. }
  61333. var self = this;
  61334. var animationOptions = self.options.animation;
  61335. var context = this.getContext();
  61336. if (self.isEnabledTime()) {
  61337. if (time === undefined) {
  61338. this.clear(context);
  61339. return;
  61340. }
  61341. if (this.context === '2d') {
  61342. context.save();
  61343. context.globalCompositeOperation = 'destination-out';
  61344. context.fillStyle = 'rgba(0, 0, 0, .1)';
  61345. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  61346. context.restore();
  61347. }
  61348. } else {
  61349. this.clear(context);
  61350. }
  61351. if (this.context === '2d') {
  61352. for (var key in self.options) {
  61353. context[key] = self.options[key];
  61354. }
  61355. } else {
  61356. context.clear(context.COLOR_BUFFER_BIT);
  61357. }
  61358. if (
  61359. (self.options.minZoom && map.getZoom() < self.options.minZoom) ||
  61360. (self.options.maxZoom && map.getZoom() > self.options.maxZoom)
  61361. ) {
  61362. return;
  61363. }
  61364. var bounds = map.getBounds(),
  61365. dw = bounds.getEast() - bounds.getWest(),
  61366. dh = bounds.getNorth() - bounds.getSouth();
  61367. var resolutionX = dw / this.canvasLayer.canvas.width,
  61368. resolutionY = dh / this.canvasLayer.canvas.height;
  61369. // 一个像素是多少米
  61370. var zoomUnit = getMeterPerMapUnit('DEGREE') * resolutionX;
  61371. var center = map.getCenter();
  61372. var centerPx = map.project(center);
  61373. var dataGetOptions = {
  61374. transferCoordinate: function (coordinate) {
  61375. if (map.transform.rotationMatrix || self.context === '2d') {
  61376. var worldPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate[0], coordinate[1]));
  61377. return [worldPoint.x, worldPoint.y];
  61378. }
  61379. var pixel = [(coordinate[0] - center.lng) / resolutionX, (center.lat - coordinate[1]) / resolutionY];
  61380. return [pixel[0] + centerPx.x, pixel[1] + centerPx.y];
  61381. }
  61382. };
  61383. if (time !== undefined) {
  61384. dataGetOptions.filter = function (item) {
  61385. var trails = animationOptions.trails || 10;
  61386. return time && item.time > time - trails && item.time < time;
  61387. };
  61388. }
  61389. var data = self.dataSet.get(dataGetOptions);
  61390. this.processData(data);
  61391. // 兼容unit为'm'的情况
  61392. if (self.options.unit === 'm') {
  61393. if (self.options.size) {
  61394. self.options._size = self.options.size / zoomUnit;
  61395. }
  61396. if (self.options.width) {
  61397. self.options._width = self.options.width / zoomUnit;
  61398. }
  61399. if (self.options.height) {
  61400. self.options._height = self.options.height / zoomUnit;
  61401. }
  61402. } else {
  61403. self.options._size = self.options.size;
  61404. self.options._height = self.options.height;
  61405. self.options._width = self.options.width;
  61406. }
  61407. var worldPoint = map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  61408. this.drawContext(context, data, self.options, worldPoint);
  61409. self.options.updateCallback && self.options.updateCallback(time);
  61410. }
  61411. init(options) {
  61412. var self = this;
  61413. self.options = options;
  61414. this.initDataRange(options);
  61415. this.context = self.options.context || '2d';
  61416. if (self.options.zIndex) {
  61417. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  61418. }
  61419. this.initAnimator();
  61420. }
  61421. /**
  61422. * @function L.supermap.MapVRenderer.prototype.bindMapEvent
  61423. * @description 绑定鼠标移动事件。
  61424. */
  61425. bindMapEvent() {
  61426. this.mapEvent = {
  61427. resizeEvent: this.resizeEvent.bind(this),
  61428. zoomStartEvent: this.zoomStartEvent.bind(this),
  61429. zoomEndEvent: this.zoomEndEvent.bind(this),
  61430. rotateStartEvent: this.rotateStartEvent.bind(this),
  61431. rotateEvent: this.rotateEvent.bind(this),
  61432. moveStartEvent: this.moveStartEvent.bind(this),
  61433. rotateEndEvent: this.rotateEndEvent.bind(this),
  61434. moveEvent: this.moveEvent.bind(this),
  61435. moveEndEvent: this.moveEndEvent.bind(this),
  61436. removeEvent: this.removeEvent.bind(this)
  61437. }
  61438. this.map.on('resize', this.mapEvent.resizeEvent);
  61439. this.map.on('zoomstart', this.mapEvent.zoomStartEvent);
  61440. this.map.on('zoomend', this.mapEvent.zoomEndEvent);
  61441. this.map.on('rotatestart', this.mapEvent.rotateStartEvent);
  61442. this.map.on('rotate', this.mapEvent.rotateEvent);
  61443. this.map.on('rotateend', this.mapEvent.rotateEndEvent);
  61444. // this.map.on('dragend', this.dragEndEvent.bind(this));
  61445. this.map.on('movestart', this.mapEvent.moveStartEvent);
  61446. this.map.on('move', this.mapEvent.moveEvent);
  61447. this.map.on('moveend', this.mapEvent.moveEndEvent);
  61448. this.map.on('remove', this.mapEvent.removeEvent);
  61449. }
  61450. /**
  61451. * @function L.supermap.MapVRenderer.prototype.unbindMapEvent
  61452. * @description 解绑鼠标移动事件。
  61453. */
  61454. unbindMapEvent() {
  61455. this.map.off('resize', this.mapEvent.resizeEvent);
  61456. this.map.off('zoomstart', this.mapEvent.zoomStartEvent);
  61457. this.map.off('zoomend', this.mapEvent.zoomEndEvent);
  61458. this.map.off('rotatestart', this.mapEvent.rotateStartEvent);
  61459. this.map.off('rotate', this.mapEvent.rotateEvent);
  61460. this.map.off('rotateend', this.mapEvent.rotateEndEvent);
  61461. this.map.off('movestart', this.mapEvent.moveStartEvent);
  61462. this.map.off('move', this.mapEvent.moveEvent);
  61463. this.map.off('moveend', this.mapEvent.moveEndEvent);
  61464. this.map.off('remove', this.mapEvent.removeEvent);
  61465. }
  61466. /**
  61467. * @function L.supermap.MapVRenderer.prototype.destroy
  61468. * @description 释放资源。
  61469. */
  61470. destroy() {
  61471. this.unbindMapEvent();
  61472. this.unbindEvent();
  61473. this.clearData();
  61474. this.animator && this.animator.stop();
  61475. this.animator = null;
  61476. this.canvasLayer = null;
  61477. }
  61478. /**
  61479. * @function MapvRenderer.prototype.addAnimatorEvent
  61480. * @description 添加动画事件。
  61481. */
  61482. addAnimatorEvent() {}
  61483. /**
  61484. * @function MapvRenderer.prototype.removeEvent
  61485. * @description 移除事件。
  61486. */
  61487. removeEvent() {
  61488. this.canvasLayer.mapContainer.removeChild(this.canvasLayer.canvas);
  61489. }
  61490. /**
  61491. * @function MapvRenderer.prototype.resizeEvent
  61492. * @description 调整事件。
  61493. */
  61494. resizeEvent() {
  61495. this.canvasLayer.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  61496. var canvas = this.canvasLayer.canvas;
  61497. canvas.style.position = 'absolute';
  61498. canvas.style.top = 0 + 'px';
  61499. canvas.style.left = 0 + 'px';
  61500. var global$2 = typeof window === 'undefined' ? {} : window;
  61501. var devicePixelRatio = this.canvasLayer.devicePixelRatio = global$2.devicePixelRatio || 1;
  61502. canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio;
  61503. canvas.height = parseInt(this.map.getCanvas().style.height) * devicePixelRatio;
  61504. if (!this.canvasLayer.mapVOptions.context || this.canvasLayer.mapVOptions.context == '2d') {
  61505. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  61506. }
  61507. canvas.style.width = this.map.getCanvas().style.width;
  61508. canvas.style.height = this.map.getCanvas().style.height;
  61509. }
  61510. moveEndEvent() {
  61511. this.stopAniamation = false;
  61512. var canvas = this.getContext().canvas;
  61513. canvas.style.transform = '';
  61514. this._canvasUpdate();
  61515. if (this._expectShow === true) {
  61516. this._show();
  61517. }
  61518. }
  61519. moveStartEvent() {
  61520. this.startPitch = this.map.getPitch();
  61521. this.startBearing = this.map.getBearing();
  61522. var startMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  61523. this.startMoveX = startMovePoint.x;
  61524. this.startMoveY = startMovePoint.y;
  61525. if (this.animation) {
  61526. this.stopAniamation = true;
  61527. }
  61528. if (this.rotating || this.zooming) {
  61529. return;
  61530. }
  61531. this._expectShow = this.canvasLayer.canvas.style.display !== 'none';
  61532. if (this.map.getPitch() !== 0) {
  61533. this._hide();
  61534. }
  61535. }
  61536. moveEvent() {
  61537. this.canvasLayer.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  61538. var tPitch = this.map.getPitch() - this.startPitch;
  61539. var tBearing = -this.map.getBearing() + this.startBearing;
  61540. var endMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  61541. var tMoveX = endMovePoint.x - this.startMoveX;
  61542. var tMoveY = endMovePoint.y - this.startMoveY;
  61543. var canvas = this.getContext().canvas;
  61544. canvas.style.transform =
  61545. 'rotateX(' +
  61546. tPitch +
  61547. 'deg)' +
  61548. ' rotateZ(' +
  61549. tBearing +
  61550. 'deg)' +
  61551. ' translate3d(' +
  61552. tMoveX +
  61553. 'px, ' +
  61554. tMoveY +
  61555. 'px, 0px)';
  61556. }
  61557. zoomStartEvent() {
  61558. this.zooming = true;
  61559. this._hide();
  61560. }
  61561. zoomEndEvent() {
  61562. this.zooming = false;
  61563. }
  61564. rotateStartEvent() {
  61565. this.rotating = true;
  61566. if (this.map.getPitch() !== 0) {
  61567. this._hide();
  61568. }
  61569. }
  61570. rotateEvent() {
  61571. this.canvasLayer.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  61572. var tPitch = this.map.getPitch() - this.startPitch;
  61573. var tBearing = -this.map.getBearing() + this.startBearing;
  61574. var canvas = this.getContext().canvas;
  61575. canvas.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)';
  61576. }
  61577. rotateEndEvent() {
  61578. this.rotating = false;
  61579. }
  61580. /**
  61581. * @function MapvRenderer.prototype.clear
  61582. * @param {Object} context - 当前环境。
  61583. * @description 清除环境。
  61584. */
  61585. clear(context) {
  61586. context &&
  61587. context.clearRect &&
  61588. context.clearRect(
  61589. 0,
  61590. 0,
  61591. parseInt(this.map.getCanvas().style.width),
  61592. parseInt(this.map.getCanvas().style.height)
  61593. );
  61594. }
  61595. /**
  61596. * @function MapvRenderer.prototype.draw
  61597. * @description 渲染绘制。
  61598. */
  61599. draw() {
  61600. this._canvasUpdate();
  61601. }
  61602. _hide() {
  61603. this.canvasLayer.canvas.style.display = 'none';
  61604. }
  61605. _show() {
  61606. this.canvasLayer.canvas.style.display = 'block';
  61607. }
  61608. }
  61609. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/MapvLayer.js
  61610. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61611. * This program are made available under the terms of the Apache License, Version 2.0
  61612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61613. /**
  61614. * @class mapboxgl.supermap.MapvLayer
  61615. * @category Visualization MapV
  61616. * @classdesc Mapv 图层。
  61617. * @param {mapboxgl.Map} map - mapboxgl 地图对象,将在下个版本弃用,请用 map.addLayer() 方法添加图层。
  61618. * @param {Mapv.DataSet} dataSet - MapV 图层数据集。
  61619. * @param {Object} mapVOptions - Mapv 参数。
  61620. * @param {string} [mapVOptions.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("mapvLayer_") 创建专题图层 ID。
  61621. */
  61622. class MapvLayer {
  61623. constructor(map, dataSet, mapVOptions) {
  61624. this.map = map;
  61625. this.id = mapVOptions.layerID ? mapVOptions.layerID : Util.createUniqueID('mapvLayer_');
  61626. delete mapVOptions['layerID'];
  61627. this.mapVOptions = mapVOptions;
  61628. this.dataSet = dataSet;
  61629. this.visibility = true;
  61630. //保留之前的用法
  61631. if (this.map) {
  61632. this.map.addLayer(this);
  61633. }
  61634. }
  61635. onAdd(map) {
  61636. this.map = map;
  61637. this.renderer = new MapvRenderer(this.map, this, this.dataSet, this.mapVOptions);
  61638. this.canvas = this._createCanvas();
  61639. this.renderer._canvasUpdate();
  61640. this.mapContainer = map.getCanvasContainer();
  61641. this.mapContainer.appendChild(this.canvas);
  61642. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  61643. }
  61644. /**
  61645. * @function mapboxgl.supermap.MapvLayer.prototype.removeFromMap
  61646. * @description 移除图层。
  61647. */
  61648. removeFromMap() {
  61649. this.mapContainer.removeChild(this.canvas);
  61650. this.renderer.destroy();
  61651. }
  61652. /**
  61653. * @function mapboxgl.supermap.MapvLayer.prototype.setVisibility
  61654. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  61655. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  61656. */
  61657. setVisibility(visibility) {
  61658. if (visibility !== this.visibility) {
  61659. this.visibility = visibility;
  61660. if (visibility) {
  61661. this.show();
  61662. } else {
  61663. this.hide();
  61664. }
  61665. }
  61666. }
  61667. /**
  61668. * @function mapboxgl.supermap.MapvLayer.prototype.moveTo
  61669. * @description 将图层移动到某个图层之前。
  61670. * @param {string} layerID - 待插入的图层 ID。
  61671. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  61672. */
  61673. moveTo(layerID, before) {
  61674. const layer = document.getElementById(this.canvas.id);
  61675. before = before !== undefined ? before : true;
  61676. if (before) {
  61677. const beforeLayer = document.getElementById(layerID);
  61678. if (layer && beforeLayer) {
  61679. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  61680. }
  61681. return;
  61682. }
  61683. const nextLayer = document.getElementById(layerID);
  61684. if (layer) {
  61685. if (nextLayer.nextSibling) {
  61686. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  61687. return;
  61688. }
  61689. nextLayer.parentNode.appendChild(layer);
  61690. }
  61691. }
  61692. /**
  61693. * @function mapboxgl.supermap.MapvLayer.prototype.getTopLeft
  61694. * @description 获取左上的距离。
  61695. */
  61696. getTopLeft() {
  61697. var map = this.map;
  61698. var topLeft;
  61699. if (map) {
  61700. var bounds = map.getBounds();
  61701. topLeft = bounds.getNorthWest();
  61702. }
  61703. return topLeft;
  61704. }
  61705. /**
  61706. * @function mapboxgl.supermap.MapvLayer.prototype.addData
  61707. * @description 追加数据。
  61708. * @param {Object} data - 要追加的数据。
  61709. * @param {Object} options - 要追加的值。
  61710. */
  61711. addData(data, options) {
  61712. this.renderer.addData(data, options);
  61713. }
  61714. /**
  61715. * @function mapboxgl.supermap.MapvLayer.prototype.update
  61716. * @description 更新图层。
  61717. * @param {Object} opt - 待更新的数据。
  61718. * @param {Object} opt.data - mapv 数据集。
  61719. * @param {Object} opt.options - mapv 绘制参数。
  61720. */
  61721. update(opt) {
  61722. this.renderer.update(opt);
  61723. }
  61724. /**
  61725. * @function mapboxgl.supermap.MapvLayer.prototype.getData
  61726. * @description 获取数据。
  61727. * @returns {mapv.DataSet} mapv 数据集。
  61728. */
  61729. getData() {
  61730. if (this.renderer) {
  61731. this.dataSet = this.renderer.getData();
  61732. }
  61733. return this.dataSet;
  61734. }
  61735. /**
  61736. * @function mapboxgl.supermap.MapvLayer.prototype.removeData
  61737. * @description 删除符合过滤条件的数据。
  61738. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  61739. * @example
  61740. * filter=function(data){
  61741. * if(data.id=="1"){
  61742. * return true
  61743. * }
  61744. * return false;
  61745. * }
  61746. */
  61747. removeData(filter) {
  61748. this.renderer && this.renderer.removeData(filter);
  61749. }
  61750. /**
  61751. * @function mapboxgl.supermap.MapvLayer.prototype.clearData
  61752. * @description 清除数据。
  61753. */
  61754. clearData() {
  61755. this.renderer.clearData();
  61756. }
  61757. show() {
  61758. if (this.renderer) {
  61759. this.renderer._show();
  61760. }
  61761. return this;
  61762. }
  61763. hide() {
  61764. if (this.renderer) {
  61765. this.renderer._hide();
  61766. }
  61767. return this;
  61768. }
  61769. _createCanvas() {
  61770. var canvas = document.createElement('canvas');
  61771. canvas.id = this.id;
  61772. canvas.style.position = 'absolute';
  61773. canvas.style.top = 0 + 'px';
  61774. canvas.style.left = 0 + 'px';
  61775. var global$2 = typeof window === 'undefined' ? {} : window;
  61776. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  61777. canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio;
  61778. canvas.height = parseInt(this.map.getCanvas().style.height) * devicePixelRatio;
  61779. if (!this.mapVOptions.context || this.mapVOptions.context == '2d') {
  61780. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  61781. }
  61782. canvas.style.width = this.map.getCanvas().style.width;
  61783. canvas.style.height = this.map.getCanvas().style.height;
  61784. return canvas;
  61785. }
  61786. /**
  61787. * @function mapboxgl.supermap.MapvLayer.prototype.setZIndex
  61788. * @description 设置 canvas 层级。
  61789. * @param {number} zIndex - canvas 层级。
  61790. */
  61791. setZIndex(z) {
  61792. this.canvas.style.zIndex = z;
  61793. }
  61794. }
  61795. (external_mapboxgl_default()).supermap.MapvLayer = MapvLayer;
  61796. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/Theme3DLayer.js
  61797. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61798. * This program are made available under the terms of the Apache License, Version 2.0
  61799. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61800. /**
  61801. * @class mapboxgl.supermap.Theme3DLayer
  61802. * @category Visualization Theme
  61803. * @classdesc 三维专题图基类,不能直接实例化。
  61804. * @param {string} [id] - 专题图图层 id。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  61805. * @param {Object} layerOptions -专题图图层配置项。
  61806. * @param {number} [layerOptions.opacity=1] - 图层透明度。
  61807. * @param {boolean} [layerOptions.parseNumber=fasle] - 是否预处理数据,将数据转换为 number。
  61808. * @param {boolean} [layerOptions.enableHighlight=false] - 是否开启高亮。
  61809. * @param {string} [layerOptions.highlight="#ADA91E"] - 高亮颜色。
  61810. * @param {string} [layerOptions.baseHeightField] - 数据中表示基础高度的字段。
  61811. * @param {number} [layerOptions.height] - 高度。如果数据指定的 heightField (为height)没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  61812. * @param {string} [layerOptions.heightField] - 数据中表示高度的字段。
  61813. * @param {string} [layerOptions.themeField] - 专题展示的字段。
  61814. * @param {boolean} [playerOptions.showLegend=true] - 是否显示图例。
  61815. * @param {string} [layerOptions.legendTitle] - 图例标题。
  61816. * @param {string} [layerOptions.legendTheme='light'] - 图例主题,取值:'light','dark'。
  61817. * @param {string} [layerOptions.legendOrientation='horizontal'] - 图例方向,取值:'horizontal','vertical'。
  61818. * @param {string} [layerOptions.legendPosition] - 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  61819. */
  61820. class Theme3DLayer {
  61821. constructor(id, layerOptions) {
  61822. /**
  61823. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.id
  61824. * @description Mapbox GL 图层 id。
  61825. */
  61826. this.id = id;
  61827. /**
  61828. * @member {Object} mapboxgl.supermap.Theme3DLayer.prototype.map
  61829. * @description Mapbox GL 地图对象。
  61830. */
  61831. this.map = null;
  61832. /**
  61833. * @member {number} [mapboxgl.supermap.Theme3DLayer.prototype.opacity=1]
  61834. * @description 图层透明度。
  61835. */
  61836. this.opacity = 1;
  61837. /**
  61838. * @member {boolean} [mapboxgl.supermap.Theme3DLayer.prototype.parseNumber=false]
  61839. * @description 是否进行数据预处理,有些字段是 string 类型,需要转换为 number。
  61840. */
  61841. this.parseNumber = false;
  61842. /**
  61843. * @member {boolean} [mapboxgl.supermap.Theme3DLayer.prototype.enableHighlight=false]
  61844. * @description 是否开启高亮。
  61845. */
  61846. this.enableHighlight = false;
  61847. /**
  61848. * @member {Object} [mapboxgl.supermap.Theme3DLayer.prototype.highlight={color: "#ADA91E"}]
  61849. * @description 高亮相关配置。
  61850. */
  61851. this.highlight = {color: "#ADA91E"};
  61852. /**
  61853. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.baseHeightField
  61854. * @description 数据中表示基础高度的字段。
  61855. */
  61856. this.baseHeightField = null;
  61857. /**
  61858. * @member {number} mapboxgl.supermap.Theme3DLayer.prototype.height
  61859. * @description 高度。如果数据指定的 heightField (默认 height) 没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  61860. */
  61861. this.height = null;
  61862. /**
  61863. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.heightField
  61864. * @description 数据中表示高度的字段。
  61865. */
  61866. this.heightField = 'height';
  61867. /**
  61868. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.themeField]
  61869. * @description 专题展示的字段。
  61870. */
  61871. this.themeField = this.heightField;
  61872. /**
  61873. * @member {boolean} [mapboxgl.supermap.Theme3DLayer.prototype.showLegend=true]
  61874. * @description 是否显示图例。
  61875. */
  61876. this.showLegend = true;
  61877. /**
  61878. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.legendTitle]
  61879. * @description 图例标题。
  61880. */
  61881. this.legendTitle = null;
  61882. /**
  61883. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.legendTheme='light']
  61884. * @description 图例主题,取值:'light','dark'。
  61885. * @default 'light'
  61886. */
  61887. this.legendTheme = 'light';
  61888. /**
  61889. * @member {string} [mapboxgl.supermap.Theme3DLayer.prototype.legendOrientation='horizontal']
  61890. * @description 图例方向,取值:'horizontal','vertical'。
  61891. * @default 'horizontal'
  61892. */
  61893. this.legendOrientation = 'horizontal';
  61894. /**
  61895. * @member {string} mapboxgl.supermap.Theme3DLayer.prototype.legendPosition
  61896. * @description 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  61897. * @default 'bottom-right'
  61898. */
  61899. this.legendPosition = 'bottom-right';
  61900. this._highlightLayerId = `${this.id}-highlightLayer`;
  61901. this._extend(this, layerOptions);
  61902. }
  61903. /**
  61904. * @function mapboxgl.supermap.Theme3DLayer.prototype.setLayerOptions
  61905. * @description 设置图层相关参数。
  61906. * @param {Object} layerOptions - 该专题图图层相关参数。
  61907. * @param {number} [layerOptions.opacity=1] - 图层透明度。
  61908. * @param {boolean} [layerOptions.parseNumber=false] - 是否预处理数据,将数据转换为 number。
  61909. * @param {string} [layerOptions.baseHeightField] - 数据中表示基础高度的字段
  61910. * @param {number} [layerOptions.height] - 高度。如果数据指定的heightField(默认height)没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  61911. * @param {string} [layerOptions.heightField] - 数据中表示高度的字段。
  61912. * @param {string} [layerOptions.themeField] - 专题展示的字段。
  61913. * @param {boolean} [layerOptions.showLegend=true] - 是否显示图例。
  61914. * @param {string} layerOptions.legendTitle - 图例标题。
  61915. * @param {string} [layerOptions.legendTheme='light'] - 图例主题,取值:'light','dark'。
  61916. * @param {string} [layerOptions.legendOrientation='horizontal'] - 图例方向,取值:'horizontal','vertical'。
  61917. * @param {string} [layerOptions.legendPosition] - 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'。
  61918. * @returns {this}
  61919. */
  61920. setLayerOptions(layerOptions) {
  61921. this._extend(this, layerOptions);
  61922. return this;
  61923. }
  61924. /**
  61925. * @function mapboxgl.supermap.Theme3DLayer.prototype.setHighlightStyleOptions
  61926. * @description 设置图层高亮相关参数。
  61927. * @param {Object} highlightOptions - 该专题图图层高亮相关参数。
  61928. * @param {string} [highlightOptions.color] - 颜色。
  61929. * @param {function} highlightOptions.callback - 回调,返回数据参数(data,event)。
  61930. * @returns {this}
  61931. */
  61932. setHighlightStyleOptions(highlightOptions) {
  61933. this._extend(this.highlight, highlightOptions);
  61934. return this;
  61935. }
  61936. /**
  61937. * @function mapboxgl.supermap.Theme3DLayer.prototype.setData
  61938. * @description 设置数据,数据格式必须为 GeoJSON 格式。
  61939. * @param {GeoJSONObject} data - GeoJSON 格式数据。
  61940. * @param {boolean} [parseNumber=false] - 是否进行数据预处理,有些字段是 string 类型,需要转换为 number。
  61941. */
  61942. setData(data, parseNumber) {
  61943. var me = this;
  61944. me.data = data;
  61945. if (parseNumber != null) {
  61946. me.parseNumber = parseNumber;
  61947. }
  61948. me.parseNumber && me.data && me.data.features && me.data.features.map(function (val) {
  61949. if (me.baseHeightField && val.properties[me.baseHeightField]) {
  61950. val.properties[me.baseHeightField] = parseFloat(val.properties[me.baseHeightField]);
  61951. }
  61952. if (me.heightField && val.properties[me.heightField]) {
  61953. val.properties[me.heightField] = parseFloat(val.properties[me.heightField]);
  61954. }
  61955. return val;
  61956. });
  61957. return this;
  61958. }
  61959. /**
  61960. * @function mapboxgl.supermap.Theme3DLayer.prototype.getData
  61961. * @description 获取数据。
  61962. * @returns {GeoJSONObject} 获取的数据。
  61963. */
  61964. getData() {
  61965. return this.data;
  61966. }
  61967. /**
  61968. * @function mapboxgl.supermap.Theme3DLayer.prototype.addTo
  61969. * @description 添加图层到地图上。
  61970. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  61971. * @returns {this} this 对象。
  61972. */
  61973. addTo(map) {
  61974. this.map = map;
  61975. if (!this.map) {
  61976. return this;
  61977. }
  61978. this.show();
  61979. return this;
  61980. }
  61981. /**
  61982. * @function mapboxgl.supermap.Theme3DLayer.prototype.show
  61983. * @description 显示图层。
  61984. * @param {Object} options - 图层配置项。
  61985. * @returns {this} this 对象。
  61986. */
  61987. show(options) {
  61988. this._extend(this, options);
  61989. this._addLayer();
  61990. if (this.enableHighlight) {
  61991. this._addHighLightLayer();
  61992. }
  61993. if (this.showLegend) {
  61994. if (!this.legend) {
  61995. this.legend = this._createLegendControl();
  61996. }
  61997. this.map.addControl(this.legend, this.legendPosition);
  61998. }
  61999. return this;
  62000. }
  62001. /**
  62002. * @function mapboxgl.supermap.Theme3DLayer.prototype.remove
  62003. * @description 从地图上移除图层。
  62004. * @returns {this} this 对象。
  62005. */
  62006. remove() {
  62007. if (!this.map) {
  62008. return this;
  62009. }
  62010. //移除图层
  62011. var layerId = this.id ? this.id : "theme3DLayer";
  62012. if (this.map.getLayer(layerId)) {
  62013. this.map.off('mousemove', layerId, this._onMouseMove.bind(this));
  62014. this.map.on('mouseout', layerId, this._onMouseMove.bind(this));
  62015. this.map.removeLayer(layerId);
  62016. }
  62017. //移除高亮图层
  62018. if (this.map.getLayer(this._highlightLayerId)) {
  62019. this._selectFeatureId = null;
  62020. this.map.removeLayer(this._highlightLayerId );
  62021. }
  62022. //移除图例
  62023. if (this.legend) {
  62024. this.map.removeControl(this.legend);
  62025. }
  62026. return this;
  62027. }
  62028. /**
  62029. * @function mapboxgl.supermap.Theme3DLayer.prototype.getLayerStyleOptions
  62030. * @description 获取图层样式。
  62031. * @returns {Object} Mapbox GL 样式对象。
  62032. */
  62033. getLayerStyleOptions() {
  62034. //子类重写实现
  62035. }
  62036. /**
  62037. * @function mapboxgl.supermap.Theme3DLayer.prototype.getHighlightStyleOptions
  62038. * @description 获取高亮样式,子类重写实现。
  62039. * @returns {Object} Mapbox GL 样式对象。
  62040. */
  62041. getHighlightStyleOptions() {
  62042. //子类重写实现
  62043. }
  62044. _createLegendControl(html) {
  62045. var me = this;
  62046. function LegendControl() {
  62047. }
  62048. LegendControl.prototype.onAdd = function (map) {
  62049. this._map = map;
  62050. this._container = document.createElement('div');
  62051. var className = 'mapboxgl-ctrl legend ';
  62052. var theme = 'legend-light';
  62053. if (me.legendTheme === 'dark') {
  62054. theme = 'legend-dark';
  62055. }
  62056. var orientation = ' legend-horizontal';
  62057. if (me.legendOrientation === 'vertical') {
  62058. orientation = ' legend-vertical';
  62059. }
  62060. this._container.className = className + theme + orientation;
  62061. if (html) {
  62062. this._container.innerHTML = html;
  62063. } else {
  62064. var legendTitle = me.legendTitle || "";
  62065. var titleElement = " <div class='legend-title'>" + legendTitle + "</div>";
  62066. var content = me._createLegendElement.call(me) || "";
  62067. var contentElement = "<div class='legend-content'>" + content + "</div>";
  62068. this._container.innerHTML = titleElement + contentElement;
  62069. }
  62070. me._appendLegendCSSStyle();
  62071. return this._container;
  62072. };
  62073. LegendControl.prototype.onRemove = function () {
  62074. this._container.parentNode.removeChild(this._container);
  62075. this._map = undefined;
  62076. };
  62077. return new LegendControl();
  62078. }
  62079. _createLegendElement() {
  62080. //子类实现
  62081. }
  62082. _addLayer() {
  62083. var paintOptions = this.getLayerStyleOptions();
  62084. var id = this.id ? this.id : "theme3DLayer";
  62085. var sourceId = this.sourceId = id + 'Source';
  62086. if (!this.map.getSource(sourceId)) {
  62087. this.map.addSource(sourceId, {
  62088. 'type': 'geojson',
  62089. 'data': this.data
  62090. });
  62091. } else {
  62092. this.map.removeSource(sourceId);
  62093. this.map.addSource(sourceId, {
  62094. 'type': 'geojson',
  62095. 'data': this.data
  62096. });
  62097. }
  62098. this.map.addLayer({
  62099. 'id': id,
  62100. 'type': 'fill-extrusion',
  62101. 'source': sourceId,
  62102. 'paint': paintOptions
  62103. });
  62104. this.map.moveLayer(id);
  62105. }
  62106. //添加高亮图层
  62107. _addHighLightLayer() {
  62108. if (!this.map) {
  62109. return;
  62110. }
  62111. var map = this.map;
  62112. map.addLayer({
  62113. 'id': this._highlightLayerId,
  62114. 'type': 'fill-extrusion',
  62115. 'source': this.sourceId,
  62116. 'paint': this.getHighlightStyleOptions(),
  62117. "filter": ["in", "$id", ""]
  62118. });
  62119. this._selectFeatureId = null;
  62120. map.on('mousemove', this.id, this._onMouseMove.bind(this));
  62121. map.on('mouseout', this.id, this._onMouseMove.bind(this));
  62122. }
  62123. _onMouseMove(e) {
  62124. var me = this, map = this.map;
  62125. var features = map.queryRenderedFeatures(e.point, {layers: [me.id]});
  62126. if (me.highlight && me.highlight.callback) {
  62127. me.highlight.callback(features, e);
  62128. }
  62129. if (!features || features.length < 1) {
  62130. me._clearHighlight.call(me);
  62131. me._selectFeatureId = null;
  62132. return;
  62133. }
  62134. var id = features[0].id;
  62135. if (me._selectFeatureId === id) {
  62136. return;
  62137. }
  62138. me._selectFeatureId = id;
  62139. map.setFilter(me._highlightLayerId, ['==', '$id', me._selectFeatureId]);
  62140. }
  62141. _clearHighlight() {
  62142. if (this.map) {
  62143. this.map.setFilter(this._highlightLayerId, ["in", "$id", ""]);
  62144. }
  62145. }
  62146. _appendLegendCSSStyle() {
  62147. var legendStyle = document.createElement('style');
  62148. legendStyle.type = 'text/css';
  62149. var baseStyle = `
  62150. .legend {
  62151. display: inline-block;
  62152. border-radius: 2px;
  62153. -moz-border-radius: 2px;
  62154. -webkit-border-radius: 2px;
  62155. font-size: 12px;
  62156. color: rgba(0, 0, 0, 0.8);
  62157. background-color: rgb(255, 255, 255);
  62158. }
  62159. .legend-light {
  62160. color: rgba(0, 0, 0, 0.8);
  62161. background-color: rgb(255, 255, 255);
  62162. box-shadow: 0px 0px 6px #bbbbbb;
  62163. -moz-box-shadow: 0px 6px 10px #bbbbbb;
  62164. -webkit-box-shadow: 0px 0px 6px #bbbbbb;
  62165. }
  62166. .legend-dark {
  62167. color: rgba(255, 255, 255, 0.8);
  62168. background-color: rgb(64, 64, 64);
  62169. }
  62170. .legend .legend-title {
  62171. min-height: 14px;
  62172. max-width: 500px;
  62173. padding:6px 10px;
  62174. }
  62175. .legend-light .legend-title {
  62176. color: rgba(0, 0, 0, 0.8);
  62177. }
  62178. .legend-dark .legend-title {
  62179. color: rgba(255, 255, 255, 0.8);
  62180. }
  62181. .legend-content{
  62182. padding:6px 10px;
  62183. }
  62184. `;
  62185. legendStyle.innerHTML = baseStyle + this._legendCSSStyle();
  62186. document.getElementsByTagName('head')[0].appendChild(legendStyle);
  62187. }
  62188. //各种图层对应的自己的图例的样式
  62189. _legendCSSStyle() {
  62190. //子类可重写实现
  62191. return `
  62192. .legend ul {
  62193. padding: 0;
  62194. margin: 0 16px;
  62195. height: 100%;
  62196. display: block;
  62197. list-style: none;
  62198. }
  62199. .legend li {
  62200. vertical-align: middle;
  62201. }
  62202. .legend li span:first-child {
  62203. vertical-align: middle;
  62204. }
  62205. .legend li span:last-child {
  62206. line-height: 28px;
  62207. max-width: 200px;
  62208. vertical-align: middle;
  62209. white-space: nowrap;
  62210. overflow: hidden;
  62211. text-overflow: ellipsis;
  62212. -ms-text-overflow: ellipsis;
  62213. }
  62214. .legend-vertical li {
  62215. height: 28px;
  62216. }
  62217. .legend-vertical li span:first-child {
  62218. display: inline-block;
  62219. width: 60px;
  62220. height: 100%;
  62221. }
  62222. .legend-vertical li span:last-child {
  62223. display: inline-block;
  62224. margin-left: 16px;
  62225. height: 100%;
  62226. }
  62227. .legend-horizontal li {
  62228. height: 56px;
  62229. float: left;
  62230. }
  62231. .legend-horizontal li span:first-child {
  62232. display: block;
  62233. width: 100%;
  62234. height: 50%;
  62235. }
  62236. .legend-horizontal li span:last-child {
  62237. display: block;
  62238. vertical-align: middle;
  62239. width: 60px;
  62240. height: 50%;
  62241. text-align: center;
  62242. }
  62243. `;
  62244. }
  62245. _extend(dest) {
  62246. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  62247. var arg = Object.getOwnPropertyNames(arguments)[index];
  62248. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  62249. continue;
  62250. }
  62251. var obj = arguments[arg];
  62252. if (obj) {
  62253. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  62254. var key = Object.getOwnPropertyNames(obj)[j];
  62255. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  62256. continue;
  62257. }
  62258. dest[key] = obj[key];
  62259. }
  62260. }
  62261. }
  62262. return dest;
  62263. }
  62264. }
  62265. (external_mapboxgl_default()).supermap.Theme3DLayer = Theme3DLayer;
  62266. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/RangeTheme3DLayer.js
  62267. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62268. * This program are made available under the terms of the Apache License, Version 2.0
  62269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62270. /**
  62271. * @class mapboxgl.supermap.RangeTheme3DLayer
  62272. * @category Visualization Theme
  62273. * @classdesc 三维分段专题图。
  62274. * @param {string} [id] - 专题图图层 id。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  62275. * @param {Object} layerOptions - 专题图图层配置项,参数继承自 Theme3DLayer。
  62276. * @param {Array} [layerOptions.heightStops] - 新增参数,数据高度分段数组。
  62277. * @param {Array} layerOptions.colorStops - 新增参数,数据颜色分段数组。
  62278. * @param {number} [layerOptions.base] - 新增参数,数据分段线性增量。
  62279. * @param {number} [layerOptions.legendRatio=1] - 新增参数,图例数值扩大系数。
  62280. * @example
  62281. * new mapboxgl.supermap.RangeTheme3DLayer(layerId, map, {
  62282. * enableHighlight:true,
  62283. * // 设置分段
  62284. * heightField: "floor",
  62285. * heightStops: [[1, 10], [10, 100]],
  62286. * 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)']],
  62287. * // 显示图例
  62288. * showLegend: true,
  62289. * legendTheme: 'dark',
  62290. * legendTitle: "图例"
  62291. * });
  62292. */
  62293. class RangeTheme3DLayer extends Theme3DLayer {
  62294. constructor(id, layerOptions) {
  62295. super(id, layerOptions);
  62296. /**
  62297. * @member {Array} mapboxgl.supermap.RangeTheme3DLayer.prototype.heightStops
  62298. * @description 数据高度分段数组。
  62299. */
  62300. this.heightStops = null;
  62301. /**
  62302. * @member {Array} mapboxgl.supermap.RangeTheme3DLayer.prototype.colorStops
  62303. * @description 数据颜色分段数组。
  62304. */
  62305. this.colorStops = null;
  62306. /**
  62307. * @member {number} mapboxgl.supermap.RangeTheme3DLayer.prototype.base
  62308. * @description 数据分段线性增量。
  62309. */
  62310. this.base = null;
  62311. /**
  62312. * @member {number} [mapboxgl.supermap.RangeTheme3DLayer.prototype.legendRatio=1]
  62313. * @description 图例数值扩大系数。
  62314. */
  62315. this.legendRatio = 1;
  62316. this._extend(this, layerOptions);
  62317. }
  62318. /**
  62319. * @function mapboxgl.supermap.RangeTheme3DLayer.prototype.getLayerStyleOptions
  62320. * @description 获取图层样式。
  62321. * @returns {Object} Mapbox GL 样式对象。
  62322. */
  62323. getLayerStyleOptions() {
  62324. var opacity = this.opacity == null ? 1 : this.opacity;
  62325. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  62326. var reg = /^[0-9]+.?[0-9]*$/;
  62327. var options = {
  62328. 'fill-extrusion-color': {
  62329. 'stops': this.colorStops,
  62330. 'property': this.themeField || this.heightField,
  62331. 'type': 'interval',
  62332. 'base': reg.test(this.base) ? this.base : 1
  62333. },
  62334. 'fill-extrusion-opacity': opacity
  62335. };
  62336. if (this.heightStops) {
  62337. options['fill-extrusion-height'] = {
  62338. 'stops': this.heightStops,
  62339. 'property': this.heightField || 'height',
  62340. 'base': reg.test(this.base) ? this.base : 1
  62341. }
  62342. } else if (this.height) {
  62343. options['fill-extrusion-height'] = this.height;
  62344. } else {
  62345. options['fill-extrusion-height'] = {
  62346. 'property': this.heightField || 'height',
  62347. 'type': 'identity'
  62348. }
  62349. }
  62350. if (this.baseHeightField) {
  62351. options['fill-extrusion-base'] = {
  62352. 'property': this.baseHeightField,
  62353. 'type': 'identity'
  62354. }
  62355. }
  62356. return options;
  62357. }
  62358. /**
  62359. * @function mapboxgl.supermap.RangeTheme3DLayer.prototype.getHighlightStyleOptions
  62360. * @description 获取高亮样式。
  62361. * @returns {Object} mapboxgl 样式对象。
  62362. */
  62363. getHighlightStyleOptions() {
  62364. var color = (this.highlight && this.highlight.color != null) ? this.highlight.color : '#ADA91E';
  62365. return {
  62366. 'fill-extrusion-color': color,
  62367. 'fill-extrusion-height': {
  62368. "stops": this.heightStops,
  62369. "property": this.heightField
  62370. },
  62371. 'fill-extrusion-opacity': this.highlight && this.highlight.opacity || 0.6
  62372. }
  62373. }
  62374. _createLegendElement() {
  62375. var len = this.colorStops && this.colorStops.length || 0;
  62376. //颜色分段对应标识
  62377. var legendListElement = "<ul>";
  62378. var i;
  62379. for (i = 0; i < len; i++) {
  62380. var value = this.colorStops[i][0];
  62381. var text = this._getWrapperText(value);
  62382. if (i === len - 1) {
  62383. text = "> " + text;
  62384. } else {
  62385. var next = this._getWrapperText(this.colorStops[i + 1][0]);
  62386. text = text + "-" + next;
  62387. }
  62388. var color = this.colorStops[i][1];
  62389. legendListElement += "<li><span style='background-color:" + color + ";'></span><span>" + text + "</span></li>";
  62390. }
  62391. legendListElement += "</ul>";
  62392. return legendListElement;
  62393. }
  62394. _getWrapperText(number) {
  62395. var value = number * ((this.legendRatio == null) ? 1 : parseFloat(this.legendRatio));
  62396. //单个颜色值宽度为60px,最大只能完全显示1000000,否则就超出宽度,则显示以为k计数单位的值
  62397. var num = parseFloat(value);
  62398. if (num % 1000000 <= 1000000) {
  62399. return num.toString();
  62400. }
  62401. return parseInt(num / 1000) + 'k'
  62402. }
  62403. }
  62404. (external_mapboxgl_default()).supermap.RangeTheme3DLayer = RangeTheme3DLayer;
  62405. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/RangeThemeLayer.js
  62406. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62407. * This program are made available under the terms of the Apache License, Version 2.0
  62408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62409. /**
  62410. * @class mapboxgl.supermap.RangeThemeLayer
  62411. * @category Visualization Theme
  62412. * @classdesc 分段专题图层。
  62413. * @param {string} name - 图层名。
  62414. * @param {Object} options - 参数。
  62415. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  62416. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
  62417. * @param {mapboxgl.Map} options.map - 当前 Mapbox GL map 对象。
  62418. * @param {number} [options.opacity=1] - 图层透明度。
  62419. * @param {string} options.themeField - 指定创建专题图字段。
  62420. * @param {Object} options.style - 专题图样式。
  62421. * @param {Object} options.styleGroups - 各专题类型样式组。
  62422. * @param {boolean} [options.isHoverAble=false] - 是否开启 hover 事件。
  62423. * @param {Object} [options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  62424. * @extends {mapboxgl.supermap.GeoFeatureThemeLayer}
  62425. */
  62426. class Range extends GeoFeature {
  62427. constructor(name, opt_options) {
  62428. super(name, opt_options);
  62429. this.style = opt_options.style;
  62430. this.isHoverAble = opt_options.isHoverAble;
  62431. this.highlightStyle = opt_options.highlightStyle;
  62432. this.themeField = opt_options.themeField;
  62433. this.styleGroups = opt_options.styleGroups;
  62434. }
  62435. /**
  62436. * @function mapboxgl.supermap.RangeThemeLayer.prototype.createThematicFeature
  62437. * @description 创建专题图要素。
  62438. * @param {Object} feature - 要创建的专题图形要素。
  62439. */
  62440. createThematicFeature(feature) {
  62441. //赋 style
  62442. var style = this.getStyleByData(feature);
  62443. //创建专题要素时的可选参数
  62444. var options = {};
  62445. options.nodesClipPixel = this.nodesClipPixel;
  62446. options.isHoverAble = this.isHoverAble;
  62447. options.isMultiHover = this.isMultiHover;
  62448. options.isClickAble = this.isClickAble;
  62449. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  62450. //将数据转为专题要素(Vector)
  62451. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  62452. //直接添加图形到渲染器
  62453. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  62454. this.renderer.addShape(thematicFeature.shapes[m]);
  62455. }
  62456. return thematicFeature;
  62457. }
  62458. /**
  62459. * @private
  62460. * @function mapboxgl.supermap.RangeThemeLayer.prototype.getStyleByData
  62461. * @description 通过数据获取 style。
  62462. * @param {Object} fea - 要素数据。
  62463. */
  62464. getStyleByData(fea) {
  62465. var style = {};
  62466. var feature = fea;
  62467. style = Util.copyAttributesWithClip(style, this.style);
  62468. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  62469. var Sf = this.themeField;
  62470. var Attrs = feature.attributes;
  62471. var Gro = this.styleGroups;
  62472. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  62473. var attr = null; //属性值
  62474. for (var property in Attrs) {
  62475. if (Sf === property) {
  62476. isSfInAttrs = true;
  62477. attr = Attrs[property];
  62478. break;
  62479. }
  62480. }
  62481. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  62482. if (isSfInAttrs) {
  62483. for (var i = 0, len = Gro.length; i < len; i++) {
  62484. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  62485. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  62486. var sty1 = Gro[i].style;
  62487. style = Util.copyAttributesWithClip(style, sty1);
  62488. }
  62489. }
  62490. }
  62491. }
  62492. if (feature.style && this.isAllowFeatureStyle === true) {
  62493. style = Util.copyAttributesWithClip(feature.style);
  62494. }
  62495. return style;
  62496. }
  62497. }
  62498. (external_mapboxgl_default()).supermap.RangeThemeLayer = Range;
  62499. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/RankSymbolThemeLayer.js
  62500. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62501. * This program are made available under the terms of the Apache License, Version 2.0
  62502. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62503. /**
  62504. * @class mapboxgl.supermap.RankSymbolThemeLayer
  62505. * @category Visualization Theme
  62506. * @classdesc 等级符号专题图层。
  62507. * @param {string} name - 图层名。
  62508. * @param {string} symbolType - 符号类型。
  62509. * @param {Object} opt_options - 参数。
  62510. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  62511. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  62512. * @param {mapboxgl.Map} opt_options.map - 当前 mapboxgl map 对象。
  62513. * @param {number} [opt_options.opacity=1] - 图层透明度。
  62514. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  62515. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  62516. * @param {string} [opt_options.chartsType] - 图表类型。目前可用:"Bar", "Line", "Pie"。
  62517. * @param {Object} [opt_options.symbolSetting] - 各类型图表的 symbolSetting 对象可设属性请参考具体图表模型类的注释中对 symbolSetting 对象可设属性的描述。symbolSetting 对象通常都具有以下 5 个基础可设属性:
  62518. * @param {number} [opt_options.symbolSetting.width] - 专题要素(图表)宽度。
  62519. * @param {number} [opt_options.symbolSetting.height] - 专题要素(图表)高度。
  62520. * @param {Array.<number>} opt_options.symbolSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  62521. * @param {number} [opt_options.symbolSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  62522. * @param {number} [opt_options.symbolSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  62523. * @param {Array.<number>} opt_options.symbolSetting.dataViewBoxParameter - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  62524. * @param {number} opt_options.symbolSetting.decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  62525. * @extends {mapboxgl.supermap.GraphThemeLayer}
  62526. */
  62527. class RankSymbolThemeLayer_RankSymbol extends GraphThemeLayer_Graph {
  62528. constructor(name, symbolType, opt_options) {
  62529. super(name, symbolType, opt_options);
  62530. this.symbolType = symbolType;
  62531. this.symbolSetting = opt_options.symbolSetting;
  62532. this.themeField = opt_options.themeField;
  62533. }
  62534. /**
  62535. * @function mapboxgl.supermap.RankSymbolThemeLayer.prototype.setSymbolType
  62536. * @description 设置标志符号。
  62537. * @param {string} [symbolType] - 符号类型。
  62538. */
  62539. setSymbolType(symbolType) {
  62540. this.symbolType = symbolType;
  62541. this.redraw();
  62542. }
  62543. /**
  62544. * @function mapboxgl.supermap.RankSymbolThemeLayer.prototype.createThematicFeature
  62545. * @description 创建专题图形要素。
  62546. * @param {Object} feature - 要创建的专题图形要素。
  62547. */
  62548. createThematicFeature(feature) {
  62549. var thematicFeature;
  62550. // 检查图形创建条件并创建图形
  62551. if (Theme_Theme[this.symbolType] && this.themeField && this.symbolSetting) {
  62552. thematicFeature = new Theme_Theme[this.symbolType](feature, this, [this.themeField], this.symbolSetting);
  62553. }
  62554. // thematicFeature 是否创建成功
  62555. if (!thematicFeature) {
  62556. return false;
  62557. }
  62558. // 对专题要素执行图形装载
  62559. thematicFeature.assembleShapes();
  62560. return thematicFeature;
  62561. }
  62562. }
  62563. (external_mapboxgl_default()).supermap.RankSymbolThemeLayer = RankSymbolThemeLayer_RankSymbol;
  62564. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/UniqueTheme3DLayer.js
  62565. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62566. * This program are made available under the terms of the Apache License, Version 2.0
  62567. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62568. /**
  62569. * @class mapboxgl.supermap.UniqueTheme3DLayer
  62570. * @category Visualization Theme
  62571. * @classdesc 三维单值专题图。
  62572. * @param {string} [id] - 专题图图层 id。默认使用 CommonUtil.createUniqueID("theme3DLayer") 创建专题图层 ID。
  62573. * @param {Object} layerOptions - 专题图图层配置项,参数继承自 Theme3DLayer。
  62574. * @param {number} [layerOptions.height] - 新增参数,如果数据指定的 heightField (默认为 height )没有可以表示高度的字段,可以为所有数据统一设置一个高度。
  62575. * @param {Array} layerOptions.colorStops - 新增参数,数据颜色分段数组。
  62576. */
  62577. class UniqueTheme3DLayer extends Theme3DLayer {
  62578. constructor(id, layerOptions) {
  62579. super(id, layerOptions);
  62580. /**
  62581. * @member mapboxgl.supermap.UniqueTheme3DLayer.prototype.colorStops -{Array}
  62582. * @description 数据颜色数组,如[["绿地","#CD7054"],["道路","#AD1283"]]。
  62583. */
  62584. this.colorStops = null;
  62585. this._extend(this, layerOptions);
  62586. }
  62587. /**
  62588. * @function mapboxgl.supermap.UniqueTheme3DLayer.prototype.getLayerStyleOptions
  62589. * @description 获取图层样式。
  62590. * @returns {Object} Mapbox GL 样式对象。
  62591. */
  62592. getLayerStyleOptions() {
  62593. var opacity = this.opacity == null ? 1 : this.opacity;
  62594. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  62595. var options = {
  62596. 'fill-extrusion-color': {
  62597. 'stops': this.colorStops,
  62598. 'property': this.themeField,
  62599. 'type': 'categorical'
  62600. },
  62601. 'fill-extrusion-opacity': opacity
  62602. };
  62603. if (this.height != null) {
  62604. options['fill-extrusion-height'] = this.height;
  62605. } else {
  62606. options['fill-extrusion-height'] = {
  62607. 'property': this.heightField || 'height',
  62608. 'type': 'categorical'
  62609. };
  62610. }
  62611. if (this.baseHeightField) {
  62612. options['fill-extrusion-base'] = {
  62613. 'property': this.baseHeightField,
  62614. 'type': 'identity'
  62615. }
  62616. }
  62617. return options;
  62618. }
  62619. /**
  62620. * @function mapboxgl.supermap.UniqueTheme3DLayer.prototype.getHighlightStyleOptions
  62621. * @description 获取高亮样式。
  62622. * @returns {Object} Mapbox GL 样式对象。
  62623. */
  62624. getHighlightStyleOptions() {
  62625. var color = (this.highlight && this.highlight.color != null) ? this.highlight.color : '#ADA91E';
  62626. var paint = {
  62627. 'fill-extrusion-color': color,
  62628. 'fill-extrusion-height': {
  62629. "stops": this.heightStops,
  62630. "property": this.heightField,
  62631. 'type': 'categorical'
  62632. },
  62633. 'fill-extrusion-opacity': this.highlight && this.highlight.opacity || 0.6
  62634. };
  62635. if (this.height != null) {
  62636. paint['fill-extrusion-height'] = this.height || 0;
  62637. }
  62638. return paint;
  62639. }
  62640. _createLegendElement() {
  62641. var legendListElement = "<ul>";
  62642. var len = this.colorStops && this.colorStops.length || 0;
  62643. for (var i = 0; i < len; i++) {
  62644. var text = this.colorStops[i][0];
  62645. var color = this.colorStops[i][1];
  62646. legendListElement += "<li><span style='background-color:" + color + ";'></span><span>" + text + "</span></li>";
  62647. }
  62648. legendListElement += "</ul>";
  62649. return legendListElement;
  62650. }
  62651. }
  62652. (external_mapboxgl_default()).supermap.UniqueTheme3DLayer = UniqueTheme3DLayer;
  62653. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/UniqueThemeLayer.js
  62654. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62655. * This program are made available under the terms of the Apache License, Version 2.0
  62656. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62657. /**
  62658. * @class mapboxgl.supermap.UniqueThemeLayer
  62659. * @category Visualization Theme
  62660. * @classdesc 单值专题图层。
  62661. * @param {string} name - 图层名。
  62662. * @param {Object} opt_options - 参数。
  62663. * @param {string} opt_options.themeField - 指定创建专题图字段。
  62664. * @param {Object} opt_options.style - 专题图样式。
  62665. * @param {Object} opt_options.styleGroups - 各专题类型样式组。
  62666. * @param {mapboxgl.Map} opt_options.map - 当前 mapboxgl map 对象。
  62667. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  62668. * @param {boolean} [opt_options.loadWhileAnimating=true] - 是否实时重绘。
  62669. * @param {number} [opt_options.opacity=1] - 图层透明度。
  62670. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  62671. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  62672. * @extends {mapboxgl.supermap.GeoFeatureThemeLayer}
  62673. */
  62674. class Unique extends GeoFeature {
  62675. constructor(name, opt_options) {
  62676. super(name, opt_options);
  62677. this.themeField = opt_options.themeField;
  62678. this.style = opt_options.style;
  62679. this.styleGroups = opt_options.styleGroups;
  62680. this.isHoverAble = opt_options.isHoverAble;
  62681. this.highlightStyle = opt_options.highlightStyle;
  62682. }
  62683. /**
  62684. * @private
  62685. * @function mapboxgl.supermap.UniqueThemeLayer.prototype.createThematicFeature
  62686. * @description 创建专题图要素。
  62687. * @param {Object} feature - 要创建的专题图形要素。
  62688. */
  62689. createThematicFeature(feature) {
  62690. //赋 style
  62691. var style = this.getStyleByData(feature);
  62692. //创建专题要素时的可选参数
  62693. var options = {};
  62694. options.nodesClipPixel = this.nodesClipPixel;
  62695. options.isHoverAble = this.isHoverAble;
  62696. options.isMultiHover = this.isMultiHover;
  62697. options.isClickAble = this.isClickAble;
  62698. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  62699. //将数据转为专题要素(Vector)
  62700. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  62701. //直接添加图形到渲染器
  62702. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  62703. this.renderer.addShape(thematicFeature.shapes[m]);
  62704. }
  62705. return thematicFeature;
  62706. }
  62707. /**
  62708. * @private
  62709. * @function mapboxgl.supermap.UniqueThemeLayer.prototype.getStyleByData
  62710. * @description 通过数据获取 style。
  62711. * @param {Object} fea - 要素数据。
  62712. */
  62713. getStyleByData(fea) {
  62714. var style = {};
  62715. var feature = fea;
  62716. style = Util.copyAttributesWithClip(style, this.style);
  62717. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  62718. var tf = this.themeField;
  62719. var Attrs = feature.attributes;
  62720. var Gro = this.styleGroups;
  62721. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  62722. var attr = null; //属性值
  62723. for (var property in Attrs) {
  62724. if (tf === property) {
  62725. isSfInAttrs = true;
  62726. attr = Attrs[property];
  62727. break;
  62728. }
  62729. }
  62730. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  62731. if (isSfInAttrs) {
  62732. for (var i = 0, len = Gro.length; i < len; i++) {
  62733. if ((attr).toString() === ( Gro[i].value).toString()) {
  62734. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  62735. var sty1 = Gro[i].style;
  62736. style = Util.copyAttributesWithClip(style, sty1);
  62737. }
  62738. }
  62739. }
  62740. }
  62741. if (feature.style && this.isAllowFeatureStyle === true) {
  62742. style = Util.copyAttributesWithClip(feature.style);
  62743. }
  62744. return style;
  62745. }
  62746. }
  62747. (external_mapboxgl_default()).supermap.UniqueThemeLayer = Unique;
  62748. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/graphic/Graphic.js
  62749. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62750. * This program are made available under the terms of the Apache License, Version 2.0
  62751. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62752. /**
  62753. * @class mapboxgl.supermap.Graphic
  62754. * @classdesc 高效率点图层点要素类。
  62755. * @category Visualization Graphic
  62756. * @param {(Object|Array.<number>)} lngLat - 坐标。格式:经纬度数组或包含{lng,lat}格式对象。
  62757. * @param {Object} style - 图形参数。
  62758. * @param {Array.<number>} [style.color] - 点颜色。目前只支持 rgba 数组。
  62759. * @param {Object} [style.radius] - 点半径。
  62760. * @param {Object} [attributes] - 属性信息。
  62761. * @example
  62762. * var graphic = new mapboxgl.supermap.Graphic(
  62763. * {
  62764. * lng:116,
  62765. * lat:39
  62766. * },{
  62767. * color:[255,0,0],
  62768. * radius:30
  62769. * }
  62770. * });
  62771. */
  62772. class Graphic {
  62773. constructor(lngLat, style, attributes) {
  62774. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  62775. this.style = core_Util_Util.extend({}, style);
  62776. this.attributes = attributes;
  62777. }
  62778. /**
  62779. * @function mapboxgl.supermap.Graphic.prototype.getId
  62780. * @description 获取当前 ID。
  62781. * @returns {string} id
  62782. */
  62783. getId() {
  62784. return this.id;
  62785. }
  62786. /**
  62787. * @function mapboxgl.supermap.Graphic.prototype.setId
  62788. * @description 设置当前要素 ID。
  62789. * @param {string} id - 要素 ID。
  62790. */
  62791. setId(id) {
  62792. this.id = id;
  62793. }
  62794. /**
  62795. * @function mapboxgl.supermap.Graphic.prototype.getLngLat
  62796. * @description 获取经纬度坐标。
  62797. * @returns {Object} 经纬度坐标,数据格式{lng,lat}。
  62798. */
  62799. getLngLat() {
  62800. return this.lngLat;
  62801. }
  62802. /**
  62803. * @function mapboxgl.supermap.Graphic.prototype.setLngLat
  62804. * @description 设置经纬度坐标。
  62805. * @param {Object} lngLat - 经纬度坐标,数据格式{lng,lat}。
  62806. */
  62807. setLngLat(lngLat) {
  62808. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  62809. }
  62810. /**
  62811. * @function mapboxgl.supermap.Graphic.prototype.setStyle
  62812. * @description 设置点样式。
  62813. * @param {Object} style -样式选项。
  62814. * @param {Array} [style.color] - 颜色。
  62815. * @param {number} [style.radius] - 半径。
  62816. */
  62817. setStyle(style) {
  62818. this.style = core_Util_Util.extend(this.style, style);
  62819. }
  62820. /**
  62821. * @function mapboxgl.supermap.Graphic.prototype.getStyle
  62822. * @description 获取样式。
  62823. * @returns {Object} 点样式。
  62824. */
  62825. getStyle() {
  62826. return this.style;
  62827. }
  62828. /**
  62829. * @function mapboxgl.supermap.Graphic.prototype.setAttributes
  62830. * @description 设置属性信息。
  62831. * @param {Object} [attributes] - 属性信息。
  62832. */
  62833. setAttributes(attributes) {
  62834. this.attributes = core_Util_Util.extend({}, this.attributes, attributes);
  62835. }
  62836. /**
  62837. * @function mapboxgl.supermap.Graphic.prototype.getAttributes
  62838. * @description 获取属性信息。
  62839. * @returns {Object} 属性信息。
  62840. */
  62841. getAttributes() {
  62842. return this.attributes;
  62843. }
  62844. }
  62845. (external_mapboxgl_default()).supermap.Graphic = Graphic;
  62846. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/graphic/index.js
  62847. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62848. * This program are made available under the terms of the Apache License, Version 2.0
  62849. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62850. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraphicLayer.js
  62851. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62852. * This program are made available under the terms of the Apache License, Version 2.0
  62853. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62854. const defaultProps = {
  62855. color: [0, 0, 0, 255],
  62856. opacity: 0.8,
  62857. radius: 10,
  62858. radiusScale: 1,
  62859. radiusMinPixels: 0,
  62860. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  62861. strokeWidth: 1,
  62862. outline: false
  62863. };
  62864. /**
  62865. * @class mapboxgl.supermap.GraphicLayer
  62866. * @category Visualization Graphic
  62867. * @classdesc 高效率点图层。
  62868. * @param {string} [id] - 图层id。默认使用 CommonUtil.createUniqueID("graphicLayer_") 创建专题图层 ID。
  62869. * @param {Object} options - 图层配置项。
  62870. * @param {Array.<mapboxgl.supermap.Graphic>} options.graphics - 点要素对象数组 。
  62871. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  62872. * @param {number} [options.radius=10] - 半径。
  62873. * @param {number} [options.opacity=0.8] - 不透明度。
  62874. * @param {Array.<number>} [options.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  62875. * @param {number} [options.radiusScale=1] - 点放大倍数。
  62876. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  62877. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  62878. * @param {number} [options.strokeWidth=1] - 边框大小。
  62879. * @param {boolean} [options.outline=false] - 是否显示边框。
  62880. */
  62881. class GraphicLayer {
  62882. constructor(id, options) {
  62883. let opt = core_Util_Util.extend(this, defaultProps, options);
  62884. /**
  62885. * @member {string} mapboxgl.supermap.GraphicLayer.prototype.id
  62886. * @description 高效率点图层 id。
  62887. */
  62888. this.id = id || Util.createUniqueID("graphicLayer_");
  62889. /**
  62890. * @member {Array.<mapboxgl.supermap.Graphic>} mapboxgl.supermap.GraphicLayer.prototype.graphics
  62891. * @description 点要素对象数组。
  62892. */
  62893. this.graphics = [].concat(opt.graphics);
  62894. /**
  62895. * @member {boolean} [mapboxgl.supermap.GraphicLayer.prototype.visibility=true]
  62896. * @description 图层显示状态属性。
  62897. */
  62898. this.visibility = true;
  62899. }
  62900. /**
  62901. * @function mapboxgl.supermap.GraphicLayer.prototype.addTo
  62902. * @description 图层添加到地图,将在下个版本废弃,请使用 onAdd() 代替。
  62903. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  62904. * @returns this
  62905. */
  62906. addTo(map) {
  62907. this.onAdd(map);
  62908. }
  62909. /**
  62910. * @function mapboxgl.supermap.GraphicLayer.prototype.onAdd
  62911. * @description 图层添加到地图。
  62912. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  62913. * @returns {mapboxgl.supermap.GraphicLayer}
  62914. */
  62915. onAdd(map) {
  62916. this.map = map;
  62917. if (this.canvas) {
  62918. this.mapContainer = this.map.getCanvasContainer();
  62919. this.mapContainer.appendChild(this.canvas);
  62920. return this;
  62921. }
  62922. this._initContainer();
  62923. //当使用扩展的mapboxgl代码时有效
  62924. if (map.getCRS && map.getCRS() !== (external_mapboxgl_default()).CRS.EPSG3857) {
  62925. this.coordinateSystem = 3;
  62926. this.isGeographicCoordinateSystem = true;
  62927. }
  62928. let mapState = this.getState();
  62929. let {
  62930. data,
  62931. color,
  62932. radius,
  62933. opacity,
  62934. highlightColor,
  62935. radiusScale,
  62936. radiusMinPixels,
  62937. radiusMaxPixels,
  62938. strokeWidth,
  62939. outline
  62940. } = mapState;
  62941. let me = this;
  62942. let layerOptions = {
  62943. id: 'scatter-plot',
  62944. data,
  62945. pickable: Boolean(this.onClick) || Boolean(this.onHover),
  62946. autoHighlight: true,
  62947. color: color,
  62948. opacity: opacity,
  62949. radius: radius,
  62950. radiusScale: radiusScale,
  62951. highlightColor: highlightColor,
  62952. radiusMinPixels: radiusMinPixels,
  62953. radiusMaxPixels: radiusMaxPixels,
  62954. strokeWidth: strokeWidth,
  62955. outline: outline,
  62956. isGeographicCoordinateSystem: this.isGeographicCoordinateSystem,
  62957. coordinateSystem: this.coordinateSystem,
  62958. getPosition: function (point) {
  62959. if (!point) {
  62960. return [0, 0, 0];
  62961. }
  62962. let lngLat = point.getLngLat();
  62963. return lngLat && [lngLat.lng, lngLat.lat, 0];
  62964. },
  62965. getColor: function (point) {
  62966. let style = point && point.getStyle();
  62967. return style && style.color || me.color
  62968. },
  62969. getRadius: function (point) {
  62970. let style = point && point.getStyle();
  62971. return style && style.radius || me.radius
  62972. },
  62973. updateTriggers: {
  62974. getColor: [color],
  62975. getRadius: [radius]
  62976. }
  62977. };
  62978. if (this.onClick) {
  62979. layerOptions.onClick = this.onClick;
  62980. }
  62981. if (this.onHover) {
  62982. layerOptions.onHover = this.onHover;
  62983. }
  62984. this.layer = new window.DeckGL.ScatterplotLayer(layerOptions);
  62985. let deckOptions = {};
  62986. for (let key in mapState) {
  62987. deckOptions[key] = mapState[key];
  62988. }
  62989. deckOptions.layers = [this.layer];
  62990. deckOptions.canvas = this.canvas;
  62991. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  62992. this.map.on('render', this._moveEvent.bind(this));
  62993. this.map.on('resize', this._resizeEvent.bind(this));
  62994. this.draw();
  62995. return this;
  62996. }
  62997. /**
  62998. * @function mapboxgl.supermap.GraphicLayer.prototype.setStyle
  62999. * @description 设置图层整体样式。
  63000. * @param {Object} styleOptions - 样式对象。
  63001. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  63002. * @param {number} [styleOptions.radius=10] - 点半径。
  63003. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  63004. * @param {Array} [styleOptions.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  63005. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  63006. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  63007. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  63008. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  63009. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  63010. */
  63011. setStyle(styleOptions) {
  63012. let styleOpt = {
  63013. color: this.color,
  63014. radius: this.radius,
  63015. opacity: this.opacity,
  63016. highlightColor: this.highlightColor,
  63017. radiusScale: this.radiusScale,
  63018. radiusMinPixels: this.radiusMinPixels,
  63019. radiusMaxPixels: this.radiusMaxPixels,
  63020. strokeWidth: this.strokeWidth,
  63021. outline: this.outline
  63022. };
  63023. core_Util_Util.extend(this, styleOpt, styleOptions);
  63024. this.update();
  63025. }
  63026. /**
  63027. * @function mapboxgl.supermap.GraphicLayer.prototype.setGraphics
  63028. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  63029. * @param {Array.<mapboxgl.supermap.Graphic>} graphics - 点要素对象数组。
  63030. */
  63031. setGraphics(graphics) {
  63032. this.graphics = this.graphics || [];
  63033. this.graphics.length = 0;
  63034. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  63035. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  63036. if (!this.layer.props.data) {
  63037. this.layer.props.data = [];
  63038. }
  63039. this.layer.props.data.length = 0;
  63040. for (let i = 0; i < sGraphics.length; i++) {
  63041. this.layer.props.data.push(sGraphics[i]);
  63042. }
  63043. this.update();
  63044. }
  63045. /**
  63046. * @function mapboxgl.supermap.GraphicLayer.prototype.addGraphics
  63047. * @description 添加点要素,不会覆盖之前的要素。
  63048. * @param {Array.<mapboxgl.supermap.Graphic>} graphics - 点要素对象数组。
  63049. */
  63050. addGraphics(graphics) {
  63051. this.graphics = this.graphics || [];
  63052. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  63053. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  63054. if (!this.layer.props.data) {
  63055. this.layer.props.data = [];
  63056. }
  63057. for (let i = 0; i < sGraphics.length; i++) {
  63058. this.layer.props.data.push(sGraphics[i]);
  63059. }
  63060. this.update();
  63061. }
  63062. /**
  63063. * @function mapboxgl.supermap.GraphicLayer.prototype.getGraphicBy
  63064. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  63065. * @param {string} property - graphic 的某个属性名称。
  63066. * @param {string} value - property 所对应的值。
  63067. * @returns {ol.Graphic} 一个匹配的 graphic。
  63068. */
  63069. getGraphicBy(property, value) {
  63070. let graphic = null;
  63071. for (let index in this.graphics) {
  63072. if (this.graphics[index][property] === value) {
  63073. graphic = this.graphics[index];
  63074. break;
  63075. }
  63076. }
  63077. return graphic;
  63078. }
  63079. /**
  63080. * @function mapboxgl.supermap.GraphicLayer.prototype.getGraphicById
  63081. * @description 通过给定一个 id,返回对应的矢量要素。
  63082. * @param {string} graphicId - 矢量要素的属性 id
  63083. * @returns {ol.Graphic} 一个匹配的 graphic。
  63084. */
  63085. getGraphicById(graphicId) {
  63086. return this.getGraphicBy("id", graphicId);
  63087. }
  63088. /**
  63089. * @function mapboxgl.supermap.GraphicLayer.prototype.getGraphicsByAttribute
  63090. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  63091. * @param {string} attrName - graphic 的某个属性名称。
  63092. * @param {string} attrValue - property 所对应的值。
  63093. * @returns {Array.<ol.Graphic>} 一个匹配的 graphic 数组。
  63094. */
  63095. getGraphicsByAttribute(attrName, attrValue) {
  63096. var graphic,
  63097. foundgraphics = [];
  63098. for (let index in this.graphics) {
  63099. graphic = this.graphics[index];
  63100. if (graphic && graphic.attributes) {
  63101. if (graphic.attributes[attrName] === attrValue) {
  63102. foundgraphics.push(graphic);
  63103. }
  63104. }
  63105. }
  63106. return foundgraphics;
  63107. }
  63108. /**
  63109. * @function mapboxgl.supermap.GraphicLayer.prototype.removeGraphics
  63110. * @description 删除要素数组,默认将删除所有要素
  63111. * @param {Array.<ol.Graphic>} [graphics=null] - 删除的 graphics 数组
  63112. */
  63113. removeGraphics(graphics = null) {
  63114. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  63115. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  63116. this.graphics.length = 0;
  63117. if (this.layer.props.data) {
  63118. this.layer.props.data.length = 0;
  63119. }
  63120. this.update();
  63121. return;
  63122. }
  63123. if (!(Util.isArray(graphics))) {
  63124. graphics = [graphics];
  63125. }
  63126. for (let i = graphics.length - 1; i >= 0; i--) {
  63127. let graphic = graphics[i];
  63128. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  63129. //并将其放入未删除的数组中。
  63130. let findex = Util.indexOf(this.graphics, graphic);
  63131. if (findex === -1) {
  63132. continue;
  63133. }
  63134. this.graphics.splice(findex, 1);
  63135. }
  63136. //删除完成后重新设置 setGraphics,以更新
  63137. this.update();
  63138. }
  63139. /**
  63140. * @function mapboxgl.supermap.GraphicLayer.prototype.update
  63141. * @description 更新图层。
  63142. */
  63143. update() {
  63144. if (this.layer.lifecycle !== 'Awaiting state') {
  63145. this.layer.setChangeFlags({
  63146. dataChanged: true,
  63147. propsChanged: true,
  63148. viewportChanged: true,
  63149. updateTriggersChanged: true
  63150. });
  63151. let state = this.getState();
  63152. this.layer.setState(state);
  63153. }
  63154. }
  63155. /**
  63156. * @function mapboxgl.supermap.GraphicLayer.prototype.clear
  63157. * @description 释放图层资源。
  63158. */
  63159. clear() {
  63160. this.removeGraphics();
  63161. this.deckGL.finalize();
  63162. }
  63163. /**
  63164. * @function mapboxgl.supermap.GraphicLayer.prototype.remove
  63165. * @description 删除该图层。
  63166. */
  63167. remove() {
  63168. this.map.off('render', this._moveEvent.bind(this));
  63169. this.map.off('resize', this._resizeEvent.bind(this));
  63170. this.map.getCanvasContainer().removeChild(this.canvas);
  63171. }
  63172. /**
  63173. * @function mapboxgl.supermap.GraphicLayer.prototype.removeFromMap
  63174. * @deprecated
  63175. * @description 删除该图层。
  63176. */
  63177. removeFromMap() {
  63178. this.remove();
  63179. this.clear();
  63180. }
  63181. /**
  63182. * @function mapboxgl.supermap.GraphicLayer.prototype.moveTo
  63183. * @description 将图层移动到某个图层之前。
  63184. * @param {string} layerID - 待插入的图层 ID。
  63185. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  63186. */
  63187. moveTo(layerID, before) {
  63188. var layer = document.getElementById(this.id);
  63189. before = before !== undefined ? before : true;
  63190. if (before) {
  63191. var beforeLayer = document.getElementById(layerID);
  63192. if (layer && beforeLayer) {
  63193. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  63194. }
  63195. return;
  63196. }
  63197. var nextLayer = document.getElementById(layerID);
  63198. if (layer) {
  63199. if (nextLayer.nextSibling) {
  63200. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  63201. return;
  63202. }
  63203. nextLayer.parentNode.appendChild(layer);
  63204. }
  63205. }
  63206. /**
  63207. * @function mapboxgl.supermap.GraphicLayer.prototype.setVisibility
  63208. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  63209. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  63210. */
  63211. setVisibility(visibility) {
  63212. if (this.canvas && visibility !== this.visibility) {
  63213. this.visibility = visibility;
  63214. this.canvas.style.display = visibility ? "block" : "none";
  63215. }
  63216. }
  63217. /**
  63218. * @function mapboxgl.supermap.GraphicLayer.prototype.getState
  63219. * @description 获取当前地图及图层状态。
  63220. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  63221. */
  63222. getState() {
  63223. let map = this.map;
  63224. let width = parseInt(this.canvas.style.width);
  63225. let height = parseInt(this.canvas.style.height);
  63226. let center = map.getCenter();
  63227. let longitude = center.lng;
  63228. let latitude = center.lat;
  63229. let zoom = map.getZoom();
  63230. let maxZoom = map.getMaxZoom();
  63231. let pitch = map.getPitch();
  63232. let bearing = map.getBearing();
  63233. let mapViewport = {
  63234. longitude: longitude,
  63235. latitude: latitude,
  63236. zoom: zoom,
  63237. maxZoom: maxZoom,
  63238. pitch: pitch,
  63239. bearing: bearing
  63240. };
  63241. let state = {};
  63242. for (let key in mapViewport) {
  63243. state[key] = mapViewport[key];
  63244. }
  63245. state.width = width;
  63246. state.height = height;
  63247. state.data = this.graphics;
  63248. state.color = this.color;
  63249. state.radius = this.radius;
  63250. state.opacity = this.opacity;
  63251. state.highlightColor = this.highlightColor;
  63252. state.radiusScale = this.radiusScale;
  63253. state.radiusMinPixels = this.radiusMinPixels;
  63254. state.radiusMaxPixels = this.radiusMaxPixels;
  63255. state.strokeWidth = this.strokeWidth;
  63256. state.outline = this.outline;
  63257. //当使用扩展的mapboxgl代码时有效
  63258. if (map.getCRS && map.getCRS() !== (external_mapboxgl_default()).CRS.EPSG3857) {
  63259. state.coordinateSystem = this.coordinateSystem;
  63260. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  63261. }
  63262. return state;
  63263. }
  63264. /**
  63265. * @function mapboxgl.supermap.GraphicLayer.prototype.draw
  63266. * @description 绘制图层。
  63267. */
  63268. draw() {
  63269. let mapState = this.getState();
  63270. let deckOptions = {};
  63271. for (let key in mapState) {
  63272. deckOptions[key] = mapState[key];
  63273. }
  63274. deckOptions.layers = [this.layer];
  63275. deckOptions.canvas = this.canvas;
  63276. this.deckGL.setProps(deckOptions);
  63277. }
  63278. _moveEvent() {
  63279. this.draw();
  63280. }
  63281. _resizeEvent() {
  63282. let canvas = this.canvas;
  63283. let map = this.map;
  63284. canvas.width = parseInt(map.getCanvas().style.width);
  63285. canvas.height = parseInt(map.getCanvas().style.height);
  63286. canvas.style.width = map.getCanvas().style.width;
  63287. canvas.style.height = map.getCanvas().style.height;
  63288. this.draw();
  63289. }
  63290. _initContainer() {
  63291. this.canvas = this._createCanvas();
  63292. this.mapContainer = this.map.getCanvasContainer();
  63293. this.mapContainer.appendChild(this.canvas);
  63294. }
  63295. _createCanvas() {
  63296. let canvas = document.createElement('canvas');
  63297. if (this.id) {
  63298. canvas.id = this.id;
  63299. }
  63300. canvas.style.position = 'absolute';
  63301. canvas.style.top = 0 + "px";
  63302. canvas.style.left = 0 + "px";
  63303. canvas.style.cursor = "";
  63304. let map = this.map;
  63305. canvas.width = parseInt(map.getCanvas().style.width);
  63306. canvas.height = parseInt(map.getCanvas().style.height);
  63307. canvas.style.width = map.getCanvas().style.width;
  63308. canvas.style.height = map.getCanvas().style.height;
  63309. return canvas;
  63310. }
  63311. }
  63312. (external_mapboxgl_default()).supermap.GraphicLayer = GraphicLayer;
  63313. ;// CONCATENATED MODULE: external "function(){try{return THREE}catch(e){return {}}}()"
  63314. const external_function_try_return_THREE_catch_e_return_namespaceObject = function(){try{return THREE}catch(e){return {}}}();
  63315. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/threejs/Transform.js
  63316. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  63317. * This program are made available under the terms of the Apache License, Version 2.0
  63318. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63319. function wrap(source, min, max) {
  63320. if (source === max || source === min) {
  63321. return source;
  63322. }
  63323. let len = max - min;
  63324. return ((source - min) % len + len) % len + min
  63325. }
  63326. function rad(angle) {
  63327. return angle * Math.PI / 180;
  63328. }
  63329. var Projection = {
  63330. R: 6378137,
  63331. minZoom: 0,
  63332. maxZoom: 22,
  63333. nativeMaxZoom: 19,
  63334. RAD: Math.PI / 180,
  63335. METERS_PER_DEGREE: 6378137 * Math.PI / 180,
  63336. MAX_LATITUDE: 85.0511287798,
  63337. project: function (lngLat) {
  63338. const rad = this.RAD,
  63339. metersPerDegree = this.METERS_PER_DEGREE,
  63340. max = this.MAX_LATITUDE;
  63341. let ll = (lngLat instanceof Array)
  63342. ? {lng: lngLat[0], lat: lngLat[1]}
  63343. : {lng: lngLat.lng, lat: lngLat.lat};
  63344. let lng = ll.lng, lat = Math.max(Math.min(max, ll.lat), -max);
  63345. let c;
  63346. if (lat === 0) {
  63347. c = 0;
  63348. } else {
  63349. c = Math.log(Math.tan((90 + lat) * rad / 2)) / rad;
  63350. }
  63351. return {x: lng * metersPerDegree, y: c * metersPerDegree};
  63352. },
  63353. unproject: function (point) {
  63354. const x = point.x,
  63355. y = point.y;
  63356. const rad = this.RAD,
  63357. metersPerDegree = this.METERS_PER_DEGREE;
  63358. let c;
  63359. if (y === 0) {
  63360. c = 0;
  63361. } else {
  63362. c = y / metersPerDegree;
  63363. c = (2 * Math.atan(Math.exp(c * rad)) - Math.PI / 2) / rad;
  63364. }
  63365. return {lng: wrap(x / metersPerDegree, -180, 180), lat: wrap(c, -this.MAX_LATITUDE, this.MAX_LATITUDE)};
  63366. },
  63367. locate: function (lngLat, dx, dy) {
  63368. if (!lngLat) {
  63369. return null;
  63370. }
  63371. dx = !dx ? 0 : dx;
  63372. dy = !dy ? 0 : dy;
  63373. if (!dx && !dy) {
  63374. return lngLat;
  63375. }
  63376. let lng = lngLat.lng;
  63377. if (dx !== 0) {
  63378. let ndx = Math.abs(dx), radLng = rad(lngLat.lng);
  63379. let sLng = 2 * Math.sqrt(Math.pow(Math.sin(ndx / (2 * this.R)), 2) / Math.pow(Math.cos(radLng), 2));
  63380. radLng = radLng + sLng * (ndx > 0 ? 1 : -1);
  63381. lng = wrap(radLng * 180 / Math.PI, -180, 180);
  63382. }
  63383. let lat = lngLat.lat;
  63384. if (dy !== 0) {
  63385. let ndy = Math.abs(dy), radLat = rad(lngLat.lat);
  63386. let sLat = Math.sin(ndy / (2 * this.R)) * 2;
  63387. radLat = radLat + sLat * (ndy > 0 ? 1 : -1);
  63388. lat = wrap(radLat * 180 / Math.PI, -90, 90);
  63389. }
  63390. return {lng, lat};
  63391. },
  63392. getResolution: function (zoom) {
  63393. if (!this.resolutions) {
  63394. var resolutions = [];
  63395. var d = 2 * 6378137 * Math.PI;
  63396. for (var i = 0; i <= this.maxZoom; i++) {
  63397. resolutions[i] = d / (256 * Math.pow(2, i));
  63398. }
  63399. this.resolutions = resolutions;
  63400. }
  63401. let z = (zoom | 0), length = this.resolutions.length;
  63402. z = z < 0 ? 0 : z > length - 1 ? length - 1 : z;
  63403. const res = this.resolutions[z];
  63404. if ((zoom | 0) !== zoom && z !== length - 1) {
  63405. const next = this.resolutions[z + 1];
  63406. return res + (next - res) * (zoom - z);
  63407. }
  63408. return res;
  63409. }
  63410. };
  63411. var Transform = {
  63412. matrix: [1, -1, 0, 0],
  63413. projection: Projection,
  63414. project: function (lngLat) {
  63415. return this.projection.project(lngLat);
  63416. },
  63417. unproject: function (point) {
  63418. return this.projection.unproject(point);
  63419. },
  63420. lngLatToPoint: function (lngLat, zoom) {
  63421. var pt = this.project(lngLat);
  63422. return this.transform(pt, this.projection.getResolution(zoom));
  63423. },
  63424. locate: function (lngLat, dx, dy) {
  63425. return this.projection.locate(lngLat, dx, dy);
  63426. },
  63427. transform: function (point, scale) {
  63428. return {
  63429. x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
  63430. y: this.matrix[1] * (point.y - this.matrix[3]) / scale
  63431. };
  63432. }
  63433. };
  63434. (external_mapboxgl_default()).supermap.Transform = Transform;
  63435. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/threejs/ThreeLayerRenderer.js
  63436. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  63437. * This program are made available under the terms of the Apache License, Version 2.0
  63438. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63439. /**
  63440. * reference and modification
  63441. * maptalks.three
  63442. * (https://github.com/maptalks/maptalks.three)
  63443. * Apache Licene 2.0
  63444. * thanks maptalks
  63445. */
  63446. const projection = Transform.projection;
  63447. const {
  63448. Color: ThreeLayerRenderer_Color,
  63449. Scene,
  63450. WebGLRenderer,
  63451. CanvasRenderer,
  63452. PerspectiveCamera
  63453. } = external_function_try_return_THREE_catch_e_return_namespaceObject;
  63454. const RADIAN = Math.PI / 180;
  63455. const ThreeLayerRenderer_frame = window.requestAnimationFrame ||
  63456. window.mozRequestAnimationFrame ||
  63457. window.webkitRequestAnimationFrame ||
  63458. window.msRequestAnimationFrame;
  63459. const cancel = window.cancelAnimationFrame ||
  63460. window.mozCancelAnimationFrame ||
  63461. window.webkitCancelAnimationFrame ||
  63462. window.msCancelAnimationFrame;
  63463. /**
  63464. * @private
  63465. * @class ThreeLayerRenderer
  63466. * @category Visualization Three
  63467. * @classdesc Three图层渲染器
  63468. * @param {mapboxgl.supermap.ThreeLayer} layer - ThreeJs图层。</br>
  63469. * @param {string} [renderer="gl"] - 图层渲染方式(canvas或WebGL)。取值:"gl","canvas"。</br>
  63470. * @param {Object} options - threejs渲染器初始化参数对象。参数内容详见:
  63471. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}/
  63472. * [CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  63473. *
  63474. * @extends {mapboxgl.Evented}
  63475. * @fires mapboxgl.supermap.ThreeLayer#initialized
  63476. * @fires mapboxgl.supermap.ThreeLayer#draw
  63477. * @fires mapboxgl.supermap.ThreeLayer#rendererinitialized
  63478. */
  63479. class ThreeLayerRenderer {
  63480. constructor(layer, renderer, options) {
  63481. this._layer = layer;
  63482. this.renderer = renderer || "gl";
  63483. this.options = options;
  63484. }
  63485. setMap(map) {
  63486. this.map = map;
  63487. }
  63488. //开始渲染
  63489. render() {
  63490. if (!this._layer) {
  63491. return;
  63492. }
  63493. this.prepare();
  63494. /**
  63495. * @event mapboxgl.supermap.ThreeLayer#initialized
  63496. * @description three 初始化之后后触发。
  63497. */
  63498. this._layer.fire("initialized");
  63499. this._layer && this._layer.draw(this.context, this.scene, this.camera);
  63500. /**
  63501. * @event mapboxgl.supermap.ThreeLayer#draw
  63502. * @description draw 绘制事件, 调用提供给外部绘制的接口后触发
  63503. */
  63504. this._layer.fire("draw");
  63505. this.renderScene();
  63506. }
  63507. update() {
  63508. this.remove();
  63509. this.render();
  63510. }
  63511. //渲染场景(模型已经添加到图层)
  63512. renderScene() {
  63513. this.locationCamera();
  63514. this.animationFrame = this.renderFrame((function () {
  63515. this.animationFrame = null;
  63516. this.context && this.context.render(this.scene, this.camera);
  63517. }).bind(this));
  63518. }
  63519. renderFrame(fn) {
  63520. var render = function () {
  63521. fn && typeof fn === "function" && fn();
  63522. };
  63523. return ThreeLayerRenderer_frame(render);
  63524. }
  63525. resize() {
  63526. this._resetElementSize(this.container);
  63527. this._resetElementSize(this.canvas);
  63528. let width = this.canvas.width,
  63529. height = this.canvas.height;
  63530. let size = this.getMapSize();
  63531. this.camera.aspect = width / height;
  63532. this.camera.updateProjectionMatrix();
  63533. this.context.setSize(size.width, size.height);
  63534. this.renderScene();
  63535. }
  63536. //创建画布、初始化渲染器、初始化相机等
  63537. prepare() {
  63538. if (!this.map) {
  63539. return new Error("map object is necessary");
  63540. }
  63541. if (!this.canvas) {
  63542. this._initContainer();
  63543. this._initThreeRenderer();
  63544. /**
  63545. * @event mapboxgl.supermap.ThreeLayer#rendererinitialized
  63546. * @description rendererinitialized 事件,初始化 three 渲染器后触发
  63547. */
  63548. this._layer.fire("rendererinitialized");
  63549. } else {
  63550. this.clear(this.context);
  63551. }
  63552. }
  63553. getMapSize() {
  63554. let container = this.map.getContainer();
  63555. return {width: container.clientWidth, height: container.clientHeight};
  63556. }
  63557. cancelFrame() {
  63558. if (this.animationFrame != null) {
  63559. cancel(this.animationFrame);
  63560. }
  63561. }
  63562. remove() {
  63563. if (this.animationFrame != null) {
  63564. cancel(this.animationFrame);
  63565. }
  63566. this.container.removeChild(this.canvas);
  63567. this.container.parentNode.removeChild(this.container);
  63568. this.context = null;
  63569. this.canvas = null;
  63570. this.container = null;
  63571. }
  63572. //清理画布内容
  63573. clear(context) {
  63574. context && context.clear && context.clear();
  63575. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  63576. }
  63577. //计算缩放比例
  63578. getScale(zoom) {
  63579. let map = this.map;
  63580. let z = zoom == null ? map.getZoom() : zoom;
  63581. let max = projection.getResolution(projection.nativeMaxZoom),
  63582. res = projection.getResolution(z);
  63583. return res / max;
  63584. }
  63585. getCanvasContainer() {
  63586. return this.container;
  63587. }
  63588. getCanvas() {
  63589. return this.canvas;
  63590. }
  63591. //重新设置相机位置
  63592. locationCamera() {
  63593. let map = this.map;
  63594. let size = this.getMapSize();
  63595. let scale = map.transform.zoomScale(projection.nativeMaxZoom - map.getZoom() - 1);
  63596. let fovRatio = Math.tan(map.transform.fov / 2 * RADIAN);
  63597. let camera = this.camera;
  63598. //倾斜时,相机位置低于Z轴
  63599. let pitch = map.getPitch() * RADIAN;
  63600. let pZ = -scale * size.height / 2 / fovRatio;
  63601. camera.position.z = pZ * Math.cos(pitch);
  63602. let centerPoint = Transform.lngLatToPoint(map.getCenter(), projection.nativeMaxZoom);
  63603. let distance = Math.sin(pitch) * pZ;
  63604. let bearing = map.getBearing() * RADIAN;
  63605. camera.position.x = centerPoint.x + distance * Math.sin(bearing);
  63606. camera.position.y = centerPoint.y - distance * Math.cos(bearing);
  63607. camera.up.set(Math.sin(bearing), -Math.cos(bearing), 0);
  63608. camera.lookAt(new external_function_try_return_THREE_catch_e_return_namespaceObject.Vector3(centerPoint.x, centerPoint.y, 0));
  63609. camera.updateProjectionMatrix();
  63610. }
  63611. _initContainer() {
  63612. var canvas = this._createCanvas();
  63613. var container = this.container = document.createElement("div");
  63614. if (this._layer._layerId) {
  63615. container.id = this._layer._layerId;
  63616. }
  63617. container.className = "threejs-wrapper";
  63618. container.style.position = "absolute";
  63619. container.style.left = "0px";
  63620. container.style.top = "0px";
  63621. container.style.overflow = "hidden";
  63622. this._resetElementSize(container);
  63623. container.appendChild(canvas);
  63624. var mapContainer = this.map.getCanvasContainer();
  63625. mapContainer.appendChild(container)
  63626. }
  63627. _createCanvas() {
  63628. if (this.canvas) {
  63629. return;
  63630. }
  63631. const canvas = this.canvas = document.createElement('canvas');
  63632. canvas.className = "threejs-overlay";
  63633. canvas.style.outline = "none";
  63634. this._resetElementSize(canvas);
  63635. return canvas;
  63636. }
  63637. _resetElementSize(element) {
  63638. if (!element) {
  63639. return;
  63640. }
  63641. const size = this.getMapSize();
  63642. const dpr = window.devicePixelRatio ? window.devicePixelRatio : 1;
  63643. const width = dpr * size.width;
  63644. const height = dpr * size.height;
  63645. element.width = width;
  63646. element.height = height;
  63647. element.style.width = size.width + 'px';
  63648. element.style.height = size.height + 'px';
  63649. }
  63650. _initThreeRenderer() {
  63651. let map = this.map;
  63652. let size = this.getMapSize();
  63653. let renderer = this.renderer || 'gl';
  63654. let context;
  63655. if (renderer === 'gl') {
  63656. context = new WebGLRenderer({
  63657. 'canvas': this.canvas,
  63658. 'alpha': true,
  63659. 'antialias': true,
  63660. 'preserveDrawingBuffer': true
  63661. }, this.options);
  63662. context.autoClear = true;
  63663. context.clear();
  63664. } else {
  63665. context = new CanvasRenderer(Util.extend({
  63666. 'canvas': this.canvas,
  63667. 'alpha': true
  63668. }, this.options));
  63669. }
  63670. context.setClearColor(new ThreeLayerRenderer_Color(1, 1, 1), 0);
  63671. context.canvas = this.canvas;
  63672. this.context = context;
  63673. let fov = map.transform.fov;
  63674. let fovRatio = Math.tan(fov / 2 * RADIAN);
  63675. let maxScale = this.getScale(projection.minZoom) / this.getScale(projection.nativeMaxZoom);
  63676. let far = maxScale * size.height / 2 / fovRatio;
  63677. this.camera = new PerspectiveCamera(fov, size.width / size.height, 1, far);
  63678. this.scene = new Scene();
  63679. this.scene.add(this.camera);
  63680. }
  63681. }
  63682. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/threejs/index.js
  63683. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  63684. * This program are made available under the terms of the Apache License, Version 2.0
  63685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63686. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/ThreeLayer.js
  63687. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  63688. * This program are made available under the terms of the Apache License, Version 2.0
  63689. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63690. /**
  63691. * reference and modification
  63692. * maptalks.three
  63693. * (https://github.com/maptalks/maptalks.three)
  63694. * Apache Licene 2.0
  63695. * thanks maptalks
  63696. */
  63697. const {
  63698. Vector3,
  63699. Shape: ThreeLayer_Shape,
  63700. Mesh,
  63701. BufferGeometry,
  63702. ExtrudeGeometry
  63703. } = external_function_try_return_THREE_catch_e_return_namespaceObject;
  63704. /**
  63705. * @class mapboxgl.supermap.ThreeLayer
  63706. * @category Visualization Three
  63707. * @classdesc Three 图层。
  63708. * @param {string} id - 图层 ID。
  63709. * @param {string} [renderer="gl"] - 图层渲染方式( canvas 或 WebGL )。取值:"gl","canvas"。
  63710. * @param {Object} options - 初始化参数。
  63711. * @param {Object} options.threeOptions - threejs 渲染器初始化参数对象。参数内容详见:
  63712. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}
  63713. * [CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  63714. *
  63715. * @extends {mapboxgl.Evented}
  63716. * @fires mapboxgl.supermap.ThreeLayer#render
  63717. * @fires mapboxgl.supermap.ThreeLayer#renderscene
  63718. * @example
  63719. * var threeLayer = new mapboxgl.supermap.ThreeLayer('three');
  63720. * //模型绘制
  63721. * threeLayer.on("initialized", draw);
  63722. * threeLayer.addTo(map);
  63723. *
  63724. * function draw() {
  63725. * var scene=threeLayer.getScene();
  63726. * camera=threeLayer.getCamera();
  63727. * var light = new THREE.PointLight(0xffffff);
  63728. * camera.add(light);
  63729. * var material = new THREE.MeshPhongMaterial({color: 0xff0000});
  63730. * //根据坐标点转换成模型
  63731. * var mesh = this.toThreeMesh(feature.geometry.coordinates, 10, material, true);
  63732. * //模型添加到3D场景
  63733. * scene.add(mesh);
  63734. * }
  63735. *
  63736. * 叠加模型可以通过两种方式:</br>
  63737. * 1.调用 threeLayer.toThreeMesh 直接将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑),然后添加到 3D 场景
  63738. * 2.使用 ThreeJS 的接口创建好 Mesh,然后调用 threeLayer.setPosition 设置地理位置,然后添加到 3D 场景
  63739. *
  63740. */
  63741. class ThreeLayer extends (external_mapboxgl_default()).Evented {
  63742. //options.threeOptions是初始化threejs renderer的参数对象
  63743. constructor(id, renderer, options) {
  63744. super();
  63745. this._layerId = id;
  63746. this.options = options;
  63747. let threeOptions = options && options.threeOptions;
  63748. this.renderer = new ThreeLayerRenderer(this, renderer, threeOptions);
  63749. }
  63750. /**
  63751. * @function mapboxgl.supermap.ThreeLayer.prototype.toThreeShape
  63752. * @description 创建 threejs shape 对象。
  63753. * @param {Array} coordinates - 坐标点数组。
  63754. * @returns THREE.Shape{@link https://threejs.org/docs/index.html#api/extras/core/Shape} threejs shape 对象。
  63755. */
  63756. toThreeShape(coordinates) {
  63757. if (!coordinates) {
  63758. return null;
  63759. }
  63760. let center = this.getCoordinatesCenter(coordinates);
  63761. let centerPoint = this.lngLatToPosition(center);
  63762. let outer = coordinates.map(coords => this.lngLatToPosition({
  63763. lng: coords[0],
  63764. lat: coords[1]
  63765. }).sub(centerPoint));
  63766. return new ThreeLayer_Shape(outer);
  63767. }
  63768. /**
  63769. * @function mapboxgl.supermap.ThreeLayer.prototype.toThreeMesh
  63770. * @description 创建 threejs Mesh 对象。将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑)。
  63771. * @param {Array.<Object>} coordinates - 坐标点数组。
  63772. * @param {number} amount - 高度。
  63773. * @param {THREE.Material} material - Threejs 材质对象。参考:[THREE.Material]{@link https://threejs.org/docs/index.html#api/extras/core/Material}
  63774. * @param {boolean} [removeDuplicated] - 是否移除重复的坐标点。
  63775. * @returns {THREE.Mesh} threejs Mesh 对象。参考:[THREE.Mesh]{@link https://threejs.org/docs/index.html#api/objects/Mesh}
  63776. */
  63777. toThreeMesh(coordinates, amount, material, removeDuplicated) {
  63778. if (!coordinates) {
  63779. return null;
  63780. }
  63781. let coords = coordinates;
  63782. if (removeDuplicated) {
  63783. coords = this.removeDuplicatedCoordinates(coordinates)
  63784. }
  63785. let targetAmount = this.distanceToThreeVector3(amount, amount).x;
  63786. let shape = this.toThreeShape(coords);
  63787. let geometry = new ExtrudeGeometry(shape, {
  63788. 'amount': targetAmount,
  63789. 'bevelEnabled': true
  63790. });
  63791. let bufferGeometry = new BufferGeometry().fromGeometry(geometry);
  63792. let mesh = new Mesh(bufferGeometry, material);
  63793. let center = this.lngLatToPosition(this.getCoordinatesCenter(coords));
  63794. mesh.position.set(center.x, center.y, -targetAmount);
  63795. return mesh;
  63796. }
  63797. /**
  63798. * @function mapboxgl.supermap.ThreeLayer.prototype.addObject
  63799. * @description 设置threejs 3D 对象的坐标(经纬度)。
  63800. * @param {THREE.Object3D} object3D - threejs 3D 对象。参考:[THREE.Object3D]{@link https://threejs.org/docs/index.html#api/core/Object3D}及子类对象。
  63801. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  63802. * @returns {this} this
  63803. */
  63804. addObject(object3D, coordinate) {
  63805. if (coordinate && object3D) {
  63806. this.setPosition(object3D, coordinate);
  63807. }
  63808. this.renderer && this.renderer.scene.add(object3D);
  63809. }
  63810. /**
  63811. * @function mapboxgl.supermap.ThreeLayer.prototype.getScene
  63812. * @description 获取threejs 场景对象
  63813. * @returns {THREE.Scene} threejs 场景对象,参考:[THREE.Scene]{@link https://threejs.org/docs/index.html#api/scenes/Scene}
  63814. */
  63815. getScene() {
  63816. return this.renderer.scene;
  63817. }
  63818. /**
  63819. * @function mapboxgl.supermap.ThreeLayer.prototype.getCamera
  63820. * @description 获取threejs 相机。
  63821. * @returns {THREE.Camera} threejs 相机。参考:[THREE.Camera]{@link https://threejs.org/docs/index.html#api/cameras/Camera}
  63822. */
  63823. getCamera() {
  63824. return this.renderer.camera;
  63825. }
  63826. /**
  63827. * @function mapboxgl.supermap.ThreeLayer.prototype.getThreeRenderer
  63828. * @description 获取 threejs renderer。
  63829. * @returns {THREE.WebGLRenderer|THREE.CanvasRenderer} threejs renderer。参考:
  63830. * [THREE.WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}/
  63831. * [THREE.CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  63832. */
  63833. getThreeRenderer() {
  63834. return this.renderer.context;
  63835. }
  63836. // /**
  63837. // * @function mapboxgl.supermap.ThreeLayer.prototype.getObject
  63838. // * @description 根据条件获取添加到场景中的对象
  63839. // * @return {THREE.Object3D} threejs 3D对象。参考:[THREE.Object3D]{@link https://threejs.org/docs/index.html#api/core/Object3D}及子类对象
  63840. // */
  63841. // getObject(conditions) {
  63842. // if(!conditions){
  63843. // return;
  63844. // }
  63845. // var scene = this.getScene();
  63846. // var objects = scene.children;
  63847. // for(let obj of objects ){
  63848. // for(let condition of conditions ){
  63849. // obj[condition]
  63850. // }
  63851. // }
  63852. // }
  63853. /**
  63854. * @function mapboxgl.supermap.ThreeLayer.prototype.clearMesh
  63855. * @description 清除所有 threejs mesh 对象。
  63856. * @returns {this} this 对象。
  63857. */
  63858. clearMesh() {
  63859. let scene = this.renderer.scene;
  63860. if (!scene) {
  63861. return this;
  63862. }
  63863. for (let i = scene.children.length - 1; i >= 0; i--) {
  63864. if (scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_namespaceObject.Mesh) {
  63865. scene.remove(scene.children[i]);
  63866. }
  63867. }
  63868. return this;
  63869. }
  63870. /**
  63871. * @function mapboxgl.supermap.ThreeLayer.prototype.clearAll
  63872. * @description 清除所有 threejs 对象。
  63873. * @param {boolean} clearCamera - 是否同时清除相机。
  63874. * @returns {this} this 对象。
  63875. */
  63876. clearAll(clearCamera) {
  63877. let scene = this.renderer.scene;
  63878. if (!scene) {
  63879. return this;
  63880. }
  63881. for (let i = scene.children.length - 1; i >= 0; i--) {
  63882. if (!clearCamera && scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_namespaceObject.Camera) {
  63883. continue;
  63884. }
  63885. scene.remove(scene.children[i]);
  63886. }
  63887. return this;
  63888. }
  63889. /**
  63890. * @function mapboxgl.supermap.ThreeLayer.prototype.setPosition
  63891. * @description 设置 threejs 3D 对象的坐标(经纬度)。
  63892. * @param {THREE.Object3D} object3D - threejs 3D 对象,参考:[THREE.Object3D]{@link https://threejs.org/docs/index.html#api/core/Object3D}及子类对象。
  63893. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  63894. * @returns {this} this 对象。
  63895. */
  63896. setPosition(object3D, coordinate) {
  63897. if (!object3D || !coordinate) {
  63898. return this;
  63899. }
  63900. var pos = this.lngLatToPosition(coordinate);
  63901. object3D.position.set(pos.x, pos.y, pos.z);
  63902. return this;
  63903. }
  63904. /**
  63905. * @function mapboxgl.supermap.ThreeLayer.prototype.lngLatToPosition
  63906. * @description 经纬度转threejs 3D 失量对象。
  63907. * @param {(Array.<number>|Object)} lngLat - 经纬度坐标。
  63908. * @returns {THREE.Vector3} threejs 3D 失量对象。参考:[THREE.Vector3]{@link https://threejs.org/docs/index.html#api/math/Vector3}
  63909. */
  63910. lngLatToPosition(lngLat) {
  63911. let zoom = Transform.projection.nativeMaxZoom;
  63912. let point = Transform.lngLatToPoint(lngLat, zoom);
  63913. return new Vector3(point.x, point.y, -0);
  63914. }
  63915. /**
  63916. * @function mapboxgl.supermap.ThreeLayer.prototype.distanceToThreeVector3
  63917. * @description 计算距离指定坐标给定距离的新坐标的 threejs 3D 失量对象。
  63918. * @param {number} x - x 轴距离,单位米。
  63919. * @param {number} y - y 轴距离,单位米。
  63920. * @param {(Array.<number>|Object)} lngLat - 源坐标。
  63921. * @returns {THREE.Vector3} 目标点的 threejs 3D 失量对象。参考:[THREE.Vector3]{@link https://threejs.org/docs/index.html#api/math/Vector3}
  63922. */
  63923. distanceToThreeVector3(x, y, lngLat) {
  63924. let map = this._map;
  63925. let center = lngLat || map.getCenter(),
  63926. maxZoom = Transform.projection.nativeMaxZoom,
  63927. targetLngLat = Transform.locate(center, x, y);
  63928. let point1 = Transform.lngLatToPoint(center, maxZoom),
  63929. point2 = Transform.lngLatToPoint(targetLngLat, maxZoom);
  63930. let targetX = Math.abs(point2.x - point1.x) * Math.sign(x);
  63931. let targetY = Math.abs(point2.y - point1.y) * Math.sign(y);
  63932. return new Vector3(targetX, targetY, 0);
  63933. }
  63934. /**
  63935. * @function mapboxgl.supermap.ThreeLayer.prototype.removeDuplicatedCoordinates
  63936. * @description 移除数组中的重复坐标。
  63937. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  63938. * @returns {(Array.<Array.<number>>)} 新的坐标数组。
  63939. */
  63940. removeDuplicatedCoordinates(coordinates) {
  63941. function equals(point1, point2) {
  63942. return point1[0] === point2[0] && point1[1] === point2[1]
  63943. }
  63944. let coords = [].concat(coordinates);
  63945. let length = coords.length;
  63946. for (let i = length - 1; i >= 1; i--) {
  63947. if (equals(coords[i], coords[i - 1])) {
  63948. coords.splice(i, 1);
  63949. }
  63950. }
  63951. let isClose = equals(coords[0], coords[coords.length - 1]);
  63952. isClose && coords.splice(coords.length - 1, 1);
  63953. return coords;
  63954. }
  63955. /**
  63956. * @function mapboxgl.supermap.ThreeLayer.prototype.getCoordinatesCenter
  63957. * @description 获取给定坐标数组的中心坐标。
  63958. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  63959. * @returns {Object} 包含经纬度的坐标对象。
  63960. */
  63961. getCoordinatesCenter(coordinates) {
  63962. let sumX = 0, sumY = 0, count = 0;
  63963. let i = 0, len = coordinates.length;
  63964. for (; i < len; i++) {
  63965. if (coordinates[i]) {
  63966. sumX += coordinates[i][0];
  63967. sumY += coordinates[i][1];
  63968. count++;
  63969. }
  63970. }
  63971. return {
  63972. lng: sumX / count,
  63973. lat: sumY / count
  63974. };
  63975. }
  63976. /**
  63977. * @function mapboxgl.supermap.ThreeLayer.prototype.addTo
  63978. * @description 添加图层到地图。
  63979. * @param {Object} map - 地图对象。
  63980. * @returns {this} this 对象。
  63981. */
  63982. addTo(map) {
  63983. var me = this;
  63984. me._map = map;
  63985. me.renderer.setMap(map);
  63986. me.renderer.render();
  63987. //three mbgl 联动(仅联动相机,不执行重绘操作)
  63988. me._map.on('render', this._update.bind(me));
  63989. me._map.on('resize', this._resize.bind(me));
  63990. me.on('render', (function () {
  63991. this.context && this.context.render(this.scene, this.camera);
  63992. }).bind(me.renderer));
  63993. return this;
  63994. }
  63995. /**
  63996. * @function mapboxgl.supermap.ThreeLayer.prototype.getCanvasContainer
  63997. * @description 获取 three 图层容器。
  63998. * @returns {HTMLElement} three 图层的容器。
  63999. */
  64000. getCanvasContainer() {
  64001. return this.renderer.getCanvasContainer();
  64002. }
  64003. /**
  64004. * @function mapboxgl.supermap.ThreeLayer.prototype.getCanvas
  64005. * @description 获取 three 图层画布。
  64006. * @returns {HTMLCanvasElement} three 图层画布。
  64007. */
  64008. getCanvas() {
  64009. return this.renderer.getCanvas();
  64010. }
  64011. /**
  64012. * @function mapboxgl.supermap.ThreeLayer.prototype.remove
  64013. * @description 移除图层。
  64014. */
  64015. remove() {
  64016. let map = this._map, me = this;
  64017. map.off('render', me._update.bind(me));
  64018. map.off('resize', me._resize.bind(me));
  64019. me.renderer.remove();
  64020. me._map = null;
  64021. }
  64022. /**
  64023. * @function mapboxgl.supermap.ThreeLayer.prototype.draw
  64024. * @description 提供给外部的 threejs 模型绘制接口。
  64025. * @param {THREE.WebGLRenderer|THREE.CanvasRenderer} gl - threejs 渲染器上下文 。详情请参考:</br>
  64026. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}/
  64027. * [CanvasRenderer]{@link https://threejs.org/docs/index.html#examples/renderers/CanvasRenderer}
  64028. * @param {THREE.Scene} scene - threejs 场景对象。详情请参考:[THREE.Scene]{@link https://threejs.org/docs/index.html#api/scenes/Scene}
  64029. * @param {THREE.Camera} camera - threejs 相机对象。详情请参考:[THREE.Camera]{@link https://threejs.org/docs/index.html#api/cameras/Camera}
  64030. * @returns {this} this对象。
  64031. * @example
  64032. * var threeLayer = new mapboxgl.supermap.ThreeLayer('three');
  64033. * //可以通过重写 draw 实现模型绘制
  64034. * threeLayer.draw = function (gl, scene, camera) {
  64035. * //TODO 绘制操作
  64036. * }
  64037. * threeLayer.addTo(map);
  64038. */
  64039. draw(gl, scene, camera) {// eslint-disable-line no-unused-vars
  64040. return this;
  64041. }
  64042. /**
  64043. * @function mapboxgl.supermap.ThreeLayer.prototype.renderScene
  64044. * @description 渲染场景。
  64045. * @returns {this} this
  64046. */
  64047. renderScene() {
  64048. this.renderer.renderScene();
  64049. /**
  64050. * @event mapboxgl.supermap.ThreeLayer#renderscene
  64051. * @description renderScene 事件,场景渲染后触发。
  64052. */
  64053. this.fire("renderscene");
  64054. return this;
  64055. }
  64056. _resize() {
  64057. this.renderer.resize();
  64058. }
  64059. _update() {
  64060. /**
  64061. * @event mapboxgl.supermap.ThreeLayer#render
  64062. * @description render 事件,地图渲染时(地图状态改变时)触发。
  64063. */
  64064. this.renderScene();
  64065. this.fire('render');
  64066. return this;
  64067. }
  64068. }
  64069. (external_mapboxgl_default()).supermap.ThreeLayer = ThreeLayer;
  64070. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/HeatMapLayer.js
  64071. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64072. * This program are made available under the terms of the Apache License, Version 2.0
  64073. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64074. /**
  64075. * @class mapboxgl.supermap.HeatMapLayer
  64076. * @classdesc 热力图层类。
  64077. * @category Visualization HeatMap
  64078. * @param {string} name - 图层名称。
  64079. * @param {Object} options - 构造参数。
  64080. * @param {mapboxgl.Map} options.map - mapboxgl map 对象。
  64081. * @param {string} options.featureWeight - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  64082. * @param {string} [options.id] - 专题图层ID。默认使用 CommonUtil.createUniqueID("HeatMapLayer_") 创建专题图层 ID。
  64083. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  64084. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  64085. * @param {number} [options.opacity=1] - 图层透明度。
  64086. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为canvas所支。
  64087. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。 当设置为 true 时,热点半径和图层地理坐标保持一致。
  64088. * @extends {mapboxgl.Evented}
  64089. * @fires mapboxgl.supermap.HeatMapLayer#featuresadded
  64090. * @fires mapboxgl.supermap.HeatMapLayer#changelayer
  64091. * @fires mapboxgl.supermap.HeatMapLayer#featuresremoved
  64092. *
  64093. */
  64094. class HeatMapLayer extends (external_mapboxgl_default()).Evented {
  64095. constructor(name, options) {
  64096. super();
  64097. var _options = options ? options : {};
  64098. /**
  64099. * @member {string} mapboxgl.supermap.HeatMapLayer.prototype.name
  64100. * @description 图层名字。
  64101. */
  64102. this.name = name;
  64103. /**
  64104. * @member {string} mapboxgl.supermap.HeatMapLayer.prototype.id
  64105. * @description 热力图图层 id。
  64106. */
  64107. this.id = _options.id ? _options.id : Util.createUniqueID("HeatMapLayer_");
  64108. /**
  64109. * @member {mapboxgl.Map} mapboxgl.supermap.HeatMapLayer.prototype.map
  64110. * @description 热力图图层 map。
  64111. */
  64112. this.map = _options.map ? _options.map : null;
  64113. /**
  64114. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.loadWhileAnimating=true]
  64115. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  64116. */
  64117. this.loadWhileAnimating = _options.loadWhileAnimating === undefined ? true : _options.loadWhileAnimating;
  64118. /**
  64119. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.visibility=true]
  64120. * @description 图层显示状态属性。
  64121. */
  64122. this.visibility = true;
  64123. /**
  64124. * @member {number} [mapboxgl.supermap.HeatMapLayer.prototype.opacity=1]
  64125. * @description 图层透明度,取值范围[0,1]。
  64126. */
  64127. this.opacity = _options.opacity ? _options.opacity : 1;
  64128. /**
  64129. * @member {Array.<string>} [mapboxgl.supermap.HeatMapLayer.prototype.colors=['blue','cyan','lime','yellow','red']]
  64130. * @description 颜色线性渐变数组,颜色值必须为 canvas 所支。
  64131. */
  64132. this.colors = _options.colors ? _options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
  64133. /**
  64134. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.useGeoUnit=false]
  64135. * @description 使用地理单位,即默认热点半径默认使用像素单位。 当设置为 true 时,热点半径和图层地理坐标保持一致。
  64136. */
  64137. this.useGeoUnit = _options.useGeoUnit ? _options.useGeoUnit : false;
  64138. /**
  64139. * @member {number} [mapboxgl.supermap.HeatMapLayer.prototype.radius=50]
  64140. * @description 热点渲染的最大半径(热点像素半径),
  64141. * 热点显示的时候以精确点为中心点开始往四周辐射衰减,
  64142. * 其衰减半径和权重值成比列。
  64143. */
  64144. this.radius = _options.radius ? _options.radius : 50;
  64145. /**
  64146. * @member {string} mapboxgl.supermap.HeatMapLayer.prototype.featureWeight
  64147. * @description 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  64148. * @example
  64149. * //feature.attributes中表示权重的字段为 height,则在 HeatMapLayer 的 featureWeight 参数赋值为 "height"。
  64150. * feature1.attributes.height = 7.0;
  64151. * feature2.attributes.height = 6.0;
  64152. * var heatMapLayer = new mapboxgl.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  64153. * heatMapLayer.addFeatures([feature1,feature2]);
  64154. */
  64155. this.featureWeight = _options.featureWeight ? _options.featureWeight : null;
  64156. /**
  64157. * @member {Array.<SuperMap.Feature.Vector>} mapboxgl.supermap.HeatMapLayer.prototype.features
  64158. * @description 热点信息数组,记录存储图层上添加的所有热点信息。
  64159. */
  64160. this.features = [];
  64161. /**
  64162. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.maxWeight
  64163. * @description 设置权重最大值。如果不设置此属性,将按照当前屏幕范围内热点所拥有的权重最大值绘制热点图。
  64164. */
  64165. this.maxWeight = null;
  64166. /**
  64167. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.minWeight
  64168. * @description 设置权重最小值。如果不设置此属性,将按照当前屏幕范围内热点所拥有的权重最小值绘制热点图。
  64169. */
  64170. this.minWeight = null;
  64171. /**
  64172. * @member mapboxgl.supermap.HeatMapLayer.prototype.EVENT_TYPES
  64173. * @description 监听一个自定义事件可用如下方式:
  64174. * 热点图自定义事件信息,事件调用时的属性与具体事件类型相对应。
  64175. *
  64176. * All event objects have at least the following properties:
  64177. * {Object} object - A reference to layer.events.object.
  64178. * {DOMElement} element - A reference to layer.events.element.
  64179. *
  64180. * 支持的事件如下 (另外包含 <SuperMap.Layer 中定义的其他事件>):
  64181. * featuresadded - 热点添加完成时触发。传递参数为添加的热点信息数组和操作成功与否信息。
  64182. * 参数类型:{features: features, succeed: succeed}
  64183. * featuresremoved - 热点被删除时触发。传递参数为删除的热点信息数组和操作成功与否信息。
  64184. * 参数类型:{features: features, succeed: succeed}
  64185. * featuresdrawcompleted - 热点图渲染完成时触发,没有额外属性。
  64186. */
  64187. this.EVENT_TYPES = ["featuresadded", "featuresremoved", "featuresdrawcompleted"];
  64188. /**
  64189. * @member {boolean} [mapboxgl.supermap.HeatMapLayer.prototype.supported=false]
  64190. * @description 当前浏览器是否支持 canvas 绘制,
  64191. * 决定了热点图是否可用,内部判断使用。
  64192. */
  64193. this.supported = false;
  64194. /**
  64195. * @member {Object} mapboxgl.supermap.HeatMapLayer.prototype.rootCanvas
  64196. * @description 热点图主绘制面板。
  64197. */
  64198. this.rootCanvas = null;
  64199. /**
  64200. * @member {Object} mapboxgl.supermap.HeatMapLayer.prototype.canvasContext
  64201. * @description 热点图主绘制对象。
  64202. */
  64203. this.canvasContext = null;
  64204. /**
  64205. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.maxWidth
  64206. * @description 当前绘制面板宽度。和当前 map 窗口宽度一致。
  64207. */
  64208. this.maxWidth = null;
  64209. /**
  64210. * @member {number} mapboxgl.supermap.HeatMapLayer.prototype.maxHeight
  64211. * @description 当前绘制面板宽度。和当前 map 窗口高度一致。
  64212. */
  64213. this.maxHeight = null;
  64214. }
  64215. /**
  64216. * @function mapboxgl.supermap.HeatMapLayer.prototype.onAdd
  64217. * @description 向底图添加该图层
  64218. */
  64219. onAdd(map) {
  64220. this.map = map;
  64221. if (this.features.length === 0) {
  64222. return;
  64223. }
  64224. //创建热力图绘制容器
  64225. this._createCanvasContainer();
  64226. //绑定图层事件与Map同步
  64227. this.map.on('resize', this._resizeEvent.bind(this));
  64228. this.map.on('zoomstart', this._zoomStartEvent.bind(this));
  64229. this.map.on('zoomend', this._zoomEndEvent.bind(this));
  64230. this.map.on('rotatestart', this._rotateStartEvent.bind(this));
  64231. this.map.on('rotate', this._rotateEvent.bind(this));
  64232. this.map.on('rotateend', this._rotateEndEvent.bind(this));
  64233. this.map.on('dragend', this._dragEndEvent.bind(this));
  64234. this.map.on('movestart', this._moveStartEvent.bind(this));
  64235. this.map.on('move', this._moveEvent.bind(this));
  64236. this.map.on('moveend', this._moveEndEvent.bind(this));
  64237. this.map.on('remove', this.removeFromMap.bind(this));
  64238. this.refresh();
  64239. }
  64240. /**
  64241. * @function mapboxgl.supermap.HeatMapLayer.prototype.removeFromMap
  64242. * @description 从底图删除该图层。
  64243. */
  64244. removeFromMap() {
  64245. this.removeAllFeatures();
  64246. this.map.getCanvasContainer().removeChild(this.rootCanvas);
  64247. }
  64248. /**
  64249. * @function mapboxgl.supermap.HeatMapLayer.prototype._createCanvasContainer
  64250. * @description 创建热力图绘制容器。
  64251. * @private
  64252. */
  64253. _createCanvasContainer() {
  64254. this.supported = true;
  64255. //构建绘图面板
  64256. this.mapContainer = this.map.getCanvasContainer();
  64257. //热点图要求使用canvas绘制,判断是否支持
  64258. this.rootCanvas = document.createElement("canvas");
  64259. this.rootCanvas.id = this.id;
  64260. var mapCanvas = this.map.getCanvas();
  64261. this.rootCanvas.width = this.maxWidth = parseInt(mapCanvas.width);
  64262. this.rootCanvas.height = this.maxHeight = parseInt(mapCanvas.height);
  64263. Util.modifyDOMElement(this.rootCanvas, null, null, null,
  64264. "absolute", null, null, this.opacity);
  64265. this.canvasContext = this.rootCanvas.getContext('2d');
  64266. this.mapContainer.appendChild(this.rootCanvas);
  64267. }
  64268. /**
  64269. * @function mapboxgl.supermap.HeatMapLayer.prototype.addFeatures
  64270. * @description 添加热点信息。
  64271. * @param {GeoJSONObject} features - 待添加的要素数组。
  64272. *
  64273. * @example
  64274. * var geojson = {
  64275. * "type": "FeatureCollection",
  64276. * "features": [
  64277. * {
  64278. * "type": "feature",
  64279. * "geometry": {
  64280. * "type": "Point", //只支持point类型
  64281. * "coordinates": [0, 0]
  64282. * },
  64283. * "properties": {
  64284. * "height": Math.random()*9,
  64285. * "geoRadius": useGeoRadius?radius:null
  64286. * }
  64287. * }
  64288. * ]
  64289. * };
  64290. * var heatMapLayer = new mapboxgl.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"}); pLayer = new mapboxgl.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  64291. * heatMapLayer.addFeatures(geojson);
  64292. * map.addLayer(heatMapLayer);
  64293. */
  64294. addFeatures(features) {
  64295. this.features = this.toiClientFeature(features);
  64296. /**
  64297. * @event mapboxgl.supermap.HeatMapLayer#featuresadded
  64298. * @description 要素添加完成之后触发。
  64299. * @property {GeoJSONObject} features - 被添加的要素。
  64300. * @property {boolean} succeed - 要素是否成功添加。
  64301. */
  64302. this.fire(this.EVENT_TYPES[0], {features: features, succeed: true});
  64303. //支持更新features,刷新底图
  64304. this.refresh();
  64305. }
  64306. /**
  64307. * @function mapboxgl.supermap.HeatMapLayer.prototype.refresh
  64308. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  64309. */
  64310. refresh() {
  64311. if (this.features.length === 0) {
  64312. return;
  64313. }
  64314. if (this.map) {
  64315. var extent = this.map.getBounds();
  64316. this.updateHeatPoints(extent);
  64317. }
  64318. }
  64319. /**
  64320. * @function mapboxgl.supermap.HeatMapLayer.prototype.setOpacity
  64321. * @description 设置图层的不透明度,取值[0-1]之间。
  64322. * @param {number} [opacity] - 透明度。
  64323. */
  64324. setOpacity(opacity) {
  64325. if (opacity !== this.opacity) {
  64326. this.opacity = opacity;
  64327. Util.modifyDOMElement(this.rootCanvas, null, null, null,
  64328. null, null, null, opacity);
  64329. if (this.map !== null) {
  64330. /**
  64331. * @event mapboxgl.supermap.HeatMapLayer#changelayer
  64332. * @description 图层属性改变之后触发。
  64333. * @property {Object} layer - 图层。
  64334. * @property {string} property - 被改变的图层属性。
  64335. */
  64336. this.fire('changelayer', {layer: this, property: "opacity"});
  64337. }
  64338. }
  64339. }
  64340. /**
  64341. * @function mapboxgl.supermap.HeatMapLayer.prototype.updateHeatPoints
  64342. * @description 刷新热点图显示。
  64343. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  64344. */
  64345. updateHeatPoints(bounds) {
  64346. if (this.features && this.features.length > 0) {
  64347. this.convertFastToPixelPoints(bounds);
  64348. } else {
  64349. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  64350. }
  64351. }
  64352. /**
  64353. * @function mapboxgl.supermap.HeatMapLayer.prototype.convertFastToPixelPoints
  64354. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  64355. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  64356. * @private
  64357. */
  64358. convertFastToPixelPoints(bounds) {
  64359. var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
  64360. //获取当前像素下的地理范围
  64361. var dw = bounds.getEast() - bounds.getWest();
  64362. var dh = bounds.getNorth() - bounds.getSouth();
  64363. var mapCanvas = this.map.getCanvas();
  64364. if (dw / mapCanvas.width > dh / mapCanvas.height) {
  64365. resolution = dw / mapCanvas.width;
  64366. } else {
  64367. resolution = dh / mapCanvas.height;
  64368. }
  64369. //热点半径
  64370. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  64371. for (var i = 0; i < this.features.length; i++) {
  64372. var feature = this.features[i];
  64373. var point = feature.geometry;
  64374. //可通过bounds过滤需绘制的features以优化性能,但mapboxgl旋转获取得bounds不适
  64375. var pixelPoint = this.getPixelXY(new LonLat(point.x, point.y));
  64376. if (this.featureWeight) {
  64377. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  64378. if (!this.maxWeight) {
  64379. //找出最大最小权重值
  64380. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  64381. minTemp = minTemp ? minTemp : pixelPoint.weight;
  64382. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  64383. minTemp = Math.min(minTemp, pixelPoint.weight);
  64384. }
  64385. } else {
  64386. pixelPoint.weight = 1;
  64387. }
  64388. x = Math.floor(pixelPoint.x);
  64389. y = Math.floor(pixelPoint.y);
  64390. k = pixelPoint.weight;
  64391. data.push([x, y, k]);
  64392. }
  64393. //无最大权重设置
  64394. if (!this.maxWeight) {
  64395. if (maxTemp && minTemp) {
  64396. maxWeightTemp = (maxTemp + minTemp) / 2;
  64397. } else {
  64398. maxWeightTemp = 1;
  64399. }
  64400. this.draw(data, maxWeightTemp);
  64401. } else {
  64402. this.draw(data, this.maxWeight);
  64403. }
  64404. }
  64405. /**
  64406. * @function mapboxgl.supermap.HeatMapLayer.prototype.draw
  64407. * @description 绘制热点图。
  64408. * @param {Array} data - convertToPixelPoints方法计算出的点。
  64409. * @private
  64410. */
  64411. draw(data, maxWeight) {
  64412. if (this.maxHeight > 0 && this.maxWidth > 0) {
  64413. //清空
  64414. var ctx = this.canvasContext;
  64415. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  64416. this.drawCircle(this.useRadius);
  64417. this.createGradient();
  64418. for (var i = 0; i < data.length; i++) {
  64419. var p = data[i];
  64420. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  64421. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  64422. }
  64423. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  64424. this.colorize(colored.data, this.grad);
  64425. ctx.putImageData(colored, 0, 0);
  64426. } else {
  64427. return false;
  64428. }
  64429. }
  64430. /**
  64431. * @function mapboxgl.supermap.HeatMapLayer.prototype.colorize
  64432. * @description 根据渐变色重置热点图rgb值。
  64433. * @param {Array} pixels - 像素 RGBA 值。
  64434. * @param {Array} gradient - 渐变 canvas.getImageData.data。
  64435. * @private
  64436. */
  64437. colorize(pixels, gradient) {
  64438. for (var i = 0, j; i < pixels.length; i += 4) {
  64439. j = pixels[i + 3] * 4;
  64440. if (j) {
  64441. pixels[i] = gradient[j];
  64442. pixels[i + 1] = gradient[j + 1];
  64443. pixels[i + 2] = gradient[j + 2];
  64444. }
  64445. }
  64446. }
  64447. /**
  64448. * @function mapboxgl.supermap.HeatMapLayer.drawCircle
  64449. * @description 绘制热点半径圆。
  64450. * @param {number} r - 热点半径。
  64451. * @private
  64452. */
  64453. drawCircle(r) {
  64454. var blur = r / 2;
  64455. var circle = this.circle = document.createElement('canvas'),
  64456. ctx = circle.getContext("2d");
  64457. circle.height = 2 * r;
  64458. circle.width = 2 * r;
  64459. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  64460. ctx.shadowBlur = blur;
  64461. ctx.shadowColor = "#000000";
  64462. ctx.beginPath();
  64463. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  64464. ctx.closePath();
  64465. ctx.fill();
  64466. }
  64467. /**
  64468. * @function mapboxgl.supermap.HeatMapLayer.createGradient
  64469. * @description 根据 this.colors 设置渐变并 getImageData。
  64470. * @private
  64471. */
  64472. createGradient() {
  64473. var colors = this.colors;
  64474. var canvas = document.createElement('canvas'),
  64475. ctx = canvas.getContext("2d"),
  64476. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  64477. canvas.height = 256;
  64478. canvas.width = 1;
  64479. var index = 1;
  64480. for (var i = 0, len = colors.length; i < len; i++) {
  64481. gradient.addColorStop(index / len, colors[i]);
  64482. index++;
  64483. }
  64484. ctx.fillStyle = gradient;
  64485. ctx.fillRect(0, 0, 1, 256);
  64486. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  64487. }
  64488. /**
  64489. * @function mapboxgl.supermap.HeatMapLayer.prototype.getPixelXY
  64490. * @description 转换地理坐标为相对于当前窗口左上角的像素坐标。
  64491. * @param {number} x - 热点的像素 x 坐标。
  64492. * @param {number} y - 热点的像素 y 坐标。
  64493. */
  64494. getPixelXY(coordinate) {
  64495. var pixelP, map = this.map;
  64496. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  64497. let tempPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate.x, coordinate.y));
  64498. pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
  64499. }
  64500. if (coordinate instanceof LonLat) {
  64501. let tempPoint = map.project(new (external_mapboxgl_default()).LngLat(coordinate.lon, coordinate.lat));
  64502. pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
  64503. }
  64504. return pixelP;
  64505. }
  64506. /**
  64507. * @function mapboxgl.supermap.HeatMapLayer.prototype.toiClientFeature
  64508. * @description 转为 iClient 要素。
  64509. * @param {GeoJSONObject} features - 待添加的要素数组。
  64510. */
  64511. toiClientFeature(features) {
  64512. if (!Util.isArray(features)) {
  64513. features = [features];
  64514. }
  64515. let featuresTemp = [];
  64516. for (let i = 0; i < features.length; i++) {
  64517. if (features[i] instanceof Vector) {
  64518. // 若是 GeometryVector 直接返回
  64519. featuresTemp.push(features[i]);
  64520. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  64521. //GeoJSON 规范数据类型
  64522. let format = new GeoJSON();
  64523. featuresTemp = featuresTemp.concat(format.read(features[i]));
  64524. } else if (features[i].geometry && features[i].geometry.parts) {
  64525. //iServer服务器返回数据格式
  64526. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  64527. } else {
  64528. throw new Error(`Features[${i}]'s type does not match, please check.`);
  64529. }
  64530. }
  64531. return featuresTemp;
  64532. }
  64533. /**
  64534. * @function mapboxgl.supermap.HeatMapLayer.prototype.removeFeatures
  64535. * @description 移除指定的热点信息。
  64536. * @param {Array.<SuperMap.Feature.Vector>} features - 热点信息数组。
  64537. */
  64538. removeFeatures(features) {
  64539. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  64540. return;
  64541. }
  64542. if (features === this.features) {
  64543. return this.removeAllFeatures();
  64544. }
  64545. if (!(Util.isArray(features))) {
  64546. features = [features];
  64547. }
  64548. var heatPoint, index, heatPointsFailedRemoved = [];
  64549. for (var i = 0, len = features.length; i < len; i++) {
  64550. heatPoint = features[i];
  64551. index = Util.indexOf(this.features, heatPoint);
  64552. //找不到视为删除失败
  64553. if (index === -1) {
  64554. heatPointsFailedRemoved.push(heatPoint);
  64555. continue;
  64556. }
  64557. //删除热点
  64558. this.features.splice(index, 1);
  64559. }
  64560. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  64561. //派发删除features成功的事件
  64562. /**
  64563. * @event mapboxgl.supermap.HeatMapLayer#featuresremoved
  64564. * @description 要素删除之后触发。
  64565. * @property {Array.<SuperMap.Feature.Vector>} features - 需要被删除的要素。
  64566. * @property {boolean} succeed - 要素删除成功与否。
  64567. */
  64568. this.fire(this.EVENT_TYPES[1], {features: heatPointsFailedRemoved, succeed: succeed});
  64569. this.refresh();
  64570. }
  64571. /**
  64572. * @function mapboxgl.supermap.HeatMapLayer.prototype.removeAllFeatures
  64573. * @description 移除全部的热点信息。
  64574. */
  64575. removeAllFeatures() {
  64576. this.features = [];
  64577. this.refresh();
  64578. }
  64579. /**
  64580. * @function mapboxgl.supermap.HeatMapLayer.prototype.moveTo
  64581. * @description 将图层移动到某个图层之前。
  64582. * @param {string} layerID - 待插入的图层ID。
  64583. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  64584. */
  64585. moveTo(layerID, before) {
  64586. var layer = document.getElementById(this.rootCanvas.id);
  64587. before = before !== undefined ? before : true;
  64588. if (before) {
  64589. var beforeLayer = document.getElementById(layerID);
  64590. if (layer && beforeLayer) {
  64591. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  64592. }
  64593. return;
  64594. }
  64595. var nextLayer = document.getElementById(layerID);
  64596. if (layer) {
  64597. if (nextLayer.nextSibling) {
  64598. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  64599. return;
  64600. }
  64601. nextLayer.parentNode.appendChild(layer);
  64602. }
  64603. }
  64604. /**
  64605. * @function mapboxgl.supermap.HeatMapLayer.prototype.setVisibility
  64606. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  64607. * @param {boolean} [visibility] - 是否显示图层(当前地图的resolution在最大最小resolution之间)。
  64608. */
  64609. setVisibility(visibility) {
  64610. if (this.rootCanvas && visibility !== this.visibility) {
  64611. this.visibility = visibility;
  64612. this.rootCanvas.style.display = visibility ? "block" : "none";
  64613. }
  64614. }
  64615. //事件绑定
  64616. _resizeEvent() {
  64617. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  64618. var canvas = this.map.getCanvas();
  64619. this.rootCanvas.style.width = canvas.style.width;
  64620. this.rootCanvas.style.height = canvas.style.height;
  64621. this.rootCanvas.width = this.maxWidth = parseInt(canvas.width);
  64622. this.rootCanvas.height = this.maxHeight = parseInt(canvas.height);
  64623. let devicePixelRatio = window.devicePixelRatio || 1;
  64624. devicePixelRatio !== 1 && this.canvasContext && this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
  64625. this.refresh();
  64626. }
  64627. _zoomStartEvent() {
  64628. if (this.loadWhileAnimating || !this.visibility) {
  64629. return;
  64630. }
  64631. this.zooming = true;
  64632. this._hide();
  64633. }
  64634. _zoomEndEvent() {
  64635. if (this.loadWhileAnimating || !this.visibility) {
  64636. return;
  64637. }
  64638. this.zooming = false;
  64639. this._show();
  64640. }
  64641. _rotateStartEvent() {
  64642. if (this.loadWhileAnimating || !this.visibility) {
  64643. return;
  64644. }
  64645. this.rotating = true;
  64646. }
  64647. _rotateEvent() {
  64648. if (this.loadWhileAnimating || !this.visibility) {
  64649. return;
  64650. }
  64651. if (this.map.getPitch() !== 0) {
  64652. this._hide();
  64653. }
  64654. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  64655. var tPitch = this.map.getPitch() - this.startPitch;
  64656. var tBearing = -this.map.getBearing() + this.startBearing;
  64657. this.rootCanvas.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)'
  64658. }
  64659. _rotateEndEvent() {
  64660. if (this.loadWhileAnimating || !this.visibility) {
  64661. return;
  64662. }
  64663. this.rotating = false;
  64664. this._show();
  64665. }
  64666. _dragEndEvent() {
  64667. if (this.loadWhileAnimating || !this.visibility) {
  64668. return;
  64669. }
  64670. this._hide();
  64671. }
  64672. _moveEndEvent() {
  64673. if (this.loadWhileAnimating || !this.visibility) {
  64674. return;
  64675. }
  64676. this.rootCanvas.style.transform = '';
  64677. this.refresh();
  64678. this._show();
  64679. }
  64680. _moveStartEvent() {
  64681. if (this.loadWhileAnimating || !this.visibility) {
  64682. return;
  64683. }
  64684. this.startPitch = this.map.getPitch();
  64685. this.startBearing = this.map.getBearing();
  64686. var startMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  64687. this.startMoveX = startMovePoint.x;
  64688. this.startMoveY = startMovePoint.y;
  64689. }
  64690. _moveEvent() {
  64691. if (this.loadWhileAnimating || !this.visibility) {
  64692. this.refresh();
  64693. return;
  64694. }
  64695. if (this.rotating || this.zooming) {
  64696. return;
  64697. }
  64698. if (this.map.getPitch() !== 0) {
  64699. this._hide();
  64700. }
  64701. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  64702. var tPitch = this.map.getPitch() - this.startPitch;
  64703. var tBearing = -this.map.getBearing() + this.startBearing;
  64704. var endMovePoint = this.map.project(new (external_mapboxgl_default()).LngLat(0, 0));
  64705. var tMoveX = endMovePoint.x - this.startMoveX;
  64706. var tMoveY = endMovePoint.y - this.startMoveY;
  64707. this.rootCanvas.style.transform = 'rotateX(' + tPitch + 'deg)' + ' rotateZ(' + tBearing + 'deg)' + ' translate3d(' + tMoveX + 'px, ' + tMoveY + 'px, 0px)';
  64708. }
  64709. _hide() {
  64710. this.rootCanvas.style.display = 'none';
  64711. }
  64712. _show() {
  64713. this.rootCanvas.style.display = 'block';
  64714. }
  64715. }
  64716. (external_mapboxgl_default()).supermap.HeatMapLayer = HeatMapLayer;
  64717. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/DeckglLayer.js
  64718. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64719. * This program are made available under the terms of the Apache License, Version 2.0
  64720. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64721. /**
  64722. * @class mapboxgl.supermap.DeckglLayer
  64723. * @category Visualization DeckGL
  64724. * @classdesc Deckgl 高效率图层,该图图层为综合图层,通过该图层可创建 高效率点图层、路径图层(线图层)、高效率面图层、曲线图层、
  64725. * 正六边形图层(蜂巢图层)、网格图层,只需给定相依配置,因此,在创建图层之前,请仔细阅读参数配置。
  64726. * @param {string} layerTypeID - 高效率图层类型 ID,包括 "scatter-plot" 高效率点图层、"path-layer" 路径图层(线图层)、
  64727. * "polygon-layer" 高效率面图层、 "arc-layer" 曲线图层、"hexagon-layer" 正六边形图层(蜂巢图层)、"screen-grid-layer" 网格图层。
  64728. * @param {Object} options - 图层配置项,包括以下参数:
  64729. * @param {Array.<GeoJSONObject>} options.data - 图层数据,支持 GeoJSON 规范数据类型。
  64730. * @param {Object} options.callback - deckgl 图层回调函数配置项。
  64731. * @param {Object} options.props - deckgl 图层配置项, 在该参数下配置图层配置项:
  64732. * @param {boolean} options.props.coverage - "hexagon-layer" 配置项:六边形半径乘数,介于0 - 1之间。六边形的最终半径通过覆盖半径计算。 注意:覆盖范围不会影响分数的分配方式。 分配方式的半径仅由半径属性确定;
  64733. * @param {boolean} options.props.hexagonAggregator - "hexagon-layer" 配置项:* @param {boolean}
  64734. * options.props.lightSettings - 公共配置项:光照,包含以下几个配置;
  64735. * @param {Array} options.props.lightSettings.lightsPosition - 光照配置项:指定为`[x,y,z]`的光在平面阵列中的位置`, 在一个平面阵列。 长度应该是 `3 x numberOfLights`。
  64736. * @param {Array} options.props.lightSettings.lightsStrength - 光照配置项:平面阵列中指定为“[x,y]`的灯的强度。 长度应该是`2 x numberOfLights`。
  64737. * @param {number} [options.props.lightSettings.numberOfLights=1] - 光照配置项:光照值,最大值为 `5`。
  64738. * @param {number} [options.props.lightSettings.coordinateSystem=COORDINATE_SYSTEM.LNGLAT] - 光照配置项:指定灯位置的坐标系。
  64739. * @param {number} [options.props.lightSettings.coordinateOrigin=[0, 0, 0]] - 光照配置项:指定灯位置的坐标原点。
  64740. * @param {number} [options.props.lightSettings.modelMatrix] - 光照配置项:光位置的变换矩阵。
  64741. * @param {number} [options.props.lightSettings.ambientRatio=0.4] - 光照配置项:光照的环境比例。
  64742. * @param {number} [options.props.lightSettings.diffuseRatio=0.6] - 光照配置项:光的漫反射率。
  64743. * @param {number} [options.props.lightSettings.specularRatio=0.8] - 光照配置项:光的镜面反射率。
  64744. * @param {Object} [options.layerId] - DeckglLayer 图层 Dom 元素 ID。默认使用 CommonUtil.createUniqueID("graphicLayer_" + this.layerTypeID + "_") 创建专题图层 ID。
  64745. * @param {number} [options.props.opacity=1] - 公共配置项:图层透明度。
  64746. * @param {boolean} [options.props.pickable=false] - 公共配置项:是否响应鼠标事件(鼠标点击,鼠标滑动)。
  64747. * @param {function} [options.props.autoHighlight=false] - 公共配置项:鼠标滑动高亮要素。
  64748. * @param {function} [options.props.highlightColor=[0, 0, 128, 128]] - 公共配置项:鼠标滑动高亮颜色。
  64749. * @param {function} [options.props.onClick] - 公共配置项:鼠标点击事件。
  64750. * @param {function} [options.props.onHover] - 公共配置项:鼠标滑动事件。
  64751. * @param {number} [options.props.radiusScale=1] - "scatter-plot" 配置项:散点半径比例。
  64752. * @param {boolean} [options.props.outline=false] - "scatter-plot" 配置项:是否边线显示。
  64753. * @param {number} [options.props.strokeWidth=1] - "scatter-plot" 配置项:边线宽度。
  64754. * @param {number} [options.props.radiusMinPixels=0] - "scatter-plot" 配置项:半径最小像素值。
  64755. * @param {number} [options.props.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - "scatter-plot" 配置项:半径最大像素值。
  64756. * @param {boolean} [options.props.fp64=false] - "scatter-plot" 配置项:否应以高精度64位模式呈现图层。
  64757. * @param {number} [options.props.widthScale=1] - "path-layer" 配置项:线宽比例。
  64758. * @param {number} [options.props.widthMinPixels=0] - "path-layer" 配置项:线宽最小像素值。
  64759. * @param {number} [options.props.widthMaxPixels=Number.MAX_SAFE_INTEGER] - "path-layer" 配置项:线宽最大像素值。
  64760. * @param {boolean} [options.props.rounded=false] - "path-layer" 配置项:节点是否绘制为弧形。
  64761. * @param {number} [options.props.miterLimit=4] - "path-layer" 配置项:节点相对于线宽的最大范围,仅在 rounded 为 false 时有效;
  64762. * @param {boolean} [options.props.fp64=false] - "path-layer" 配置项:否应以高精度64位模式呈现图层。
  64763. * @param {boolean} [options.props.dashJustified=false] - "path-layer" 配置项:是否虚线形式显示,仅在 getDashArray() 回调函数被指定时有效。
  64764. * @param {boolean} [options.props.filled=true] - "polygon-layer" 配置项:是否填充面。
  64765. * @param {boolean} [options.props.stroked=true] - "polygon-layer" 配置项:是否绘制边线。
  64766. * @param {boolean} [options.props.extruded=false] - "polygon-layer" 配置项:是否拉伸建筑。
  64767. * @param {boolean} [options.props.wireframe=false] - "polygon-layer" 配置项:当面被拉伸为建筑时,是否描绘建筑物边线。
  64768. * @param {boolean} [options.props.elevationScale=1] - "polygon-layer" 配置项:海拔比例。
  64769. * @param {boolean} [options.props.lineWidthScale=1] - "polygon-layer" 配置项:线宽比例。
  64770. * @param {boolean} [options.props.lineWidthMinPixels=0] - "polygon-layer" 配置项:线宽最小像素值。
  64771. * @param {boolean} [options.props.lineWidthMaxPixels=Number.MAX_SAFE_INTEGER] - "polygon-layer" 配置项:线宽最大像素值。
  64772. * @param {boolean} [options.props.lineJointRounded=false] - "polygon-layer" 配置项:节点是否绘制为弧形。
  64773. * @param {boolean} [options.props.lineMiterLimit=4] - "polygon-layer" 配置项:节点相对于线宽的最大范围,仅在 lineJointRounded 为 false 时有效。
  64774. * @param {boolean} [options.props.lineDashJustified=false] - "polygon-layer" 配置项:是否虚线形式显示,仅在 getLineDashArray() 回调函数被指定时有效。
  64775. * @param {boolean} [options.props.fp64=false] - "polygon-layer" 配置项:否应以高精度64位模式呈现图层。
  64776. * @param {boolean} [options.props.fp64=false] - "arc-layer" 配置项:否应以高精度64位模式呈现图层。
  64777. * @param {boolean} [options.props.strokeWidth=1] - "arc-layer" 配置项:线宽。
  64778. * @param {boolean} [options.props.radius=1000] - "hexagon-layer" 配置项:六边形半径值。
  64779. * @param {boolean} [options.props.extruded=false] - "hexagon-layer" 配置项:是否拉伸要素。
  64780. * @param {boolean} [options.props.upperPercentile=100] - "hexagon-layer" 配置项:筛选箱并通过upperPercentile重新计算颜色。 颜色值大于upperPercentile的六边形将被隐藏。
  64781. * @param {boolean} [options.props.elevationScale=1] - "hexagon-layer" 配置项:高程乘数,实际海拔高度由 elevationScale * getElevation(d)计算。 elevationScale是一个方便的属性,可以在不更新数据的情况下缩放所有六边形。
  64782. * @param {boolean} [options.props.colorDomain=false] - "hexagon-layer" 配置项:色阶。
  64783. * @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" 配置项:色带。
  64784. */
  64785. class DeckglLayer {
  64786. constructor(layerTypeID, options) {
  64787. // Util.extend(defaultProps, options);
  64788. /**
  64789. * @member {string} mapboxgl.supermap.DeckglLayer.prototype.id
  64790. * @description 高效率点图层 id。
  64791. */
  64792. this.layerTypeID = layerTypeID;
  64793. /**
  64794. * @member {Array.<mapboxgl.supermap.Graphic>} mapboxgl.supermap.DeckglLayer.prototype.graphics
  64795. * @description 点要素对象数组。
  64796. */
  64797. this.data = [].concat(options.data);
  64798. this.props = options.props ? options.props : {};
  64799. this.callback = options.callback ? options.callback : {};
  64800. this.id = options.layerId
  64801. ? options.layerId
  64802. : Util.createUniqueID('graphicLayer_' + this.layerTypeID + '_');
  64803. /**
  64804. * @member {boolean} [mapboxgl.supermap.DeckglLayer.prototype.visibility=true]
  64805. * @description 图层显示状态属性。
  64806. */
  64807. this.visibility = true;
  64808. }
  64809. /**
  64810. * @function mapboxgl.supermap.DeckglLayer.prototype.onAdd
  64811. * @param {mapboxgl.Map} map - Mapbox GL 地图对象。
  64812. * @returns {mapboxgl.supermap.DeckglLayer}
  64813. */
  64814. onAdd(map) {
  64815. this.map = map;
  64816. if (this.canvas) {
  64817. this.mapContainer = this.map.getCanvasContainer();
  64818. this.mapContainer.appendChild(this.canvas);
  64819. return this;
  64820. }
  64821. //当使用扩展的mapboxgl代码时有效
  64822. if (map.getCRS && map.getCRS() !== (external_mapboxgl_default()).CRS.EPSG3857) {
  64823. this.coordinateSystem = 3;
  64824. this.isGeographicCoordinateSystem = true;
  64825. }
  64826. //创建图层容器
  64827. this._initContainer();
  64828. //创建 deckgl 图层
  64829. this._createLayerByLayerTypeID();
  64830. var mapState = this._getState();
  64831. let deckOptions = {};
  64832. for (let key in mapState) {
  64833. deckOptions[key] = mapState[key];
  64834. }
  64835. deckOptions.layers = [this.layer];
  64836. deckOptions.canvas = this.canvas;
  64837. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  64838. this.map.on('render', this._moveEvent.bind(this));
  64839. this.map.on('resize', this._resizeEvent.bind(this));
  64840. this._draw();
  64841. return this;
  64842. }
  64843. /**
  64844. * @function mapboxgl.supermap.DeckglLayer.prototype.remove
  64845. * @description 删除该图层。
  64846. */
  64847. remove() {
  64848. this.map.off('render', this._moveEvent.bind(this));
  64849. this.map.off('resize', this._resizeEvent.bind(this));
  64850. this.map.getCanvasContainer().removeChild(this.canvas);
  64851. }
  64852. /**
  64853. * @function mapboxgl.supermap.DeckglLayer.prototype.removeFromMap
  64854. * @deprecated
  64855. * @description 删除该图层。
  64856. */
  64857. removeFromMap() {
  64858. this.remove();
  64859. this.clear();
  64860. }
  64861. /**
  64862. * @function mapboxgl.supermap.DeckglLayer.prototype.moveTo
  64863. * @description 将图层移动到某个图层之前。
  64864. * @param {string} layerID - 待插入的图层 ID。
  64865. * @param {boolean} [before=true] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  64866. */
  64867. moveTo(layerID, before) {
  64868. var layer = document.getElementById(this.id);
  64869. before = before !== undefined ? before : true;
  64870. if (before) {
  64871. var beforeLayer = document.getElementById(layerID);
  64872. if (layer && beforeLayer) {
  64873. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  64874. }
  64875. return;
  64876. }
  64877. var nextLayer = document.getElementById(layerID);
  64878. if (layer) {
  64879. if (nextLayer.nextSibling) {
  64880. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  64881. return;
  64882. }
  64883. nextLayer.parentNode.appendChild(layer);
  64884. }
  64885. }
  64886. /**
  64887. * @function mapboxgl.supermap.DeckglLayer.prototype.setVisibility
  64888. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  64889. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  64890. */
  64891. setVisibility(visibility) {
  64892. if (this.canvas && visibility !== this.visibility) {
  64893. this.visibility = visibility;
  64894. this.canvas.style.display = visibility ? 'block' : 'none';
  64895. }
  64896. }
  64897. /**
  64898. * @function mapboxgl.supermap.DeckglLayer.prototype.setStyle
  64899. * @description 设置图层整体样式。
  64900. * @param {Object} styleOptions - 样式对象。
  64901. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  64902. * @param {number} [styleOptions.radius=10] - 点半径。
  64903. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  64904. * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  64905. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  64906. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  64907. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  64908. * @param {number} [styleOptions.strokeWidth=12] - 边框大小。
  64909. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  64910. */
  64911. setStyle(styleOptions) {
  64912. core_Util_Util.extend(this.props, styleOptions);
  64913. this._createLayerByLayerTypeID();
  64914. this.update();
  64915. }
  64916. /**
  64917. * @function mapboxgl.supermap.DeckglLayer.prototype.setData
  64918. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  64919. * @param {Array.<Object>} data - 点要素对象数组。
  64920. */
  64921. setData(data) {
  64922. this.data = this.data || [];
  64923. this.data.length = 0;
  64924. let dataTemp = !core_Util_Util.isArray(data) ? [data] : [].concat(data);
  64925. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  64926. if (!this.layer.props.data) {
  64927. this.layer.props.data = [];
  64928. }
  64929. this.layer.props.data.length = 0;
  64930. for (let i = 0; i < dataTemp.length; i++) {
  64931. this.layer.props.data.push(dataTemp[i]);
  64932. }
  64933. this.data = this.layer.props.data;
  64934. this.update();
  64935. }
  64936. /**
  64937. * @function mapboxgl.supermap.DeckglLayer.prototype.addData
  64938. * @description 添加点要素,不会覆盖之前的要素。
  64939. * @param {Array.<Object>} data - 点要素对象数组。
  64940. */
  64941. addData(data) {
  64942. this.data = this.data || [];
  64943. let dataTemp = !core_Util_Util.isArray(data) ? [data] : [].concat(data);
  64944. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  64945. if (!this.layer.props.data) {
  64946. this.layer.props.data = [];
  64947. }
  64948. for (let i = 0; i < dataTemp.length; i++) {
  64949. this.layer.props.data.push(dataTemp[i]);
  64950. }
  64951. this.update();
  64952. }
  64953. /**
  64954. * @function mapboxgl.supermap.DeckglLayer.prototype.update
  64955. * @description 更新图层。
  64956. */
  64957. update() {
  64958. if (this.layer.lifecycle !== 'Awaiting state') {
  64959. let changeFlags = {
  64960. dataChanged: true,
  64961. propsChanged: true,
  64962. viewportChanged: true,
  64963. updateTriggersChanged: true
  64964. };
  64965. this.layer.setChangeFlags(changeFlags);
  64966. }
  64967. this._draw();
  64968. }
  64969. /**
  64970. * @function mapboxgl.supermap.DeckglLayer.prototype.clear
  64971. * @description 释放图层资源。
  64972. */
  64973. // todo 还有哪些资源应该被释放?
  64974. clear() {
  64975. this.removeData();
  64976. this.deckGL.finalize();
  64977. }
  64978. /**
  64979. * @function mapboxgl.supermap.DeckglLayer.prototype.removeData
  64980. * @description 移除所有要素。
  64981. */
  64982. removeData() {
  64983. this.data.length = 0;
  64984. if (this.layer.props.data) {
  64985. this.layer.props.data.length = 0;
  64986. }
  64987. this.update();
  64988. }
  64989. _draw() {
  64990. let deckOptions = this._getState();
  64991. deckOptions.layers = [this.layer];
  64992. deckOptions.canvas = this.canvas;
  64993. // this.deckGL.updateLayers();
  64994. this.deckGL.setProps(deckOptions);
  64995. }
  64996. _getState() {
  64997. //获取地图信息构建state
  64998. let map = this.map;
  64999. let width = parseInt(this.canvas.style.width);
  65000. let height = parseInt(this.canvas.style.height);
  65001. let center = map.getCenter();
  65002. let longitude = center.lng;
  65003. let latitude = center.lat;
  65004. let zoom = map.getZoom();
  65005. let maxZoom = map.getMaxZoom();
  65006. let pitch = map.getPitch();
  65007. let bearing = map.getBearing();
  65008. let mapViewport = {
  65009. width: width,
  65010. height: height,
  65011. longitude: longitude,
  65012. latitude: latitude,
  65013. zoom: zoom,
  65014. maxZoom: maxZoom,
  65015. pitch: pitch,
  65016. bearing: bearing
  65017. };
  65018. let state = {};
  65019. //克隆 mapViewport
  65020. for (let key in mapViewport) {
  65021. state[key] = mapViewport[key];
  65022. }
  65023. //克隆 props
  65024. for (let key in this.props) {
  65025. state[key] = this.props[key];
  65026. }
  65027. //当使用扩展的mapboxgl代码时有效
  65028. if (map.getCRS && map.getCRS() !== (external_mapboxgl_default()).CRS.EPSG3857) {
  65029. state.coordinateSystem = this.coordinateSystem;
  65030. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  65031. }
  65032. //更行数据
  65033. state.data = this.data;
  65034. return state;
  65035. }
  65036. /**
  65037. * @function mapboxgl.supermap.DeckglLayer.prototype._createLayerByLayerTypeID
  65038. * @description 判别当前创建图层类型。
  65039. * @private
  65040. */
  65041. _createLayerByLayerTypeID() {
  65042. //统一处理公共属性:
  65043. this.props.data = this.data;
  65044. this.props.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  65045. this.props.coordinateSystem = this.coordinateSystem;
  65046. //添加事件监听
  65047. this.props.pickable = Boolean(this.props.onClick) || Boolean(this.props.onHover);
  65048. //各类型各自从 defaultProps 取出相形的参数:
  65049. if (this.layerTypeID === 'scatter-plot') {
  65050. this.props.id = 'scatter-plot';
  65051. this._createScatterPlotLayer();
  65052. } else if (this.layerTypeID === 'path-layer') {
  65053. this.props.id = 'path-layer';
  65054. this._createPathLayer();
  65055. } else if (this.layerTypeID === 'polygon-layer') {
  65056. this.props.id = 'polygon-layer';
  65057. this._createPolygonLayer();
  65058. } else if (this.layerTypeID === 'arc-layer') {
  65059. this.props.id = 'arc-layer';
  65060. this._createArcLineLayer();
  65061. } else if (this.layerTypeID === 'hexagon-layer') {
  65062. this.props.id = 'hexagon-layer';
  65063. this._createHexagonLayer();
  65064. } else {
  65065. throw new Error(this.layerTypeID + ' does not support');
  65066. }
  65067. }
  65068. /**
  65069. * @description scatter-plot
  65070. * @private
  65071. */
  65072. _createScatterPlotLayer() {
  65073. //处理回调
  65074. /* this.props.getPosition = this.callback.getPosition ? this.callback.getPosition : function (point) {
  65075. if (!point) {
  65076. return [0, 0, 0];
  65077. }
  65078. return point.geometry.coordinates;
  65079. };*/
  65080. var me = this;
  65081. this.props.getPosition = this.callback.getPosition
  65082. ? this.callback.getPosition
  65083. : function(point) {
  65084. if (!point) {
  65085. return [0, 0, 0];
  65086. }
  65087. let lngLat = point.getLngLat();
  65088. return lngLat && [lngLat.lng, lngLat.lat, 0];
  65089. };
  65090. if (this.callback.getColor) {
  65091. this.props.getColor = this.callback.getColor
  65092. ? this.callback.getColor
  65093. : function(point) {
  65094. let style = point && point.getStyle();
  65095. return (style && style.color) || me.props.color;
  65096. };
  65097. }
  65098. if (this.callback.getRadius) {
  65099. this.props.getRadius = this.callback.getRadius
  65100. ? this.callback.getRadius
  65101. : function(point) {
  65102. let style = point && point.getStyle();
  65103. return (style && style.radius) || me.props.radius;
  65104. };
  65105. }
  65106. if (this.props.color || this.props.radius) {
  65107. this.props.updateTriggers = {};
  65108. if (this.props.radius) {
  65109. this.props.updateTriggers.getRadius = [this.props.radius];
  65110. }
  65111. if (this.props.color) {
  65112. this.props.updateTriggers.getColor = [this.props.color];
  65113. }
  65114. }
  65115. this.layer = new window.DeckGL.ScatterplotLayer(this.props);
  65116. }
  65117. /**
  65118. * @description path-layer
  65119. * @private
  65120. */
  65121. _createPathLayer() {
  65122. this.props.getPath = this.callback.getPath
  65123. ? this.callback.getPath
  65124. : function(feature) {
  65125. return feature.geometry.coordinates;
  65126. };
  65127. //以下几个函数也可走默认值
  65128. if (this.callback.getColor) {
  65129. this.props.getColor = this.callback.getColor;
  65130. }
  65131. if (this.callback.getWidth) {
  65132. this.props.getWidth = this.callback.getWidth;
  65133. }
  65134. if (this.callback.getDashArray) {
  65135. this.props.getDashArray = this.callback.getDashArray;
  65136. }
  65137. this.layer = new window.DeckGL.PathLayer(this.props);
  65138. }
  65139. /**
  65140. * @description polygon-layer
  65141. * @private
  65142. */
  65143. _createPolygonLayer() {
  65144. this.props.getPolygon = this.callback.getPolygon
  65145. ? this.callback.getPolygon
  65146. : function(feature) {
  65147. return feature.geometry.coordinates;
  65148. };
  65149. //todo 思考下真的让用户配这么多回调么,或者先判断下数据属性里面有没有配置的属性值?
  65150. if (this.callback.getElevation) {
  65151. this.props.getElevation = this.callback.getElevation;
  65152. }
  65153. if (this.callback.getFillColor) {
  65154. this.props.getFillColor = this.callback.getFillColor;
  65155. }
  65156. if (this.callback.getLineColor) {
  65157. this.props.getLineColor = this.callback.getLineColor;
  65158. }
  65159. if (this.callback.getLineWidth) {
  65160. this.props.getLineWidth = this.callback.getLineWidth;
  65161. }
  65162. this.props.updateTriggers = {};
  65163. this.props.updateTriggers.getColor = this.props.color ? this.props.color : [0, 0, 128, 128];
  65164. this.layer = new window.DeckGL.PolygonLayer(this.props);
  65165. }
  65166. /**
  65167. * @description arc-layer
  65168. * @private
  65169. */
  65170. _createArcLineLayer() {
  65171. //todo ArcLineLayer geojson coordinates数组中只能有一个线段
  65172. this.props.getSourcePosition = this.callback.getSourcePosition
  65173. ? this.callback.getSourcePosition
  65174. : function(feature) {
  65175. if (!feature) {
  65176. return [0, 0, 0];
  65177. }
  65178. return feature.geometry.coordinates[0];
  65179. };
  65180. this.props.getTargetPosition = this.callback.getTargetPosition
  65181. ? this.callback.getTargetPosition
  65182. : function(feature) {
  65183. if (!feature) {
  65184. return [0, 0, 0];
  65185. }
  65186. return feature.geometry.coordinates[1];
  65187. };
  65188. if (this.callback.getStrokeWidth) {
  65189. this.props.getStrokeWidth = this.callback.getStrokeWidth;
  65190. }
  65191. if (this.callback.getSourceColor) {
  65192. this.props.getSourceColor = this.callback.getSourceColor;
  65193. }
  65194. if (this.callback.getTargetColor) {
  65195. this.props.getTargetColor = this.callback.getTargetColor;
  65196. }
  65197. this.layer = new window.DeckGL.ArcLayer(this.props);
  65198. }
  65199. /**
  65200. * @description hexagon-layer
  65201. * @private
  65202. */
  65203. _createHexagonLayer() {
  65204. this.props.getPosition = this.callback.getPosition
  65205. ? this.callback.getPosition
  65206. : function(feature) {
  65207. if (!feature) {
  65208. return [0, 0, 0];
  65209. }
  65210. return feature.geometry.coordinates;
  65211. };
  65212. if (this.callback.getColorValue) {
  65213. this.props.getColorValue = this.callback.getColorValue;
  65214. }
  65215. if (this.callback.getElevationValue) {
  65216. this.props.getElevationValue = this.callback.getElevationValue;
  65217. }
  65218. this.layer = new window.DeckGL.HexagonLayer(this.props);
  65219. }
  65220. _initContainer() {
  65221. this.canvas = this._createCanvas();
  65222. this.mapContainer = this.map.getCanvasContainer();
  65223. this.mapContainer.appendChild(this.canvas);
  65224. }
  65225. _createCanvas() {
  65226. let canvas = document.createElement('canvas');
  65227. canvas.id = this.id;
  65228. canvas.style.position = 'absolute';
  65229. canvas.style.top = 0 + 'px';
  65230. canvas.style.left = 0 + 'px';
  65231. canvas.style.cursor = '';
  65232. let map = this.map;
  65233. canvas.width = parseInt(map.getCanvas().style.width);
  65234. canvas.height = parseInt(map.getCanvas().style.height);
  65235. canvas.style.width = map.getCanvas().style.width;
  65236. canvas.style.height = map.getCanvas().style.height;
  65237. return canvas;
  65238. }
  65239. _moveEvent() {
  65240. this._draw();
  65241. }
  65242. _resizeEvent() {
  65243. let canvas = this.canvas;
  65244. let map = this.map;
  65245. canvas.width = parseInt(map.getCanvas().style.width);
  65246. canvas.height = parseInt(map.getCanvas().style.height);
  65247. canvas.style.width = map.getCanvas().style.width;
  65248. canvas.style.height = map.getCanvas().style.height;
  65249. this._draw();
  65250. }
  65251. }
  65252. (external_mapboxgl_default()).supermap.DeckglLayer = DeckglLayer;
  65253. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/GraticuleLayer.js
  65254. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  65255. * This program are made available under the terms of the Apache License, Version 2.0
  65256. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65257. /**
  65258. * reference and modification
  65259. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  65260. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  65261. * Apache Licene 2.0
  65262. * thanks dereklieu, cloudybay
  65263. */
  65264. /**
  65265. * @class mapboxgl.supermap.GraticuleLayer
  65266. * @category Visualization GraticuleLayer
  65267. * @classdesc 经纬网。
  65268. * @version 10.1.1
  65269. * @param {Object} options -经纬网参数。
  65270. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("graticuleLayer_") 创建图层 ID。
  65271. * @param {boolean} [options.visible=true] - 是否显示经纬网。
  65272. * @param {boolean} [options.showLabel=true] - 是否显示标签。
  65273. * @param {number} [options.opacity=1] - 画布透明度。
  65274. * @param {number|Function} [options.interval = 10] - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  65275. * @param {mapboxgl.LngLatBounds} [options.extent] - 经纬网渲染的边界范围([minx, miny, maxx, maxy]),不传为整个地图范围。
  65276. * @param {number} [options.minZoom] - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  65277. * @param {number} [options.maxZoom] - 该图层可见的最大视图缩放级别(含)。
  65278. * @param {Function} [options.lngLabelFormatter = null] - 经度标签转换函数。
  65279. * @param {Function} [options.latLabelFormatter = null] - 纬度标签转换函数。
  65280. * @param {mapboxgl.supermap.GraticuleLayer.LabelStyle} [options.lngLabelStyle] - 经度标签样式。
  65281. * @param {mapboxgl.supermap.GraticuleLayer.LabelStyle} [options.latLabelStyle] - 纬度标签样式。
  65282. * @param {mapboxgl.supermap.GraticuleLayer.StrokeStyle} [options.strokeStyle] - 绘制经纬线的样式。
  65283. */
  65284. /**
  65285. * @typedef {Object} mapboxgl.supermap.GraticuleLayer.LabelStyle - 标签样式
  65286. * @property {Array.<string>} [textFont = ['Calibri','sans-serif']] - 字体样式。
  65287. * @property {string} [textSize = '12px'] - 字体大小。
  65288. * @property {string} [textColor ='rgba(0,0,0,1)'] - 字体颜色
  65289. * @property {string} [textHaloColor ='rgba(255,255,255,1)'] - 描边颜色
  65290. * @property {number} [textHaloWidth = 1] - 描边宽度
  65291. * @property {string} [textAnchor = 'bottom'] - 字体基线: "center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"
  65292. */
  65293. /**
  65294. * @typedef {Object} mapboxgl.supermap.GraticuleLayer.StrokeStyle - 线样式
  65295. * @property {string} [lineColor = 'red'] - 线颜色。
  65296. * @property {string} [lineCap = 'round'] - 线端点风格:butt, round, square。
  65297. * @property {string} [lineJoin = round] - 线连接样式:bevel, round, miter。
  65298. * @property {Array.<number>} [lindDasharray = [0.5,4]] - 虚线样式。
  65299. * @property {number} [lineWidth = 1] - 线宽。
  65300. */
  65301. const defaultTextStyle = {
  65302. textSize: '12px',
  65303. textFont: ['12px Calibri', 'sans-serif'],
  65304. textAnchor: 'bottom',
  65305. textColor: 'rgba(0,0,0,1)',
  65306. textHaloColor: 'rgba(255,255,255,1)',
  65307. textHaloWidth: 1
  65308. };
  65309. const defaultStrokeStyle = {
  65310. lineColor: 'red',
  65311. lineCap: 'round', // butt, round, square
  65312. lineJoin: 'round', // bevel, round, miter
  65313. lindDasharray: [0.4, 5], // 数组|function
  65314. lineDashOffset: 0,
  65315. lineWidth: 1 // 数字|function
  65316. };
  65317. const defaultOptions = {
  65318. showLabel: true,
  65319. opacity: 1,
  65320. visible: true,
  65321. interval: 10, // function|number
  65322. extent: null,
  65323. minZoom: 0,
  65324. maxZoom: 50,
  65325. wrapX: true,
  65326. strokeStyle: defaultStrokeStyle,
  65327. lngLabelFormatter: null,
  65328. latLabelFormatter: null,
  65329. lngLabelStyle: defaultTextStyle,
  65330. latLabelStyle: defaultTextStyle
  65331. };
  65332. class GraticuleLayer {
  65333. constructor(options) {
  65334. this.id = options && options.layerID ? options.layerID : Util.createUniqueID('graticuleLayer_');
  65335. this.sourceId = this.id + '_line';
  65336. this.canvasId = this.id;
  65337. this.options = options;
  65338. this.resetEvent = this._reset.bind(this);
  65339. this.styleDataEevent = this._setLayerTop.bind(this);
  65340. this.resizeEvent = this._resizeCallback.bind(this);
  65341. this.zoomendEvent = this.setVisibility.bind(this);
  65342. }
  65343. onAdd(map = this.map) {
  65344. this.map = map;
  65345. this._initialize();
  65346. this._createCanvas();
  65347. this._bindEvent();
  65348. this._drawCanvas();
  65349. this._addGraticuleLayer();
  65350. this.setVisibility();
  65351. }
  65352. /**
  65353. * @function mapboxgl.supermap.GraticuleLayer.prototype.removeFromMap
  65354. * @description 移除图层。
  65355. */
  65356. removeFromMap() {
  65357. this.mapContainer.removeChild(this.canvas);
  65358. this.canvas = null;
  65359. this._unbindEvent();
  65360. }
  65361. /**
  65362. * @function mapboxgl.supermap.GraticuleLayer.prototype.setVisibility
  65363. * @description 设置是否可见。
  65364. * @param {boolean} visible - 是否可见。
  65365. */
  65366. setVisibility(visible) {
  65367. const zoom = this.map && this.map.getZoom();
  65368. this.options.visible = typeof visible === 'boolean' ? visible : this.options.visible;
  65369. this.visible =
  65370. typeof visible === 'boolean'
  65371. ? visible
  65372. : this.options.visible && zoom >= this.options.minZoom && zoom <= this.options.maxZoom;
  65373. if (this.map.getLayer(this.sourceId)) {
  65374. this.map.setLayoutProperty(this.sourceId, 'visibility', this.visible ? 'visible' : 'none');
  65375. }
  65376. this._drawLabel();
  65377. }
  65378. /**
  65379. * @function mapboxgl.supermap.GraticuleLayer.prototype.setMinZoom
  65380. * @description 设置最小视图缩放级别。
  65381. * @param {number} minZoom - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  65382. */
  65383. setMinZoom(minZoom) {
  65384. this.options.minZoom = minZoom;
  65385. this.setVisibility();
  65386. }
  65387. /**
  65388. * @function mapboxgl.supermap.GraticuleLayer.prototype.setMaxZoom
  65389. * @description 该图层可见的最大视图缩放级别。
  65390. * @param {number} maxZoom - 该图层可见的最大视图缩放级别(含)。
  65391. */
  65392. setMaxZoom(maxZoom) {
  65393. this.options.maxZoom = maxZoom;
  65394. this.setVisibility();
  65395. }
  65396. /**
  65397. * @function mapboxgl.supermap.GraticuleLayer.prototype.setShowLabel
  65398. * @description 设置显示标签。
  65399. * @param {boolean} showLabel - 是否显示标签。
  65400. */
  65401. setShowLabel(showLabel) {
  65402. this.options.showLabel = showLabel;
  65403. this._drawLabel();
  65404. }
  65405. /**
  65406. * @function mapboxgl.supermap.GraticuleLayer.prototype.setExtent
  65407. * @description 设置经纬网渲染的边界范围。
  65408. * @param {mapboxgl.LngLatBounds} extent - 经纬网渲染的边界范围。
  65409. */
  65410. setExtent(extent) {
  65411. this.options.extent = this._getDefaultExtent(extent, this.map);
  65412. this.features = this._getGraticuleFeatures();
  65413. this._updateGraticuleLayer();
  65414. this._drawLabel();
  65415. }
  65416. /**
  65417. * @function mapboxgl.supermap.GraticuleLayer.prototype.setStrokeStyle
  65418. * @description 设置经纬线样式。
  65419. * @param {mapboxgl.supermap.GraticuleLayer.StrokeStyle} strokeStyle - 经纬线样式。
  65420. */
  65421. setStrokeStyle(strokeStyle) {
  65422. if (!this.map || !this.map.getLayer(this.sourceId)) {
  65423. return;
  65424. }
  65425. this.options.strokeStyle = strokeStyle;
  65426. const { layout, paint } = this._transformStrokeStyle(strokeStyle);
  65427. for (let key in layout) {
  65428. this.map.setLayoutProperty(this.sourceId, key, layout[key]);
  65429. }
  65430. for (let key in paint) {
  65431. this.map.setPaintProperty(this.sourceId, key, paint[key]);
  65432. }
  65433. }
  65434. /**
  65435. * @function mapboxgl.supermap.GraticuleLayer.prototype.setLngLabelStyle
  65436. * @description 设置经度标签样式。
  65437. * @param {mapboxgl.supermap.GraticuleLayer.LabelStyle} labelStyle - 标签样式。
  65438. */
  65439. setLngLabelStyle(labelStyle) {
  65440. this.options.lngLabelStyle = labelStyle;
  65441. this._drawLabel();
  65442. }
  65443. /**
  65444. * @function mapboxgl.supermap.GraticuleLayer.prototype.setLatLabelStyle
  65445. * @description 设置纬度标签样式。
  65446. * @param {mapboxgl.supermap.GraticuleLayer.LabelStyle} labelStyle - 标签样式。
  65447. */
  65448. setLatLabelStyle(labelStyle) {
  65449. this.options.latLabelStyle = labelStyle;
  65450. this._drawLabel();
  65451. }
  65452. /**
  65453. * @function mapboxgl.supermap.GraticuleLayer.prototype.setIntervals
  65454. * @description 设置经纬度的间隔(以度为单位)
  65455. * @param {number|Function} interval - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  65456. */
  65457. setIntervals(interval) {
  65458. this.options.interval = interval;
  65459. this._calcInterval();
  65460. this.features = this._getGraticuleFeatures();
  65461. this._updateGraticuleLayer();
  65462. this._drawLabel();
  65463. }
  65464. _bindEvent() {
  65465. this.map.on('move', this.resetEvent);
  65466. this.map.on('moveend', this.resetEvent);
  65467. this.map.on('styledata', this.styleDataEevent);
  65468. this.map.on('resize', this.resizeEvent);
  65469. this.map.on('zoomend', this.zoomendEvent);
  65470. }
  65471. _unbindEvent() {
  65472. this.map.off('move', this.resetEvent);
  65473. this.map.off('moveend', this.resetEvent);
  65474. this.map.off('styledata', this.styleDataEevent);
  65475. this.map.off('resize', this.resizeEvent);
  65476. this.map.off('zoomend', this.zoomendEvent);
  65477. }
  65478. _initialize(map = this.map, options = this.options) {
  65479. options = options || {};
  65480. options.strokeStyle = { ...defaultStrokeStyle, ...(options.strokeStyle || {}) };
  65481. options.lngLabelStyle = { ...defaultTextStyle, ...(options.lngLabelStyle || {}) };
  65482. options.latLabelStyle = { ...defaultTextStyle, ...(options.latLabelStyle || {}) };
  65483. this.options = {
  65484. ...defaultOptions,
  65485. ...options,
  65486. extent: this._getDefaultExtent(options.extent, map),
  65487. wrapX: typeof options.wrapX === 'boolean' ? options.wrapX : map.getRenderWorldCopies()
  65488. };
  65489. this.oldExtent = this.options.extent;
  65490. this._calcInterval();
  65491. this.isRotate = false;
  65492. this.visible = true;
  65493. this.features = this._getGraticuleFeatures();
  65494. }
  65495. _createCanvas() {
  65496. if (this.canvas) {
  65497. return;
  65498. }
  65499. this.canvas = document.createElement('canvas');
  65500. this.canvas.id = this.canvasId;
  65501. this.canvas.style.position = 'absolute';
  65502. this.canvas.style.top = 0 + 'px';
  65503. this.canvas.style.left = 0 + 'px';
  65504. var global$2 = typeof window === 'undefined' ? {} : window;
  65505. var devicePixelRatio = global$2.devicePixelRatio || 1;
  65506. this.canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio;
  65507. this.canvas.height = parseInt(this.map.getCanvas().style.height) * devicePixelRatio;
  65508. this.canvas.style.width = this.map.getCanvas().style.width;
  65509. this.canvas.style.height = this.map.getCanvas().style.height;
  65510. this.canvas.globalAlpha = this.options.opacity;
  65511. this.mapContainer = this.map.getCanvasContainer();
  65512. this.mapContainer.appendChild(this.canvas);
  65513. }
  65514. _drawCanvas() {
  65515. if (!this.canvas) {
  65516. this._createCanvas();
  65517. }
  65518. this.setVisibility();
  65519. this._reset();
  65520. }
  65521. _resizeCallback() {
  65522. this.mapContainer && this.mapContainer.removeChild(this.canvas);
  65523. this.canvas = null;
  65524. this._drawCanvas();
  65525. }
  65526. _reset() {
  65527. this._updateRotate();
  65528. this._updateExtent();
  65529. this._calcInterval();
  65530. this._drawLabel();
  65531. }
  65532. _setLayerTop(map = this.map) {
  65533. if (!map) {
  65534. return;
  65535. }
  65536. const layersOnMap = map.getStyle && map.getStyle().layers;
  65537. if (
  65538. layersOnMap &&
  65539. layersOnMap.length &&
  65540. layersOnMap.findIndex(item => item.id === this.sourceId) !== layersOnMap.length - 1
  65541. ) {
  65542. if (map.getLayer(this.sourceId)) {
  65543. map.removeLayer(this.sourceId);
  65544. this._addGraticuleLayer();
  65545. }
  65546. }
  65547. }
  65548. _getDefaultExtent(extent, map = this.map) {
  65549. const crs = (map.getCRS && map.getCRS()) || {};
  65550. let { extent: crsExtent } = crs;
  65551. if (!crsExtent) {
  65552. crsExtent = [-180, -85.05119, 180, 85.05119];
  65553. }
  65554. if (!extent || extent.length === 0) {
  65555. return crsExtent;
  65556. }
  65557. const { _sw, _ne } = external_mapboxgl_default().LngLatBounds.convert(extent);
  65558. extent = [_sw.lng, _sw.lat, _ne.lng, _ne.lat];
  65559. extent = [
  65560. Math.max(crsExtent[0], extent[0]),
  65561. Math.max(crsExtent[1], extent[1]),
  65562. Math.min(crsExtent[2], extent[2]),
  65563. Math.min(crsExtent[3], extent[3])
  65564. ];
  65565. return extent;
  65566. }
  65567. _updateRotate() {
  65568. const bearing = this.map.getBearing();
  65569. this.isRotate = (bearing > -180 && bearing <= -90) || (bearing >= 90 && bearing < 180);
  65570. }
  65571. _updateExtent() {
  65572. if (this.options.wrapX && !this.oldExtent) {
  65573. const { _ne, _sw } = this.map.getBounds();
  65574. this.options.extent = [_sw.lng, _sw.lat, _ne.lng, _ne.lat];
  65575. }
  65576. }
  65577. _calcInterval(interval = this.options.interval) {
  65578. if (typeof interval === 'function') {
  65579. interval = interval(this.map);
  65580. this._currLngInterval = interval;
  65581. this._currLatInterval = interval;
  65582. } else {
  65583. this._currLngInterval = interval;
  65584. this._currLatInterval = interval;
  65585. }
  65586. }
  65587. _formatLat(lat) {
  65588. if (this.options.latFormatTickLabel) {
  65589. return this.options.latLabelFormatter(lat);
  65590. }
  65591. if (lat < 0) {
  65592. return '' + conversionDegree(lat * -1) + 'S';
  65593. } else if (lat > 0) {
  65594. return '' + conversionDegree(lat) + 'N';
  65595. }
  65596. return '' + conversionDegree(lat);
  65597. }
  65598. _formatLng(lng) {
  65599. if (this.options.lngLabelFormatter) {
  65600. return this.options.lngLabelFormatter(lng);
  65601. }
  65602. lng = getWrapNum(lng);
  65603. if (lng > 0 && lng <= 180) {
  65604. return '' + conversionDegree(lng) + 'E';
  65605. } else if (lng < 0 && lng >= -180) {
  65606. return '' + conversionDegree(lng * -1) + 'W';
  65607. }
  65608. return '' + conversionDegree(lng);
  65609. }
  65610. _parsePxToInt(txt) {
  65611. if (txt.length > 2) {
  65612. if (txt.charAt(txt.length - 2) === 'p') {
  65613. txt = txt.substr(0, txt.length - 2);
  65614. }
  65615. }
  65616. try {
  65617. return parseInt(txt, 10);
  65618. } catch (e) {
  65619. console.log(e);
  65620. }
  65621. return 0;
  65622. }
  65623. _drawLabel(visible = this.visible) {
  65624. const canvas = this.canvas;
  65625. const ctx = canvas.getContext('2d');
  65626. if (!visible || !this.options.showLabel) {
  65627. ctx.clearRect(0, 0, canvas.width, canvas.height);
  65628. return;
  65629. }
  65630. if (this.map) {
  65631. if (!this._currLngInterval || !this._currLatInterval) {
  65632. this._calcInterval();
  65633. }
  65634. ctx.clearRect(0, 0, canvas.width, canvas.height);
  65635. const { lngLabelStyle, latLabelStyle } = this.options;
  65636. const { lngPoints, latPonits } = this._getGridiculePoints();
  65637. lngPoints.forEach(point => {
  65638. this._drawLng(ctx, point[0], point[1], point[2], lngLabelStyle);
  65639. });
  65640. latPonits.forEach(point => {
  65641. this._drawLat(ctx, point[0], point[1], point[2], latLabelStyle);
  65642. });
  65643. }
  65644. }
  65645. _drawLat(ctx, latTick, bb, isIntersect, latLabelStyle) {
  65646. ctx = this._setLabelStyle(ctx, latLabelStyle);
  65647. const ww = this.canvas.width;
  65648. let txtHeight = 12;
  65649. try {
  65650. const fontSize = ctx.font.split(' ')[0];
  65651. txtHeight = this._parsePxToInt(fontSize);
  65652. } catch (e) {
  65653. console.log(e);
  65654. }
  65655. if (!isIntersect) {
  65656. const lngR = latTick;
  65657. latTick = bb;
  65658. bb = this.map.project([lngR, latTick]);
  65659. }
  65660. const latstr = this._formatLat(latTick);
  65661. const txtWidth = ctx.measureText(latstr).width;
  65662. ctx.strokeText(latstr, (isIntersect ? ww : bb.x) - txtWidth, (isIntersect ? bb : bb.y) + txtHeight / 2);
  65663. ctx.fillText(latstr, (isIntersect ? ww : bb.x) - txtWidth, (isIntersect ? bb : bb.y) + txtHeight / 2);
  65664. }
  65665. _drawLng(ctx, lngTick, bb, isIntersect, lngLabelStyle) {
  65666. ctx = this._setLabelStyle(ctx, lngLabelStyle);
  65667. const hh = this.canvas.height;
  65668. if (!isIntersect) {
  65669. const latTick = bb;
  65670. bb = this.map.project([lngTick, latTick]);
  65671. }
  65672. const lngstr = this._formatLng(lngTick);
  65673. const txtWidth = ctx.measureText(lngstr).width;
  65674. ctx.strokeText(lngstr, (isIntersect ? bb : bb.x) - txtWidth / 2, isIntersect ? hh : bb.y);
  65675. ctx.fillText(lngstr, (isIntersect ? bb : bb.x) - txtWidth / 2, isIntersect ? hh : bb.y);
  65676. }
  65677. _getLatPoints(lngRange = [-180, 180], firstLng, lastLng, features = this.features) {
  65678. if (!features) {
  65679. return;
  65680. }
  65681. if (this.options.wrapX && lngRange[0] === -180 && lngRange[1] === 180) {
  65682. return [];
  65683. }
  65684. let points = [];
  65685. features.forEach(feature => {
  65686. const lat = feature.geometry.coordinates[0][1];
  65687. const isLatFeature = feature.geometry.coordinates[1][1] === lat;
  65688. if (isLatFeature) {
  65689. let lng = typeof lastLng === 'number' ? lastLng : lngRange[1];
  65690. if (this.isRotate) {
  65691. lng = typeof firstLng === 'number' ? firstLng : lngRange[0];
  65692. }
  65693. if (this.options.wrapX) {
  65694. points = points.concat(this._getWrapPoints(lng, lat, [lng, lng]));
  65695. }
  65696. points.push([lng, lat]);
  65697. }
  65698. });
  65699. return points;
  65700. }
  65701. _getLngPoints(latRange = [-90, 90], firstLat, lastLat, features = this.features) {
  65702. if (!features) {
  65703. return;
  65704. }
  65705. let lat = typeof firstLat === 'number' ? firstLat : latRange[0];
  65706. if (this.isRotate) {
  65707. lat = typeof lastLat === 'number' ? lastLat : latRange[1];
  65708. }
  65709. let points = [];
  65710. features.forEach(feature => {
  65711. let lng = feature.geometry.coordinates[0][0];
  65712. const isLngFeature = feature.geometry.coordinates[1][0] === lng;
  65713. if (isLngFeature) {
  65714. points.push([lng, lat]);
  65715. if (this.options.wrapX) {
  65716. points = points.concat(this._getWrapPoints(lng, lat));
  65717. }
  65718. }
  65719. });
  65720. return points;
  65721. }
  65722. _getWrapPoints(lng, lat, extent = this.oldExtent) {
  65723. const points = [];
  65724. const { _ne, _sw } = this.map.getBounds();
  65725. const lastLng = extent.length > 2 ? extent[2] : extent[1];
  65726. while (lng >= _sw.lng) {
  65727. const wrapNum = getWrapNum(lng, lastLng === 180, extent[0] === -180);
  65728. if (!extent || (wrapNum >= extent[0] && wrapNum <= lastLng)) {
  65729. points.push([lng, lat]);
  65730. }
  65731. lng -= 360;
  65732. }
  65733. while (lng <= _ne.lng) {
  65734. const wrapNum = getWrapNum(lng, lastLng === 180, extent[0] === -180);
  65735. if (!extent || (wrapNum >= extent[0] && wrapNum <= lastLng)) {
  65736. points.push([lng, lat]);
  65737. }
  65738. lng += 360;
  65739. }
  65740. return points;
  65741. }
  65742. _getGridiculePoints() {
  65743. const intersectLatPoints = this._getEdgeLat();
  65744. const intersectLngPoints = this._getEdgeLng();
  65745. const { latRange, lngRange, firstLat, firstLng, lastLat, lastLng } = this._getRange();
  65746. const latPonits = this._getUniquePoint(this._getLatPoints(lngRange, firstLng, lastLng), intersectLatPoints, 1);
  65747. const lngPoints = this._getUniquePoint(this._getLngPoints(latRange, firstLat, lastLat), intersectLngPoints, 0);
  65748. return { latPonits, lngPoints };
  65749. }
  65750. _getEdgeLat(_currLatInterval = this._currLatInterval, map = this.map) {
  65751. let latPoints = [];
  65752. let latCoordinates = [];
  65753. let firstLat;
  65754. const ww = this.canvas.width;
  65755. const hh = this.canvas.height;
  65756. const { extent } = this._getRange();
  65757. const { _ne } = this.map.getBounds();
  65758. if (this.options.wrapX && getWrapNum(_ne.lng) > extent[2]) {
  65759. return [];
  65760. }
  65761. const countDecimals = this._countDecimals(_currLatInterval);
  65762. for (let i = 0; i <= hh; i++) {
  65763. const point = map.unproject([ww, i]);
  65764. const wrapNum = getWrapNum(point.lng);
  65765. const lngEdge = this.options.wrapX
  65766. ? wrapNum >= extent[0] && wrapNum <= extent[2]
  65767. : point.lng >= extent[0] && point.lng <= extent[2];
  65768. if (lngEdge && point.lat >= extent[1] && point.lat <= extent[3]) {
  65769. latPoints.push([point.lat, i]);
  65770. latCoordinates.push(point.lat);
  65771. if (firstLat === undefined && point.lat.toFixed(countDecimals) % _currLatInterval === 0) {
  65772. firstLat = Number(point.lat.toFixed(countDecimals));
  65773. }
  65774. }
  65775. }
  65776. const { first, last, coordinates, points } = this._getIntersectRange(
  65777. firstLat,
  65778. latCoordinates,
  65779. latPoints,
  65780. _currLatInterval
  65781. );
  65782. firstLat = Math.min(Math.max(first, -90), 90);
  65783. const lastLat = Math.max(Math.min(Math.round(last), 90), -90);
  65784. if (firstLat !== -90 || lastLat !== -90) {
  65785. return this._getClosestCoordinate(firstLat, lastLat, coordinates, points, _currLatInterval);
  65786. }
  65787. return [];
  65788. }
  65789. _getEdgeLng(_currLngInterval = this._currLngInterval, map = this.map) {
  65790. let lngPoints = [];
  65791. let lngCoordinates = [];
  65792. let firstLng;
  65793. const ww = this.canvas.width;
  65794. const hh = this.canvas.height;
  65795. const extent = this.options.extent;
  65796. const countDecimals = this._countDecimals(_currLngInterval);
  65797. const { _sw } = this.map.getBounds();
  65798. if (this.options.wrapX && getWrapNum(_sw.lat) > extent[3]) {
  65799. return [];
  65800. }
  65801. for (let i = 0; i <= ww; i++) {
  65802. const point = map.unproject([i, hh]);
  65803. const wrapNum = getWrapNum(point.lng);
  65804. const lngEdge = this.options.wrapX
  65805. ? wrapNum >= extent[0] && wrapNum <= extent[2]
  65806. : point.lng >= extent[0] && point.lng <= extent[2];
  65807. if (lngEdge && point.lat >= extent[1] && point.lat <= extent[3]) {
  65808. lngPoints.push([point.lng, i]);
  65809. lngCoordinates.push(point.lng);
  65810. if (firstLng === undefined && point.lng.toFixed(countDecimals) % _currLngInterval === 0) {
  65811. firstLng = Number(point.lng.toFixed(countDecimals));
  65812. }
  65813. }
  65814. }
  65815. const { first, last: lastLng, coordinates, points } = this._getIntersectRange(
  65816. firstLng,
  65817. lngCoordinates,
  65818. lngPoints,
  65819. _currLngInterval
  65820. );
  65821. firstLng = first;
  65822. return this._getClosestCoordinate(firstLng, lastLng, coordinates, points, _currLngInterval);
  65823. }
  65824. _getIntersectRange(first, coordinates, points, interval) {
  65825. let last = coordinates[coordinates.length - 1];
  65826. if (first > last) {
  65827. last = first;
  65828. coordinates.reverse();
  65829. points.reverse();
  65830. const countDecimals = this._countDecimals(interval);
  65831. for (let i = 0; i <= coordinates.length; i++) {
  65832. const point = coordinates[i];
  65833. if (point.toFixed(countDecimals) % interval === 0) {
  65834. first = Number(point.toFixed(countDecimals));
  65835. break;
  65836. }
  65837. }
  65838. }
  65839. return { first, last, coordinates, points };
  65840. }
  65841. _getClosestCoordinate(first, last, coordinates, points, interval) {
  65842. let result = [];
  65843. let graticule = first;
  65844. while (graticule <= last) {
  65845. const index = this._getClosestNumberIndex(graticule, coordinates);
  65846. const point = points[index];
  65847. result.push([Math.round(point[0]), point[1], true]);
  65848. graticule += interval;
  65849. coordinates = coordinates.slice(index);
  65850. points = points.slice(index);
  65851. }
  65852. return result;
  65853. }
  65854. _getClosestNumberIndex(num, arr) {
  65855. var index = 0;
  65856. var diffValue = Number.MAX_VALUE;
  65857. for (var i = 0; i < arr.length; i++) {
  65858. var newDiffValue = Math.abs(arr[i] - num);
  65859. if (newDiffValue <= diffValue) {
  65860. if (newDiffValue === diffValue && arr[i] < arr[index]) {
  65861. continue;
  65862. }
  65863. index = i;
  65864. diffValue = newDiffValue;
  65865. }
  65866. }
  65867. return index;
  65868. }
  65869. _getUniquePoint(points, intersectPoints, index = 0) {
  65870. if (this.options.wrapX) {
  65871. return points.concat(intersectPoints);
  65872. }
  65873. if (!intersectPoints || intersectPoints.length === 0) {
  65874. return points;
  65875. }
  65876. var tmp = intersectPoints;
  65877. const width = this.canvas.width;
  65878. const height = this.canvas.height;
  65879. for (var i in points) {
  65880. const edgePoint = this.map.project(points[i]);
  65881. const intersetIndex = tmp.findIndex(item => item[0] === points[i][index]);
  65882. if (intersetIndex <= -1) {
  65883. tmp.push(points[i]);
  65884. } else if (
  65885. edgePoint &&
  65886. edgePoint.x >= 0 &&
  65887. edgePoint.x <= width &&
  65888. edgePoint.y >= 0 &&
  65889. edgePoint.y <= height
  65890. ) {
  65891. tmp[intersetIndex] = points[i];
  65892. }
  65893. }
  65894. return tmp;
  65895. }
  65896. _countDecimals(value) {
  65897. if (Math.floor(value) !== value) {
  65898. return value.toString().split('.')[1].length || 0;
  65899. }
  65900. return 0;
  65901. }
  65902. _addGraticuleLayer(features = this.features) {
  65903. if (!this.map.getSource(this.sourceId)) {
  65904. const source = {
  65905. type: 'geojson',
  65906. data: {
  65907. type: 'FeatureCollection',
  65908. features
  65909. }
  65910. };
  65911. this.map.addSource(this.sourceId, source);
  65912. }
  65913. if (!this.map.getLayer(this.sourceId)) {
  65914. this.map.addLayer({
  65915. id: this.sourceId,
  65916. type: 'line',
  65917. source: this.sourceId,
  65918. ...this._transformStrokeStyle()
  65919. });
  65920. }
  65921. }
  65922. _updateGraticuleLayer(features = this.features) {
  65923. if (this.map.getSource(this.sourceId)) {
  65924. const geoJSONData = {
  65925. type: 'FeatureCollection',
  65926. features
  65927. };
  65928. this.map.getSource(this.sourceId).setData(geoJSONData);
  65929. }
  65930. this._addGraticuleLayer();
  65931. }
  65932. _getGraticuleFeatures() {
  65933. const _currLngInterval = this._currLngInterval || 10;
  65934. const _currLatInterval = this._currLatInterval || 10;
  65935. const features = [];
  65936. let { latRange, lngRange, firstLat, firstLng, lastLat, lastLng } = this._getRange();
  65937. if (this.options.wrapX && !this.oldExtent) {
  65938. latRange = [-90, 90];
  65939. lngRange = [-180, 180];
  65940. firstLat = firstLng = lastLat = lastLng = null;
  65941. }
  65942. if (typeof firstLng === 'number') {
  65943. features.unshift(this._makeLineFeature(this._makeLineCoords(firstLng, latRange, firstLat, lastLat)));
  65944. }
  65945. if (typeof lastLng === 'number') {
  65946. features.unshift(this._makeLineFeature(this._makeLineCoords(lastLng, latRange, firstLat, lastLat)));
  65947. }
  65948. for (var lng = lngRange[0]; lng <= lngRange[1]; lng += _currLngInterval) {
  65949. features.unshift(this._makeLineFeature(this._makeLineCoords(lng, latRange, firstLat, lastLat)));
  65950. }
  65951. if (typeof firstLat === 'number') {
  65952. features.unshift(this._makeLineFeature(this._makeLineCoords(firstLat, lngRange, firstLng, lastLng, 'lat')));
  65953. }
  65954. if (typeof lastLat === 'number') {
  65955. features.unshift(this._makeLineFeature(this._makeLineCoords(lastLat, lngRange, firstLng, lastLng, 'lat')));
  65956. }
  65957. for (var lat = latRange[0]; lat <= latRange[1]; lat += _currLatInterval) {
  65958. features.unshift(this._makeLineFeature(this._makeLineCoords(lat, lngRange, firstLng, lastLng, 'lat')));
  65959. }
  65960. return features;
  65961. }
  65962. _getRange(extent = this.options.extent && [...this.options.extent]) {
  65963. if (!extent || extent.length === 0) {
  65964. extent = this._getDefaultExtent();
  65965. }
  65966. extent = extent.map(item => {
  65967. return Number(item.toFixed(6));
  65968. });
  65969. const realExtent = {};
  65970. if (extent[1] % this._currLatInterval !== 0) {
  65971. realExtent.firstLat = extent[1];
  65972. const intNumber = Math.ceil(extent[1] / this._currLatInterval);
  65973. extent[1] = intNumber * this._currLatInterval;
  65974. }
  65975. if (extent[3] % this._currLatInterval !== 0) {
  65976. realExtent.lastLat = extent[3];
  65977. const intNumber = Math.floor(extent[3] / this._currLatInterval);
  65978. extent[3] = intNumber * this._currLatInterval;
  65979. }
  65980. if (extent[0] % this._currLngInterval !== 0) {
  65981. realExtent.firstLng = extent[0];
  65982. const intNumber = Math.ceil(extent[0] / this._currLngInterval);
  65983. extent[0] = intNumber * this._currLngInterval;
  65984. }
  65985. if (extent[2] % this._currLngInterval !== 0) {
  65986. realExtent.lastLng = extent[2];
  65987. const intNumber = Math.floor(extent[2] / this._currLngInterval);
  65988. extent[2] = intNumber * this._currLngInterval;
  65989. }
  65990. return { latRange: [extent[1], extent[3]], lngRange: [extent[0], extent[2]], extent, ...realExtent };
  65991. }
  65992. _makeLineCoords(fixedDegree, range = [-90, 90], first, last, type = 'lng') {
  65993. fixedDegree = type === 'lng' ? this._lngFix(fixedDegree) : fixedDegree;
  65994. first = typeof first === 'number' ? first : range[0];
  65995. last = typeof last === 'number' ? last : range[1];
  65996. const interval = Math.abs(first - last);
  65997. const coords = [];
  65998. for (var changedDegree = first; changedDegree <= last; changedDegree += interval) {
  65999. if (type === 'lng') {
  66000. coords.push([fixedDegree, changedDegree]);
  66001. } else {
  66002. coords.push([changedDegree, fixedDegree]);
  66003. }
  66004. }
  66005. return coords;
  66006. }
  66007. _makeLineFeature(coordinates, type = 'LineString') {
  66008. return {
  66009. type: 'Feature',
  66010. geometry: {
  66011. type,
  66012. coordinates
  66013. }
  66014. };
  66015. }
  66016. _lngFix(lng) {
  66017. if (lng >= 180) {
  66018. return 180;
  66019. }
  66020. if (lng <= -180) {
  66021. return -180;
  66022. }
  66023. return lng;
  66024. }
  66025. _transformStrokeStyle(strokeStyle = this.options.strokeStyle) {
  66026. if (!strokeStyle || typeof strokeStyle === 'string') {
  66027. return { paint: { 'line-color': strokeStyle || 'rgba(0,0,0,0.2)' } };
  66028. }
  66029. const layout = {
  66030. visibility: this.visible ? 'visible' : 'none',
  66031. 'line-join': strokeStyle.lineJoin || 'round',
  66032. 'line-cap': strokeStyle.lineCap || 'round'
  66033. };
  66034. const paint = {
  66035. 'line-color': strokeStyle.lineColor || 'rgba(0,0,0,0.2)',
  66036. 'line-width': strokeStyle.lineWidth || 1,
  66037. 'line-offset': strokeStyle.lineDashOffset || 0,
  66038. 'line-translate-anchor': 'viewport'
  66039. };
  66040. if (strokeStyle.lineWidth) {
  66041. if (typeof strokeStyle.lineWidth === 'function') {
  66042. paint['line-width'] = strokeStyle.lineWidth(this.map);
  66043. } else {
  66044. paint['line-width'] = strokeStyle.lineWidth;
  66045. }
  66046. }
  66047. if (strokeStyle.lindDasharray) {
  66048. if (typeof strokeStyle.lindDasharray === 'function') {
  66049. paint['line-dasharray'] = strokeStyle.lindDasharray(this.map);
  66050. } else {
  66051. paint['line-dasharray'] = strokeStyle.lindDasharray;
  66052. }
  66053. }
  66054. return { layout, paint };
  66055. }
  66056. _setLabelStyle(ctx, labelStyle) {
  66057. if (labelStyle.textColor) {
  66058. ctx.fillStyle = labelStyle.textColor;
  66059. }
  66060. if (labelStyle.textSize) {
  66061. ctx.font = labelStyle.textSize + ' ' + (labelStyle.textFont || ['Calibri', 'sans-serif']).join(',');
  66062. }
  66063. if (labelStyle.textHaloColor) {
  66064. ctx.strokeStyle = labelStyle.textHaloColor;
  66065. ctx.lineWidth = labelStyle.textHaloWidth || 1;
  66066. }
  66067. if (labelStyle.textAnchor) {
  66068. ctx.textBaseline = this._getTxetBaseline(labelStyle.textAnchor);
  66069. ctx.textAligin = this._getTxetAlign(labelStyle.textAligin);
  66070. }
  66071. return ctx;
  66072. }
  66073. _getTxetBaseline(textAnchor) {
  66074. if (!textAnchor) {
  66075. return 'bottom';
  66076. }
  66077. const textStyle = textAnchor.split('-');
  66078. if (textStyle.includes('bottom')) {
  66079. return 'bottom';
  66080. }
  66081. if (textStyle.includes('top')) {
  66082. return 'top';
  66083. }
  66084. if (textStyle.includes('center')) {
  66085. return 'middle';
  66086. }
  66087. }
  66088. _getTxetAlign(textAnchor) {
  66089. if (!textAnchor) {
  66090. return 'center';
  66091. }
  66092. const textStyle = textAnchor.split('-');
  66093. if (textStyle.includes('left')) {
  66094. return 'left';
  66095. }
  66096. if (textStyle.includes('right')) {
  66097. return 'right';
  66098. }
  66099. if (textStyle.includes('center')) {
  66100. return 'center';
  66101. }
  66102. }
  66103. }
  66104. (external_mapboxgl_default()).supermap.GraticuleLayer = GraticuleLayer;
  66105. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapvDataSet.js
  66106. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66107. * This program are made available under the terms of the Apache License, Version 2.0
  66108. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66109. var MapvDataSet = {
  66110. /**
  66111. * 返回mapv点数据集
  66112. */
  66113. getPoint: function (center) {
  66114. if (center && (center instanceof Array)) {
  66115. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet([{
  66116. geometry: {
  66117. type: 'Point',
  66118. coordinates: center
  66119. }
  66120. }]);
  66121. }
  66122. },
  66123. /**
  66124. * 返回mapv多点数据集
  66125. */
  66126. getPoints: function (points) {
  66127. if (points && (points instanceof Array)) {
  66128. var mPoints = [];
  66129. points.map(function (data) {
  66130. mPoints.push({
  66131. geometry: {
  66132. type: 'Point',
  66133. coordinates: data.geometry.coordinates
  66134. }
  66135. });
  66136. return data;
  66137. });
  66138. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet(mPoints);
  66139. }
  66140. },
  66141. /**
  66142. * 返回mapv弧形线数据集
  66143. */
  66144. getCurveLines: function (startPoint, LinePoints) {
  66145. if (startPoint && (startPoint instanceof Array) && LinePoints && (LinePoints instanceof Array)) {
  66146. var lineData = [];
  66147. LinePoints.map(function (data) {
  66148. var coords = data.geometry && data.geometry.coordinates;
  66149. var toCenter = {lng: coords[0], lat: coords[1]};
  66150. var fromCenter = {lng: startPoint[0], lat: startPoint[1]};
  66151. var cv = external_function_try_return_mapv_catch_e_return_namespaceObject.utilCurve.getPoints([fromCenter, toCenter]);
  66152. lineData.push({
  66153. geometry: {
  66154. type: 'LineString',
  66155. coordinates: cv
  66156. }
  66157. });
  66158. return data;
  66159. });
  66160. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet(lineData);
  66161. }
  66162. },
  66163. /**
  66164. * 返回mapv弧形动态点数据集
  66165. */
  66166. getCurveDynamicPoints: function (center, endPoints) {
  66167. if (center && (center instanceof Array) && endPoints && (endPoints instanceof Array)) {
  66168. var timeData = [];
  66169. endPoints.map(function (data) {
  66170. var coords = data.geometry && data.geometry.coordinates;
  66171. var toCenter = {lng: coords[0], lat: coords[1]};
  66172. var fromCenter = {lng: center[0], lat: center[1]};
  66173. var cv = external_function_try_return_mapv_catch_e_return_namespaceObject.utilCurve.getPoints([fromCenter, toCenter]);
  66174. for (var j = 0; j < cv.length; j++) {
  66175. timeData.push({
  66176. geometry: {
  66177. type: 'Point',
  66178. coordinates: cv[j]
  66179. },
  66180. time: j
  66181. });
  66182. }
  66183. return data
  66184. });
  66185. return new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet(timeData);
  66186. }
  66187. }
  66188. };
  66189. (external_mapboxgl_default()).supermap.MapvDataSet = MapvDataSet;
  66190. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/MapExtend.js
  66191. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66192. * This program are made available under the terms of the Apache License, Version 2.0
  66193. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66194. (external_mapboxgl_default()).supermap = (external_mapboxgl_default()).supermap || {};
  66195. (external_mapboxgl_default()).supermap.map = (external_mapboxgl_default()).supermap.map || {};
  66196. var getDefaultVectorTileStyle = function (urlTemplate, options) {
  66197. options = options || {};
  66198. var defaultOptions = {};
  66199. defaultOptions.version = options.version || 8;
  66200. defaultOptions.layers = options.layers || [];
  66201. defaultOptions.light = options.light || {
  66202. "anchor": "viewport",
  66203. "color": "#fcf6ef",
  66204. "intensity": 0.5,
  66205. "position": [1.15, 201, 20]
  66206. };
  66207. var style = {
  66208. "version": defaultOptions.version,
  66209. "sources": {
  66210. "vector-tiles": {
  66211. "type": "vector",
  66212. "tiles": [urlTemplate]
  66213. }
  66214. },
  66215. "layers": defaultOptions.layers,
  66216. "light": defaultOptions.light
  66217. };
  66218. if (options.sprite != null) {
  66219. style.sprite = options.sprite;
  66220. }
  66221. if (options.glyphs != null) {
  66222. style.glyphs = options.glyphs;
  66223. }
  66224. return style;
  66225. };
  66226. var setBackground = function (map, color) {
  66227. if (color && map) {
  66228. map.addLayer({
  66229. "id": "background",
  66230. "type": "background",
  66231. "paint": {
  66232. "background-color": color
  66233. }
  66234. }, "background");
  66235. }
  66236. };
  66237. var setPaintProperty = function (map, layerIds, type, paint, source, sourceLayers) {
  66238. if (layerIds && map) {
  66239. if (Object.prototype.toString.call(layerIds) !== '[object Array]') {
  66240. layerIds = [layerIds];
  66241. }
  66242. for (var i = 0; i < layerIds.length; i++) {
  66243. var sourceLayer = sourceLayers ? sourceLayers[i] : null;
  66244. var layer = getLayer(layerIds[i], type, source, sourceLayer, paint);
  66245. map.addLayer(layer, layerIds[i]);
  66246. map.moveLayer(layerIds[i]);
  66247. }
  66248. }
  66249. };
  66250. function getLayer(id, type, source, sourceLayer, paint) {
  66251. var sourceType = source || "vector-tiles";
  66252. var sLayer = sourceLayer || id;
  66253. var layer = {
  66254. "id": id,
  66255. "type": type,
  66256. "source": sourceType,
  66257. "source-layer": sLayer,
  66258. "paint": paint
  66259. };
  66260. return layer;
  66261. }
  66262. (external_mapboxgl_default()).supermap.map.getDefaultVectorTileStyle = getDefaultVectorTileStyle;
  66263. (external_mapboxgl_default()).supermap.map.setBackground = setBackground;
  66264. (external_mapboxgl_default()).supermap.map.setPaintProperty = setPaintProperty;
  66265. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/mapv/index.js
  66266. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66267. * This program are made available under the terms of the Apache License, Version 2.0
  66268. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66269. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/theme/index.js
  66270. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66271. * This program are made available under the terms of the Apache License, Version 2.0
  66272. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66273. ;// CONCATENATED MODULE: ./src/mapboxgl/overlay/index.js
  66274. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66275. * This program are made available under the terms of the Apache License, Version 2.0
  66276. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66277. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ServiceBase.js
  66278. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66279. * This program are made available under the terms of the Apache License, Version 2.0
  66280. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66281. /**
  66282. * @class mapboxgl.supermap.ServiceBase
  66283. * @category iServer
  66284. * @description mapboxgl.supermap 服务基类。
  66285. * @param {string} url - 与客户端交互的服务地址。
  66286. * @param {Object} options - 可选参数。
  66287. * @param {string} [options.proxy] - 服务代理地址。
  66288. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66289. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66290. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66291. * @param {Object} [options.headers] - 请求头。
  66292. * @fires mapboxgl.supermap.ServiceBase#initialized
  66293. */
  66294. class ServiceBase extends (external_mapboxgl_default()).Evented {
  66295. constructor(url, options) {
  66296. super();
  66297. this.options = options || {};
  66298. this.url = url;
  66299. /**
  66300. * @event mapboxgl.supermap.ServiceBase#initialized
  66301. * @description 构造函数构造成功之后触发。
  66302. * @property {Object} this - this 对象。
  66303. */
  66304. this.fire('initialized', this);
  66305. }
  66306. }
  66307. (external_mapboxgl_default()).supermap.ServiceBase = ServiceBase;
  66308. ;// CONCATENATED MODULE: ./src/mapboxgl/services/AddressMatchService.js
  66309. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66310. * This program are made available under the terms of the Apache License, Version 2.0
  66311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66312. /**
  66313. * @class mapboxgl.supermap.AddressMatchService
  66314. * @category iServer AddressMatch
  66315. * @classdesc 地址匹配服务。
  66316. * @example
  66317. * new mapboxgl.supermap.AddressMatchService(url,options)
  66318. * .code(function(result){
  66319. * //doSomething
  66320. * })
  66321. * @param {string} url - 与客户端交互的服务地址。
  66322. * @param {Object} options - 交互时所需可选参数。
  66323. * @param {string} [options.proxy] - 服务代理地址。
  66324. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66325. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66326. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66327. * @param {Object} [options.headers] - 请求头。
  66328. * @extends {mapboxgl.supermap.ServiceBase}
  66329. */
  66330. class AddressMatchService extends ServiceBase {
  66331. constructor(url, options) {
  66332. super(url, options);
  66333. }
  66334. /**
  66335. * @function mapboxgl.supermap.AddressMatchService.prototype.code
  66336. * @description 获取正向地址匹配结果。
  66337. * @param {Object} params - 正向匹配参数。
  66338. * @param {RequestCallback} callback - 请求结果的回调函数。
  66339. */
  66340. code(params, callback) {
  66341. var me = this;
  66342. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  66343. proxy: me.options.proxy,
  66344. withCredentials: me.options.withCredentials,
  66345. crossOrigin: me.options.crossOrigin,
  66346. headers: me.options.headers,
  66347. serverType: me.options.serverType,
  66348. eventListeners: {
  66349. scope: me,
  66350. processCompleted: callback,
  66351. processFailed: callback
  66352. }
  66353. });
  66354. addressMatchService.code(Util.urlPathAppend(me.url, 'geocoding'), params);
  66355. }
  66356. /**
  66357. * @function mapboxgl.supermap.AddressMatchService.prototype.decode
  66358. * @description 获取反向地址匹配结果。
  66359. * @param {Object} params -反向匹配参数。
  66360. * @param {RequestCallback} callback - 请求结果的回调函数。
  66361. */
  66362. decode(params, callback) {
  66363. var me = this;
  66364. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  66365. proxy: me.options.proxy,
  66366. withCredentials: me.options.withCredentials,
  66367. crossOrigin: me.options.crossOrigin,
  66368. headers: me.options.headers,
  66369. serverType: me.options.serverType,
  66370. eventListeners: {
  66371. scope: me,
  66372. processCompleted: callback,
  66373. processFailed: callback
  66374. }
  66375. });
  66376. addressMatchService.decode(Util.urlPathAppend(me.url, 'geodecoding'), params);
  66377. }
  66378. }
  66379. (external_mapboxgl_default()).supermap.AddressMatchService = AddressMatchService;
  66380. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ChartService.js
  66381. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66382. * This program are made available under the terms of the Apache License, Version 2.0
  66383. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66384. /**
  66385. * @class mapboxgl.supermap.ChartService
  66386. * @category iServer Map Chart
  66387. * @classdesc 海图服务。
  66388. * @extends {mapboxgl.supermap.ServiceBase}
  66389. * @example
  66390. * new mapboxgl.supermap.ChartService(url)
  66391. * .queryChart(param,function(result){
  66392. * //doSomething
  66393. * })
  66394. * @param {string} url - 与客户端交互的海图服务地址。
  66395. * @param {Object} options - 交互时所需可选参数。
  66396. * @param {string} [options.proxy] - 服务代理地址。
  66397. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66398. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66399. * @param {Object} [options.headers] - 请求头。
  66400. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66401. */
  66402. class ChartService extends ServiceBase {
  66403. constructor(url, options) {
  66404. super(url, options);
  66405. }
  66406. /**
  66407. * @function mapboxgl.supermap.ChartService.prototype.queryChart
  66408. * @description 查询海图服务。
  66409. * @param {SuperMap.ChartQueryParameters} params - 海图查询所需参数类。
  66410. * @param {RequestCallback} callback 回调函数。
  66411. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果格式类型。
  66412. */
  66413. queryChart(params, callback, resultFormat) {
  66414. var me = this,
  66415. param = me._processParams(params),
  66416. format = me._processFormat(resultFormat);
  66417. var chartQueryService = new ChartQueryService(me.url, {
  66418. proxy: me.options.proxy,
  66419. withCredentials: me.options.withCredentials,
  66420. crossOrigin: me.options.crossOrigin,
  66421. headers: me.options.headers,
  66422. serverType: me.options.serverType,
  66423. eventListeners: {
  66424. scope: me,
  66425. processCompleted: callback,
  66426. processFailed: callback
  66427. },
  66428. format: format
  66429. });
  66430. chartQueryService.processAsync(param);
  66431. }
  66432. /**
  66433. * @function mapboxgl.supermap.ChartService.prototype.getChartFeatureInfo
  66434. * @description 获取海图物标信息服务。
  66435. * @param {RequestCallback} callback 回调函数。
  66436. */
  66437. getChartFeatureInfo(callback) {
  66438. var me = this, url = me.url.concat();
  66439. url = Util.urlPathAppend(url, 'chartFeatureInfoSpecs');
  66440. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  66441. proxy: me.options.proxy,
  66442. withCredentials: me.options.withCredentials,
  66443. crossOrigin: me.options.crossOrigin,
  66444. headers: me.options.headers,
  66445. serverType: me.options.serverType,
  66446. eventListeners: {
  66447. scope: me,
  66448. processCompleted: callback,
  66449. processFailed: callback
  66450. }
  66451. });
  66452. chartFeatureInfoSpecsService.processAsync();
  66453. }
  66454. _processParams(params) {
  66455. if (!params) {
  66456. return {};
  66457. }
  66458. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  66459. if (params.filter) {
  66460. params.chartQueryFilterParameters = core_Util_Util.isArray(params.filter) ? params.filter : [params.filter];
  66461. }
  66462. if (params.bounds) {
  66463. if (params.bounds instanceof Array) {
  66464. params.bounds = new Bounds(
  66465. params.bounds[0],
  66466. params.bounds[1],
  66467. params.bounds[2],
  66468. params.bounds[3]
  66469. );
  66470. }
  66471. if (params.bounds instanceof (external_mapboxgl_default()).LngLatBounds) {
  66472. params.bounds = new Bounds(
  66473. params.bounds.getSouthWest().lng,
  66474. params.bounds.getSouthWest().lat,
  66475. params.bounds.getNorthEast().lng,
  66476. params.bounds.getNorthEast().lat
  66477. );
  66478. }
  66479. }
  66480. }
  66481. _processFormat(resultFormat) {
  66482. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  66483. }
  66484. }
  66485. (external_mapboxgl_default()).supermap.ChartService = ChartService;
  66486. ;// CONCATENATED MODULE: ./src/mapboxgl/services/DataFlowService.js
  66487. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66488. * This program are made available under the terms of the Apache License, Version 2.0
  66489. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66490. /**
  66491. * @class mapboxgl.supermap.DataFlowService
  66492. * @category iServer DataFlow
  66493. * @classdesc 数据流服务。
  66494. * @extends {mapboxgl.supermap.ServiceBase}
  66495. * @example
  66496. * new mapboxgl.supermap.DataFlowService(url)
  66497. * .queryChart(param,function(result){
  66498. * //doSomething
  66499. * })
  66500. * @param {string} url - 与客户端交互的实时数据服务地址。
  66501. * @param {Object} options - 加载实时数据可选参数。
  66502. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  66503. * @param {Object} [options.excludeField] - 排除字段。
  66504. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66505. * @param {Object} [options.headers] - 请求头。
  66506. * @fires mapboxgl.supermap.DataFlowService#broadcastSocketConnected
  66507. * @fires mapboxgl.supermap.DataFlowService#broadcastSocketError
  66508. * @fires mapboxgl.supermap.DataFlowService#broadcastFailed
  66509. * @fires mapboxgl.supermap.DataFlowService#broadcastSucceeded
  66510. * @fires mapboxgl.supermap.DataFlowService#subscribeSocketError
  66511. * @fires mapboxgl.supermap.DataFlowService#messageSucceeded
  66512. * @fires mapboxgl.supermap.DataFlowService#setFilterParamSucceeded
  66513. */
  66514. class DataFlowService extends ServiceBase {
  66515. constructor(url, options) {
  66516. options = options || {};
  66517. if (options.projection) {
  66518. options.prjCoordSys = options.projection;
  66519. }
  66520. super(url, options);
  66521. this.dataFlow = new DataFlowService_DataFlowService(url, options);
  66522. /**
  66523. * @event mapboxgl.supermap.DataFlowService#broadcastSocketConnected
  66524. * @description broadcast Socket 连接成功。
  66525. */
  66526. /**
  66527. * @event mapboxgl.supermap.DataFlowService#broadcastSocketError
  66528. * @description broadcast Socket 连接失败。
  66529. */
  66530. /**
  66531. * @event mapboxgl.supermap.DataFlowService#broadcastFailed
  66532. * @description 广播失败。
  66533. */
  66534. /**
  66535. * @event mapboxgl.supermap.DataFlowService#broadcastSucceeded
  66536. * @description 广播成功。
  66537. */
  66538. /**
  66539. * @event mapboxgl.supermap.DataFlowService#subscribeSocketConnected
  66540. * @description 订阅数据连接成功。
  66541. */
  66542. /**
  66543. * @event mapboxgl.supermap.DataFlowService#subscribeSocketError
  66544. * @description 订阅数据连接失败。
  66545. */
  66546. /**
  66547. * @event mapboxgl.supermap.DataFlowService#messageSucceeded
  66548. * @description 获取信息成功。
  66549. */
  66550. /**
  66551. * @event mapboxgl.supermap.DataFlowService#setFilterParamSucceeded
  66552. * @description 设置过滤参数成功。
  66553. */
  66554. this.dataFlow.events.on({
  66555. "broadcastSocketConnected": this._defaultEvent,
  66556. "broadcastSocketError": this._defaultEvent,
  66557. "broadcastFailed": this._defaultEvent,
  66558. "broadcastSucceeded": this._defaultEvent,
  66559. "subscribeSocketConnected": this._defaultEvent,
  66560. "subscribeSocketError": this._defaultEvent,
  66561. "messageSucceeded": this._defaultEvent,
  66562. "setFilterParamSucceeded": this._defaultEvent,
  66563. scope: this
  66564. });
  66565. var me = this;
  66566. me.on('subscribeSocketConnected', function (e) {
  66567. /**
  66568. * @event mapboxgl.supermap.DataFlowService#subscribesucceeded
  66569. * @description 数据流服务订阅成功后触发。
  66570. * @property {Object} e - 事件对象。
  66571. */
  66572. me.fire('subscribesucceeded', e);
  66573. })
  66574. }
  66575. /**
  66576. * @function mapboxgl.supermap.DataFlowService.prototype.initBroadcast
  66577. * @description 初始化广播。
  66578. * @returns {mapboxgl.supermap.DataFlowService}
  66579. */
  66580. initBroadcast() {
  66581. this.dataFlow.initBroadcast();
  66582. return this;
  66583. }
  66584. /**
  66585. * @function mapboxgl.supermap.DataFlowService.prototype.broadcast
  66586. * @description 加载广播数据。
  66587. * @param {JSON} obj - JSON 格式的要素数据。
  66588. */
  66589. broadcast(obj) {
  66590. this.dataFlow.broadcast(obj);
  66591. }
  66592. /**
  66593. * @function mapboxgl.supermap.DataFlowService.prototype.initSubscribe
  66594. * @description 初始化订阅数据。
  66595. */
  66596. initSubscribe() {
  66597. this.dataFlow.initSubscribe();
  66598. return this;
  66599. }
  66600. /**
  66601. * @function mapboxgl.supermap.DataFlowService.prototype.setExcludeField
  66602. * @description 设置排除字段。
  66603. * @param {Object} excludeField - 排除字段。
  66604. */
  66605. setExcludeField(excludeField) {
  66606. this.dataFlow.setExcludeField(excludeField);
  66607. this.options.excludeField = excludeField;
  66608. return this;
  66609. }
  66610. /**
  66611. * @function mapboxgl.supermap.DataFlowService.prototype.setGeometry
  66612. * @description 设置添加的几何要素数据。
  66613. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  66614. */
  66615. setGeometry(geometry) {
  66616. this.dataFlow.setGeometry(geometry);
  66617. this.options.geometry = geometry;
  66618. return this;
  66619. }
  66620. /**
  66621. * @function mapboxgl.supermap.DataFlowService.prototype.unSubscribe
  66622. * @description 结束订阅数据。
  66623. */
  66624. unSubscribe() {
  66625. this.dataFlow.unSubscribe();
  66626. }
  66627. /**
  66628. * @function mapboxgl.supermap.DataFlowService.prototype.unBroadcast
  66629. * @description 结束加载广播。
  66630. */
  66631. unBroadcast() {
  66632. this.dataFlow.unBroadcast();
  66633. }
  66634. _defaultEvent(e) {
  66635. this.fire(e.eventType || e.type, e);
  66636. }
  66637. }
  66638. (external_mapboxgl_default()).supermap.DataFlowService = DataFlowService;
  66639. ;// CONCATENATED MODULE: ./src/mapboxgl/services/FeatureService.js
  66640. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66641. * This program are made available under the terms of the Apache License, Version 2.0
  66642. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66643. /**
  66644. * @class mapboxgl.supermap.FeatureService
  66645. * @category iServer Data Feature
  66646. * @classdesc 要素数据集类。提供:ID 查询,范围查询,SQL 查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  66647. * @example
  66648. * new mapboxgl.supermap.FeatureService(url)
  66649. * .getFeaturesByIDs(param,function(result){
  66650. * //doSomething
  66651. * })
  66652. * @extends {mapboxgl.supermap.ServiceBase}
  66653. * @param {string} url - 要素数据集服务地址。
  66654. * @param {Object} options - 创建要素数据集服务类可选参数。
  66655. * @param {string} [options.proxy] - 服务代理地址。
  66656. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66657. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66658. * @param {Object} [options.headers] - 请求头。
  66659. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66660. */
  66661. class FeatureService extends ServiceBase {
  66662. constructor(url, options) {
  66663. super(url, options);
  66664. }
  66665. /**
  66666. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByIDs
  66667. * @description 数据集 ID 查询服务。
  66668. * @param {SuperMap.GetFeaturesByIDsParameters} params - 查询所需参数类。
  66669. * @param {RequestCallback} callback - 回调函数。
  66670. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66671. */
  66672. getFeaturesByIDs(params, callback, resultFormat) {
  66673. var me = this;
  66674. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  66675. proxy: me.options.proxy,
  66676. withCredentials: me.options.withCredentials,
  66677. crossOrigin: me.options.crossOrigin,
  66678. headers: me.options.headers,
  66679. serverType: me.options.serverType,
  66680. eventListeners: {
  66681. processCompleted: callback,
  66682. processFailed: callback
  66683. },
  66684. format: me._processFormat(resultFormat)
  66685. });
  66686. getFeaturesByIDsService.processAsync(me._processParams(params));
  66687. }
  66688. /**
  66689. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByBounds
  66690. * @description 数据集 Bounds 查询服务。
  66691. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 查询所需参数类。
  66692. * @param {RequestCallback} callback - 回调函数。
  66693. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66694. */
  66695. getFeaturesByBounds(params, callback, resultFormat) {
  66696. var me = this;
  66697. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  66698. proxy: me.options.proxy,
  66699. withCredentials: me.options.withCredentials,
  66700. crossOrigin: me.options.crossOrigin,
  66701. headers: me.options.headers,
  66702. serverType: me.options.serverType,
  66703. eventListeners: {
  66704. processCompleted: callback,
  66705. processFailed: callback
  66706. },
  66707. format: me._processFormat(resultFormat)
  66708. });
  66709. getFeaturesByBoundsService.processAsync(me._processParams(params));
  66710. }
  66711. /**
  66712. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByBuffer
  66713. * @description 数据集 Buffer 查询服务。
  66714. * @param {SuperMap.GetFeaturesByBufferParameters} params - 查询所需参数类。
  66715. * @param {RequestCallback} callback 回调函数。
  66716. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66717. */
  66718. getFeaturesByBuffer(params, callback, resultFormat) {
  66719. var me = this;
  66720. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  66721. proxy: me.options.proxy,
  66722. withCredentials: me.options.withCredentials,
  66723. crossOrigin: me.options.crossOrigin,
  66724. headers: me.options.headers,
  66725. serverType: me.options.serverType,
  66726. eventListeners: {
  66727. processCompleted: callback,
  66728. processFailed: callback
  66729. },
  66730. format: me._processFormat(resultFormat)
  66731. });
  66732. getFeatureService.processAsync(me._processParams(params));
  66733. }
  66734. /**
  66735. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesBySQL
  66736. * @description 数据集 SQL 查询服务。
  66737. * @param {SuperMap.GetFeaturesBySQLParameters} params - 查询所需参数类。
  66738. * @param {RequestCallback} callback 回调函数。
  66739. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  66740. */
  66741. getFeaturesBySQL(params, callback, resultFormat) {
  66742. var me = this;
  66743. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  66744. proxy: me.options.proxy,
  66745. withCredentials: me.options.withCredentials,
  66746. crossOrigin: me.options.crossOrigin,
  66747. headers: me.options.headers,
  66748. serverType: me.options.serverType,
  66749. eventListeners: {
  66750. processCompleted: callback,
  66751. processFailed: callback
  66752. },
  66753. format: me._processFormat(resultFormat)
  66754. });
  66755. getFeatureBySQLService.processAsync(me._processParams(params));
  66756. }
  66757. /**
  66758. * @function mapboxgl.supermap.FeatureService.prototype.getFeaturesByGeometry
  66759. * @description 数据集几何查询服务类。
  66760. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询所需参数类。
  66761. * @param {RequestCallback} callback - 回调函数。
  66762. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  66763. */
  66764. getFeaturesByGeometry(params, callback, resultFormat) {
  66765. var me = this;
  66766. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  66767. proxy: me.options.proxy,
  66768. withCredentials: me.options.withCredentials,
  66769. crossOrigin: me.options.crossOrigin,
  66770. headers: me.options.headers,
  66771. serverType: me.options.serverType,
  66772. eventListeners: {
  66773. processCompleted: callback,
  66774. processFailed: callback
  66775. },
  66776. format: me._processFormat(resultFormat)
  66777. });
  66778. getFeaturesByGeometryService.processAsync(me._processParams(params));
  66779. }
  66780. /**
  66781. * @function mapboxgl.supermap.FeatureService.prototype.editFeatures
  66782. * @description 地物编辑服务。
  66783. * @param {SuperMap.EditFeaturesParameters} params - 查询所需参数类。
  66784. * @param {RequestCallback} callback 回调函数。
  66785. */
  66786. editFeatures(params, callback) {
  66787. if (!params || !params.dataSourceName || !params.dataSetName) {
  66788. return;
  66789. }
  66790. var me = this,
  66791. url = me.url,
  66792. dataSourceName = params.dataSourceName,
  66793. dataSetName = params.dataSetName;
  66794. url = Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  66795. var editFeatureService = new EditFeaturesService(url, {
  66796. proxy: me.options.proxy,
  66797. withCredentials: me.options.withCredentials,
  66798. crossOrigin: me.options.crossOrigin,
  66799. headers: me.options.headers,
  66800. serverType: me.options.serverType,
  66801. eventListeners: {
  66802. processCompleted: callback,
  66803. processFailed: callback
  66804. }
  66805. });
  66806. editFeatureService.processAsync(me._processParams(params));
  66807. }
  66808. /**
  66809. * @private
  66810. * @description 参数类型转换。
  66811. * @param {Object} params - 服务参数 。
  66812. * @returns {Object} params - 转换后的对接 SuperMap 服务的参数。
  66813. */
  66814. _processParams(params) {
  66815. if (!params) {
  66816. return {};
  66817. }
  66818. var me = this;
  66819. params.returnContent = params.returnContent == null ? true : params.returnContent;
  66820. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  66821. params.toIndex = params.toIndex === 0 ? 0 : params.toIndex ? params.toIndex : -1;
  66822. if (params.bounds) {
  66823. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  66824. }
  66825. if (params.editType) {
  66826. params.editType = params.editType.toLowerCase();
  66827. }
  66828. //mapboxgl geojson要素对象转 SuperMap Geometry 对象
  66829. if (params.geometry) {
  66830. if (params.geometry instanceof (external_mapboxgl_default()).LngLatBounds) {
  66831. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  66832. } else {
  66833. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  66834. }
  66835. }
  66836. //editFeature服务参数转换,传入单独得对象或对象数组
  66837. if (params.features) {
  66838. var features = [];
  66839. if (core_Util_Util.isArray(params.features)) {
  66840. params.features.map(function(feature) {
  66841. features.push(me._createServerFeature(feature));
  66842. return features;
  66843. });
  66844. } else {
  66845. features.push(me._createServerFeature(params.features));
  66846. }
  66847. params.features = features;
  66848. }
  66849. return params;
  66850. }
  66851. //geoFeature严格按照 mapboxgl geojson的结构
  66852. _createServerFeature(geoFeature) {
  66853. var feature = {},
  66854. fieldNames = [],
  66855. fieldValues = [];
  66856. var properties = geoFeature.properties;
  66857. for (var key in properties) {
  66858. fieldNames.push(key);
  66859. fieldValues.push(properties[key]);
  66860. }
  66861. feature.fieldNames = fieldNames;
  66862. feature.fieldValues = fieldValues;
  66863. if (geoFeature.id) {
  66864. feature.id = geoFeature.id;
  66865. }
  66866. feature.geometry = core_Util_Util.toSuperMapGeometry(geoFeature);
  66867. return feature;
  66868. }
  66869. _processFormat(resultFormat) {
  66870. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  66871. }
  66872. }
  66873. (external_mapboxgl_default()).supermap.FeatureService = FeatureService;
  66874. ;// CONCATENATED MODULE: ./src/mapboxgl/services/FieldService.js
  66875. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66876. * This program are made available under the terms of the Apache License, Version 2.0
  66877. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66878. /**
  66879. * @class mapboxgl.supermap.FieldService
  66880. * @category iServer Data Field
  66881. * @classdesc 字段服务类。
  66882. * @example
  66883. * new mapboxgl.supermap.FieldService(url).getFields(function(result){
  66884. * //doSomething
  66885. * });
  66886. * @param {string} url - 与客户端交互的服务地址。
  66887. * @param {Object} options - 参数。
  66888. * @param {string} [options.proxy] - 服务代理地址。
  66889. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66890. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66891. * @param {Object} [options.headers] - 请求头。
  66892. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66893. * @extends {mapboxgl.supermap.ServiceBase}
  66894. */
  66895. class FieldService extends ServiceBase {
  66896. constructor(url, options) {
  66897. super(url, options);
  66898. }
  66899. /**
  66900. * @function mapboxgl.supermap.FieldService.prototype.getFields
  66901. * @description 字段查询服务。
  66902. * @param {SuperMap.FieldParameters} params - 字段信息查询参数类。
  66903. * @param {RequestCallback} callback 回调函数。
  66904. */
  66905. getFields(params, callback) {
  66906. var me = this;
  66907. var getFieldsService = new GetFieldsService(me.url, {
  66908. proxy: me.options.proxy,
  66909. withCredentials: me.options.withCredentials,
  66910. crossOrigin: me.options.crossOrigin,
  66911. headers: me.options.headers,
  66912. serverType: me.options.serverType,
  66913. eventListeners: {
  66914. scope: me,
  66915. processCompleted: callback,
  66916. processFailed: callback
  66917. },
  66918. datasource: params.datasource,
  66919. dataset: params.dataset
  66920. });
  66921. getFieldsService.processAsync();
  66922. }
  66923. /**
  66924. * @function mapboxgl.supermap.FieldService.prototype.getFieldStatisticsInfo
  66925. * @description 字段统计服务。
  66926. * @param {SuperMap.FieldStatisticsParameters} params - 查询所需参数类。
  66927. * @param {RequestCallback} callback 回调函数。
  66928. */
  66929. getFieldStatisticsInfo(params, callback) {
  66930. var me = this,
  66931. fieldName = params.fieldName,
  66932. modes = params.statisticMode;
  66933. if (modes && !core_Util_Util.isArray(modes)) {
  66934. modes = [modes];
  66935. }
  66936. me.currentStatisticResult = {fieldName: fieldName};
  66937. me._statisticsCallback = callback;
  66938. //针对每种统计方式分别进行请求
  66939. modes.forEach(mode => {
  66940. me.currentStatisticResult[mode] = null;
  66941. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  66942. })
  66943. }
  66944. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  66945. var me = this;
  66946. var statisticService = new FieldStatisticService(me.url, {
  66947. eventListeners: {
  66948. scope: me,
  66949. processCompleted: me._processCompleted,
  66950. processFailed: me._statisticsCallback
  66951. },
  66952. datasource: datasource,
  66953. dataset: dataset,
  66954. field: fieldName,
  66955. statisticMode: statisticMode,
  66956. crossOrigin: me.options.crossOrigin,
  66957. headers: me.options.headers
  66958. });
  66959. statisticService.processAsync();
  66960. }
  66961. _processCompleted(fieldStatisticResult) {
  66962. var me = this;
  66963. var getAll = true,
  66964. result = fieldStatisticResult.result;
  66965. if (this.currentStatisticResult) {
  66966. if (null == me.currentStatisticResult[result.mode]) {
  66967. this.currentStatisticResult[result.mode] = result.result;
  66968. }
  66969. }
  66970. for (var mode in me.currentStatisticResult) {
  66971. if (null == me.currentStatisticResult[mode]) {
  66972. getAll = false;
  66973. break;
  66974. }
  66975. }
  66976. if (getAll) {
  66977. me._statisticsCallback({result: me.currentStatisticResult});
  66978. }
  66979. }
  66980. }
  66981. (external_mapboxgl_default()).supermap.FieldService = FieldService;
  66982. ;// CONCATENATED MODULE: ./src/mapboxgl/services/GridCellInfosService.js
  66983. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66984. * This program are made available under the terms of the Apache License, Version 2.0
  66985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66986. /**
  66987. * @class mapboxgl.supermap.GridCellInfosService
  66988. * @category iServer Data Grid
  66989. * @classdesc 数据栅格查询服务。
  66990. * @extends {mapboxgl.supermap.ServiceBase}
  66991. * @example
  66992. * new mapboxgl.supermap.GridCellInfosService(url)
  66993. * .getGridCellInfos(param,function(result){
  66994. * //doSomething
  66995. * })
  66996. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:</br>
  66997. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  66998. * @param {Object} options - 服务所需可选参数。
  66999. * @param {string} [options.proxy] - 服务代理地址。
  67000. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67001. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67002. * @param {Object} [options.headers] - 请求头。
  67003. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67004. */
  67005. class GridCellInfosService extends ServiceBase {
  67006. constructor(url, options) {
  67007. super(url, options);
  67008. }
  67009. /**
  67010. * @function mapboxgl.supermap.GridCellInfosService.prototype.getGridCellInfos
  67011. * @param {SuperMap.GetGridCellInfosParameters} params - 查询所需参数类。
  67012. * @param {RequestCallback} callback 回调函数。
  67013. */
  67014. getGridCellInfos(params, callback) {
  67015. if (!params) {
  67016. return null;
  67017. }
  67018. var me = this;
  67019. var gridCellQueryService = new GetGridCellInfosService(me.url, {
  67020. proxy: me.options.proxy,
  67021. withCredentials: me.options.withCredentials,
  67022. crossOrigin: me.options.crossOrigin,
  67023. headers: me.options.headers,
  67024. serverType: me.options.serverType,
  67025. eventListeners: {
  67026. scope: me,
  67027. processCompleted: callback,
  67028. processFailed: callback
  67029. }
  67030. });
  67031. gridCellQueryService.processAsync(params);
  67032. }
  67033. }
  67034. (external_mapboxgl_default()).supermap.GridCellInfosService = GridCellInfosService;
  67035. ;// CONCATENATED MODULE: ./src/mapboxgl/services/GeoprocessingService.js
  67036. /**
  67037. * @class mapboxgl.supermap.GeoprocessingService
  67038. * @classdesc 地理处理服务接口类。
  67039. * @version 10.1.0
  67040. * @category iServer GeoprocessingService
  67041. * @extends {mapboxgl.supermap.ServiceBase}
  67042. * @example
  67043. * //为了安全访问受保护的地理处理服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  67044. * SuperMap.SecurityManager.registerToken(serviceUrl, token);
  67045. * var geoprocessingService = new L.supermap.geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  67046. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  67047. console.log(serverResult.result);
  67048. var jobID = serverResult.result.jobID;
  67049. var options = {
  67050. interval: 5000,
  67051. statusCallback: function(state) {
  67052. console.log("Job Status: ", state);
  67053. }
  67054. };
  67055. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  67056. console.log(serverResult);
  67057. })
  67058. })
  67059. * @param {string} url - 服务地址。
  67060. * @param {Object} options - 参数。
  67061. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。
  67062. */
  67063. class GeoprocessingService extends ServiceBase {
  67064. constructor(url, options) {
  67065. super(url, options);
  67066. this.headers = {};
  67067. this.crossOrigin = true;
  67068. this.withCredentials = true;
  67069. this.proxy = true;
  67070. }
  67071. /**
  67072. * @function mapboxgl.supermap.GeoprocessingService.prototype.getTools
  67073. * @description 获取地理处理工具列表。
  67074. * @param {RequestCallback} callback 请求结果的回调函数。
  67075. */
  67076. getTools(callback) {
  67077. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67078. proxy: this.options.proxy,
  67079. withCredentials: this.options.withCredentials,
  67080. crossOrigin: this.options.crossOrigin,
  67081. headers: this.options.headers,
  67082. serverType: this.options.serverType,
  67083. eventListeners: {
  67084. scope: this,
  67085. processCompleted: callback,
  67086. processFailed: callback
  67087. }
  67088. });
  67089. geoprocessingJobsService.getTools();
  67090. }
  67091. /**
  67092. * @function mapboxgl.supermap.GeoprocessingService.prototype.getTool
  67093. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  67094. * @param {string} identifier - 地理处理工具ID。
  67095. * @param {RequestCallback} callback 请求结果的回调函数。
  67096. */
  67097. getTool(identifier, callback) {
  67098. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67099. proxy: this.options.proxy,
  67100. withCredentials: this.options.withCredentials,
  67101. crossOrigin: this.options.crossOrigin,
  67102. headers: this.options.headers,
  67103. serverType: this.options.serverType,
  67104. eventListeners: {
  67105. scope: this,
  67106. processCompleted: callback,
  67107. processFailed: callback
  67108. }
  67109. });
  67110. geoprocessingJobsService.getTool(identifier);
  67111. }
  67112. /**
  67113. * @function mapboxgl.supermap.GeoprocessingService.prototype.execute
  67114. * @description 同步执行地理处理工具。
  67115. * @param {string} identifier - 地理处理工具ID。
  67116. * @param {Object} parameter - 地理处理工具的输入参数。
  67117. * @param {Object} environment - 地理处理工具的环境参数。
  67118. * @param {RequestCallback} callback 回调函数。
  67119. */
  67120. execute(identifier, parameter, environment, callback) {
  67121. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67122. proxy: this.options.proxy,
  67123. withCredentials: this.options.withCredentials,
  67124. crossOrigin: this.options.crossOrigin,
  67125. headers: this.options.headers,
  67126. serverType: this.options.serverType,
  67127. eventListeners: {
  67128. scope: this,
  67129. processCompleted: callback,
  67130. processFailed: callback
  67131. }
  67132. });
  67133. geoprocessingJobsService.execute(identifier, parameter, environment);
  67134. }
  67135. /**
  67136. * @function mapboxgl.supermap.GeoprocessingService.prototype.submitJob
  67137. * @description 异步执行地理处理工具。
  67138. * @param {string} identifier - 地理处理工具ID。
  67139. * @param {Object} parameter - 地理处理工具的输入参数。
  67140. * @param {Object} environment - 地理处理工具的环境参数。
  67141. * @param {RequestCallback} callback 回调函数。
  67142. */
  67143. submitJob(identifier, parameter, environment, callback) {
  67144. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67145. proxy: this.options.proxy,
  67146. withCredentials: this.options.withCredentials,
  67147. crossOrigin: this.options.crossOrigin,
  67148. headers: this.options.headers,
  67149. serverType: this.options.serverType,
  67150. eventListeners: {
  67151. scope: this,
  67152. processCompleted: callback,
  67153. processFailed: callback
  67154. }
  67155. });
  67156. geoprocessingJobsService.submitJob(identifier, parameter, environment);
  67157. }
  67158. /**
  67159. * @function mapboxgl.supermap.GeoprocessingService.prototype.waitForJobCompletion
  67160. * @description 获取地理处理异步执行状态信息。
  67161. * @param {string} jobId - 地理处理任务ID。
  67162. * @param {string} identifier - 地理处理工具ID。
  67163. * @param {Object} options - 状态信息参数。
  67164. * @param {number} options.interval - 定时器时间间隔。
  67165. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  67166. * @param {RequestCallback} callback 回调函数。
  67167. */
  67168. waitForJobCompletion(jobId, identifier, options, callback) {
  67169. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67170. proxy: this.options.proxy,
  67171. withCredentials: this.options.withCredentials,
  67172. crossOrigin: this.options.crossOrigin,
  67173. headers: this.options.headers,
  67174. serverType: this.options.serverType,
  67175. eventListeners: {
  67176. scope: this,
  67177. processCompleted: callback,
  67178. processFailed: callback
  67179. }
  67180. });
  67181. geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options);
  67182. }
  67183. /**
  67184. * @function mapboxgl.supermap.GeoprocessingService.prototype.getJobInfo
  67185. * @description 获取地理处理任务的执行信息。
  67186. * @param {string} identifier - 地理处理工具ID。
  67187. * @param {string} jobId - 地理处理任务ID。
  67188. * @param {RequestCallback} callback 回调函数。
  67189. */
  67190. getJobInfo(identifier, jobId, callback) {
  67191. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67192. proxy: this.options.proxy,
  67193. withCredentials: this.options.withCredentials,
  67194. crossOrigin: this.options.crossOrigin,
  67195. headers: this.options.headers,
  67196. serverType: this.options.serverType,
  67197. eventListeners: {
  67198. scope: this,
  67199. processCompleted: callback,
  67200. processFailed: callback
  67201. }
  67202. });
  67203. geoprocessingJobsService.getJobInfo(identifier, jobId);
  67204. }
  67205. /**
  67206. * @function mapboxgl.supermap.GeoprocessingService.prototype.cancelJob
  67207. * @description 取消地理处理任务的异步执行。
  67208. * @param {string} identifier - 地理处理工具ID。
  67209. * @param {string} jobId - 地理处理任务ID。
  67210. * @param {RequestCallback} callback 回调函数。
  67211. */
  67212. cancelJob(identifier, jobId, callback) {
  67213. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67214. proxy: this.options.proxy,
  67215. withCredentials: this.options.withCredentials,
  67216. crossOrigin: this.options.crossOrigin,
  67217. headers: this.options.headers,
  67218. serverType: this.options.serverType,
  67219. eventListeners: {
  67220. scope: this,
  67221. processCompleted: callback,
  67222. processFailed: callback
  67223. }
  67224. });
  67225. geoprocessingJobsService.cancelJob(identifier, jobId);
  67226. }
  67227. /**
  67228. * @function mapboxgl.supermap.GeoprocessingService.prototype.getJobs
  67229. * @description 获取地理处理服务任务列表。
  67230. * @param {string} identifier - 地理处理工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  67231. * @param {RequestCallback} callback 回调函数。
  67232. */
  67233. getJobs(identifier, callback) {
  67234. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67235. proxy: this.options.proxy,
  67236. withCredentials: this.options.withCredentials,
  67237. crossOrigin: this.options.crossOrigin,
  67238. headers: this.options.headers,
  67239. serverType: this.options.serverType,
  67240. eventListeners: {
  67241. scope: this,
  67242. processCompleted: callback,
  67243. processFailed: callback
  67244. }
  67245. });
  67246. geoprocessingJobsService.getJobs(identifier);
  67247. }
  67248. /**
  67249. * @function mapboxgl.supermap.GeoprocessingService.prototype.getResults
  67250. * @description 地理处理工具异步执行的结果,支持结果过滤。
  67251. * @param {string} identifier - 地理处理工具ID。
  67252. * @param {string} jobId - 地理处理任务ID。
  67253. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  67254. * @param {RequestCallback} callback 请求结果的回调函数。
  67255. */
  67256. getResults(identifier, jobId, filter, callback) {
  67257. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  67258. proxy: this.options.proxy,
  67259. withCredentials: this.options.withCredentials,
  67260. crossOrigin: this.options.crossOrigin,
  67261. headers: this.options.headers,
  67262. serverType: this.options.serverType,
  67263. eventListeners: {
  67264. scope: this,
  67265. processCompleted: callback,
  67266. processFailed: callback
  67267. }
  67268. });
  67269. geoprocessingJobsService.getResults(identifier, jobId, filter);
  67270. }
  67271. }
  67272. (external_mapboxgl_default()).supermap.GeoprocessingService = GeoprocessingService;
  67273. ;// CONCATENATED MODULE: ./src/mapboxgl/services/LayerInfoService.js
  67274. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67275. * This program are made available under the terms of the Apache License, Version 2.0
  67276. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67277. /**
  67278. * @class mapboxgl.supermap.LayerInfoService
  67279. * @category iServer Map Layer
  67280. * @classdesc 图层信息服务类 。
  67281. * @extends {mapboxgl.supermap.ServiceBase}
  67282. * @example
  67283. * new mapboxgl.supermap.LayerInfoService(url).getLayersInfo(function(result){
  67284. * //doSomething
  67285. * })
  67286. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:</br>
  67287. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  67288. * @param {Object} options - 服务所需可选参数。
  67289. * @param {string} [options.proxy] - 服务代理地址。
  67290. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67291. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67292. * @param {Object} [options.headers] - 请求头。
  67293. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67294. */
  67295. class LayerInfoService extends ServiceBase {
  67296. constructor(url, options) {
  67297. super(url, options);
  67298. }
  67299. /**
  67300. * @function mapboxgl.supermap.LayerInfoService.prototype.getLayersInfo
  67301. * @description 获取图层信息服务。
  67302. * @param {RequestCallback} callback - 回调函数。
  67303. * @returns {mapboxgl.supermap.LayerInfoService} 返回图层信息类。
  67304. */
  67305. getLayersInfo(callback) {
  67306. var me = this;
  67307. var getLayersInfoService = new GetLayersInfoService(me.url, {
  67308. proxy: me.options.proxy,
  67309. withCredentials: me.options.withCredentials,
  67310. crossOrigin: me.options.crossOrigin,
  67311. headers: me.options.headers,
  67312. serverType: me.options.serverType,
  67313. eventListeners: {
  67314. processCompleted: callback,
  67315. processFailed: callback
  67316. }
  67317. });
  67318. getLayersInfoService.processAsync();
  67319. }
  67320. /**
  67321. * @function mapboxgl.supermap.LayerInfoService.prototype.setLayerInfo
  67322. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  67323. * @param {SuperMap.SetLayerInfoParameters} params - 设置图层信息参数类。
  67324. * @param {RequestCallback} callback - 回调函数。
  67325. */
  67326. setLayerInfo(params, callback) {
  67327. if (!params) {
  67328. return;
  67329. }
  67330. var me = this,
  67331. resourceID = params.resourceID,
  67332. tempLayerName = params.tempLayerName,
  67333. layerInfoParams = params.layerInfo;
  67334. if (!resourceID || !tempLayerName) {
  67335. return;
  67336. }
  67337. var url = Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  67338. var setLayerInfoService = new SetLayerInfoService(url, {
  67339. proxy: me.options.proxy,
  67340. withCredentials: me.options.withCredentials,
  67341. crossOrigin: me.options.crossOrigin,
  67342. headers: me.options.headers,
  67343. serverType: me.options.serverType,
  67344. eventListeners: {
  67345. processCompleted: callback,
  67346. processFailed: callback
  67347. }
  67348. });
  67349. setLayerInfoService.processAsync(layerInfoParams);
  67350. }
  67351. /**
  67352. * @function mapboxgl.supermap.LayerInfoService.prototype.setLayersInfo
  67353. * @description 设置图层信息服务。可以实现创建新的临时图层和对现有临时图层的修改。
  67354. * @param {SuperMap.SetLayersInfoParameters} params - 设置图层信息参数类,包括临时图层。
  67355. * @param {RequestCallback} callback - 回调函数。
  67356. */
  67357. setLayersInfo(params, callback) {
  67358. if (!params) {
  67359. return;
  67360. }
  67361. var me = this,
  67362. resourceID = params.resourceID,
  67363. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  67364. layersInfo = params.layersInfo;
  67365. if ((isTempLayers && !resourceID) || !layersInfo) {
  67366. return;
  67367. }
  67368. var setLayersInfoService = new SetLayersInfoService(me.url, {
  67369. proxy: me.options.proxy,
  67370. withCredentials: me.options.withCredentials,
  67371. crossOrigin: me.options.crossOrigin,
  67372. headers: me.options.headers,
  67373. serverType: me.options.serverType,
  67374. eventListeners: {
  67375. processCompleted: callback,
  67376. processFailed: callback
  67377. },
  67378. resourceID: resourceID,
  67379. isTempLayers: isTempLayers
  67380. });
  67381. setLayersInfoService.processAsync(layersInfo);
  67382. }
  67383. /**
  67384. * @function mapboxgl.supermap.LayerInfoService.prototype.setLayerStatus
  67385. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  67386. * @param {SuperMap.SetLayerStatusParameters} params - 子图层显示控制参数类。
  67387. * @param {RequestCallback} callback 回调函数。
  67388. */
  67389. setLayerStatus(params, callback) {
  67390. if (!params) {
  67391. return;
  67392. }
  67393. var me = this;
  67394. var setLayerStatusService = new SetLayerStatusService(me.url, {
  67395. proxy: me.options.proxy,
  67396. withCredentials: me.options.withCredentials,
  67397. crossOrigin: me.options.crossOrigin,
  67398. headers: me.options.headers,
  67399. serverType: me.options.serverType,
  67400. eventListeners: {
  67401. processCompleted: callback,
  67402. processFailed: callback
  67403. }
  67404. });
  67405. setLayerStatusService.processAsync(params);
  67406. }
  67407. }
  67408. (external_mapboxgl_default()).supermap.LayerInfoService = LayerInfoService;
  67409. ;// CONCATENATED MODULE: ./src/mapboxgl/services/MapService.js
  67410. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67411. * This program are made available under the terms of the Apache License, Version 2.0
  67412. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67413. /**
  67414. * @class mapboxgl.supermap.MapService
  67415. * @category iServer Map
  67416. * @classdesc 地图信息服务类。
  67417. * @extends {mapboxgl.supermap.ServiceBase}
  67418. * @param {string} url - 地图服务地址。
  67419. * @param {Object} options - 地图服务信息相关参数。
  67420. * @param {string} [options.proxy] - 服务代理地址。
  67421. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67422. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67423. * @param {Object} [options.headers] - 请求头。
  67424. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67425. * @example
  67426. * new mapboxgl.supermap.MapService(url)
  67427. * .getMapInfo(function(result){
  67428. * //doSomething
  67429. * })
  67430. */
  67431. class MapService extends ServiceBase {
  67432. constructor(url, options) {
  67433. super(url, options);
  67434. }
  67435. /**
  67436. * @function mapboxgl.supermap.MapService.prototype.getMapInfo
  67437. * @description 地图信息查询服务。
  67438. * @param {RequestCallback} callback 回调函数。
  67439. * @returns {mapboxgl.supermap.MapService} 获取服务信息。
  67440. */
  67441. getMapInfo(callback) {
  67442. var me = this;
  67443. var getMapStatusService = new MapService_MapService(me.url, {
  67444. proxy: me.options.proxy,
  67445. withCredentials: me.options.withCredentials,
  67446. crossOrigin: me.options.crossOrigin,
  67447. headers: me.options.headers,
  67448. serverType: me.options.serverType,
  67449. eventListeners: {
  67450. scope: me,
  67451. processCompleted: callback,
  67452. processFailed: callback
  67453. }, projection: me.options.projection
  67454. });
  67455. getMapStatusService.processAsync();
  67456. }
  67457. /**
  67458. * @function mapboxgl.supermap.MapService.prototype.getTilesets
  67459. * @description 切片列表信息查询服务。
  67460. * @param {RequestCallback} callback - 回调函数 。
  67461. * @returns {mapboxgl.supermap.MapService} 获取服务信息。
  67462. */
  67463. getTilesets(callback) {
  67464. var me = this;
  67465. var tilesetsService = new TilesetsService(me.url, {
  67466. proxy: me.options.proxy,
  67467. withCredentials: me.options.withCredentials,
  67468. crossOrigin: me.options.crossOrigin,
  67469. headers: me.options.headers,
  67470. serverType: me.options.serverType,
  67471. eventListeners: {
  67472. scope: me,
  67473. processCompleted: callback,
  67474. processFailed: callback
  67475. }
  67476. });
  67477. tilesetsService.processAsync();
  67478. }
  67479. }
  67480. (external_mapboxgl_default()).supermap.MapService = MapService;
  67481. ;// CONCATENATED MODULE: ./src/mapboxgl/services/MeasureService.js
  67482. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67483. * This program are made available under the terms of the Apache License, Version 2.0
  67484. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67485. /**
  67486. * @class mapboxgl.supermap.MeasureService
  67487. * @category iServer Map Measure
  67488. * @classdesc 测量服务。
  67489. * @extends {mapboxgl.supermap.ServiceBase}
  67490. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map。
  67491. * @param {Object} options - 交互服务时所需可选参数。
  67492. * @param {string} [options.proxy] - 服务代理地址。
  67493. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67494. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67495. * @param {Object} [options.headers] - 请求头。
  67496. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67497. * @param {SuperMap.MeasureMode} [options.measureMode=SuperMap.MeasureMode.DISTANCE] - 量算模式,包括距离量算模式和面积量算模式。
  67498. */
  67499. class MeasureService extends ServiceBase {
  67500. constructor(url, options) {
  67501. super(url, options);
  67502. }
  67503. /**
  67504. * @function mapboxgl.supermap.MeasureService.prototype.measureDistance
  67505. * @description 距离测量。
  67506. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  67507. * @param {RequestCallback} callback 回调函数。
  67508. */
  67509. measureDistance(params, callback) {
  67510. this.measure(params, 'DISTANCE', callback);
  67511. }
  67512. /**
  67513. * @function mapboxgl.supermap.MeasureService.prototype.measureArea
  67514. * @description 面积测量。
  67515. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  67516. * @param {RequestCallback} callback 回调函数。
  67517. */
  67518. measureArea(params, callback) {
  67519. this.measure(params, 'AREA', callback);
  67520. }
  67521. /**
  67522. * @function mapboxgl.supermap.MeasureService.prototype.measure
  67523. * @description 测量。
  67524. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  67525. * @param {string} type - 测量类型。
  67526. * @param {RequestCallback} callback - 回调函数。
  67527. * @returns {mapboxgl.supermap.MeasureService} 测量服务。
  67528. */
  67529. measure(params, type, callback) {
  67530. var me = this;
  67531. var measureService = new MeasureService_MeasureService(me.url, {
  67532. proxy: me.options.proxy,
  67533. withCredentials: me.options.withCredentials,
  67534. crossOrigin: me.options.crossOrigin,
  67535. headers: me.options.headers,
  67536. serverType: me.options.serverType,
  67537. measureMode: type,
  67538. eventListeners: {
  67539. scope: me,
  67540. processCompleted: callback,
  67541. processFailed: callback
  67542. }
  67543. });
  67544. measureService.processAsync(me._processParam(params));
  67545. }
  67546. _processParam(params) {
  67547. if (params && !(params.geometry instanceof Geometry)) {
  67548. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  67549. }
  67550. return params;
  67551. }
  67552. }
  67553. (external_mapboxgl_default()).supermap.MeasureService = MeasureService;
  67554. ;// CONCATENATED MODULE: ./src/mapboxgl/services/NetworkAnalystService.js
  67555. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67556. * This program are made available under the terms of the Apache License, Version 2.0
  67557. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67558. /**
  67559. * @class mapboxgl.supermap.NetworkAnalystService
  67560. * @category iServer NetworkAnalyst
  67561. * @classdesc 网络分析服务类。
  67562. * @extends {mapboxgl.supermap.ServiceBase}
  67563. * @example
  67564. * new mapboxgl.supermap.NetworkAnalystService(url)
  67565. * .findPath(params,function(result){
  67566. * //doSomething
  67567. * })
  67568. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:</br>
  67569. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  67570. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  67571. * @param {Object} options - 服务所需可选参数。
  67572. * @param {string} [options.proxy] - 服务代理地址。
  67573. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67574. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67575. * @param {Object} [options.headers] - 请求头。
  67576. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67577. */
  67578. class NetworkAnalystService extends ServiceBase {
  67579. constructor(url, options) {
  67580. super(url, options);
  67581. }
  67582. /**
  67583. * @function mapboxgl.supermap.NetworkAnalystService.prototype.burstPipelineAnalyst
  67584. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  67585. * @param {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  67586. * @param {RequestCallback} callback 回调函数。
  67587. */
  67588. burstPipelineAnalyst(params, callback) {
  67589. var me = this;
  67590. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  67591. proxy: me.options.proxy,
  67592. withCredentials: me.options.withCredentials,
  67593. crossOrigin: me.options.crossOrigin,
  67594. headers: me.options.headers,
  67595. serverType: me.options.serverType,
  67596. eventListeners: {
  67597. scope: me,
  67598. processCompleted: callback,
  67599. processFailed: callback
  67600. }
  67601. });
  67602. burstPipelineAnalystService.processAsync(me._processParams(params));
  67603. }
  67604. /**
  67605. * @function mapboxgl.supermap.NetworkAnalystService.prototype.computeWeightMatrix
  67606. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  67607. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  67608. * @param {RequestCallback} callback - 回调函数。
  67609. */
  67610. computeWeightMatrix(params, callback) {
  67611. var me = this;
  67612. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  67613. proxy: me.options.proxy,
  67614. withCredentials: me.options.withCredentials,
  67615. crossOrigin: me.options.crossOrigin,
  67616. headers: me.options.headers,
  67617. serverType: me.options.serverType,
  67618. eventListeners: {
  67619. scope: me,
  67620. processCompleted: callback,
  67621. processFailed: callback
  67622. }
  67623. });
  67624. computeWeightMatrixService.processAsync(me._processParams(params));
  67625. }
  67626. /**
  67627. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findClosestFacilities
  67628. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  67629. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  67630. * @param {RequestCallback} callback 回调函数。
  67631. * @param {SuperMap.DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  67632. */
  67633. findClosestFacilities(params, callback, resultFormat) {
  67634. var me = this;
  67635. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  67636. proxy: me.options.proxy,
  67637. withCredentials: me.options.withCredentials,
  67638. crossOrigin: me.options.crossOrigin,
  67639. headers: me.options.headers,
  67640. serverType: me.options.serverType,
  67641. eventListeners: {
  67642. scope: me,
  67643. processCompleted: callback,
  67644. processFailed: callback
  67645. },
  67646. format: me._processFormat(resultFormat)
  67647. });
  67648. findClosestFacilitiesService.processAsync(me._processParams(params));
  67649. }
  67650. /**
  67651. * @function mapboxgl.supermap.NetworkAnalystService.prototype.streamFacilityAnalyst
  67652. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  67653. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  67654. * @param {RequestCallback} callback 回调函数。
  67655. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67656. */
  67657. streamFacilityAnalyst(params, callback, resultFormat) {
  67658. var me = this;
  67659. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  67660. proxy: me.options.proxy,
  67661. withCredentials: me.options.withCredentials,
  67662. crossOrigin: me.options.crossOrigin,
  67663. headers: me.options.headers,
  67664. serverType: me.options.serverType,
  67665. eventListeners: {
  67666. scope: me,
  67667. processCompleted: callback,
  67668. processFailed: callback
  67669. },
  67670. format: me._processFormat(resultFormat)
  67671. });
  67672. facilityAnalystStreamService.processAsync(me._processParams(params));
  67673. }
  67674. /**
  67675. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findLocation
  67676. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  67677. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类。
  67678. * @param {RequestCallback} callback 回调函数。
  67679. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67680. */
  67681. findLocation(params, callback, resultFormat) {
  67682. var me = this;
  67683. var findLocationService = new FindLocationService(me.url, {
  67684. proxy: me.options.proxy,
  67685. withCredentials: me.options.withCredentials,
  67686. crossOrigin: me.options.crossOrigin,
  67687. headers: me.options.headers,
  67688. serverType: me.options.serverType,
  67689. eventListeners: {
  67690. scope: me,
  67691. processCompleted: callback,
  67692. processFailed: callback
  67693. },
  67694. format: me._processFormat(resultFormat)
  67695. });
  67696. findLocationService.processAsync(me._processParams(params));
  67697. }
  67698. /**
  67699. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findPath
  67700. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  67701. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类。
  67702. * @param {RequestCallback} callback - 回调函数。
  67703. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67704. */
  67705. findPath(params, callback, resultFormat) {
  67706. var me = this;
  67707. var findPathService = new FindPathService(me.url, {
  67708. proxy: me.options.proxy,
  67709. withCredentials: me.options.withCredentials,
  67710. crossOrigin: me.options.crossOrigin,
  67711. headers: me.options.headers,
  67712. serverType: me.options.serverType,
  67713. eventListeners: {
  67714. scope: me,
  67715. processCompleted: callback,
  67716. processFailed: callback
  67717. },
  67718. format: me._processFormat(resultFormat)
  67719. });
  67720. findPathService.processAsync(me._processParams(params));
  67721. }
  67722. /**
  67723. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findTSPPaths
  67724. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  67725. * @param {SuperMap.SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  67726. * @param {RequestCallback} callback - 回调函数。
  67727. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67728. */
  67729. findTSPPaths(params, callback, resultFormat) {
  67730. var me = this;
  67731. var findTSPPathsService = new FindTSPPathsService(me.url, {
  67732. proxy: me.options.proxy,
  67733. withCredentials: me.options.withCredentials,
  67734. crossOrigin: me.options.crossOrigin,
  67735. headers: me.options.headers,
  67736. serverType: me.options.serverType,
  67737. eventListeners: {
  67738. scope: me,
  67739. processCompleted: callback,
  67740. processFailed: callback
  67741. },
  67742. format: me._processFormat(resultFormat)
  67743. });
  67744. findTSPPathsService.processAsync(me._processParams(params));
  67745. }
  67746. /**
  67747. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findMTSPPaths
  67748. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  67749. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  67750. * @param {RequestCallback} callback - 回调函数。
  67751. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67752. */
  67753. findMTSPPaths(params, callback, resultFormat) {
  67754. var me = this;
  67755. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  67756. proxy: me.options.proxy,
  67757. withCredentials: me.options.withCredentials,
  67758. crossOrigin: me.options.crossOrigin,
  67759. headers: me.options.headers,
  67760. serverType: me.options.serverType,
  67761. eventListeners: {
  67762. scope: me,
  67763. processCompleted: callback,
  67764. processFailed: callback
  67765. },
  67766. format: me._processFormat(resultFormat)
  67767. });
  67768. findMTSPPathsService.processAsync(me._processParams(params));
  67769. }
  67770. /**
  67771. * @function mapboxgl.supermap.NetworkAnalystService.prototype.findServiceAreas
  67772. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  67773. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类。
  67774. * @param {RequestCallback} callback 回调函数。
  67775. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  67776. */
  67777. findServiceAreas(params, callback, resultFormat) {
  67778. var me = this;
  67779. var findServiceAreasService = new FindServiceAreasService(me.url, {
  67780. proxy: me.options.proxy,
  67781. withCredentials: me.options.withCredentials,
  67782. crossOrigin: me.options.crossOrigin,
  67783. headers: me.options.headers,
  67784. serverType: me.options.serverType,
  67785. eventListeners: {
  67786. scope: me,
  67787. processCompleted: callback,
  67788. processFailed: callback
  67789. },
  67790. format: me._processFormat(resultFormat)
  67791. });
  67792. findServiceAreasService.processAsync(me._processParams(params));
  67793. }
  67794. /**
  67795. * @function mapboxgl.supermap.NetworkAnalystService.prototype.updateEdgeWeight
  67796. * @description 更新边的耗费权重服务。
  67797. * @param {SuperMap.UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  67798. * @param {RequestCallback} callback 回调函数。
  67799. */
  67800. updateEdgeWeight(params, callback) {
  67801. var me = this;
  67802. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  67803. proxy: me.options.proxy,
  67804. withCredentials: me.options.withCredentials,
  67805. crossOrigin: me.options.crossOrigin,
  67806. headers: me.options.headers,
  67807. serverType: me.options.serverType,
  67808. eventListeners: {
  67809. scope: me,
  67810. processCompleted: callback,
  67811. processFailed: callback
  67812. }
  67813. });
  67814. updateEdgeWeightService.processAsync(params);
  67815. }
  67816. /**
  67817. * @function mapboxgl.supermap.NetworkAnalystService.prototype.updateTurnNodeWeight
  67818. * @description 转向耗费权重更新服务。
  67819. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  67820. * @param {RequestCallback} callback - 回调函数。
  67821. */
  67822. updateTurnNodeWeight(params, callback) {
  67823. var me = this;
  67824. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  67825. proxy: me.options.proxy,
  67826. withCredentials: me.options.withCredentials,
  67827. crossOrigin: me.options.crossOrigin,
  67828. headers: me.options.headers,
  67829. serverType: me.options.serverType,
  67830. eventListeners: {
  67831. scope: me,
  67832. processCompleted: callback,
  67833. processFailed: callback
  67834. }
  67835. });
  67836. updateTurnNodeWeightService.processAsync(params);
  67837. }
  67838. /**
  67839. * @description 所有 Point 考虑 mapboxgl.lnglat、mapboxgl.Point、[]三种形式。
  67840. * @param {Object} params - 待转换参数。
  67841. * @returns {Object}
  67842. * @private
  67843. */
  67844. _processParams(params) {
  67845. if (!params) {
  67846. return {};
  67847. }
  67848. var me = this;
  67849. if (params.centers && core_Util_Util.isArray(params.centers)) {
  67850. params.centers.map(function (point, key) {
  67851. params.centers[key] = me._toPointObject(point);
  67852. return params.centers[key];
  67853. });
  67854. }
  67855. if (params.nodes && core_Util_Util.isArray(params.nodes)) {
  67856. params.nodes.map(function (point, key) {
  67857. params.nodes[key] = me._toPointObject(point);
  67858. return params.nodes[key];
  67859. });
  67860. }
  67861. if (params.event) {
  67862. params.event = me._toPointObject(params.event);
  67863. }
  67864. if (params.facilities && core_Util_Util.isArray(params.facilities)) {
  67865. params.facilities.map(function (point, key) {
  67866. params.facilities[key] = me._toPointObject(point);
  67867. return params.facilities[key];
  67868. });
  67869. }
  67870. if (params.parameter && params.parameter.barrierPoints) {
  67871. var barrierPoints = params.parameter.barrierPoints;
  67872. if (core_Util_Util.isArray(barrierPoints)) {
  67873. barrierPoints.map(function (point, key) {
  67874. params.parameter[key] = me._toPointObject(point);
  67875. return params.parameter.barrierPoints[key];
  67876. });
  67877. } else {
  67878. params.parameter.barrierPoints = [(barrierPoints instanceof (external_mapboxgl_default()).LngLat) ? {
  67879. x: barrierPoints.lng,
  67880. y: barrierPoints.lat
  67881. } : barrierPoints];
  67882. }
  67883. }
  67884. return params;
  67885. }
  67886. _toPointObject(point) {
  67887. if (core_Util_Util.isArray(point)) {
  67888. return {
  67889. x: point[0],
  67890. y: point[1]
  67891. };
  67892. }
  67893. if (point instanceof (external_mapboxgl_default()).LngLat) {
  67894. return {
  67895. x: point.lng,
  67896. y: point.lat
  67897. };
  67898. }
  67899. return (point instanceof (external_mapboxgl_default()).Point) ? {
  67900. x: point.x,
  67901. y: point.y
  67902. } : point;
  67903. }
  67904. _processFormat(resultFormat) {
  67905. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  67906. }
  67907. }
  67908. (external_mapboxgl_default()).supermap.NetworkAnalystService = NetworkAnalystService;
  67909. ;// CONCATENATED MODULE: ./src/mapboxgl/services/NetworkAnalyst3DService.js
  67910. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67911. * This program are made available under the terms of the Apache License, Version 2.0
  67912. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67913. /**
  67914. * @class mapboxgl.supermap.NetworkAnalyst3DService
  67915. * @category iServer FacilityAnalyst3D
  67916. * @classdesc 3D 网络分析服务类。
  67917. * @extends {mapboxgl.supermap.ServiceBase}
  67918. * @example
  67919. * new mapboxgl.supermap.NetworkAnalyst3DService(url)
  67920. * .sinksFacilityAnalyst(params,function(result){
  67921. * //doSomething
  67922. * })
  67923. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:</br>
  67924. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  67925. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  67926. * @param {Object} options - 服务所需可选参数。
  67927. * @param {string} [options.proxy] - 服务代理地址。
  67928. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  67929. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  67930. * @param {Object} [options.headers] - 请求头。
  67931. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  67932. */
  67933. class NetworkAnalyst3DService extends ServiceBase {
  67934. constructor(url, options) {
  67935. super(url, options);
  67936. }
  67937. /**
  67938. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  67939. * @description 汇查找服务。
  67940. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
  67941. * @param {RequestCallback} callback - 回调函数。
  67942. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67943. */
  67944. sinksFacilityAnalyst(params, callback) {
  67945. var me = this;
  67946. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  67947. proxy: me.options.proxy,
  67948. withCredentials: me.options.withCredentials,
  67949. crossOrigin: me.options.crossOrigin,
  67950. headers: me.options.headers,
  67951. serverType: me.options.serverType,
  67952. eventListeners: {
  67953. scope: me,
  67954. processCompleted: callback,
  67955. processFailed: callback
  67956. }
  67957. });
  67958. facilityAnalystSinks3DService.processAsync(params);
  67959. }
  67960. /**
  67961. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  67962. * @description 源查找服务。
  67963. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  67964. * @param {RequestCallback} callback - 回调函数。
  67965. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67966. */
  67967. sourcesFacilityAnalyst(params, callback) {
  67968. var me = this;
  67969. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  67970. proxy: me.options.proxy,
  67971. withCredentials: me.options.withCredentials,
  67972. crossOrigin: me.options.crossOrigin,
  67973. headers: me.options.headers,
  67974. serverType: me.options.serverType,
  67975. eventListeners: {
  67976. scope: me,
  67977. processCompleted: callback,
  67978. processFailed: callback
  67979. }
  67980. });
  67981. facilityAnalystSources3DService.processAsync(params);
  67982. }
  67983. /**
  67984. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  67985. * @description 上游追踪资源服务。
  67986. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  67987. * @param {RequestCallback} callback 回调函数。
  67988. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  67989. */
  67990. traceUpFacilityAnalyst(params, callback) {
  67991. var me = this;
  67992. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  67993. proxy: me.options.proxy,
  67994. withCredentials: me.options.withCredentials,
  67995. crossOrigin: me.options.crossOrigin,
  67996. headers: me.options.headers,
  67997. serverType: me.options.serverType,
  67998. eventListeners: {
  67999. scope: me,
  68000. processCompleted: callback,
  68001. processFailed: callback
  68002. }
  68003. });
  68004. facilityAnalystTraceup3DService.processAsync(params);
  68005. }
  68006. /**
  68007. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  68008. * @description 下游追踪资源服务。
  68009. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  68010. * @param {RequestCallback} callback 回调函数。
  68011. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  68012. */
  68013. traceDownFacilityAnalyst(params, callback) {
  68014. var me = this;
  68015. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  68016. proxy: me.options.proxy,
  68017. withCredentials: me.options.withCredentials,
  68018. crossOrigin: me.options.crossOrigin,
  68019. headers: me.options.headers,
  68020. serverType: me.options.serverType,
  68021. eventListeners: {
  68022. scope: me,
  68023. processCompleted: callback,
  68024. processFailed: callback
  68025. }
  68026. });
  68027. facilityAnalystTracedown3DService.processAsync(params);
  68028. }
  68029. /**
  68030. * @function mapboxgl.supermap.NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  68031. * @description 上游关键设施查找服务。
  68032. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  68033. * @param {RequestCallback} callback 回调函数。
  68034. * @returns {mapboxgl.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  68035. */
  68036. upstreamFacilityAnalyst(params, callback) {
  68037. var me = this;
  68038. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  68039. proxy: me.options.proxy,
  68040. withCredentials: me.options.withCredentials,
  68041. crossOrigin: me.options.crossOrigin,
  68042. headers: me.options.headers,
  68043. serverType: me.options.serverType,
  68044. eventListeners: {
  68045. scope: me,
  68046. processCompleted: callback,
  68047. processFailed: callback
  68048. }
  68049. });
  68050. facilityAnalystUpstream3DService.processAsync(params);
  68051. }
  68052. }
  68053. (external_mapboxgl_default()).supermap.NetworkAnalyst3DService = NetworkAnalyst3DService;
  68054. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ProcessingService.js
  68055. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68056. * This program are made available under the terms of the Apache License, Version 2.0
  68057. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68058. /**
  68059. * @class mapboxgl.supermap.ProcessingService
  68060. * @category iServer ProcessingService
  68061. * @classdesc 分布式分析相关服务类。
  68062. * @extends {mapboxgl.supermap.ServiceBase}
  68063. * @example
  68064. * new mapboxgl.supermap.ProcessingService(url,options)
  68065. * .getKernelDensityJobs(function(result){
  68066. * //doSomething
  68067. * })
  68068. * @param {string} url - 分布式分析服务地址。
  68069. * @param {Object} options - 交互服务时所需可选参数。
  68070. * @param {string} [options.proxy] - 服务代理地址。
  68071. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  68072. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68073. * @param {Object} [options.headers] - 请求头。
  68074. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  68075. */
  68076. class ProcessingService extends ServiceBase {
  68077. constructor(url, options) {
  68078. super(url, options);
  68079. this.kernelDensityJobs = {};
  68080. this.summaryMeshJobs = {};
  68081. this.queryJobs = {};
  68082. this.summaryRegionJobs = {};
  68083. this.vectorClipJobs = {};
  68084. this.overlayGeoJobs = {};
  68085. this.buffersJobs = {};
  68086. this.topologyValidatorJobs = {};
  68087. this.summaryAttributesJobs = {};
  68088. }
  68089. /**
  68090. * @function mapboxgl.supermap.ProcessingService.prototype.getKernelDensityJobs
  68091. * @description 获取密度分析的列表。
  68092. * @param {RequestCallback} callback - 请求结果的回调函数。
  68093. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68094. */
  68095. getKernelDensityJobs(callback, resultFormat) {
  68096. var me = this,
  68097. format = me._processFormat(resultFormat);
  68098. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  68099. proxy: me.options.proxy,
  68100. withCredentials: me.options.withCredentials,
  68101. crossOrigin: me.options.crossOrigin,
  68102. headers: me.options.headers,
  68103. serverType: me.options.serverType,
  68104. eventListeners: {
  68105. scope: me,
  68106. processCompleted: callback,
  68107. processFailed: callback
  68108. },
  68109. format: format
  68110. });
  68111. kernelDensityJobsService.getKernelDensityJobs();
  68112. }
  68113. /**
  68114. * @function mapboxgl.supermap.ProcessingService.prototype.getKernelDensityJob
  68115. * @description 获取某一个密度分析。
  68116. * @param {string} id - 空间分析的id。
  68117. * @param {RequestCallback} callback - 请求结果的回调函数。
  68118. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68119. */
  68120. getKernelDensityJob(id, callback, resultFormat) {
  68121. var me = this,
  68122. format = me._processFormat(resultFormat);
  68123. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  68124. proxy: me.options.proxy,
  68125. withCredentials: me.options.withCredentials,
  68126. crossOrigin: me.options.crossOrigin,
  68127. headers: me.options.headers,
  68128. serverType: me.options.serverType,
  68129. eventListeners: {
  68130. scope: me,
  68131. processCompleted: callback,
  68132. processFailed: callback
  68133. },
  68134. format: format
  68135. });
  68136. kernelDensityJobsService.getKernelDensityJob(id);
  68137. }
  68138. /**
  68139. * @function mapboxgl.supermap.ProcessingService.prototype.addKernelDensityJob
  68140. * @description 新建一个密度分析。
  68141. * @param {SuperMap.KernelDensityJobParameter} params -创建一个空间分析的请求参数。
  68142. * @param {RequestCallback} callback 请求结果的回调函数。
  68143. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68144. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68145. */
  68146. addKernelDensityJob(params, callback, seconds, resultFormat) {
  68147. var me = this,
  68148. param = me._processParams(params),
  68149. format = me._processFormat(resultFormat);
  68150. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  68151. proxy: me.options.proxy,
  68152. withCredentials: me.options.withCredentials,
  68153. crossOrigin: me.options.crossOrigin,
  68154. headers: me.options.headers,
  68155. eventListeners: {
  68156. scope: me,
  68157. processCompleted: callback,
  68158. processFailed: callback,
  68159. processRunning: function (job) {
  68160. me.kernelDensityJobs[job.id] = job.state;
  68161. }
  68162. },
  68163. format: format
  68164. });
  68165. kernelDensityJobsService.addKernelDensityJob(param, seconds);
  68166. }
  68167. /**
  68168. * @function mapboxgl.supermap.ProcessingService.prototype.getKernelDensityJobState
  68169. * @description 获取密度分析的状态。
  68170. * @param {string} id - 密度分析的id。
  68171. * @returns {Object} 密度分析的状态。
  68172. */
  68173. getKernelDensityJobState(id) {
  68174. return this.kernelDensityJobs[id];
  68175. }
  68176. /**
  68177. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryMeshJobs
  68178. * @description 获取点聚合分析的列表。
  68179. * @param {RequestCallback} callback - 请求结果的回调函数。
  68180. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68181. */
  68182. getSummaryMeshJobs(callback, resultFormat) {
  68183. var me = this,
  68184. format = me._processFormat(resultFormat);
  68185. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  68186. proxy: me.options.proxy,
  68187. withCredentials: me.options.withCredentials,
  68188. crossOrigin: me.options.crossOrigin,
  68189. headers: me.options.headers,
  68190. serverType: me.options.serverType,
  68191. eventListeners: {
  68192. scope: me,
  68193. processCompleted: callback,
  68194. processFailed: callback
  68195. },
  68196. format: format
  68197. });
  68198. summaryMeshJobsService.getSummaryMeshJobs();
  68199. }
  68200. /**
  68201. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryMeshJob
  68202. * @description 获取某一个点聚合分析。
  68203. * @param {string} id - 空间分析的 id。
  68204. * @param {function} callback - 请求结果的回调函数。
  68205. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68206. */
  68207. getSummaryMeshJob(id, callback, resultFormat) {
  68208. var me = this,
  68209. format = me._processFormat(resultFormat);
  68210. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  68211. proxy: me.options.proxy,
  68212. withCredentials: me.options.withCredentials,
  68213. crossOrigin: me.options.crossOrigin,
  68214. headers: me.options.headers,
  68215. serverType: me.options.serverType,
  68216. eventListeners: {
  68217. scope: me,
  68218. processCompleted: callback,
  68219. processFailed: callback
  68220. },
  68221. format: format
  68222. });
  68223. summaryMeshJobsService.getSummaryMeshJob(id);
  68224. }
  68225. /**
  68226. * @function mapboxgl.supermap.ProcessingService.prototype.addSummaryMeshJob
  68227. * @description 新建一个点聚合分析。
  68228. * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  68229. * @param {RequestCallback} callback 请求结果的回调函数。
  68230. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68231. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68232. */
  68233. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  68234. var me = this,
  68235. param = me._processParams(params),
  68236. format = me._processFormat(resultFormat);
  68237. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  68238. proxy: me.options.proxy,
  68239. withCredentials: me.options.withCredentials,
  68240. crossOrigin: me.options.crossOrigin,
  68241. headers: me.options.headers,
  68242. eventListeners: {
  68243. scope: me,
  68244. processCompleted: callback,
  68245. processFailed: callback,
  68246. processRunning: function (job) {
  68247. me.summaryMeshJobs[job.id] = job.state;
  68248. }
  68249. },
  68250. format: format
  68251. });
  68252. summaryMeshJobsService.addSummaryMeshJob(param, seconds);
  68253. }
  68254. /**
  68255. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryMeshJobState
  68256. * @description 获取点聚合分析的状态。
  68257. * @param {string} id - 点聚合分析的 ID。
  68258. * @returns {Object} 点聚合分析的状态。
  68259. */
  68260. getSummaryMeshJobState(id) {
  68261. return this.summaryMeshJobs[id];
  68262. }
  68263. /**
  68264. * @function mapboxgl.supermap.ProcessingService.prototype.getQueryJobs
  68265. * @description 获取单对象查询分析的列表。
  68266. * @param {RequestCallback} callback - 请求结果的回调函数。
  68267. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68268. */
  68269. getQueryJobs(callback, resultFormat) {
  68270. var me = this,
  68271. format = me._processFormat(resultFormat);
  68272. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  68273. proxy: me.options.proxy,
  68274. withCredentials: me.options.withCredentials,
  68275. serverType: me.options.serverType,
  68276. crossOrigin: me.options.crossOrigin,
  68277. headers: me.options.headers,
  68278. eventListeners: {
  68279. scope: me,
  68280. processCompleted: callback,
  68281. processFailed: callback
  68282. },
  68283. format: format
  68284. });
  68285. singleObjectQueryJobsService.getQueryJobs();
  68286. }
  68287. /**
  68288. * @function mapboxgl.supermap.ProcessingService.prototype.getQueryJob
  68289. * @description 获取某一个单对象查询分析。
  68290. * @param {string} id - 空间分析的 id。
  68291. * @param {RequestCallback} callback - 请求结果的回调函数。
  68292. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68293. */
  68294. getQueryJob(id, callback, resultFormat) {
  68295. var me = this,
  68296. format = me._processFormat(resultFormat);
  68297. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  68298. proxy: me.options.proxy,
  68299. withCredentials: me.options.withCredentials,
  68300. crossOrigin: me.options.crossOrigin,
  68301. headers: me.options.headers,
  68302. serverType: me.options.serverType,
  68303. eventListeners: {
  68304. scope: me,
  68305. processCompleted: callback,
  68306. processFailed: callback
  68307. },
  68308. format: format
  68309. });
  68310. singleObjectQueryJobsService.getQueryJob(id);
  68311. }
  68312. /**
  68313. * @function mapboxgl.supermap.ProcessingService.prototype.addQueryJob
  68314. * @description 新建一个单对象查询分析。
  68315. * @param {SuperMap.SingleObjectQueryJobsParameter} params -创建一个空间分析的请求参数。
  68316. * @param {RequestCallback} callback - 请求结果的回调函数。
  68317. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68318. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68319. */
  68320. addQueryJob(params, callback, seconds, resultFormat) {
  68321. var me = this,
  68322. param = me._processParams(params),
  68323. format = me._processFormat(resultFormat);
  68324. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  68325. proxy: me.options.proxy,
  68326. withCredentials: me.options.withCredentials,
  68327. crossOrigin: me.options.crossOrigin,
  68328. headers: me.options.headers,
  68329. eventListeners: {
  68330. scope: me,
  68331. processCompleted: callback,
  68332. processFailed: callback,
  68333. processRunning: function (job) {
  68334. me.queryJobs[job.id] = job.state;
  68335. }
  68336. },
  68337. format: format
  68338. });
  68339. singleObjectQueryJobsService.addQueryJob(param, seconds);
  68340. }
  68341. /**
  68342. * @function mapboxgl.supermap.ProcessingService.prototype.getQueryJobState
  68343. * @description 获取单对象查询分析的状态。
  68344. * @param {string} id - 单对象查询分析的 ID。
  68345. * @returns {Object} 单对象查询分析的状态。
  68346. */
  68347. getQueryJobState(id) {
  68348. return this.queryJobs[id];
  68349. }
  68350. /**
  68351. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryRegionJobs
  68352. * @description 获取区域汇总分析的列表。
  68353. * @param {RequestCallback} callback - 请求结果的回调函数。
  68354. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68355. */
  68356. getSummaryRegionJobs(callback, resultFormat) {
  68357. var me = this,
  68358. format = me._processFormat(resultFormat);
  68359. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  68360. proxy: me.options.proxy,
  68361. withCredentials: me.options.withCredentials,
  68362. crossOrigin: me.options.crossOrigin,
  68363. headers: me.options.headers,
  68364. serverType: me.options.serverType,
  68365. eventListeners: {
  68366. scope: me,
  68367. processCompleted: callback,
  68368. processFailed: callback
  68369. },
  68370. format: format
  68371. });
  68372. summaryRegionJobsService.getSummaryRegionJobs();
  68373. }
  68374. /**
  68375. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryRegionJob
  68376. * @description 获取某一个区域汇总分析。
  68377. * @param {string} id - 区域汇总分析的 id。
  68378. * @param {RequestCallback} callback - 请求结果的回调函数。
  68379. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68380. */
  68381. getSummaryRegionJob(id, callback, resultFormat) {
  68382. var me = this,
  68383. format = me._processFormat(resultFormat);
  68384. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  68385. proxy: me.options.proxy,
  68386. withCredentials: me.options.withCredentials,
  68387. crossOrigin: me.options.crossOrigin,
  68388. headers: me.options.headers,
  68389. serverType: me.options.serverType,
  68390. eventListeners: {
  68391. scope: me,
  68392. processCompleted: callback,
  68393. processFailed: callback
  68394. },
  68395. format: format
  68396. });
  68397. summaryRegionJobsService.getSummaryRegionJob(id);
  68398. }
  68399. /**
  68400. * @function mapboxgl.supermap.ProcessingService.prototype.addSummaryRegionJob
  68401. * @description 新建一个区域汇总分析。
  68402. * @param {SuperMap.SummaryRegionJobParameter} params - 区域汇总分析参数类。
  68403. * @param {RequestCallback} callback - 请求结果的回调函数。
  68404. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68405. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68406. */
  68407. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  68408. var me = this,
  68409. param = me._processParams(params),
  68410. format = me._processFormat(resultFormat);
  68411. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  68412. proxy: me.options.proxy,
  68413. withCredentials: me.options.withCredentials,
  68414. crossOrigin: me.options.crossOrigin,
  68415. headers: me.options.headers,
  68416. eventListeners: {
  68417. scope: me,
  68418. processCompleted: callback,
  68419. processFailed: callback,
  68420. processRunning: function (job) {
  68421. me.summaryRegionJobs[job.id] = job.state;
  68422. }
  68423. },
  68424. format: format
  68425. });
  68426. summaryRegionJobsService.addSummaryRegionJob(param, seconds);
  68427. }
  68428. /**
  68429. * @function mapboxgl.supermap.ProcessingService.prototype.getSummaryRegionJobState
  68430. * @description 获取区域汇总分析的状态。
  68431. * @param {string} id - 生成区域汇总分析的 id。
  68432. * @returns {Object} 区域汇总分析的状态。
  68433. */
  68434. getSummaryRegionJobState(id) {
  68435. return this.summaryRegionJobs[id];
  68436. }
  68437. /**
  68438. * @function mapboxgl.supermap.ProcessingService.prototype.getVectorClipJobs
  68439. * @description 获取矢量裁剪分析的列表。
  68440. * @param {RequestCallback} callback - 请求结果的回调函数。
  68441. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68442. */
  68443. getVectorClipJobs(callback, resultFormat) {
  68444. var me = this,
  68445. format = me._processFormat(resultFormat);
  68446. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  68447. proxy: me.options.proxy,
  68448. withCredentials: me.options.withCredentials,
  68449. crossOrigin: me.options.crossOrigin,
  68450. headers: me.options.headers,
  68451. serverType: me.options.serverType,
  68452. eventListeners: {
  68453. scope: me,
  68454. processCompleted: callback,
  68455. processFailed: callback
  68456. },
  68457. format: format
  68458. });
  68459. vectorClipJobsService.getVectorClipJobs();
  68460. }
  68461. /**
  68462. * @function mapboxgl.supermap.ProcessingService.prototype.getVectorClipJob
  68463. * @description 获取某一个矢量裁剪分析。
  68464. * @param {string} id - 空间分析的 id。
  68465. * @param {RequestCallback} callback - 请求结果的回调函数。
  68466. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68467. */
  68468. getVectorClipJob(id, callback, resultFormat) {
  68469. var me = this,
  68470. format = me._processFormat(resultFormat);
  68471. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  68472. proxy: me.options.proxy,
  68473. withCredentials: me.options.withCredentials,
  68474. serverType: me.options.serverType,
  68475. crossOrigin: me.options.crossOrigin,
  68476. headers: me.options.headers,
  68477. eventListeners: {
  68478. scope: me,
  68479. processCompleted: callback,
  68480. processFailed: callback
  68481. },
  68482. format: format
  68483. });
  68484. vectorClipJobsService.getVectorClipJob(id);
  68485. }
  68486. /**
  68487. * @function mapboxgl.supermap.ProcessingService.prototype.addVectorClipJob
  68488. * @description 新建一个矢量裁剪分析。
  68489. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  68490. * @param {RequestCallback} callback - 请求结果的回调函数。
  68491. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68492. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68493. */
  68494. addVectorClipJob(params, callback, seconds, resultFormat) {
  68495. var me = this,
  68496. param = me._processParams(params),
  68497. format = me._processFormat(resultFormat);
  68498. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  68499. proxy: me.options.proxy,
  68500. withCredentials: me.options.withCredentials,
  68501. serverType: me.options.serverType,
  68502. crossOrigin: me.options.crossOrigin,
  68503. headers: me.options.headers,
  68504. eventListeners: {
  68505. scope: me,
  68506. processCompleted: callback,
  68507. processFailed: callback,
  68508. processRunning: function (job) {
  68509. me.vectorClipJobs[job.id] = job.state;
  68510. }
  68511. },
  68512. format: format
  68513. });
  68514. vectorClipJobsService.addVectorClipJob(param, seconds);
  68515. }
  68516. /**
  68517. * @function mapboxgl.supermap.ProcessingService.prototype.getVectorClipJobState
  68518. * @description 获取矢量裁剪分析的状态。
  68519. * @param {number} id - 矢量裁剪分析的id。
  68520. * @returns {Object} 矢量裁剪分析的状态。
  68521. */
  68522. getVectorClipJobState(id) {
  68523. return this.vectorClipJobs[id];
  68524. }
  68525. /**
  68526. * @function mapboxgl.supermap.processingService.prototype.getOverlayGeoJobs
  68527. * @description 获取叠加分析的列表。
  68528. * @param {RequestCallback} callback - 请求结果的回调函数。
  68529. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68530. */
  68531. getOverlayGeoJobs(callback, resultFormat) {
  68532. var me = this,
  68533. format = me._processFormat(resultFormat);
  68534. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  68535. proxy: me.options.proxy,
  68536. withCredentials: me.options.withCredentials,
  68537. serverType: me.options.serverType,
  68538. crossOrigin: me.options.crossOrigin,
  68539. headers: me.options.headers,
  68540. eventListeners: {
  68541. scope: me,
  68542. processCompleted: callback,
  68543. processFailed: callback
  68544. },
  68545. format: format
  68546. });
  68547. overlayGeoJobsService.getOverlayGeoJobs();
  68548. }
  68549. /**
  68550. * @function mapboxgl.supermap.processingService.prototype.getOverlayGeoJob
  68551. * @description 获取某一个叠加分析。
  68552. * @param {string} id - 空间分析的 ID。
  68553. * @param {RequestCallback} callback - 请求结果的回调函数。
  68554. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68555. */
  68556. getOverlayGeoJob(id, callback, resultFormat) {
  68557. var me = this,
  68558. format = me._processFormat(resultFormat);
  68559. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  68560. proxy: me.options.proxy,
  68561. withCredentials: me.options.withCredentials,
  68562. serverType: me.options.serverType,
  68563. crossOrigin: me.options.crossOrigin,
  68564. headers: me.options.headers,
  68565. eventListeners: {
  68566. scope: me,
  68567. processCompleted: callback,
  68568. processFailed: callback
  68569. },
  68570. format: format
  68571. });
  68572. overlayGeoJobsService.getOverlayGeoJob(id);
  68573. }
  68574. /**
  68575. * @function mapboxgl.supermap.processingService.prototype.addOverlayGeoJob
  68576. * @description 新建一个叠加分析。
  68577. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。
  68578. * @param {RequestCallback} callback - 请求结果的回调函数。
  68579. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68580. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68581. */
  68582. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  68583. var me = this,
  68584. param = me._processParams(params),
  68585. format = me._processFormat(resultFormat);
  68586. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  68587. proxy: me.options.proxy,
  68588. withCredentials: me.options.withCredentials,
  68589. serverType: me.options.serverType,
  68590. crossOrigin: me.options.crossOrigin,
  68591. headers: me.options.headers,
  68592. eventListeners: {
  68593. scope: me,
  68594. processCompleted: callback,
  68595. processFailed: callback,
  68596. processRunning: function (job) {
  68597. me.overlayGeoJobs[job.id] = job.state;
  68598. }
  68599. },
  68600. format: format
  68601. });
  68602. overlayGeoJobsService.addOverlayGeoJob(param, seconds);
  68603. }
  68604. /**
  68605. * @function mapboxgl.supermap.processingService.prototype.getoverlayGeoJobState
  68606. * @description 获取叠加分析的状态。
  68607. * @param {string} id - 叠加分析的id。
  68608. * @returns {Object} 叠加分析的状态
  68609. */
  68610. getoverlayGeoJobState(id) {
  68611. return this.overlayGeoJobs[id];
  68612. }
  68613. /**
  68614. * @function mapboxgl.supermap.processingService.prototype.getBuffersJobs
  68615. * @description 获取缓冲区分析的列表。
  68616. * @param {RequestCallback} callback - 请求结果的回调函数。
  68617. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68618. */
  68619. getBuffersJobs(callback, resultFormat) {
  68620. var me = this,
  68621. format = me._processFormat(resultFormat);
  68622. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  68623. proxy: me.options.proxy,
  68624. withCredentials: me.options.withCredentials,
  68625. serverType: me.options.serverType,
  68626. crossOrigin: me.options.crossOrigin,
  68627. headers: me.options.headers,
  68628. eventListeners: {
  68629. scope: me,
  68630. processCompleted: callback,
  68631. processFailed: callback
  68632. },
  68633. format: format
  68634. });
  68635. buffersAnalystJobsService.getBuffersJobs();
  68636. }
  68637. /**
  68638. * @function mapboxgl.supermap.processingService.prototype.getBuffersJob
  68639. * @description 获取某一个缓冲区分析。
  68640. * @param {string} id - 空间分析的 ID。
  68641. * @param {RequestCallback} callback - 请求结果的回调函数。
  68642. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68643. */
  68644. getBuffersJob(id, callback, resultFormat) {
  68645. var me = this,
  68646. format = me._processFormat(resultFormat);
  68647. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  68648. proxy: me.options.proxy,
  68649. withCredentials: me.options.withCredentials,
  68650. serverType: me.options.serverType,
  68651. crossOrigin: me.options.crossOrigin,
  68652. headers: me.options.headers,
  68653. eventListeners: {
  68654. scope: me,
  68655. processCompleted: callback,
  68656. processFailed: callback
  68657. },
  68658. format: format
  68659. });
  68660. buffersAnalystJobsService.getBuffersJob(id);
  68661. }
  68662. /**
  68663. * @function mapboxgl.supermap.processingService.prototype.addBuffersJob
  68664. * @description 新建一个缓冲区分析。
  68665. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  68666. * @param {RequestCallback} callback - 请求结果的回调函数。
  68667. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  68668. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68669. */
  68670. addBuffersJob(params, callback, seconds, resultFormat) {
  68671. var me = this,
  68672. param = me._processParams(params),
  68673. format = me._processFormat(resultFormat);
  68674. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  68675. proxy: me.options.proxy,
  68676. withCredentials: me.options.withCredentials,
  68677. serverType: me.options.serverType,
  68678. crossOrigin: me.options.crossOrigin,
  68679. headers: me.options.headers,
  68680. eventListeners: {
  68681. scope: me,
  68682. processCompleted: callback,
  68683. processFailed: callback,
  68684. processRunning: function (job) {
  68685. me.buffersJobs[job.id] = job.state;
  68686. }
  68687. },
  68688. format: format
  68689. });
  68690. buffersAnalystJobsService.addBuffersJob(param, seconds);
  68691. }
  68692. /**
  68693. * @function mapboxgl.supermap.processingService.prototype.getBuffersJobState
  68694. * @description 获取缓冲区分析的状态。
  68695. * @param {string} id - 缓冲区分析的 ID。
  68696. * @returns {Object} 缓冲区分析的状态。
  68697. */
  68698. getBuffersJobState(id) {
  68699. return this.buffersJobs[id];
  68700. }
  68701. /**
  68702. * @function mapboxgl.supermap.processingService.prototype.getTopologyValidatorJobs
  68703. * @description 获取拓扑检查分析的列表。
  68704. * @param {RequestCallback} callback - 请求结果的回调函数。
  68705. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68706. */
  68707. getTopologyValidatorJobs(callback, resultFormat) {
  68708. var me = this,
  68709. format = me._processFormat(resultFormat);
  68710. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  68711. proxy: me.options.proxy,
  68712. withCredentials: me.options.withCredentials,
  68713. serverType: me.options.serverType,
  68714. crossOrigin: me.options.crossOrigin,
  68715. headers: me.options.headers,
  68716. eventListeners: {
  68717. scope: me,
  68718. processCompleted: callback,
  68719. processFailed: callback
  68720. },
  68721. format: format
  68722. });
  68723. topologyValidatorJobsService.getTopologyValidatorJobs();
  68724. }
  68725. /**
  68726. * @function mapboxgl.supermap.processingService.prototype.getTopologyValidatorJob
  68727. * @description 获取某一个拓扑检查分析。
  68728. * @param {string} id - 空间分析的 ID。
  68729. * @param {RequestCallback} callback - 请求结果的回调函数。
  68730. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68731. */
  68732. getTopologyValidatorJob(id, callback, resultFormat) {
  68733. var me = this,
  68734. format = me._processFormat(resultFormat);
  68735. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  68736. proxy: me.options.proxy,
  68737. withCredentials: me.options.withCredentials,
  68738. serverType: me.options.serverType,
  68739. crossOrigin: me.options.crossOrigin,
  68740. headers: me.options.headers,
  68741. eventListeners: {
  68742. scope: me,
  68743. processCompleted: callback,
  68744. processFailed: callback
  68745. },
  68746. format: format
  68747. });
  68748. topologyValidatorJobsService.getTopologyValidatorJob(id);
  68749. }
  68750. /**
  68751. * @function mapboxgl.supermap.processingService.prototype.addTopologyValidatorJob
  68752. * @description 新建一个拓扑检查分析。
  68753. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  68754. * @param {RequestCallback} callback - 请求结果的回调函数。
  68755. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68756. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68757. */
  68758. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  68759. var me = this,
  68760. param = me._processParams(params),
  68761. format = me._processFormat(resultFormat);
  68762. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  68763. proxy: me.options.proxy,
  68764. withCredentials: me.options.withCredentials,
  68765. serverType: me.options.serverType,
  68766. crossOrigin: me.options.crossOrigin,
  68767. headers: me.options.headers,
  68768. eventListeners: {
  68769. scope: me,
  68770. processCompleted: callback,
  68771. processFailed: callback,
  68772. processRunning: function (job) {
  68773. me.topologyValidatorJobs[job.id] = job.state;
  68774. }
  68775. },
  68776. format: format
  68777. });
  68778. topologyValidatorJobsService.addTopologyValidatorJob(param, seconds);
  68779. }
  68780. /**
  68781. * @function mapboxgl.supermap.processingService.prototype.getTopologyValidatorJobState
  68782. * @description 获取拓扑检查分析的状态。
  68783. * @param {string} id - 拓扑检查分析的 ID。
  68784. * @returns {Object} 拓扑检查分析的状态。
  68785. */
  68786. getTopologyValidatorJobState(id) {
  68787. return this.topologyValidatorJobs[id];
  68788. }
  68789. /**
  68790. * @function mapboxgl.supermap.processingService.prototype.getSummaryAttributesJobs
  68791. * @description 获取属性汇总分析的列表。
  68792. * @param {RequestCallback} callback - 请求结果的回调函数。
  68793. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68794. */
  68795. getSummaryAttributesJobs(callback, resultFormat) {
  68796. var me = this,
  68797. format = me._processFormat(resultFormat);
  68798. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  68799. proxy: me.options.proxy,
  68800. withCredentials: me.options.withCredentials,
  68801. serverType: me.options.serverType,
  68802. crossOrigin: me.options.crossOrigin,
  68803. headers: me.options.headers,
  68804. eventListeners: {
  68805. scope: me,
  68806. processCompleted: callback,
  68807. processFailed: callback
  68808. },
  68809. format: format
  68810. });
  68811. summaryAttributesJobsService.getSummaryAttributesJobs();
  68812. }
  68813. /**
  68814. * @function mapboxgl.supermap.processingService.prototype.getSummaryAttributesJob
  68815. * @description 获取某一个属性汇总分析。
  68816. * @param {string} id - 空间分析的 ID。
  68817. * @param {RequestCallback} callback - 请求结果的回调函数。
  68818. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68819. */
  68820. getSummaryAttributesJob(id, callback, resultFormat) {
  68821. var me = this,
  68822. format = me._processFormat(resultFormat);
  68823. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  68824. proxy: me.options.proxy,
  68825. withCredentials: me.options.withCredentials,
  68826. serverType: me.options.serverType,
  68827. crossOrigin: me.options.crossOrigin,
  68828. headers: me.options.headers,
  68829. eventListeners: {
  68830. scope: me,
  68831. processCompleted: callback,
  68832. processFailed: callback
  68833. },
  68834. format: format
  68835. });
  68836. summaryAttributesJobsService.getSummaryAttributesJob(id);
  68837. }
  68838. /**
  68839. * @function mapboxgl.supermap.processingService.prototype.addSummaryAttributesJob
  68840. * @description 新建一个属性汇总分析。
  68841. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  68842. * @param {RequestCallback} callback - 请求结果的回调函数。
  68843. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  68844. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  68845. */
  68846. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  68847. var me = this,
  68848. param = me._processParams(params),
  68849. format = me._processFormat(resultFormat);
  68850. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  68851. proxy: me.options.proxy,
  68852. withCredentials: me.options.withCredentials,
  68853. serverType: me.options.serverType,
  68854. crossOrigin: me.options.crossOrigin,
  68855. headers: me.options.headers,
  68856. eventListeners: {
  68857. scope: me,
  68858. processCompleted: callback,
  68859. processFailed: callback,
  68860. processRunning: function (job) {
  68861. me.summaryAttributesJobs[job.id] = job.state;
  68862. }
  68863. },
  68864. format: format
  68865. });
  68866. summaryAttributesJobsService.addSummaryAttributesJob(param, seconds);
  68867. }
  68868. /**
  68869. * @function mapboxgl.supermap.processingService.prototype.getSummaryAttributesJobState
  68870. * @description 获取属性汇总分析的状态。
  68871. * @param {string} id - 属性汇总分析的 ID。
  68872. * @returns {Object} 属性汇总分析的状态
  68873. */
  68874. getSummaryAttributesJobState(id) {
  68875. return this.summaryAttributesJobs[id];
  68876. }
  68877. _processFormat(resultFormat) {
  68878. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  68879. }
  68880. _processParams(params) {
  68881. if (!params) {
  68882. return {};
  68883. }
  68884. if (params.bounds) {
  68885. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  68886. }
  68887. //这里只允许传端的bounds
  68888. if (params.query) {
  68889. params.query = core_Util_Util.toSuperMapBounds(params.query);
  68890. }
  68891. if (params.geometryQuery) {
  68892. params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery);
  68893. }
  68894. if (params.geometryClip) {
  68895. params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip);
  68896. }
  68897. return params;
  68898. }
  68899. }
  68900. (external_mapboxgl_default()).supermap.ProcessingService = ProcessingService;
  68901. ;// CONCATENATED MODULE: ./src/mapboxgl/services/QueryService.js
  68902. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68903. * This program are made available under the terms of the Apache License, Version 2.0
  68904. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68905. /**
  68906. * @class mapboxgl.supermap.QueryService
  68907. * @category iServer Map QueryResults
  68908. * @classdesc 地图查询服务类。
  68909. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  68910. * @extends {mapboxgl.supermap.ServiceBase}
  68911. * @param {string} url - 地图查询服务访问地址。
  68912. * @param {Object} options - 服务交互时所需的可选参数。
  68913. * @param {string} [options.proxy] - 服务代理地址。
  68914. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  68915. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  68916. * @param {Object} [options.headers] - 请求头。
  68917. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  68918. * @example
  68919. * new mapboxgl.supermap.QueryService(url)
  68920. * .queryByBounds(param,function(result){
  68921. * //doSomething
  68922. * })
  68923. */
  68924. class QueryService_QueryService extends ServiceBase {
  68925. constructor(url, options) {
  68926. super(url, options);
  68927. }
  68928. /**
  68929. * @function mapboxgl.supermap.QueryService.prototype.queryByBounds
  68930. * @description Bounds 查询地图服务。
  68931. * @param {SuperMap.QueryByBoundsParameters} params - 通过 Bounds 查询的相关参数类。
  68932. * @param {RequestCallback} callback - 回调函数。
  68933. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  68934. */
  68935. queryByBounds(params, callback, resultFormat) {
  68936. var me = this;
  68937. var queryService = new QueryByBoundsService(me.url, {
  68938. proxy: me.options.proxy,
  68939. withCredentials: me.options.withCredentials,
  68940. crossOrigin: me.options.crossOrigin,
  68941. headers: me.options.headers,
  68942. serverType: me.options.serverType,
  68943. eventListeners: {
  68944. scope: me,
  68945. processCompleted: callback,
  68946. processFailed: callback
  68947. },
  68948. format: me._processFormat(resultFormat)
  68949. });
  68950. queryService.processAsync(me._processParams(params));
  68951. }
  68952. /**
  68953. * @function mapboxgl.supermap.QueryService.prototype.queryByDistance
  68954. * @description 地图距离查询服务。
  68955. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询相关参数类。
  68956. * @param {RequestCallback} callback - 回调函数。
  68957. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型
  68958. */
  68959. queryByDistance(params, callback, resultFormat) {
  68960. var me = this;
  68961. var queryByDistanceService = new QueryByDistanceService(me.url, {
  68962. proxy: me.options.proxy,
  68963. withCredentials: me.options.withCredentials,
  68964. crossOrigin: me.options.crossOrigin,
  68965. headers: me.options.headers,
  68966. serverType: me.options.serverType,
  68967. eventListeners: {
  68968. scope: me,
  68969. processCompleted: callback,
  68970. processFailed: callback
  68971. },
  68972. format: me._processFormat(resultFormat)
  68973. });
  68974. queryByDistanceService.processAsync(me._processParams(params));
  68975. }
  68976. /**
  68977. * @function mapboxgl.supermap.QueryService.prototype.queryBySQL
  68978. * @description 地图 SQL 查询服务。
  68979. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  68980. * @param {RequestCallback} callback - 回调函数。
  68981. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  68982. */
  68983. queryBySQL(params, callback, resultFormat) {
  68984. var me = this;
  68985. var queryBySQLService = new QueryBySQLService(me.url, {
  68986. proxy: me.options.proxy,
  68987. withCredentials: me.options.withCredentials,
  68988. crossOrigin: me.options.crossOrigin,
  68989. headers: me.options.headers,
  68990. serverType: me.options.serverType,
  68991. eventListeners: {
  68992. scope: me,
  68993. processCompleted: callback,
  68994. processFailed: callback
  68995. },
  68996. format: me._processFormat(resultFormat)
  68997. });
  68998. queryBySQLService.processAsync(me._processParams(params));
  68999. }
  69000. /**
  69001. * @function mapboxgl.supermap.QueryService.prototype.queryByGeometry
  69002. * @description 地图几何查询服务。
  69003. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询相关参数类。
  69004. * @param {RequestCallback} callback - 回调函数。
  69005. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69006. */
  69007. queryByGeometry(params, callback, resultFormat) {
  69008. var me = this;
  69009. var queryByGeometryService = new QueryByGeometryService(me.url, {
  69010. proxy: me.options.proxy,
  69011. withCredentials: me.options.withCredentials,
  69012. crossOrigin: me.options.crossOrigin,
  69013. headers: me.options.headers,
  69014. serverType: me.options.serverType,
  69015. eventListeners: {
  69016. scope: me,
  69017. processCompleted: callback,
  69018. processFailed: callback
  69019. },
  69020. format: me._processFormat(resultFormat)
  69021. });
  69022. queryByGeometryService.processAsync(me._processParams(params));
  69023. }
  69024. _processParams(params) {
  69025. if (!params) {
  69026. return {};
  69027. }
  69028. params.returnContent = params.returnContent == null ? true : params.returnContent;
  69029. if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
  69030. params.queryParams = [params.queryParams];
  69031. }
  69032. if (params.bounds) {
  69033. if (params.bounds instanceof Array) {
  69034. params.bounds = new Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]);
  69035. }
  69036. if (params.bounds instanceof (external_mapboxgl_default()).LngLatBounds) {
  69037. params.bounds = new Bounds(
  69038. params.bounds.getSouthWest().lng,
  69039. params.bounds.getSouthWest().lat,
  69040. params.bounds.getNorthEast().lng,
  69041. params.bounds.getNorthEast().lat
  69042. );
  69043. }
  69044. }
  69045. if (params.geometry) {
  69046. if (params.geometry instanceof (external_mapboxgl_default()).LngLat) {
  69047. params.geometry = new Point(params.geometry.lng, params.geometry.lat);
  69048. }
  69049. if (params.geometry instanceof (external_mapboxgl_default()).Point) {
  69050. params.geometry = new Point(params.geometry.x, params.geometry.y);
  69051. }
  69052. if (params.geometry instanceof (external_mapboxgl_default()).LngLatBounds) {
  69053. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  69054. }
  69055. if (!(params.geometry instanceof Geometry)) {
  69056. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  69057. }
  69058. }
  69059. return params;
  69060. }
  69061. _processFormat(resultFormat) {
  69062. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  69063. }
  69064. }
  69065. (external_mapboxgl_default()).supermap.QueryService = QueryService_QueryService;
  69066. ;// CONCATENATED MODULE: ./src/mapboxgl/services/SpatialAnalystService.js
  69067. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69068. * This program are made available under the terms of the Apache License, Version 2.0
  69069. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69070. /**
  69071. * @class mapboxgl.supermap.SpatialAnalystService
  69072. * @extends {mapboxgl.supermap.ServiceBase}
  69073. * @category iServer SpatialAnalyst
  69074. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  69075. * @example
  69076. * new mapboxgl.supermap.SpatialAnalystService(url)
  69077. * .bufferAnalysis(params,function(result){
  69078. * //doSomething
  69079. * })
  69080. * @param {string} url - 服务的访问地址。
  69081. * @param {Object} options - 交互服务时所需可选参数。
  69082. * @param {string} [options.proxy] - 服务代理地址。
  69083. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69084. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69085. * @param {Object} [options.headers] - 请求头。
  69086. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  69087. */
  69088. class SpatialAnalystService extends ServiceBase {
  69089. constructor(url, options) {
  69090. super(url, options);
  69091. }
  69092. /**
  69093. * @function mapboxgl.supermap.SpatialAnalystService.prototype.getAreaSolarRadiationResult
  69094. * @description 地区太阳辐射。
  69095. * @param {SuperMap.mapboxgl} params -查询相关参数类。
  69096. * @param {RequestCallback} callback - 回调函数。
  69097. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69098. */
  69099. getAreaSolarRadiationResult(params, callback, resultFormat) {
  69100. var me = this;
  69101. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  69102. proxy: me.options.proxy,
  69103. withCredentials: me.options.withCredentials,
  69104. crossOrigin: me.options.crossOrigin,
  69105. headers: me.options.headers,
  69106. serverType: me.options.serverType,
  69107. eventListeners: {
  69108. scope: me,
  69109. processCompleted: callback,
  69110. processFailed: callback
  69111. },
  69112. format: me._processFormat(resultFormat)
  69113. });
  69114. areaSolarRadiationService.processAsync(params);
  69115. }
  69116. /**
  69117. * @function mapboxgl.supermap.SpatialAnalystService.prototype.bufferAnalysis
  69118. * @description 缓冲区分析。
  69119. * @param {SuperMap.DatasetBufferAnalystParameters} params - 查询相关参数类。
  69120. * @param {RequestCallback} callback - 回调函数。
  69121. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69122. */
  69123. bufferAnalysis(params, callback, resultFormat) {
  69124. var me = this;
  69125. var bufferAnalystService = new BufferAnalystService(me.url, {
  69126. proxy: me.options.proxy,
  69127. withCredentials: me.options.withCredentials,
  69128. crossOrigin: me.options.crossOrigin,
  69129. headers: me.options.headers,
  69130. serverType: me.options.serverType,
  69131. eventListeners: {
  69132. scope: me,
  69133. processCompleted: callback,
  69134. processFailed: callback
  69135. },
  69136. format: me._processFormat(resultFormat)
  69137. });
  69138. bufferAnalystService.processAsync(me._processParams(params));
  69139. }
  69140. /**
  69141. * @function mapboxgl.supermap.SpatialAnalystService.prototype.densityAnalysis
  69142. * @description 点密度分析。
  69143. * @param {SuperMap.DensityKernelAnalystParameters} params - 查询相关参数类。
  69144. * @param {RequestCallback} callback - 回调函数。
  69145. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69146. */
  69147. densityAnalysis(params, callback, resultFormat) {
  69148. var me = this;
  69149. var densityAnalystService = new DensityAnalystService(me.url, {
  69150. proxy: me.options.proxy,
  69151. withCredentials: me.options.withCredentials,
  69152. crossOrigin: me.options.crossOrigin,
  69153. headers: me.options.headers,
  69154. serverType: me.options.serverType,
  69155. eventListeners: {
  69156. scope: me,
  69157. processCompleted: callback,
  69158. processFailed: callback
  69159. },
  69160. format: me._processFormat(resultFormat)
  69161. });
  69162. densityAnalystService.processAsync(me._processParams(params));
  69163. }
  69164. /**
  69165. * @function mapboxgl.supermap.SpatialAnalystService.prototype.generateSpatialData
  69166. * @description 动态分段分析。
  69167. * @param {SuperMap.GenerateSpatialDataParameters} params - 查询相关参数类。
  69168. * @param {RequestCallback} callback - 回调函数。
  69169. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69170. */
  69171. generateSpatialData(params, callback, resultFormat) {
  69172. var me = this;
  69173. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  69174. proxy: me.options.proxy,
  69175. withCredentials: me.options.withCredentials,
  69176. crossOrigin: me.options.crossOrigin,
  69177. headers: me.options.headers,
  69178. serverType: me.options.serverType,
  69179. eventListeners: {
  69180. scope: me,
  69181. processCompleted: callback,
  69182. processFailed: callback
  69183. },
  69184. format: me._processFormat(resultFormat)
  69185. });
  69186. generateSpatialDataService.processAsync(params);
  69187. }
  69188. /**
  69189. * @function mapboxgl.supermap.SpatialAnalystService.prototype.geoRelationAnalysis
  69190. * @description 空间关系分析。
  69191. * @param {SuperMap.GeoRelationAnalystParameters} params - 查询相关参数类。
  69192. * @param {RequestCallback} callback - 回调函数。
  69193. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69194. */
  69195. geoRelationAnalysis(params, callback, resultFormat) {
  69196. var me = this;
  69197. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  69198. proxy: me.options.proxy,
  69199. withCredentials: me.options.withCredentials,
  69200. crossOrigin: me.options.crossOrigin,
  69201. headers: me.options.headers,
  69202. serverType: me.options.serverType,
  69203. eventListeners: {
  69204. scope: me,
  69205. processCompleted: callback,
  69206. processFailed: callback
  69207. },
  69208. format: me._processFormat(resultFormat)
  69209. });
  69210. geoRelationAnalystService.processAsync(params);
  69211. }
  69212. /**
  69213. * @function mapboxgl.supermap.SpatialAnalystService.prototype.interpolationAnalysis
  69214. * @description 插值分析。
  69215. * @param {SuperMap.InterpolationRBFAnalystParameters} params - 查询相关参数类。
  69216. * @param {RequestCallback} callback - 回调函数。
  69217. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69218. */
  69219. interpolationAnalysis(params, callback, resultFormat) {
  69220. var me = this;
  69221. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  69222. proxy: me.options.proxy,
  69223. withCredentials: me.options.withCredentials,
  69224. crossOrigin: me.options.crossOrigin,
  69225. headers: me.options.headers,
  69226. serverType: me.options.serverType,
  69227. eventListeners: {
  69228. scope: me,
  69229. processCompleted: callback,
  69230. processFailed: callback
  69231. },
  69232. format: me._processFormat(resultFormat)
  69233. });
  69234. interpolationAnalystService.processAsync(me._processParams(params));
  69235. }
  69236. /**
  69237. * @function mapboxgl.supermap.SpatialAnalystService.prototype.mathExpressionAnalysis
  69238. * @description 栅格代数运算。
  69239. * @param {SuperMap.MathExpressionAnalysisParameters} params - 查询相关参数类。
  69240. * @param {RequestCallback} callback - 回调函数。
  69241. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69242. */
  69243. mathExpressionAnalysis(params, callback, resultFormat) {
  69244. var me = this;
  69245. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  69246. proxy: me.options.proxy,
  69247. withCredentials: me.options.withCredentials,
  69248. crossOrigin: me.options.crossOrigin,
  69249. headers: me.options.headers,
  69250. serverType: me.options.serverType,
  69251. eventListeners: {
  69252. scope: me,
  69253. processCompleted: callback,
  69254. processFailed: callback
  69255. },
  69256. format: me._processFormat(resultFormat)
  69257. });
  69258. mathExpressionAnalysisService.processAsync(me._processParams(params));
  69259. }
  69260. /**
  69261. * @function mapboxgl.supermap.SpatialAnalystService.prototype.overlayAnalysis
  69262. * @description 叠加分析。
  69263. * @param {(SuperMap.DatasetOverlayAnalystParameters|SuperMap.GeometryOverlayAnalystParameters)} params - 叠加分析参数类,支持批量几何要素叠加分析。
  69264. * @param {RequestCallback} callback - 回调函数。
  69265. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69266. */
  69267. overlayAnalysis(params, callback, resultFormat) {
  69268. var me = this;
  69269. var overlayAnalystService = new OverlayAnalystService(me.url, {
  69270. proxy: me.options.proxy,
  69271. withCredentials: me.options.withCredentials,
  69272. crossOrigin: me.options.crossOrigin,
  69273. headers: me.options.headers,
  69274. serverType: me.options.serverType,
  69275. eventListeners: {
  69276. scope: me,
  69277. processCompleted: callback,
  69278. processFailed: callback
  69279. },
  69280. format: me._processFormat(resultFormat)
  69281. });
  69282. overlayAnalystService.processAsync(me._processParams(params));
  69283. }
  69284. /**
  69285. * @function mapboxgl.supermap.SpatialAnalystService.prototype.routeCalculateMeasure
  69286. * @description 路由测量计算。
  69287. * @param {SuperMap.RouteCalculateMeasureParameters} params - 查询相关参数类。
  69288. * @param {RequestCallback} callback - 回调函数。
  69289. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69290. */
  69291. routeCalculateMeasure(params, callback, resultFormat) {
  69292. var me = this;
  69293. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  69294. proxy: me.options.proxy,
  69295. withCredentials: me.options.withCredentials,
  69296. crossOrigin: me.options.crossOrigin,
  69297. headers: me.options.headers,
  69298. serverType: me.options.serverType,
  69299. eventListeners: {
  69300. scope: me,
  69301. processCompleted: callback,
  69302. processFailed: callback
  69303. },
  69304. format: me._processFormat(resultFormat)
  69305. });
  69306. routeCalculateMeasureService.processAsync(me._processParams(params));
  69307. }
  69308. /**
  69309. * @function mapboxgl.supermap.SpatialAnalystService.prototype.routeLocate
  69310. * @description 路由定位。
  69311. * @param {SuperMap.RouteLocatorParameters} params - 查询相关参数类。
  69312. * @param {RequestCallback} callback - 回调函数。
  69313. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69314. */
  69315. routeLocate(params, callback, resultFormat) {
  69316. var me = this;
  69317. var routeLocatorService = new RouteLocatorService(me.url, {
  69318. proxy: me.options.proxy,
  69319. withCredentials: me.options.withCredentials,
  69320. crossOrigin: me.options.crossOrigin,
  69321. headers: me.options.headers,
  69322. serverType: me.options.serverType,
  69323. eventListeners: {
  69324. scope: me,
  69325. processCompleted: callback,
  69326. processFailed: callback
  69327. },
  69328. format: me._processFormat(resultFormat)
  69329. });
  69330. routeLocatorService.processAsync(me._processParams(params));
  69331. }
  69332. /**
  69333. * @function mapboxgl.supermap.SpatialAnalystService.prototype.surfaceAnalysis
  69334. * @description 表面分析。
  69335. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析参数类。
  69336. * @param {RequestCallback} callback - 回调函数。
  69337. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69338. */
  69339. surfaceAnalysis(params, callback, resultFormat) {
  69340. var me = this;
  69341. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  69342. proxy: me.options.proxy,
  69343. withCredentials: me.options.withCredentials,
  69344. crossOrigin: me.options.crossOrigin,
  69345. headers: me.options.headers,
  69346. serverType: me.options.serverType,
  69347. eventListeners: {
  69348. scope: me,
  69349. processCompleted: callback,
  69350. processFailed: callback
  69351. },
  69352. format: me._processFormat(resultFormat)
  69353. });
  69354. surfaceAnalystService.processAsync(me._processParams(params));
  69355. }
  69356. /**
  69357. * @function mapboxgl.supermap.SpatialAnalystService.prototype.terrainCurvatureCalculate
  69358. * @description 地形曲率计算。
  69359. * @param {SuperMap.TerrainCurvatureCalculationParameters} params - 查询相关参数类。
  69360. * @param {RequestCallback} callback - 回调函数。
  69361. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69362. */
  69363. terrainCurvatureCalculate(params, callback, resultFormat) {
  69364. var me = this;
  69365. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  69366. proxy: me.options.proxy,
  69367. withCredentials: me.options.withCredentials,
  69368. crossOrigin: me.options.crossOrigin,
  69369. headers: me.options.headers,
  69370. serverType: me.options.serverType,
  69371. eventListeners: {
  69372. scope: me,
  69373. processCompleted: callback,
  69374. processFailed: callback
  69375. },
  69376. format: me._processFormat(resultFormat)
  69377. });
  69378. terrainCurvatureCalculationService.processAsync(params);
  69379. }
  69380. /**
  69381. * @function mapboxgl.supermap.SpatialAnalystService.prototype.thiessenAnalysis
  69382. * @description 泰森多边形分析。
  69383. * @param {SuperMap.DatasetThiessenAnalystParameters} params - 查询相关参数类。
  69384. * @param {RequestCallback} callback - 回调函数。
  69385. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69386. */
  69387. thiessenAnalysis(params, callback, resultFormat) {
  69388. var me = this;
  69389. var thiessenAnalystService = new ThiessenAnalystService(me.url, {
  69390. proxy: me.options.proxy,
  69391. withCredentials: me.options.withCredentials,
  69392. crossOrigin: me.options.crossOrigin,
  69393. headers: me.options.headers,
  69394. serverType: me.options.serverType,
  69395. eventListeners: {
  69396. scope: me,
  69397. processCompleted: callback,
  69398. processFailed: callback
  69399. },
  69400. format: me._processFormat(resultFormat)
  69401. });
  69402. thiessenAnalystService.processAsync(me._processParams(params));
  69403. }
  69404. /**
  69405. * @function mapboxgl.supermap.SpatialAnalystService.prototype.geometrybatchAnalysis
  69406. * @description 批量空间分析。
  69407. * @param {Array} params - 批量分析参数对象数组,包括:
  69408. * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
  69409. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  69410. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  69411. * {SuperMap.GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  69412. * {SuperMap.GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  69413. * {SuperMap.InterpolationAnalystParameters} 插值分析参数类。</br>
  69414. * {SuperMap.SurfaceAnalystParameters} 表面分析参数类。</br>
  69415. * @param {RequestCallback} callback - 回调函数。
  69416. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  69417. */
  69418. geometrybatchAnalysis(params, callback, resultFormat) {
  69419. var me = this;
  69420. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  69421. serverType: me.options.serverType,
  69422. eventListeners: {
  69423. scope: me,
  69424. processCompleted: callback,
  69425. processFailed: callback
  69426. },
  69427. format: me._processFormat(resultFormat)
  69428. });
  69429. //处理批量分析中各个分类类型的参数:
  69430. var analystParameters = [];
  69431. for (var i = 0; i < params.length; i++) {
  69432. var tempParameter = params[i];
  69433. analystParameters.push({
  69434. analystName: tempParameter.analystName,
  69435. param: me._processParams(tempParameter.param)
  69436. })
  69437. }
  69438. geometryBatchAnalystService.processAsync(analystParameters);
  69439. }
  69440. _processParams(params) {
  69441. if (!params) {
  69442. return {};
  69443. }
  69444. if (params.bounds) {
  69445. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  69446. }
  69447. //插值分析点数组转换
  69448. if (params.inputPoints) {
  69449. for (var i = 0; i < params.inputPoints.length; i++) {
  69450. var inputPoint = params.inputPoints[i];
  69451. if (core_Util_Util.isArray(inputPoint)) {
  69452. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  69453. }
  69454. }
  69455. }
  69456. //点数组转换
  69457. if (params.points) {
  69458. for (let i = 0; i < params.points.length; i++) {
  69459. var point = params.points[i];
  69460. params.points[i] = core_Util_Util.toSuperMapPoint(point);
  69461. }
  69462. }
  69463. //mapboxgl点对象转SuperMap点对象
  69464. if (params.point) {
  69465. params.point = core_Util_Util.toSuperMapPoint(params.point);
  69466. }
  69467. //初步判断mapbox数据就为geojson格式 ,进行转json格式即可
  69468. //栅格代数运算的范围
  69469. if (params.extractRegion) {
  69470. params.extractRegion = core_Util_Util.toSuperMapGeometry(params.extractRegion);
  69471. }
  69472. //获取或设置表面分析参数
  69473. if (params.extractParameter && params.extractParameter.clipRegion) {
  69474. params.extractParameter.clipRegion = core_Util_Util.toSuperMapGeometry(params.extractParameter.clipRegion);
  69475. }
  69476. if (params.clipParam && params.clipParam.clipRegion) {
  69477. params.clipParam.clipRegion = core_Util_Util.toSuperMapGeometry(params.clipParam.clipRegion);
  69478. }
  69479. //sourceRoute 路由对象。用于里程分析,该对象可以是用户自己生 成或在数据源中查询得到的符合标准的路由对象;geojson格式
  69480. if (params.sourceRoute) {
  69481. if (params.sourceRoute) {
  69482. var target = {};
  69483. target.type = "LINEM";
  69484. target.parts = [params.sourceRoute.geometry.coordinates.length];
  69485. target.points = [];
  69486. for (let i = 0; i < params.sourceRoute.geometry.coordinates.length; i++) {
  69487. var lnglat = params.sourceRoute.geometry.coordinates[i];
  69488. //measure 应该在传值时设置,
  69489. target.points = target.points.concat({x: lnglat[0], y: lnglat[1], measure: lnglat[2]})
  69490. }
  69491. params.sourceRoute = target;
  69492. }
  69493. }
  69494. //operateRegions 操作面对象集合,数据集叠加分析,表示与这些面对象进行叠加分析
  69495. if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) {
  69496. params.operateRegions.map(function (geometry, key) {
  69497. params.operateRegions[key] = core_Util_Util.toSuperMapGeometry(geometry);
  69498. return params.operateRegions[key];
  69499. });
  69500. }
  69501. //叠加分析,几何数据源 支持格式:GeoJson
  69502. if (params.sourceGeometry) {
  69503. var SRID = null;
  69504. if (params.sourceGeometrySRID) {
  69505. SRID = params.sourceGeometrySRID;
  69506. }
  69507. params.sourceGeometry = core_Util_Util.toSuperMapGeometry(params.sourceGeometry);
  69508. if (SRID) {
  69509. params.sourceGeometry.SRID = SRID;
  69510. }
  69511. delete params.sourceGeometry.sourceGeometrySRID;
  69512. }
  69513. if (params.operateGeometry) {
  69514. params.operateGeometry = core_Util_Util.toSuperMapGeometry(params.operateGeometry);
  69515. }
  69516. //支持传入多个几何要素进行叠加分析:
  69517. if (params.sourceGeometries) {
  69518. var sourceGeometries = [];
  69519. for (var k = 0; k < params.sourceGeometries.length; k++) {
  69520. sourceGeometries.push(core_Util_Util.toSuperMapGeometry(params.sourceGeometries[k]));
  69521. }
  69522. params.sourceGeometries = sourceGeometries;
  69523. }
  69524. //支持传入多个几何要素进行叠加分析:
  69525. if (params.operateGeometries) {
  69526. var operateGeometries = [];
  69527. for (var j = 0; j < params.operateGeometries.length; j++) {
  69528. operateGeometries.push(core_Util_Util.toSuperMapGeometry(params.operateGeometries[j]));
  69529. }
  69530. params.operateGeometries = operateGeometries;
  69531. }
  69532. //components 几何对象数组
  69533. if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) {
  69534. params.sourceRoute.components.map(function (geometry, key) {
  69535. params.sourceRoute.components[key] = core_Util_Util.toSuperMapGeometry(geometry);
  69536. return params.sourceRoute.components[key];
  69537. });
  69538. }
  69539. return params;
  69540. }
  69541. _processFormat(resultFormat) {
  69542. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  69543. }
  69544. }
  69545. (external_mapboxgl_default()).supermap.SpatialAnalystService = SpatialAnalystService;
  69546. ;// CONCATENATED MODULE: ./src/mapboxgl/services/ThemeService.js
  69547. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69548. * This program are made available under the terms of the Apache License, Version 2.0
  69549. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69550. /**
  69551. * @class mapboxgl.supermap.ThemeService
  69552. * @category iServer Map Theme
  69553. * @classdesc 专题图服务类。
  69554. * @extends {mapboxgl.supermap.ServiceBase}
  69555. * @example
  69556. * new mapboxgl.supermap.ThemeService(url,{
  69557. * projection:projection
  69558. * }).getThemeInfo(params,function(result){
  69559. * //doSomething
  69560. * });
  69561. * @param {string} url - 服务的访问地址。
  69562. * @param {Object} options - 交互服务时所需可选参数。
  69563. * @param {string} [options.proxy] - 服务代理地址。
  69564. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69565. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69566. * @param {Object} [options.headers] - 请求头。
  69567. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  69568. */
  69569. class ThemeService extends ServiceBase {
  69570. constructor(url, options) {
  69571. super(url, options);
  69572. }
  69573. /**
  69574. * @function mapboxgl.supermap.ThemeService.prototype.getThemeInfo
  69575. * @description 获取专题图信息。
  69576. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  69577. * @param {RequestCallback} callback - 回调函数。
  69578. */
  69579. getThemeInfo(params, callback) {
  69580. var me = this;
  69581. var themeService = new ThemeService_ThemeService(me.url, {
  69582. proxy: me.options.proxy,
  69583. withCredentials: me.options.withCredentials,
  69584. crossOrigin: me.options.crossOrigin,
  69585. headers: me.options.headers,
  69586. serverType: me.options.serverType,
  69587. eventListeners: {
  69588. scope: me,
  69589. processCompleted: callback,
  69590. processFailed: callback
  69591. }
  69592. });
  69593. themeService.processAsync(params);
  69594. }
  69595. }
  69596. (external_mapboxgl_default()).supermap.ThemeService = ThemeService;
  69597. ;// CONCATENATED MODULE: ./src/mapboxgl/services/TrafficTransferAnalystService.js
  69598. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69599. * This program are made available under the terms of the Apache License, Version 2.0
  69600. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69601. /**
  69602. * @class mapboxgl.supermap.TrafficTransferAnalystService
  69603. * @extends mapboxgl.supermap.ServiceBase
  69604. * @category iServer TrafficTransferAnalyst
  69605. * @classdesc 交通换乘分析服务类。
  69606. * @example
  69607. * new mapboxgl.supermap.TrafficTransferAnalystService(url)
  69608. * .queryStop(params,function(result){
  69609. * //doSomething
  69610. * })
  69611. * @param {string} url - 服务地址。
  69612. * @param {Object} option - 参数。
  69613. * @param {string} [options.proxy] - 服务代理地址。
  69614. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69615. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69616. * @param {Object} [options.headers] - 请求头。
  69617. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  69618. */
  69619. class TrafficTransferAnalystService extends ServiceBase {
  69620. constructor(url, options) {
  69621. super(url, options);
  69622. }
  69623. /**
  69624. * @function mapboxgl.supermap.TrafficTransferAnalystService.prototype.queryStop
  69625. * @description 站点查询服务。
  69626. * @param {SuperMap.StopQueryParameters} params - 查询相关参数类。
  69627. * @param {RequestCallback} callback - 回调函数。
  69628. */
  69629. queryStop(params, callback) {
  69630. var me = this;
  69631. var stopQueryService = new StopQueryService(me.url, {
  69632. proxy: me.options.proxy,
  69633. withCredentials: me.options.withCredentials,
  69634. crossOrigin: me.options.crossOrigin,
  69635. headers: me.options.headers,
  69636. serverType: me.options.serverType,
  69637. eventListeners: {
  69638. scope: me,
  69639. processCompleted: callback,
  69640. processFailed: callback
  69641. }
  69642. });
  69643. stopQueryService.processAsync(params);
  69644. }
  69645. /**
  69646. * @function mapboxgl.supermap.TrafficTransferAnalystService.prototype.analysisTransferPath
  69647. * @description 交通换乘线路查询服务。
  69648. * @param {SuperMap.TransferPathParameters} params - 查询相关参数类。
  69649. * @param {RequestCallback} callback - 回调函数。
  69650. */
  69651. analysisTransferPath(params, callback) {
  69652. var me = this;
  69653. var transferPathService = new TransferPathService(me.url, {
  69654. proxy: me.options.proxy,
  69655. withCredentials: me.options.withCredentials,
  69656. crossOrigin: me.options.crossOrigin,
  69657. headers: me.options.headers,
  69658. serverType: me.options.serverType,
  69659. eventListeners: {
  69660. scope: me,
  69661. processCompleted: callback,
  69662. processFailed: callback
  69663. }
  69664. });
  69665. transferPathService.processAsync(me._processParams(params));
  69666. }
  69667. /**
  69668. * @function mapboxgl.supermap.TrafficTransferAnalystService.prototype.analysisTransferSolution
  69669. * @description 交通换乘方案查询服务。
  69670. * @param {SuperMap.TransferSolutionParameters} params - 查询相关参数类。
  69671. * @param {RequestCallback} callback - 回调函数。
  69672. */
  69673. analysisTransferSolution(params, callback) {
  69674. var me = this;
  69675. var transferSolutionService = new TransferSolutionService(me.url, {
  69676. proxy: me.options.proxy,
  69677. withCredentials: me.options.withCredentials,
  69678. crossOrigin: me.options.crossOrigin,
  69679. headers: me.options.headers,
  69680. serverType: me.options.serverType,
  69681. eventListeners: {
  69682. scope: me,
  69683. processCompleted: callback,
  69684. processFailed: callback
  69685. }
  69686. });
  69687. transferSolutionService.processAsync(me._processParams(params));
  69688. }
  69689. _processParams(params) {
  69690. if (!params) {
  69691. return {};
  69692. }
  69693. if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) {
  69694. params.transferLines = [params.transferLines];
  69695. }
  69696. if (params.points && core_Util_Util.isArray(params.points)) {
  69697. params.points.map(function (point, key) {
  69698. params.points[key] = (point instanceof (external_mapboxgl_default()).LngLat) ? {
  69699. x: point.lng,
  69700. y: point.lat
  69701. } : point;
  69702. return params.points[key];
  69703. });
  69704. }
  69705. return params;
  69706. }
  69707. }
  69708. (external_mapboxgl_default()).supermap.TrafficTransferAnalystService = TrafficTransferAnalystService;
  69709. ;// CONCATENATED MODULE: ./src/mapboxgl/services/WebPrintingJobService.js
  69710. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69711. * This program are made available under the terms of the Apache License, Version 2.0
  69712. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69713. /**
  69714. * @class mapboxgl.supermap.WebPrintingJobService
  69715. * @category iServer WebPrintingJob
  69716. * @version 10.1.0
  69717. * @classdesc Web 打印服务类。
  69718. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  69719. * @extends {mapboxgl.supermap.ServiceBase}
  69720. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  69721. * @param {Object} options - 服务交互时所需的可选参数。
  69722. * @param {string} [options.proxy] - 服务代理地址。
  69723. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69724. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  69725. * @param {Object} [options.headers] - 请求头。
  69726. * @example
  69727. * new mapboxgl.supermap.WebPrintingJobService(url)
  69728. * .createWebPrintingJob(param,function(result){
  69729. * //doSomething
  69730. * })
  69731. */
  69732. class WebPrintingJobService extends ServiceBase {
  69733. constructor(url, options) {
  69734. super(url, options);
  69735. }
  69736. /**
  69737. * @function mapboxgl.supermap.WebPrintingJobService.prototype.createWebPrintingJob
  69738. * @description 创建 Web 打印任务。
  69739. * @param {SuperMap.WebPrintingJobParameters} params - 打印的请求参数。
  69740. * @param {RequestCallback} callback - 回调函数。
  69741. */
  69742. createWebPrintingJob(params, callback) {
  69743. if (!params) {
  69744. return;
  69745. }
  69746. var me = this;
  69747. var webPrintingService = new WebPrintingService(me.url, {
  69748. proxy: me.options.proxy,
  69749. withCredentials: me.options.withCredentials,
  69750. crossOrigin: me.options.crossOrigin,
  69751. headers: me.options.headers,
  69752. serverType: me.options.serverType,
  69753. eventListeners: {
  69754. scope: me,
  69755. processCompleted: callback,
  69756. processFailed: callback
  69757. }
  69758. });
  69759. webPrintingService.createWebPrintingJob(me._processParams(params));
  69760. }
  69761. /**
  69762. * @function mapboxgl.supermap.WebPrintingJobService.prototype.getPrintingJob
  69763. * @description 获取 Web 打印输出文档任务。
  69764. * @param {String} jobId - Web 打印输入文档任务 Id。
  69765. * @param {RequestCallback} callback - 回调函数。
  69766. */
  69767. getPrintingJob(jobId, callback) {
  69768. var me = this;
  69769. var webPrintingService = new WebPrintingService(me.url, {
  69770. proxy: me.options.proxy,
  69771. withCredentials: me.options.withCredentials,
  69772. crossOrigin: me.options.crossOrigin,
  69773. headers: me.options.headers,
  69774. serverType: me.options.serverType,
  69775. eventListeners: {
  69776. scope: me,
  69777. processCompleted: callback,
  69778. processFailed: callback
  69779. }
  69780. });
  69781. webPrintingService.getPrintingJob(jobId);
  69782. }
  69783. /**
  69784. * @function mapboxgl.supermap.WebPrintingJobService.prototype.getPrintingJobResult
  69785. * @description 获取 Web 打印任务的输出文档。
  69786. * @param {String} jobId - Web 打印输入文档任务 Id。
  69787. * @param {RequestCallback} callback - 回调函数。
  69788. */
  69789. getPrintingJobResult(jobId, callback) {
  69790. var me = this;
  69791. var webPrintingService = new WebPrintingService(me.url, {
  69792. proxy: me.options.proxy,
  69793. withCredentials: me.options.withCredentials,
  69794. crossOrigin: me.options.crossOrigin,
  69795. headers: me.options.headers,
  69796. serverType: me.options.serverType,
  69797. eventListeners: {
  69798. scope: me,
  69799. processCompleted: callback,
  69800. processFailed: callback
  69801. }
  69802. });
  69803. webPrintingService.getPrintingJobResult(jobId);
  69804. }
  69805. /**
  69806. * @function mapboxgl.supermap.WebPrintingJobService.prototype.getLayoutTemplates
  69807. * @description 查询 Web 打印服务所有可用的模板信息。
  69808. * @param {RequestCallback} callback - 回调函数。
  69809. */
  69810. getLayoutTemplates(callback) {
  69811. var me = this;
  69812. var webPrintingService = new WebPrintingService(me.url, {
  69813. proxy: me.options.proxy,
  69814. withCredentials: me.options.withCredentials,
  69815. crossOrigin: me.options.crossOrigin,
  69816. headers: me.options.headers,
  69817. serverType: me.options.serverType,
  69818. eventListeners: {
  69819. scope: me,
  69820. processCompleted: callback,
  69821. processFailed: callback
  69822. }
  69823. });
  69824. webPrintingService.getLayoutTemplates();
  69825. }
  69826. _processParams(params) {
  69827. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  69828. params.layoutOptions.littleMapOptions.center = this._toPointObject(params.layoutOptions.littleMapOptions.center);
  69829. }
  69830. if (params.exportOptions) {
  69831. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  69832. }
  69833. return params;
  69834. }
  69835. _toPointObject(point) {
  69836. if (core_Util_Util.isArray(point)) {
  69837. return {
  69838. x: point[0],
  69839. y: point[1]
  69840. };
  69841. } else if (point instanceof SuperMap.Geometry.Point || point instanceof (external_mapboxgl_default()).Point) {
  69842. return {
  69843. x: point.x,
  69844. y: point.y
  69845. };
  69846. } else if (point instanceof (external_mapboxgl_default()).LngLat) {
  69847. return {
  69848. x: point.lng,
  69849. y: point.lat
  69850. };
  69851. }
  69852. return point;
  69853. }
  69854. }
  69855. (external_mapboxgl_default()).supermap.WebPrintingJobService = WebPrintingJobService;
  69856. ;// CONCATENATED MODULE: ./src/mapboxgl/services/index.js
  69857. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69858. * This program are made available under the terms of the Apache License, Version 2.0
  69859. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69860. ;// CONCATENATED MODULE: external "function(){try{return convert}catch(e){return {}}}()"
  69861. const external_function_try_return_convert_catch_e_return_namespaceObject = function(){try{return convert}catch(e){return {}}}();
  69862. var external_function_try_return_convert_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_convert_catch_e_return_namespaceObject);
  69863. ;// CONCATENATED MODULE: external "function(){try{return canvg}catch(e){return {}}}()"
  69864. const external_function_try_return_canvg_catch_e_return_namespaceObject = function(){try{return canvg}catch(e){return {}}}();
  69865. var external_function_try_return_canvg_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_canvg_catch_e_return_namespaceObject);
  69866. ;// CONCATENATED MODULE: ./src/mapboxgl/mapping/WebMap.js
  69867. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69868. * This program are made available under the terms of the Apache License, Version 2.0
  69869. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69870. (external_mapboxgl_default()).supermap = (external_mapboxgl_default()).supermap || {};
  69871. const MB_SCALEDENOMINATOR_3857 = [
  69872. '559082264.0287178',
  69873. '279541132.0143589',
  69874. '139770566.0071794',
  69875. '69885283.00358972',
  69876. '34942641.50179486',
  69877. '17471320.75089743',
  69878. '8735660.375448715',
  69879. '4367830.1877224357',
  69880. '2183915.093862179',
  69881. '1091957.546931089',
  69882. '545978.7734655447',
  69883. '272989.7734655447',
  69884. '272989.3867327723',
  69885. '136494.6933663862',
  69886. '68247.34668319309',
  69887. '34123.67334159654',
  69888. '17061.83667079827',
  69889. '8530.918335399136',
  69890. '4265.459167699568',
  69891. '2132.729583849784'
  69892. ];
  69893. const MB_SCALEDENOMINATOR_4326 = [
  69894. '5.590822640287176E8',
  69895. '2.795411320143588E8',
  69896. '1.397705660071794E8',
  69897. '6.98852830035897E7',
  69898. '3.494264150179485E7',
  69899. '1.7471320750897426E7',
  69900. '8735660.375448713',
  69901. '4367830.187724357',
  69902. '2183915.0938621783',
  69903. '1091957.5469310891',
  69904. '545978.7734655446',
  69905. '272989.3867327723',
  69906. '136494.69336638614',
  69907. '68247.34668319307',
  69908. '34123.673341596535',
  69909. '17061.836670798268',
  69910. '8530.918335399134'
  69911. ];
  69912. const DEFAULT_WELLKNOWNSCALESET = ['GoogleCRS84Quad', 'GoogleMapsCompatible'];
  69913. /**
  69914. * @class mapboxgl.supermap.WebMap
  69915. * @version 9.1.2
  69916. * @category iPortal/Online
  69917. * @classdesc 对接 iPortal/Online 地图类。目前支持地图坐标系包括:'EPSG:3857','EPSG:4326','EPSG:4490','EPSG:4214','EPSG:4610'。
  69918. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  69919. * <p style="color: #ce4844">Notice</p>
  69920. * <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>
  69921. * `<script type="text/javascript" src="https://iclient.supermap.io/web/libs/geostats/geostats.js"></script>`</br>
  69922. * `<script type="text/javascript" src="https://iclient.supermap.io/web/libs/jsonsql/jsonsql.js"></script>`
  69923. * </div>
  69924. * @param {number} id - iPortal|Online 地图 ID。
  69925. * @param {Object} options - 参数。
  69926. * @param {string} [options.target='map'] - 地图容器 ID。
  69927. * @param {string} [options.server="https://www.supermapol.com"] - 地图的地址。
  69928. * @param {string} [options.credentialKey] - 凭证密钥。
  69929. * @param {string} [options.credentialValue] - 凭证值。
  69930. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  69931. * @param {boolean} [options.excludePortalProxyUrl] - server 传递过来的 URL 是否带有代理。
  69932. * @fires mapboxgl.supermap.WebMap#getmapfailed
  69933. * @fires mapboxgl.supermap.WebMap#getwmtsfailed
  69934. * @fires mapboxgl.supermap.WebMap#getlayersfailed
  69935. * @fires mapboxgl.supermap.WebMap#getfeaturesfailed
  69936. * @fires mapboxgl.supermap.WebMap#addlayerssucceeded
  69937. * @extends {mapboxgl.Evented}
  69938. */
  69939. class WebMap extends (external_mapboxgl_default()).Evented {
  69940. /**
  69941. * @constructs
  69942. * @version 9.1.2
  69943. */
  69944. constructor(id, options) {
  69945. super();
  69946. this.mapId = id;
  69947. options = options || {};
  69948. this.server = options.server || 'https://www.supermapol.com';
  69949. this.credentialKey = options.credentialKey;
  69950. this.credentialValue = options.credentialValue;
  69951. this.withCredentials = options.withCredentials || false;
  69952. this.target = options.target || 'map';
  69953. this._createWebMap();
  69954. }
  69955. /**
  69956. * @function mapboxgl.supermap.WebMap.prototype.resize
  69957. * @description map resize。
  69958. * @version 9.1.2
  69959. */
  69960. resize() {
  69961. this.map.resize();
  69962. }
  69963. /**
  69964. * @function mapboxgl.supermap.WebMap.prototype.setMapId
  69965. * @param {string} mapId - webMap 地图 ID。
  69966. * @description 设置 WebMap ID。
  69967. * @version 9.1.2
  69968. */
  69969. setMapId(mapId) {
  69970. this.mapId = mapId;
  69971. this._createWebMap();
  69972. }
  69973. /**
  69974. * @function mapboxgl.supermap.WebMap.prototype.setWebMapOptions
  69975. * @param {Object} webMapOptions - webMap 参数。
  69976. * @description 设置 webMap 参数。
  69977. * @version 9.1.2
  69978. */
  69979. setWebMapOptions(webMapOptions) {
  69980. this.server = webMapOptions.server;
  69981. this._createWebMap();
  69982. }
  69983. /**
  69984. * @function mapboxgl.supermap.WebMap.prototype.setMapOptions
  69985. * @param {Object} mapOptions - map 参数。
  69986. * @description 设置 map 参数。
  69987. * @version 9.1.2
  69988. */
  69989. setMapOptions(mapOptions) {
  69990. let { center, zoom, maxBounds, minZoom, maxZoom, isWorldCopy, bearing, pitch } = mapOptions;
  69991. center && center.length && this.map.setCenter(center);
  69992. zoom && this.map.setZoom(zoom);
  69993. maxBounds && this.map.setMaxBounds(maxBounds);
  69994. minZoom && this.map.setMinZoom(minZoom);
  69995. maxZoom && this.map.setMaxZoom(maxZoom);
  69996. isWorldCopy && this.map.setRenderWorldCopies(isWorldCopy);
  69997. bearing && this.map.setBearing(bearing);
  69998. pitch && this.map.setPitch(pitch);
  69999. }
  70000. /**
  70001. * @private
  70002. * @function mapboxgl.supermap.WebMap.prototype._createWebMap
  70003. * @description 登陆窗口后添加地图图层。
  70004. */
  70005. _createWebMap() {
  70006. let urlArr = this.server.split('');
  70007. if (urlArr[urlArr.length - 1] !== '/') {
  70008. this.server += '/';
  70009. }
  70010. let mapUrl = this.server + 'web/maps/' + this.mapId + '/map';
  70011. if (this.credentialValue && this.credentialKey) {
  70012. mapUrl += '?' + this.credentialKey + '=' + this.credentialValue;
  70013. }
  70014. let filter = 'getUrlResource.json?url=';
  70015. if (this.excludePortalProxyUrl && this.server.indexOf(filter) > -1) {
  70016. //大屏需求,或者有加上代理的
  70017. let urlArray = this.server.split(filter);
  70018. if (urlArray.length > 1) {
  70019. mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
  70020. }
  70021. }
  70022. this._getMapInfo(mapUrl);
  70023. }
  70024. /**
  70025. * @private
  70026. * @function mapboxgl.supermap.WebMap.prototype._createMap
  70027. * @description 创建地图。
  70028. */
  70029. _createMap(mapInfo) {
  70030. // 获取字体样式
  70031. let fonts = [];
  70032. let layers = mapInfo.layers;
  70033. // 获取 label 图层字体类型
  70034. if (layers && layers.length > 0) {
  70035. layers.forEach(layer => {
  70036. layer.labelStyle && fonts.push(layer.labelStyle.fontFamily);
  70037. }, this);
  70038. }
  70039. fonts.push("'supermapol-icons'");
  70040. let fontFamilys = fonts.join(',');
  70041. // zoom center
  70042. let oldcenter = mapInfo.center,
  70043. zoom = mapInfo.level || 0,
  70044. center,
  70045. zoomBase = 0;
  70046. // zoom = zoom === 0 ? 0 : zoom - 1;
  70047. if (mapInfo.minScale && mapInfo.maxScale) {
  70048. zoomBase = this._transformScaleToZoom(mapInfo.minScale, (external_mapboxgl_default()).CRS ? external_mapboxgl_default().CRS.get(this.baseProjection):'EPSG:3857');
  70049. } else {
  70050. const e =
  70051. this._getResolution(
  70052. (external_mapboxgl_default()).CRS
  70053. ? external_mapboxgl_default().CRS.get(this.baseProjection).getExtent()
  70054. : [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892]
  70055. ) / this._getResolution(mapInfo.extent);
  70056. zoomBase = +Math.log(e) / Math.LN2.toFixed(2);
  70057. }
  70058. zoom += zoomBase;
  70059. center = oldcenter ? this._unproject([oldcenter.x, oldcenter.y]) : new (external_mapboxgl_default()).LngLat(0, 0);
  70060. // 初始化 map
  70061. this.map = new (external_mapboxgl_default()).Map({
  70062. container: this.target,
  70063. center: center,
  70064. zoom: zoom,
  70065. style: {
  70066. version: 8,
  70067. sources: {},
  70068. // "glyphs": 'https://iclient.supermap.io/iserver/services/map-beijing/rest/maps/beijingMap/tileFeature/sdffonts/{fontstack}/{range}.pbf',
  70069. layers: []
  70070. },
  70071. crs: this.baseProjection,
  70072. localIdeographFontFamily: fontFamilys || ''
  70073. });
  70074. this.fire('mapinitialized');
  70075. }
  70076. /**
  70077. * @private
  70078. * @function mapboxgl.supermap.WebMap.prototype._getMapInfo
  70079. * @description 获取地图的 JSON 信息。
  70080. * @param {string} url - 请求地图的 url。
  70081. */
  70082. _getMapInfo(url) {
  70083. let mapUrl = url.indexOf('.json') === -1 ? `${url}.json` : url;
  70084. FetchRequest.get(mapUrl, null, { withCredentials: this.withCredentials })
  70085. .then(response => {
  70086. return response.json();
  70087. })
  70088. .then(mapInfo => {
  70089. this.baseProjection = mapInfo.projection;
  70090. //存储地图的名称以及描述等信息,返回给用户
  70091. this.mapParams = {
  70092. title: mapInfo.title,
  70093. description: mapInfo.description
  70094. };
  70095. const projectionMap = {
  70096. 'EPSG:4490': 'EPSG:4490',
  70097. 'EPSG:4214': 'EPSG:4214',
  70098. 'EPSG:4610': 'EPSG:4610',
  70099. 'EPSG:3857': 'EPSG:3857',
  70100. 'EPSG:4326': 'EPSG:4326'
  70101. }; // 坐标系异常处理
  70102. if (this.baseProjection in projectionMap) {
  70103. this._createMap(mapInfo, this.mapSetting);
  70104. let layers = mapInfo.layers;
  70105. this.map.on('load', () => {
  70106. this._addBaseMap(mapInfo);
  70107. if (!layers || layers.length === 0) {
  70108. this._sendMapToUser(0, 0);
  70109. } else {
  70110. this._addLayers(layers);
  70111. }
  70112. });
  70113. } else {
  70114. throw Error(Lang.i18n('msg_crsunsupport'));
  70115. }
  70116. })
  70117. .catch(error => {
  70118. /**
  70119. * @event mapboxgl.supermap.WebMap#getmapfailed
  70120. * @description 获取地图信息失败。
  70121. * @property {Object} error - 失败原因。
  70122. */
  70123. this.fire('getmapfailed', { error: error });
  70124. });
  70125. }
  70126. /**
  70127. * @private
  70128. * @function mapboxgl.supermap.WebMap.prototype._addBaseMap
  70129. * @description 添加底图。
  70130. * @param {Object} mapInfo - map 信息。
  70131. */
  70132. _addBaseMap(mapInfo) {
  70133. this._createBaseLayer(mapInfo);
  70134. }
  70135. /**
  70136. * @private
  70137. * @function mapboxgl.supermap.WebMap.prototype._createBaseLayer
  70138. * @description 创建底图。
  70139. * @param {Object} mapInfo - map 信息。
  70140. */
  70141. _createBaseLayer(mapInfo) {
  70142. let layerInfo = mapInfo.baseLayer || mapInfo;
  70143. let layerType = layerInfo.layerType; //底图和rest地图兼容
  70144. if (
  70145. layerType.indexOf('TIANDITU_VEC') > -1 ||
  70146. layerType.indexOf('TIANDITU_IMG') > -1 ||
  70147. layerType.indexOf('TIANDITU_TER') > -1
  70148. ) {
  70149. layerType = layerType.substr(0, 12);
  70150. }
  70151. let mapUrls = {
  70152. CLOUD: 'http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}',
  70153. CLOUD_BLACK: 'http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}',
  70154. OSM: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
  70155. GOOGLE:
  70156. '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',
  70157. GOOGLE_CN: 'https://mt{0-3}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',
  70158. JAPAN_STD: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
  70159. JAPAN_PALE: 'https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png',
  70160. JAPAN_RELIEF: 'https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png',
  70161. JAPAN_ORT: 'https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg'
  70162. },
  70163. url;
  70164. switch (layerType) {
  70165. case 'TIANDITU_VEC':
  70166. case 'TIANDITU_IMG':
  70167. case 'TIANDITU_TER':
  70168. this._createTiandituLayer(mapInfo);
  70169. break;
  70170. case 'BING':
  70171. this._createBingLayer(layerInfo.name);
  70172. break;
  70173. case 'WMS':
  70174. this._createWMSLayer(layerInfo);
  70175. break;
  70176. case 'WMTS':
  70177. this._createWMTSLayer(layerInfo);
  70178. break;
  70179. case 'TILE':
  70180. case 'SUPERMAP_REST':
  70181. this._createDynamicTiledLayer(layerInfo);
  70182. break;
  70183. case 'CLOUD':
  70184. case 'CLOUD_BLACK':
  70185. case 'OSM':
  70186. case 'JAPAN_ORT':
  70187. case 'JAPAN_RELIEF':
  70188. case 'JAPAN_PALE':
  70189. case 'JAPAN_STD':
  70190. case 'GOOGLE_CN':
  70191. case 'GOOGLE':
  70192. url = mapUrls[layerType];
  70193. this._createXYZLayer(layerInfo, url);
  70194. break;
  70195. case 'MAPBOXSTYLE':
  70196. this._createMapboxStyle(layerInfo);
  70197. break;
  70198. default:
  70199. break;
  70200. }
  70201. }
  70202. /**
  70203. * @private
  70204. * @function mapboxgl.supermap.WebMap.prototype._createMapboxStyle
  70205. * @description 创建 Mapbox 样式。
  70206. * @param {Object} mapInfo - map 信息。
  70207. */
  70208. _createMapboxStyle(mapInfo) {
  70209. let _this = this,
  70210. { dataSource = {} } = mapInfo,
  70211. { serverId, url } = dataSource,
  70212. styleUrl;
  70213. styleUrl = serverId !== undefined ? `${this.server}web/datas/${serverId}/download` : url;
  70214. FetchRequest.get(styleUrl, null, {
  70215. withCredentials: this.withCredentials,
  70216. withoutFormatSuffix: true,
  70217. headers: {
  70218. 'Content-Type': 'application/json;chartset=uft-8'
  70219. }
  70220. }).then(response => {
  70221. return response.json();
  70222. }).then(style => {
  70223. _this._matchStyleObject(style);
  70224. _this.map.setStyle(style);
  70225. })
  70226. }
  70227. /**
  70228. * @private
  70229. * @function mapboxgl.supermap.WebMap.prototype._matchStyleObject
  70230. * @description 恢复 style 为标准格式。
  70231. * @param {Object} style - mapbox 样式。
  70232. */
  70233. _matchStyleObject(style) {
  70234. let { sprite, glyphs } = style;
  70235. if (sprite && typeof sprite === 'object'){
  70236. style.sprite = Object.values(sprite)[0];
  70237. }
  70238. if (glyphs && typeof glyphs === 'object'){
  70239. style.glyphs = Object.values(glyphs)[0];
  70240. }
  70241. }
  70242. /**
  70243. * @private
  70244. * @function mapboxgl.supermap.WebMap.prototype._createTiandituLayer
  70245. * @description 创建天地图底图。
  70246. * @param {Object} mapInfo - map 信息。
  70247. */
  70248. _createTiandituLayer(mapInfo) {
  70249. let tiandituUrls = this._getTiandituUrl(mapInfo);
  70250. let layerType = mapInfo.baseLayer.layerType;
  70251. let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
  70252. let labelUrl = tiandituUrls['labelUrl'];
  70253. let tiandituUrl = tiandituUrls['tiandituUrl'];
  70254. this._addBaselayer(tiandituUrl, 'tianditu-layers-' + layerType);
  70255. isLabel && this._addBaselayer(labelUrl, 'tianditu-label-layers-' + layerType);
  70256. }
  70257. /**
  70258. * @private
  70259. * @function mapboxgl.supermap.WebMap.prototype._createWMTSLayer
  70260. * @description 创建 WMTS 底图。
  70261. * @param {Object} mapInfo - map 信息。
  70262. */
  70263. _createWMTSLayer(layerInfo) {
  70264. let wmtsUrl = this._getWMTSUrl(layerInfo);
  70265. this._filterWMTSIsMatched(layerInfo, (isMatched, matchMaxZoom) => {
  70266. isMatched && this._addBaselayer([wmtsUrl], 'wmts-layers' + layerInfo.name, 0, matchMaxZoom);
  70267. });
  70268. }
  70269. /**
  70270. * @private
  70271. * @function mapboxgl.supermap.WebMap.prototype._filterWMTSIsMatched
  70272. * @description 过滤能够跟mapboxgl匹配的wmts服务。
  70273. * @param {Object} mapInfo - map 信息。
  70274. * @callback matchedCallback
  70275. */
  70276. _filterWMTSIsMatched(mapInfo, matchedCallback) {
  70277. let isMatched = false,
  70278. matchMaxZoom = 22,
  70279. url = mapInfo.url;
  70280. let options = {
  70281. withCredentials: false,
  70282. withoutFormatSuffix: true
  70283. };
  70284. FetchRequest.get(url, null, options)
  70285. .then(response => {
  70286. return response.text();
  70287. })
  70288. .then(capabilitiesText => {
  70289. let converts = (external_function_try_return_convert_catch_e_return_default()) ? (external_function_try_return_convert_catch_e_return_default()) : window.convert;
  70290. let tileMatrixSet = JSON.parse(converts.xml2json(capabilitiesText, { compact: true, spaces: 4 }))
  70291. .Capabilities.Contents.TileMatrixSet;
  70292. if (!Array.isArray(tileMatrixSet)) {
  70293. tileMatrixSet = [tileMatrixSet];
  70294. }
  70295. for (let i = 0; i < tileMatrixSet.length; i++) {
  70296. if (
  70297. tileMatrixSet[i]['ows:Identifier'] &&
  70298. tileMatrixSet[i]['ows:Identifier']['_text'] === mapInfo.tileMatrixSet
  70299. ) {
  70300. if (DEFAULT_WELLKNOWNSCALESET.indexOf(tileMatrixSet[i]['WellKnownScaleSet']['_text']) > -1) {
  70301. isMatched = true;
  70302. } else if (
  70303. tileMatrixSet[i]['WellKnownScaleSet'] &&
  70304. tileMatrixSet[i]['WellKnownScaleSet']['_text'] === 'Custom'
  70305. ) {
  70306. let matchedScaleDenominator = [];
  70307. //坐标系判断
  70308. let defaultCRSScaleDenominators =
  70309. this.map.crs === 'EPSG:3857' ? MB_SCALEDENOMINATOR_3857 : MB_SCALEDENOMINATOR_4326;
  70310. for (let j = 0, len = defaultCRSScaleDenominators.length; j < len; j++) {
  70311. if (!tileMatrixSet[i].TileMatrix[j]) {
  70312. break;
  70313. }
  70314. if (
  70315. defaultCRSScaleDenominators[j] !==
  70316. tileMatrixSet[i].TileMatrix[j]['ScaleDenominator']['_text']
  70317. ) {
  70318. break;
  70319. }
  70320. matchedScaleDenominator.push(defaultCRSScaleDenominators[j]);
  70321. }
  70322. matchMaxZoom = matchedScaleDenominator.length - 1;
  70323. if (matchedScaleDenominator.length !== 0) {
  70324. isMatched = true;
  70325. } else {
  70326. throw Error(Lang.i18n('msg_tilematrixsetunsupport'));
  70327. }
  70328. } else {
  70329. throw Error(Lang.i18n('msg_tilematrixsetunsupport'));
  70330. }
  70331. }
  70332. }
  70333. matchedCallback(isMatched, matchMaxZoom);
  70334. })
  70335. .catch(error => {
  70336. /**
  70337. * @event mapboxgl.supermap.WebMap#getwmtsfailed
  70338. * @description 获取 WMTS 图层信息失败。
  70339. * @property {Object} error - 失败原因。
  70340. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  70341. */
  70342. this.fire('getwmtsfailed', { error: error, map: this.map });
  70343. });
  70344. }
  70345. /**
  70346. * @private
  70347. * @function mapboxgl.supermap.WebMap.prototype._createBingLayer
  70348. * @description 创建 Bing 图层。
  70349. */
  70350. _createBingLayer(layerName) {
  70351. let bingUrl =
  70352. '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';
  70353. this.addLayer([bingUrl], 'bing-layers-' + layerName);
  70354. }
  70355. /**
  70356. * @private
  70357. * @function mapboxgl.supermap.WebMap.prototype._createXYZLayer
  70358. * @description 创建 XYZ 底图。
  70359. * @param {String} url - url 地址。
  70360. */
  70361. _createXYZLayer(layerInfo, url) {
  70362. let urlArr = [];
  70363. if (layerInfo.layerType === 'OSM') {
  70364. let res = url.match(/\w\-\w/g)[0];
  70365. let start = res[0];
  70366. let end = res[2];
  70367. let alphabet = '';
  70368. for (let i = 97; i < 123; i++) {
  70369. alphabet += String.fromCharCode(i);
  70370. }
  70371. let alphabetArr = alphabet.split('');
  70372. let startIndex = alphabetArr.indexOf(start);
  70373. let endIndex = alphabetArr.indexOf(end);
  70374. let res3 = alphabetArr.slice(startIndex, endIndex + 1);
  70375. for (let i = 0; i < res3.length; i++) {
  70376. let replaceRes = url.replace(/{\w\-\w}/g, res3[i]);
  70377. urlArr.push(replaceRes);
  70378. }
  70379. } else if (layerInfo.layerType === 'GOOGLE_CN') {
  70380. let res = url.match(/\d\-\d/g)[0];
  70381. let start = res[0];
  70382. let end = res[2];
  70383. for (let i = start; i <= end; i++) {
  70384. let replaceRes = url.replace(/{\d\-\d}/g, i);
  70385. urlArr.push(replaceRes);
  70386. }
  70387. } else {
  70388. urlArr = [url];
  70389. }
  70390. this._addBaselayer(urlArr, 'XYZ-layers-' + layerInfo.name);
  70391. }
  70392. /**
  70393. * @private
  70394. * @function mapboxgl.supermap.WebMap.prototype._createDynamicTiledLayer
  70395. * @description 创建 iserver 底图。
  70396. * @param {Object} layerInfo - 图层信息。
  70397. */
  70398. _createDynamicTiledLayer(layerInfo) {
  70399. let url = layerInfo.url;
  70400. const layerId = layerInfo.layerID || layerInfo.name;
  70401. const { minzoom, maxzoom } = layerInfo;
  70402. this._addBaselayer([url], layerId, minzoom, maxzoom, true);
  70403. }
  70404. /**
  70405. * @private
  70406. * @function mapboxgl.supermap.WebMap.prototype._createWMSLayer
  70407. * @description 创建 WMS 图层。
  70408. * @param {Object} mapInfo - map 信息。
  70409. */
  70410. _createWMSLayer(layerInfo) {
  70411. let WMSUrl = this._getWMSUrl(layerInfo);
  70412. this._addBaselayer([WMSUrl], 'WMS-layers-' + layerInfo.name);
  70413. }
  70414. /**
  70415. * @private
  70416. * @function mapboxgl.supermap.WebMap.prototype._createVectorLayer
  70417. * @description 创建 Vector 图层。
  70418. * @param {Object} layerInfo - map 信息。
  70419. * @param {Array} features - 属性 信息。
  70420. */
  70421. _createVectorLayer(layerInfo, features) {
  70422. let style = layerInfo.style;
  70423. let type = layerInfo.featureType;
  70424. let layerID = layerInfo.layerID;
  70425. let visible = layerInfo.visible;
  70426. let layerStyle = {};
  70427. layerStyle.style = this._transformStyleToMapBoxGl(style, type);
  70428. layerStyle.layout = { visibility: visible };
  70429. let source = {
  70430. type: 'geojson',
  70431. data: {
  70432. type: 'FeatureCollection',
  70433. features: features
  70434. }
  70435. };
  70436. this._addOverlayToMap(type, source, layerID, layerStyle);
  70437. // 如果面有边框
  70438. type === 'POLYGON' &&
  70439. style.strokeColor &&
  70440. this._addStrokeLineForPoly(style, source, layerID + '-strokeLine', visible);
  70441. }
  70442. /**
  70443. * @function mapboxgl.supermap.WebMap.prototype._getTiandituUrl
  70444. * @private
  70445. * @description 创建天地图url;
  70446. * @param {Object} mapInfo - map 信息。
  70447. */
  70448. _getTiandituUrl(mapInfo) {
  70449. let re = /t0/gi;
  70450. let tiandituUrls = {};
  70451. let layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase();
  70452. let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
  70453. // let isLabel = true;
  70454. let url = 'https://t0.tianditu.gov.cn/{layer}_{proj}/wmts?';
  70455. let labelUrl = url;
  70456. let layerLabelMap = {
  70457. vec: 'cva',
  70458. ter: 'cta',
  70459. img: 'cia'
  70460. };
  70461. let tilematrixSet = this.baseProjection === 'EPSG:4326' ? 'c' : 'w';
  70462. let options = {
  70463. service: 'WMTS',
  70464. request: 'GetTile',
  70465. style: 'default',
  70466. version: '1.0.0',
  70467. layer: layerType,
  70468. tilematrixSet: tilematrixSet,
  70469. format: 'tiles',
  70470. width: 256,
  70471. height: 256
  70472. };
  70473. url += this._getParamString(options, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  70474. let tiandituUrl = url.replace('{layer}', layerType).replace('{proj}', tilematrixSet);
  70475. let tiandituUrlArr = [];
  70476. for (let i = 0; i < 8; i++) {
  70477. tiandituUrlArr.push(tiandituUrl.replace(re, `t${i}`));
  70478. }
  70479. tiandituUrls['tiandituUrl'] = tiandituUrlArr;
  70480. // 如果有 label 图层
  70481. if (isLabel) {
  70482. let labelLayer = layerLabelMap[layerType];
  70483. options.layer = labelLayer;
  70484. labelUrl += this._getParamString(options, labelUrl) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  70485. labelUrl = labelUrl.replace('{layer}', labelLayer).replace('{proj}', tilematrixSet);
  70486. let labelUrlArr = [];
  70487. for (let i = 0; i < 8; i++) {
  70488. labelUrlArr.push(labelUrl.replace(re, `t${i}`));
  70489. }
  70490. tiandituUrls['labelUrl'] = labelUrlArr;
  70491. }
  70492. return tiandituUrls;
  70493. }
  70494. /**
  70495. * @function mapboxgl.supermap.WebMap.prototype._getWMSUrl
  70496. * @private
  70497. * @description 创建 WMS url;
  70498. * @param {Object} mapInfo - map 信息。
  70499. */
  70500. _getWMSUrl(mapInfo) {
  70501. let url = mapInfo.url;
  70502. url = url.split('?')[0];
  70503. let strArr = url.split('/');
  70504. let options = {
  70505. service: 'WMS',
  70506. request: 'GetMap',
  70507. layers: strArr[strArr.length - 1],
  70508. styles: '',
  70509. format: 'image/png',
  70510. transparent: 'true',
  70511. version: '1.1.1',
  70512. width: 256,
  70513. height: 256,
  70514. srs: this.baseProjection
  70515. };
  70516. let bbox = this.baseProjection === 'EPSG:4326' ? '{bbox-epsg-4326}' : '{bbox-epsg-3857}';
  70517. url += this._getParamString(options, url) + `&bbox=${bbox}`;
  70518. return url;
  70519. }
  70520. /**
  70521. * @private
  70522. * @function mapboxgl.supermap.WebMap.prototype._addLayers
  70523. * @description 添加叠加图层。
  70524. * @param {Object} mapInfo - 图层信息。
  70525. */
  70526. _addLayers(layers) {
  70527. //存储地图上所有的图层对象
  70528. this.layers = layers;
  70529. let features,
  70530. layerAdded = 0,
  70531. len = layers.length;
  70532. layers.forEach((layer, index) => {
  70533. if ((layer.dataSource && layer.dataSource.serverId) || layer.layerType === 'MARKER') {
  70534. // 获取 serverID
  70535. let serverId = layer.dataSource ? layer.dataSource.serverId : layer.serverId;
  70536. let url = `${this.server}web/datas/${serverId}/content.json?pageSize=9999999&currentPage=1`;
  70537. // 获取图层数据
  70538. serverId &&
  70539. FetchRequest.get(url, null, { withCredentials: this.withCredentials })
  70540. .then(response => {
  70541. return response.json();
  70542. })
  70543. .then(data => {
  70544. if (data.succeed === false) {
  70545. //请求失败
  70546. layerAdded++;
  70547. this._sendMapToUser(layerAdded, len);
  70548. /**
  70549. * @event mapboxgl.supermap.WebMap#getlayersfailed
  70550. * @description 获取图层信息失败。
  70551. * @property {Object} error - 失败原因。
  70552. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  70553. */
  70554. this.fire('getlayersfailed', { error: data.error, map: this.map });
  70555. return;
  70556. }
  70557. if (data.type) {
  70558. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  70559. data.content = JSON.parse(data.content.trim());
  70560. features = this._formatGeoJSON(data.content, layer);
  70561. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  70562. features = this._excelData2Feature(data.content, layer);
  70563. }
  70564. this._addLayer(layer, features, index);
  70565. layerAdded++;
  70566. this._sendMapToUser(layerAdded, len);
  70567. }
  70568. })
  70569. .catch(error => {
  70570. layerAdded++;
  70571. this._sendMapToUser(layerAdded, len);
  70572. this.fire('getlayersfailed', { error: error, map: this.map });
  70573. });
  70574. } else if (
  70575. layer.layerType === 'SUPERMAP_REST' ||
  70576. layer.layerType === 'TILE' ||
  70577. layer.layerType === 'WMS' ||
  70578. layer.layerType === 'WMTS'
  70579. ) {
  70580. this._createBaseLayer(layer);
  70581. layerAdded++;
  70582. this._sendMapToUser(layerAdded, len);
  70583. } else if (layer.dataSource && layer.dataSource.type === 'REST_DATA') {
  70584. let dataSource = layer.dataSource;
  70585. //从restData获取数据
  70586. this._getFeatureBySQL(
  70587. dataSource.url,
  70588. [dataSource.dataSourseName || layer.name],
  70589. result => {
  70590. features = this._parseGeoJsonData2Feature({
  70591. allDatas: { features: result.result.features.features },
  70592. fileCode: layer.projection,
  70593. featureProjection: this.baseProjection
  70594. });
  70595. this._addLayer(layer, features, index);
  70596. layerAdded++;
  70597. this._sendMapToUser(layerAdded, len);
  70598. },
  70599. err => {
  70600. layerAdded++;
  70601. this._sendMapToUser(layerAdded, len);
  70602. /**
  70603. * @event mapboxgl.supermap.WebMap#getfeaturesfailed
  70604. * @description 获取图层要素失败。
  70605. * @property {Object} error - 失败原因。
  70606. */
  70607. this.fire('getfeaturesfailed', { error: err });
  70608. }
  70609. );
  70610. } else if (layer.dataSource && layer.dataSource.type === 'REST_MAP' && layer.dataSource.url) {
  70611. this._queryFeatureBySQL(
  70612. layer.dataSource.url,
  70613. layer.dataSource.layerName,
  70614. 'smid=1',
  70615. null,
  70616. null,
  70617. result => {
  70618. let recordsets = result && result.result.recordsets;
  70619. let recordset = recordsets && recordsets[0];
  70620. let attributes = recordset.fields;
  70621. if (recordset && attributes) {
  70622. let fileterAttrs = [];
  70623. for (let i in attributes) {
  70624. let value = attributes[i];
  70625. if (value.indexOf('Sm') !== 0 || value === 'SmID') {
  70626. fileterAttrs.push(value);
  70627. }
  70628. }
  70629. this._getFeatures(
  70630. fileterAttrs,
  70631. layer,
  70632. features => {
  70633. this._addLayer(layer, features, index);
  70634. layerAdded++;
  70635. this._sendMapToUser(layerAdded, len);
  70636. },
  70637. err => {
  70638. layerAdded++;
  70639. this.fire('getfeaturesfailed', { error: err, map: this.map });
  70640. }
  70641. );
  70642. }
  70643. },
  70644. err => {
  70645. this.fire('getlayersfailed', { error: err, map: this.map });
  70646. }
  70647. );
  70648. }
  70649. }, this);
  70650. }
  70651. /**
  70652. * @private
  70653. * @function mapboxgl.supermap.WebMap.prototype._getFeatures
  70654. * @description 将单个图层添加到地图上。
  70655. * @param layerInfo 某个图层的图层信息
  70656. * @param {Array.<GeoJSON>} features - feature。
  70657. */
  70658. _getFeatures(fields, layerInfo, resolve, reject) {
  70659. let source = layerInfo.dataSource;
  70660. //示例数据
  70661. let fileCode = layerInfo.projection;
  70662. this._queryFeatureBySQL(
  70663. source.url,
  70664. source.layerName,
  70665. null,
  70666. fields,
  70667. null,
  70668. result => {
  70669. let recordsets = result.result.recordsets[0];
  70670. let features = recordsets.features.features;
  70671. let featuresObj = this._parseGeoJsonData2Feature(
  70672. {
  70673. allDatas: { features },
  70674. fileCode: fileCode,
  70675. featureProjection: this.baseProjection
  70676. },
  70677. 'JSON'
  70678. );
  70679. resolve(featuresObj);
  70680. },
  70681. err => {
  70682. reject(err);
  70683. }
  70684. );
  70685. }
  70686. /**
  70687. * @private
  70688. * @function mapboxgl.supermap.WebMap.prototype._addLayer
  70689. * @description 将单个图层添加到地图上。
  70690. * @param layerInfo 某个图层的图层信息
  70691. * @param {Array.<GeoJSON>} features - feature。
  70692. */
  70693. _addLayer(layerInfo, features, index) {
  70694. let layerType = layerInfo.layerType;
  70695. layerInfo.layerID = layerType + '-' + layerInfo.name + '-' + index;
  70696. layerInfo.visible = layerInfo.visible ? 'visible' : 'none';
  70697. // mbgl 目前不能处理 geojson 复杂面情况
  70698. // mbgl isssue https://github.com/mapbox/mapbox-gl-js/issues/7023
  70699. if (features[0] && features[0].geometry.type === 'Polygon') {
  70700. features = this._handleMultyPolygon(features);
  70701. }
  70702. if (layerInfo.style && layerInfo.filterCondition) {
  70703. //将 feature 根据过滤条件进行过滤, 分段专题图和单值专题图因为要计算 styleGroup 所以暂时不过滤
  70704. if (layerType !== 'RANGE' && layerType !== 'UNIQUE') {
  70705. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  70706. }
  70707. }
  70708. if (layerType === 'VECTOR') {
  70709. if (layerInfo.featureType === 'POINT') {
  70710. if (layerInfo.style.type === 'SYMBOL_POINT') {
  70711. this._createSymbolLayer(layerInfo, features);
  70712. } else {
  70713. this._createGraphicLayer(layerInfo, features);
  70714. }
  70715. } else {
  70716. //线和面
  70717. this._createVectorLayer(layerInfo, features);
  70718. }
  70719. } else if (layerType === 'UNIQUE') {
  70720. this._createUniqueLayer(layerInfo, features);
  70721. } else if (layerType === 'RANGE') {
  70722. this._createRangeLayer(layerInfo, features);
  70723. } else if (layerType === 'HEAT') {
  70724. this._createHeatLayer(layerInfo, features);
  70725. } else if (layerType === 'MARKER') {
  70726. this._createMarkerLayer(layerInfo, features);
  70727. }
  70728. if (layerInfo.labelStyle && layerInfo.labelStyle.labelField) {
  70729. // 存在标签专题图
  70730. this._addLabelLayer(layerInfo, features);
  70731. }
  70732. }
  70733. /**
  70734. * @private
  70735. * @function mapboxgl.supermap.WebMap.prototype._addLabelLayer
  70736. * @description 添加标签图层。
  70737. * @param layerInfo 某个图层的图层信息。
  70738. * @param {Array.<GeoJSON>} features - feature。
  70739. */
  70740. _addLabelLayer(layerInfo, features) {
  70741. let labelStyle = layerInfo.labelStyle;
  70742. this.map.addLayer({
  70743. id: layerInfo.layerID + 'label',
  70744. type: 'symbol',
  70745. source: {
  70746. type: 'geojson',
  70747. data: {
  70748. type: 'FeatureCollection',
  70749. features: features
  70750. }
  70751. },
  70752. paint: {
  70753. 'text-color': labelStyle.fill
  70754. },
  70755. layout: {
  70756. 'text-field': `{${labelStyle.labelField}}`,
  70757. 'text-size': parseFloat(labelStyle.fontSize) || 12,
  70758. 'text-offset': labelStyle.offsetX
  70759. ? [labelStyle.offsetX / 10 || 0, labelStyle.offsetY / 10 || 0]
  70760. : [0, -1.5],
  70761. 'text-font': ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'],
  70762. visibility: layerInfo.visible
  70763. }
  70764. });
  70765. }
  70766. /**
  70767. * @private
  70768. * @function mapboxgl.supermap.WebMap.prototype._createSymbolLayer
  70769. * @description 添加 symbol 图层。
  70770. * @param layerInfo 某个图层的图层信息。
  70771. * @param {Array.<GeoJSON>} features - feature。
  70772. */
  70773. _createSymbolLayer(layerInfo, features) {
  70774. //用来请求symbol_point字体文件
  70775. let target = document.getElementById(`${this.target}`);
  70776. target.classList.add('supermapol-icons-map');
  70777. let style = layerInfo.style;
  70778. let unicode = layerInfo.style.unicode;
  70779. let text = String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16));
  70780. let layerID = layerInfo.layerID;
  70781. this.map.addSource(layerID + '-source', {
  70782. type: 'geojson',
  70783. data: {
  70784. type: 'FeatureCollection',
  70785. features: []
  70786. }
  70787. });
  70788. this.map.addLayer({
  70789. id: layerID,
  70790. type: 'symbol',
  70791. source: layerID + '-source',
  70792. paint: {
  70793. 'text-color': style.fillColor
  70794. },
  70795. layout: {
  70796. 'text-field': text,
  70797. 'text-font': ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'],
  70798. visibility: layerInfo.visible
  70799. }
  70800. });
  70801. this.map.getSource(layerID + '-source').setData({
  70802. type: 'FeatureCollection',
  70803. features: features
  70804. });
  70805. }
  70806. /**
  70807. * @private
  70808. * @function mapboxgl.supermap.WebMap.prototype._createGraphicLayer
  70809. * @description 创建 Graphic 图层。
  70810. * @param {Object} layerInfo - map 信息。
  70811. * @param {Array} features - 属性 信息。
  70812. */
  70813. _createGraphicLayer(layerInfo, features) {
  70814. let style = layerInfo.style;
  70815. let layerStyle = {};
  70816. let layerID = layerInfo.layerID;
  70817. let source = {
  70818. type: 'geojson',
  70819. data: {
  70820. type: 'FeatureCollection',
  70821. features: features
  70822. }
  70823. };
  70824. if (style.type === 'IMAGE_POINT') {
  70825. let imageInfo = style.imageInfo;
  70826. let imgDom = imageInfo.img;
  70827. if (!imgDom || !imgDom.src) {
  70828. //要组装成完整的url
  70829. imageInfo.url = this.server + imageInfo.url;
  70830. }
  70831. this.map.loadImage(imageInfo.url || imgDom.src, (error, image) => {
  70832. if (error) {
  70833. console.log(error);
  70834. }
  70835. let iconSize = Number.parseFloat((style.radius / image.height).toFixed(2)) * 2;
  70836. this.map.addImage('imageIcon', image);
  70837. this.map.addLayer({
  70838. id: layerID,
  70839. type: 'symbol',
  70840. source: source,
  70841. layout: {
  70842. 'icon-image': 'imageIcon',
  70843. 'icon-size': iconSize,
  70844. visibility: layerInfo.visible
  70845. }
  70846. });
  70847. });
  70848. } else if (style.type === 'SVG_POINT') {
  70849. let svg_url = style.url;
  70850. if (!this.svgDiv) {
  70851. this.svgDiv = document.createElement('div');
  70852. document.body.appendChild(this.svgDiv);
  70853. }
  70854. this._getCanvasFromSVG(svg_url, this.svgDiv, canvas => {
  70855. let imgUrl = canvas.toDataURL('img/png');
  70856. imgUrl &&
  70857. this.map.loadImage(
  70858. imgUrl,
  70859. (error, image) => {
  70860. if (error) {
  70861. console.log(error);
  70862. }
  70863. let iconSize = Number.parseFloat((style.radius / canvas.width).toFixed(2));
  70864. this.map.addImage('imageIcon', image);
  70865. this.map.addLayer({
  70866. id: layerID,
  70867. type: 'symbol',
  70868. source: source,
  70869. layout: {
  70870. 'icon-image': 'imageIcon',
  70871. 'icon-size': iconSize,
  70872. visibility: layerInfo.visible
  70873. }
  70874. });
  70875. },
  70876. this
  70877. );
  70878. });
  70879. } else {
  70880. layerStyle.style = this._transformStyleToMapBoxGl(style, layerInfo.featureType);
  70881. layerStyle.layout = { visibility: layerInfo.visible };
  70882. this._addOverlayToMap('POINT', source, layerID, layerStyle);
  70883. }
  70884. }
  70885. /**
  70886. * @private
  70887. * @function mapboxgl.supermap.WebMap.prototype._createUniqueLayer
  70888. * @description 创建单值图层。
  70889. * @param layerInfo 某个图层的图层信息
  70890. * @param features 图层上的 feature
  70891. */
  70892. _createUniqueLayer(layerInfo, features) {
  70893. let styleGroup = this._getUniqueStyleGroup(layerInfo, features);
  70894. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  70895. let style = layerInfo.style;
  70896. let layerStyle = {};
  70897. let themeField = layerInfo.themeSetting.themeField;
  70898. let type = layerInfo.featureType;
  70899. let expression = ['match', ['get', 'index']];
  70900. let layerID = layerInfo.layerID;
  70901. features.forEach(row => {
  70902. styleGroup.forEach(item => {
  70903. if (item.value === row.properties[themeField]) {
  70904. expression.push(row.properties['index'], item.color);
  70905. }
  70906. });
  70907. });
  70908. expression.push('#ffffff');
  70909. layerStyle.style = this._transformStyleToMapBoxGl(style, type, expression);
  70910. let visible = layerInfo.visible;
  70911. layerStyle.layout = { visibility: visible };
  70912. let source = {
  70913. type: 'geojson',
  70914. data: {
  70915. type: 'FeatureCollection',
  70916. features: features
  70917. }
  70918. };
  70919. this._addOverlayToMap(type, source, layerID, layerStyle);
  70920. type === 'POLYGON' &&
  70921. style.strokeColor &&
  70922. this._addStrokeLineForPoly(style, source, layerID + '-strokeLine', visible);
  70923. }
  70924. /**
  70925. * @private
  70926. * @function mapboxgl.supermap.WebMap.prototype._getUniqueStyleGroup
  70927. * @description 获取单值的目标字段与颜色的对应数组。
  70928. * @param layerInfo 某个图层的图层信息
  70929. * @param features 图层上的 feature
  70930. */
  70931. _getUniqueStyleGroup(parameters, features) {
  70932. // 找出所有的单值
  70933. let featureType = parameters.featureType,
  70934. style = parameters.style,
  70935. themeSetting = parameters.themeSetting;
  70936. let fieldName = themeSetting.themeField,
  70937. colors = themeSetting.colors;
  70938. let names = [],
  70939. customSettings = themeSetting.customSettings;
  70940. for (let i in features) {
  70941. let properties = features[i].properties;
  70942. let name = properties[fieldName];
  70943. let isSaved = false;
  70944. for (let j in names) {
  70945. if (names[j] === name) {
  70946. isSaved = true;
  70947. break;
  70948. }
  70949. }
  70950. if (!isSaved) {
  70951. names.push(name);
  70952. }
  70953. }
  70954. //获取一定量的颜色
  70955. let curentColors = colors || this.defaultParameters.colors;
  70956. curentColors = ColorsPickerUtil.getGradientColors(curentColors, names.length);
  70957. //生成styleGroup
  70958. let styleGroup = [];
  70959. names.forEach((name, index) => {
  70960. let color = curentColors[index];
  70961. if (name in customSettings) {
  70962. color = customSettings[name];
  70963. }
  70964. if (featureType === 'LINE') {
  70965. style.strokeColor = color;
  70966. } else {
  70967. style.fillColor = color;
  70968. }
  70969. styleGroup.push({ color: color, value: name });
  70970. }, this);
  70971. return styleGroup;
  70972. }
  70973. /**
  70974. * @private
  70975. * @function mapboxgl.supermap.WebMap.prototype._getWMTSUrl
  70976. * @description 根据传入的配置信息拼接wmts url。
  70977. * @param options 配置对象
  70978. */
  70979. _getWMTSUrl(options) {
  70980. let obj = {
  70981. service: 'WMTS',
  70982. request: 'GetTile',
  70983. version: '1.0.0',
  70984. style: 'default',
  70985. layer: options.layer,
  70986. tilematrixSet: options.tileMatrixSet,
  70987. format: 'image/png'
  70988. };
  70989. let url = options.url;
  70990. url += this._getParamString(obj, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}';
  70991. return url;
  70992. }
  70993. /**
  70994. * @private
  70995. * @function mapboxgl.supermap.WebMap.prototype._createMarkerLayer
  70996. * @description 添加标记图层。
  70997. * @param {Array.<GeoJSON>} features - feature。
  70998. */
  70999. _createMarkerLayer(layerInfo, features) {
  71000. features &&
  71001. features.forEach(feature => {
  71002. let geomType = feature.geometry.type.toUpperCase();
  71003. let defaultStyle = feature.dv_v5_markerStyle;
  71004. if (geomType === 'POINT' && defaultStyle.text) {
  71005. //说明是文字的feature类型
  71006. geomType = 'TEXT';
  71007. }
  71008. let featureInfo = this.setFeatureInfo(feature);
  71009. feature.properties['useStyle'] = defaultStyle;
  71010. feature.properties['featureInfo'] = featureInfo;
  71011. if (
  71012. geomType === 'POINT' &&
  71013. defaultStyle.src &&
  71014. (defaultStyle.src.indexOf('http://') === -1 && defaultStyle.src.indexOf('https://') === -1)
  71015. ) {
  71016. //说明地址不完整
  71017. defaultStyle.src = this.server + defaultStyle.src;
  71018. }
  71019. let source = {
  71020. type: 'geojson',
  71021. data: feature
  71022. };
  71023. let index = feature.properties.index;
  71024. let layerID = geomType + '-' + index;
  71025. // image-marker
  71026. geomType === 'POINT' &&
  71027. defaultStyle.src &&
  71028. defaultStyle.src.indexOf('svg') <= -1 &&
  71029. this.map.loadImage(
  71030. defaultStyle.src,
  71031. (error, image) => {
  71032. if (error) {
  71033. console.log(error);
  71034. }
  71035. this.map.addImage(index + '', image);
  71036. this.map.addLayer({
  71037. id: layerID,
  71038. type: 'symbol',
  71039. source: source,
  71040. layout: {
  71041. 'icon-image': index + '',
  71042. 'icon-size': defaultStyle.scale,
  71043. visibility: layerInfo.visible
  71044. }
  71045. });
  71046. },
  71047. this
  71048. );
  71049. // svg-marker
  71050. if (geomType === 'POINT' && defaultStyle.src && defaultStyle.src.indexOf('svg') > -1) {
  71051. if (!this.svgDiv) {
  71052. this.svgDiv = document.createElement('div');
  71053. document.body.appendChild(this.svgDiv);
  71054. }
  71055. this._getCanvasFromSVG(defaultStyle.src, this.svgDiv, canvas => {
  71056. let imgUrl = canvas.toDataURL('img/png');
  71057. imgUrl &&
  71058. this.map.loadImage(
  71059. imgUrl,
  71060. (error, image) => {
  71061. if (error) {
  71062. console.log(error);
  71063. }
  71064. this.map.addImage(index + '', image);
  71065. this.map.addLayer({
  71066. id: layerID,
  71067. type: 'symbol',
  71068. source: source,
  71069. layout: {
  71070. 'icon-image': index + '',
  71071. 'icon-size': defaultStyle.scale,
  71072. visibility: layerInfo.visible
  71073. }
  71074. });
  71075. },
  71076. this
  71077. );
  71078. });
  71079. }
  71080. // point-line-polygon-marker
  71081. if (!defaultStyle.src) {
  71082. let layeStyle = { layout: {} };
  71083. if (geomType === 'LINESTRING' && defaultStyle.lineCap) {
  71084. geomType = 'LINE';
  71085. layeStyle.layout = { 'line-cap': defaultStyle.lineCap };
  71086. }
  71087. let visible = layerInfo.visible;
  71088. layeStyle.layout.visibility = visible;
  71089. // get style
  71090. layeStyle.style = this._transformStyleToMapBoxGl(defaultStyle, geomType);
  71091. this._addOverlayToMap(geomType, source, layerID, layeStyle);
  71092. // 若面有边框
  71093. geomType === 'POLYGON' &&
  71094. defaultStyle.strokeColor &&
  71095. this._addStrokeLineForPoly(defaultStyle, source, layerID + '-strokeLine', visible);
  71096. }
  71097. }, this);
  71098. }
  71099. /**
  71100. * @private
  71101. * @function mapboxgl.supermap.WebMap.prototype.setFeatureInfo
  71102. * @description 设置 feature 信息。
  71103. * @param {Array.<GeoJSON>} features - feature。
  71104. */
  71105. setFeatureInfo(feature) {
  71106. let featureInfo;
  71107. let info = feature.dv_v5_markerInfo;
  71108. if (info && info.dataViz_title) {
  71109. //有featureInfo信息就不需要再添加
  71110. featureInfo = info;
  71111. } else {
  71112. // featureInfo = this.getDefaultAttribute();
  71113. return info;
  71114. }
  71115. let properties = feature.properties;
  71116. for (let key in featureInfo) {
  71117. if (properties[key]) {
  71118. featureInfo[key] = properties[key];
  71119. delete properties[key];
  71120. }
  71121. }
  71122. return featureInfo;
  71123. }
  71124. /**
  71125. * @private
  71126. * @function mapboxgl.supermap.WebMap.prototype._createHeatLayer
  71127. * @description 添加热力图。
  71128. * @param {Array.<GeoJSON>} features - feature。
  71129. */
  71130. _createHeatLayer(layerInfo, features) {
  71131. let style = layerInfo.themeSetting;
  71132. let layerOption = {};
  71133. layerOption.gradient = style.colors.slice();
  71134. layerOption.radius = parseInt(style.radius);
  71135. //自定义颜色
  71136. let customSettings = style.customSettings;
  71137. for (let i in customSettings) {
  71138. layerOption.gradient[i] = customSettings[i];
  71139. }
  71140. // 权重字段恢复
  71141. if (style.weight) {
  71142. this._changeWeight(features, style.weight);
  71143. }
  71144. let color = ['interpolate', ['linear'], ['heatmap-density']];
  71145. let length = layerOption.gradient.length;
  71146. let step = (1 / length).toFixed(2);
  71147. layerOption.gradient.forEach((item, index) => {
  71148. color.push(index * step);
  71149. if (index === 0) {
  71150. item = core_Util_Util.hexToRgba(item, 0);
  71151. }
  71152. color.push(item);
  71153. });
  71154. let paint = {
  71155. 'heatmap-color': color,
  71156. 'heatmap-radius': style.radius + 15,
  71157. 'heatmap-intensity': { base: 1, stops: [[0, 0.8], [22, 1]] }
  71158. };
  71159. if (features[0].weight && features.length >= 4) {
  71160. let weight = [];
  71161. features.forEach(item => {
  71162. weight.push(item.weight);
  71163. });
  71164. let max = ArrayStatistic.getMax(weight);
  71165. let min = ArrayStatistic.getMin(weight);
  71166. paint['heatmap-weight'] = ['interpolate', ['linear'], ['get', 'weight'], min, 0, max, 1];
  71167. }
  71168. this.map.addLayer({
  71169. id: layerInfo.layerID,
  71170. type: 'heatmap',
  71171. source: {
  71172. type: 'geojson',
  71173. data: {
  71174. type: 'FeatureCollection',
  71175. features: features
  71176. }
  71177. },
  71178. paint: paint
  71179. });
  71180. }
  71181. /**
  71182. * @private
  71183. * @function mapboxgl.supermap.WebMap.prototype._changeWeight
  71184. * @description 改变当前权重字段
  71185. * @param {Array.<GeoJSON>} features - feature。
  71186. * @param {String} weightFeild - 权重字段
  71187. */
  71188. _changeWeight(features, weightFeild) {
  71189. this.fieldMaxValue = {};
  71190. this._getMaxValue(features, weightFeild);
  71191. let maxValue = this.fieldMaxValue[weightFeild];
  71192. features.forEach(feature => {
  71193. let attributes = feature.properties;
  71194. let value = attributes[weightFeild];
  71195. feature['weight'] = value / maxValue;
  71196. });
  71197. }
  71198. /**
  71199. * @private
  71200. * @function mapboxgl.supermap.WebMap.prototype._getMaxValue
  71201. * @description 获取当前字段对应的最大值,用于计算权重。
  71202. * @param {Array.<GeoJSON>} features - feature。
  71203. * @param {String} weightFeild - 权重字段
  71204. */
  71205. _getMaxValue(features, weightField) {
  71206. let values = [],
  71207. attributes;
  71208. let field = weightField;
  71209. if (this.fieldMaxValue[field]) {
  71210. return;
  71211. }
  71212. features.forEach(feature => {
  71213. //收集当前权重字段对应的所有值
  71214. attributes = feature.properties;
  71215. attributes && parseFloat(attributes[field]) && values.push(parseFloat(attributes[field]));
  71216. });
  71217. this.fieldMaxValue[field] = ArrayStatistic.getArrayStatistic(values, 'Maximum');
  71218. }
  71219. /**
  71220. * @private
  71221. * @function mapboxgl.supermap.WebMap.prototype._createRangeLayer
  71222. * @description 添加分段专题图。
  71223. * @param {Array.<GeoJSON>} features - feature。
  71224. */
  71225. _createRangeLayer(layerInfo, features) {
  71226. let fieldName = layerInfo.themeSetting.themeField;
  71227. let style = layerInfo.style;
  71228. let featureType = layerInfo.featureType;
  71229. let styleGroups = this._getRangeStyleGroup(layerInfo, features);
  71230. features = this._getFiterFeatures(layerInfo.filterCondition, features);
  71231. let source = {
  71232. type: 'geojson',
  71233. data: {
  71234. type: 'FeatureCollection',
  71235. features: features
  71236. }
  71237. };
  71238. // 获取 expression
  71239. let expression = ['match', ['get', 'index']];
  71240. features.forEach(row => {
  71241. let tartget = parseFloat(row.properties[fieldName]);
  71242. for (let i = 0; i < styleGroups.length; i++) {
  71243. if (styleGroups[i].start <= tartget && tartget < styleGroups[i].end) {
  71244. expression.push(row.properties['index'], styleGroups[i].color);
  71245. // return;
  71246. }
  71247. }
  71248. !tartget && expression.push(row.properties['index'], 'rgba(0, 0, 0, 0)');
  71249. }, this);
  71250. expression.push('rgba(0, 0, 0, 0)');
  71251. // 获取样式
  71252. let layerStyle = { layout: {} };
  71253. if (featureType === 'LINE' && style.lineCap) {
  71254. layerStyle.layout = { 'line-cap': style.lineCap };
  71255. }
  71256. let visible = layerInfo.visible;
  71257. layerStyle.layout.visibility = visible;
  71258. layerStyle.style = this._transformStyleToMapBoxGl(style, featureType, expression);
  71259. // 添加图层
  71260. let layerID = layerInfo.layerID;
  71261. this._addOverlayToMap(featureType, source, layerID, layerStyle);
  71262. // 如果面有边框
  71263. featureType === 'POLYGON' &&
  71264. style.strokeColor &&
  71265. this._addStrokeLineForPoly(style, source, layerID + '-strokeline', visible);
  71266. }
  71267. /**
  71268. * @private
  71269. * @function mapboxgl.supermap.WebMap.prototype._getFiterFeatures
  71270. * @description 通过过滤条件查询满足的 feature。
  71271. * @param {String} filterCondition - 过滤条件。
  71272. * @param {array} allFeatures - 图层上的 feature 集合
  71273. */
  71274. _getFiterFeatures(filterCondition, allFeatures) {
  71275. if (!filterCondition) {
  71276. return allFeatures;
  71277. }
  71278. let condition = this._replaceFilterCharacter(filterCondition);
  71279. let sql = 'select * from json where (' + condition + ')';
  71280. let filterFeatures = [];
  71281. for (let i = 0; i < allFeatures.length; i++) {
  71282. let feature = allFeatures[i];
  71283. let filterResult = false;
  71284. try {
  71285. filterResult = window.jsonsql.query(sql, {
  71286. properties: feature.properties
  71287. });
  71288. } catch (err) {
  71289. //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
  71290. continue;
  71291. }
  71292. if (filterResult && filterResult.length > 0) {
  71293. //afterFilterFeatureIdx.push(i);
  71294. filterFeatures.push(feature);
  71295. }
  71296. }
  71297. return filterFeatures;
  71298. }
  71299. /**
  71300. * @private
  71301. * @function mapboxgl.supermap.WebMap.prototype._replaceFilterCharacter
  71302. * @description 获取过滤字符串。
  71303. * @param {String} filterString - 过滤条件。
  71304. */
  71305. _replaceFilterCharacter(filterString) {
  71306. filterString = filterString
  71307. .replace(/=/g, '==')
  71308. .replace(/AND|and/g, '&&')
  71309. .replace(/or|OR/g, '||')
  71310. .replace(/<==/g, '<=')
  71311. .replace(/>==/g, '>=');
  71312. return filterString;
  71313. }
  71314. /**
  71315. * @private
  71316. * @function mapboxgl.supermap.WebMap.prototype._getRangeStyleGroup
  71317. * @description 获取分段样式。
  71318. * @param {Array.<GeoJSON>} features - feature。
  71319. */
  71320. _getRangeStyleGroup(layerInfo, features) {
  71321. // 找出分段值
  71322. let featureType = layerInfo.featureType;
  71323. let style = layerInfo.style;
  71324. let values = [],
  71325. attributes;
  71326. let themeSetting = layerInfo.themeSetting;
  71327. let customSettings = themeSetting.customSettings;
  71328. let fieldName = themeSetting.themeField;
  71329. let segmentCount = themeSetting.segmentCount;
  71330. features.forEach(feature => {
  71331. attributes = feature.properties || feature.get('Properties');
  71332. if (attributes) {
  71333. //过滤掉非数值的数据
  71334. attributes[fieldName] &&
  71335. core_Util_Util.isNumber(attributes[fieldName]) &&
  71336. values.push(parseFloat(attributes[fieldName]));
  71337. } else if (feature.get(fieldName) && core_Util_Util.isNumber(feature.get(fieldName))) {
  71338. feature.get(fieldName) && values.push(parseFloat(feature.get(fieldName)));
  71339. }
  71340. }, this);
  71341. let segements = ArrayStatistic.getArraySegments(values, themeSetting.segmentMethod, segmentCount);
  71342. if (segements) {
  71343. let itemNum = segmentCount;
  71344. if (attributes && segements[0] === segements[attributes.length - 1]) {
  71345. itemNum = 1;
  71346. segements.length = 2;
  71347. }
  71348. //保留两位有效数
  71349. for (let key in segements) {
  71350. let value = segements[key];
  71351. value = key == 0 ? Math.floor(value * 100) / 100 : Math.ceil(value * 100) / 100 + 0.1; // 加0.1 解决最大值没有样式问题
  71352. segements[key] = Number(value.toFixed(2));
  71353. }
  71354. //获取一定量的颜色
  71355. let curentColors = themeSetting.colors;
  71356. // curentColors = ColorsPickerUtil.getGradientColors(curentColors, itemNum, 'RANGE');
  71357. for (let index = 0; index < itemNum; index++) {
  71358. if (index in customSettings) {
  71359. if (customSettings[index]['segment']['start']) {
  71360. segements[index] = customSettings[index]['segment']['start'];
  71361. }
  71362. if (customSettings[index]['segment']['end']) {
  71363. segements[index + 1] = customSettings[index]['segment']['end'];
  71364. }
  71365. }
  71366. }
  71367. //生成styleGroup
  71368. let styleGroups = [];
  71369. for (let i = 0; i < itemNum; i++) {
  71370. let color = curentColors[i];
  71371. if (i in customSettings) {
  71372. if (customSettings[i].color) {
  71373. color = customSettings[i].color;
  71374. }
  71375. }
  71376. if (featureType === 'LINE') {
  71377. style.strokeColor = color;
  71378. } else {
  71379. style.fillColor = color;
  71380. }
  71381. let start = segements[i];
  71382. let end = segements[i + 1];
  71383. let styleObj = JSON.parse(JSON.stringify(style));
  71384. styleGroups.push({ style: styleObj, color: color, start: start, end: end });
  71385. }
  71386. return styleGroups;
  71387. }
  71388. }
  71389. /**
  71390. * @private
  71391. * @function mapboxgl.supermap.WebMap.prototype._formatGeoJSON
  71392. * @description 格式 GeoJSON。
  71393. * @param {GeoJSON} data - GeoJSON 数据。
  71394. */
  71395. _formatGeoJSON(data) {
  71396. let features = data.features;
  71397. features.forEach((row, index) => {
  71398. row.properties['index'] = index;
  71399. // TODO 待优化 坐标转换
  71400. // if (fileCode !== 'EPSG:4326') {
  71401. // if(row.geometry.coordinates[0] instanceof Array){
  71402. // row.geometry.coordinates.forEach((coords, index) => {
  71403. // let lnglat = this._unproject(coords);
  71404. // row.geometry.coordinates[index] = [lnglat.lng, lnglat.lat];
  71405. // }, this)
  71406. // return;
  71407. // }
  71408. // let lnglat = this._unproject(row.geometry.coordinates);
  71409. // row.geometry.coordinates = [lnglat.lng, lnglat.lat];
  71410. // }
  71411. });
  71412. return features;
  71413. }
  71414. /**
  71415. * @private
  71416. * @function mapboxgl.supermap.WebMap.prototype._excelData2Feature将
  71417. * @description csv 和 xls 文件内容转换成 geojson
  71418. * @param content 文件内容
  71419. * @param layerInfo 图层信息
  71420. * @returns {Array} feature的数组集合
  71421. */
  71422. _excelData2Feature(dataContent) {
  71423. let fieldCaptions = dataContent.colTitles;
  71424. // let fileCode = layerInfo.projection;
  71425. //位置属性处理
  71426. let xfieldIndex = -1,
  71427. yfieldIndex = -1;
  71428. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  71429. if (this._isXField(fieldCaptions[i])) {
  71430. xfieldIndex = i;
  71431. }
  71432. if (this._isYField(fieldCaptions[i])) {
  71433. yfieldIndex = i;
  71434. }
  71435. }
  71436. // feature 构建后期支持坐标系 4326/3857
  71437. let features = [];
  71438. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  71439. let row = dataContent.rows[i];
  71440. let x = Number(row[xfieldIndex]),
  71441. y = Number(row[yfieldIndex]);
  71442. // let coordinates = [x, y];
  71443. // TODO 待优化 坐标转换
  71444. // if (fileCode !== 'EPSG:4326') {
  71445. // if(row.geometry.coordinates[0] instanceof Array){
  71446. // row.geometry.coordinates.forEach((coords, index) => {
  71447. // let lnglat = this._unproject(coords);
  71448. // row.geometry.coordinates[index] = [lnglat.lng, lnglat.lat];
  71449. // }, this)
  71450. // return;
  71451. // }
  71452. // let lnglat = this._unproject(row.geometry.coordinates);
  71453. // row.geometry.coordinates = [lnglat.lng, lnglat.lat];
  71454. // }
  71455. //属性信息
  71456. let attributes = {};
  71457. for (let index in dataContent.colTitles) {
  71458. let key = dataContent.colTitles[index];
  71459. attributes[key] = dataContent.rows[i][index];
  71460. }
  71461. attributes['index'] = i + '';
  71462. //目前csv 只支持处理点,所以先生成点类型的 geojson
  71463. let feature = {
  71464. type: 'Feature',
  71465. geometry: {
  71466. type: 'Point',
  71467. coordinates: [x, y]
  71468. },
  71469. properties: attributes
  71470. };
  71471. features.push(feature);
  71472. }
  71473. return features;
  71474. }
  71475. /**
  71476. * @private
  71477. * @function mapboxgl.supermap.WebMap.prototype._sendMapToUser
  71478. * @description 返回最终的 map 对象给用户,供他们操作使用。
  71479. * @param count
  71480. * @param layersLen
  71481. */
  71482. _sendMapToUser(count, layersLen) {
  71483. if (count === layersLen) {
  71484. /**
  71485. * @event mapboxgl.supermap.WebMap#addlayerssucceeded
  71486. * @description 添加图层成功。
  71487. * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
  71488. * @property {Object} mapparams - 地图信息。
  71489. * @property {string} mapParams.title - 地图标题。
  71490. * @property {string} mapParams.description - 地图描述。
  71491. * @property {Array.<Object>} layers - 地图上所有的图层对象
  71492. */
  71493. this.fire('addlayerssucceeded', { map: this.map, mapparams: this.mapParams, layers: this.layers });
  71494. }
  71495. }
  71496. /**
  71497. * @function mapboxgl.supermap.WebMap.prototype._unproject
  71498. * @private
  71499. * @description 墨卡托转经纬度。
  71500. * @param {} point - 待转换的点。
  71501. */
  71502. _unproject(point) {
  71503. var d = 180 / Math.PI,
  71504. r = 6378137,
  71505. ts = Math.exp(-point[1] / r),
  71506. phi = Math.PI / 2 - 2 * Math.atan(ts);
  71507. for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {
  71508. con = 1;
  71509. dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;
  71510. phi += dphi;
  71511. }
  71512. return new (external_mapboxgl_default()).LngLat((point[0] * d) / r, phi * d);
  71513. }
  71514. /**
  71515. * @function mapboxgl.supermap.WebMap.prototype._getParamString
  71516. * @private
  71517. * @param {Object} obj - 待添加的参数。
  71518. * @param {string} existingUrl - 待添加参数的 url。
  71519. * @param {Boolean} [uppercase] - 参数是否转换为大写。
  71520. */
  71521. _getParamString(obj, existingUrl, uppercase) {
  71522. var params = [];
  71523. for (var i in obj) {
  71524. params.push((uppercase ? i.toUpperCase() : i) + '=' + obj[i]);
  71525. }
  71526. return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');
  71527. }
  71528. /**
  71529. * @private
  71530. * @description 判断是否地理X坐标
  71531. * @param data
  71532. */
  71533. _isXField(data) {
  71534. var lowerdata = data.toLowerCase();
  71535. return (
  71536. lowerdata === 'x' ||
  71537. lowerdata === 'smx' ||
  71538. lowerdata === 'jd' ||
  71539. lowerdata === '经度' ||
  71540. lowerdata === '东经' ||
  71541. lowerdata === 'longitude' ||
  71542. lowerdata === 'lot' ||
  71543. lowerdata === 'lon' ||
  71544. lowerdata === 'lng'
  71545. );
  71546. }
  71547. /**
  71548. * @private
  71549. * @description 判断是否地理Y坐标
  71550. * @param data
  71551. */
  71552. _isYField(data) {
  71553. var lowerdata = data.toLowerCase();
  71554. return (
  71555. lowerdata === 'y' ||
  71556. lowerdata === 'smy' ||
  71557. lowerdata === 'wd' ||
  71558. lowerdata === '纬度' ||
  71559. lowerdata === '北纬' ||
  71560. lowerdata === 'latitude' ||
  71561. lowerdata === 'lat'
  71562. );
  71563. }
  71564. /**
  71565. * @private
  71566. * @function mapboxgl.supermap.WebMap.prototype._transformStyleToMapBoxGl
  71567. * @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxgl 中的 style 格式。
  71568. * @param {Object} style - layerInfo中的style属性
  71569. * @param {String} type - 图层类型
  71570. * @param {Array} [expression] - 存储颜色值得表达式
  71571. */
  71572. _transformStyleToMapBoxGl(style, type, expression) {
  71573. let transTable = {};
  71574. if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') {
  71575. transTable = {
  71576. fillColor: 'circle-color',
  71577. strokeWidth: 'circle-stroke-width',
  71578. fillOpacity: 'circle-opacity',
  71579. radius: 'circle-radius',
  71580. strokeColor: 'circle-stroke-color',
  71581. strokeOpacity: 'circle-stroke-opacity'
  71582. };
  71583. } else if (type === 'LINE') {
  71584. transTable = {
  71585. strokeWidth: 'line-width',
  71586. strokeColor: 'line-color',
  71587. strokeOpacity: 'line-opacity'
  71588. };
  71589. } else if (type === 'POLYGON') {
  71590. transTable = {
  71591. fillColor: 'fill-color',
  71592. fillOpacity: 'fill-opacity',
  71593. strokeColor: 'fill-outline-color'
  71594. };
  71595. }
  71596. let newObj = {};
  71597. for (let item in style) {
  71598. if (transTable[item]) {
  71599. newObj[transTable[item]] = style[item];
  71600. }
  71601. }
  71602. if (expression) {
  71603. if (newObj['circle-color']) {
  71604. newObj['circle-color'] = expression;
  71605. } else if (newObj['line-color']) {
  71606. newObj['line-color'] = expression;
  71607. } else {
  71608. newObj['fill-color'] = expression;
  71609. }
  71610. }
  71611. if (style.lineDash && style.lineDash !== 'solid' && type === 'LINE') {
  71612. newObj['line-dasharray'] = this._dashStyle(style);
  71613. }
  71614. return newObj;
  71615. }
  71616. /**
  71617. * @private
  71618. * @function mapboxgl.supermap.WebMap.prototype.._dashStyle
  71619. * @description 符号样式。
  71620. * @param {Object} style - 样式参数。
  71621. * @param {number} widthFactor - 宽度系数。
  71622. */
  71623. _dashStyle(style) {
  71624. if (!style) {
  71625. return [];
  71626. }
  71627. // var w = style.strokeWidth * widthFactor;
  71628. var w = 1;
  71629. var str = style.strokeDashstyle || style.lineDash;
  71630. switch (str) {
  71631. case 'solid':
  71632. return [];
  71633. case 'dot':
  71634. return [1, 4 * w];
  71635. case 'dash':
  71636. return [4 * w, 4 * w];
  71637. case 'dashdot':
  71638. return [4 * w, 4 * w, 1 * w, 4 * w];
  71639. case 'longdash':
  71640. return [8 * w, 4 * w];
  71641. case 'longdashdot':
  71642. return [8 * w, 4 * w, 1, 4 * w];
  71643. default:
  71644. if (!str) {
  71645. return [];
  71646. }
  71647. if (Util.isArray(str)) {
  71648. return str;
  71649. }
  71650. str = StringExt.trim(str).replace(/\s+/g, ',');
  71651. return str.replace(/\[|\]/gi, '').split(',');
  71652. }
  71653. }
  71654. /**
  71655. * @private
  71656. * @description 将SVG转换成Canvas
  71657. * @param svgUrl
  71658. * @param divDom
  71659. * @param callBack
  71660. */
  71661. _getCanvasFromSVG(svgUrl, divDom, callBack) {
  71662. //一个图层对应一个canvas
  71663. let canvas = document.createElement('canvas');
  71664. canvas.id = 'dataviz-canvas-' + core_Util_Util.newGuid(8);
  71665. canvas.style.display = 'none';
  71666. divDom.appendChild(canvas);
  71667. let canvgs = window.canvg ? window.canvg : (external_function_try_return_canvg_catch_e_return_default());
  71668. canvgs(canvas.id, svgUrl, {
  71669. ignoreMouse: true,
  71670. ignoreAnimation: true,
  71671. renderCallback: () => {
  71672. if (canvas.width > 300 || canvas.height > 300) {
  71673. return;
  71674. }
  71675. callBack(canvas);
  71676. },
  71677. forceRedraw: () => {
  71678. return false;
  71679. }
  71680. });
  71681. }
  71682. /**
  71683. * @private
  71684. * @function mapboxgl.supermap.WebMap.prototype._addOverlayToMap
  71685. * @description 添加基础矢量图层到 MAP
  71686. * @param {Object} style - mabgl style
  71687. * @param {String} type - 图层类型
  71688. */
  71689. _addOverlayToMap(type, source, layerID, layerStyle) {
  71690. let mbglTypeMap = {
  71691. POINT: 'circle',
  71692. LINE: 'line',
  71693. POLYGON: 'fill'
  71694. };
  71695. type = mbglTypeMap[type];
  71696. if (type === 'circle' || type === 'line' || type === 'fill') {
  71697. this.map.addLayer({
  71698. id: layerID,
  71699. type: type,
  71700. source: source,
  71701. paint: layerStyle.style,
  71702. layout: layerStyle.layout || {}
  71703. });
  71704. }
  71705. }
  71706. _addBaselayer(url, layerID, minzoom = 0, maxzoom = 22, isIserver) {
  71707. this.map.addLayer({
  71708. id: layerID,
  71709. type: 'raster',
  71710. source: {
  71711. type: 'raster',
  71712. tiles: url,
  71713. tileSize: 256,
  71714. rasterSource: isIserver ? 'iserver' : '',
  71715. prjCoordSys: isIserver ? { epsgCode: this.baseProjection.split(':')[1] } : ''
  71716. },
  71717. minzoom: minzoom,
  71718. maxzoom: maxzoom
  71719. });
  71720. }
  71721. /**
  71722. * @private
  71723. * @function mapboxgl.supermap.WebMap.prototype._addStrokeLineForPoly
  71724. * @description 添加面的边框。
  71725. * @param {Object} style - mabgl style
  71726. */
  71727. _addStrokeLineForPoly(style, source, layerID, visible) {
  71728. let lineStyle = {};
  71729. lineStyle.style = this._transformStyleToMapBoxGl(style, 'LINE');
  71730. lineStyle.layout = { visibility: visible };
  71731. this._addOverlayToMap('LINE', source, layerID, lineStyle);
  71732. }
  71733. /**
  71734. * @private
  71735. * @function mapboxgl.supermap.WebMap.prototype._parseGeoJsonData2Feature
  71736. * @description 将从restData地址上获取的json转换成feature(从iserver中获取的json转换成feature)
  71737. * @param {object} metaData - json内容
  71738. * @returns {Array} ol.feature的数组集合
  71739. */
  71740. _parseGeoJsonData2Feature(metaData) {
  71741. let allFeatures = metaData.allDatas.features,
  71742. features = [];
  71743. for (let i = 0, len = allFeatures.length; i < len; i++) {
  71744. // TODO 坐标转换
  71745. let feature = allFeatures[i];
  71746. let coordinate = feature.geometry.coordinates;
  71747. if (allFeatures[i].geometry.type === 'Point') {
  71748. // 标注图层 还没有属性值时候不加
  71749. if (allFeatures[i].properties) {
  71750. allFeatures[i].properties.lon = coordinate[0];
  71751. allFeatures[i].properties.lat = coordinate[1];
  71752. }
  71753. }
  71754. features.properties['index'] = i + '';
  71755. features.push(feature);
  71756. }
  71757. return features;
  71758. }
  71759. /**
  71760. * @private
  71761. * @function mapboxgl.supermap.WebMap.prototype._getFeatureBySQL
  71762. * @description 通过 sql 方式查询数据。
  71763. */
  71764. _getFeatureBySQL(url, datasetNames, processCompleted, processFaild) {
  71765. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  71766. getFeatureParam = new FilterParameter({
  71767. name: datasetNames.join().replace(':', '@'),
  71768. attributeFilter: 'SMID > 0'
  71769. });
  71770. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  71771. queryParameter: getFeatureParam,
  71772. datasetNames: datasetNames,
  71773. fromIndex: 0,
  71774. toIndex: 100000,
  71775. returnContent: true
  71776. });
  71777. let options = {
  71778. eventListeners: {
  71779. processCompleted: getFeaturesEventArgs => {
  71780. processCompleted && processCompleted(getFeaturesEventArgs);
  71781. },
  71782. processFailed: e => {
  71783. processFaild && processFaild(e);
  71784. }
  71785. }
  71786. };
  71787. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  71788. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  71789. }
  71790. /**
  71791. * @private
  71792. * @function mapboxgl.supermap.WebMap.prototype._queryFeatureBySQL
  71793. * @description 通过 sql 方式查询数据。
  71794. */
  71795. _queryFeatureBySQL(
  71796. url,
  71797. layerName,
  71798. attributeFilter,
  71799. fields,
  71800. epsgCode,
  71801. processCompleted,
  71802. processFaild,
  71803. startRecord,
  71804. recordLength,
  71805. onlyAttribute
  71806. ) {
  71807. var queryParam, queryBySQLParams, queryBySQLService;
  71808. queryParam = new FilterParameter({
  71809. name: layerName,
  71810. attributeFilter: attributeFilter
  71811. });
  71812. if (fields) {
  71813. queryParam.fields = fields;
  71814. }
  71815. var params = {
  71816. queryParams: [queryParam]
  71817. };
  71818. if (onlyAttribute) {
  71819. params.queryOption = QueryOption.ATTRIBUTE;
  71820. }
  71821. startRecord && (params.startRecord = startRecord);
  71822. recordLength && (params.expectCount = recordLength);
  71823. if (epsgCode) {
  71824. params.prjCoordSys = {
  71825. epsgCode: epsgCode
  71826. };
  71827. }
  71828. queryBySQLParams = new QueryBySQLParameters(params);
  71829. queryBySQLService = new (external_mapboxgl_default()).supermap.QueryService(url);
  71830. queryBySQLService.queryBySQL(queryBySQLParams, data => {
  71831. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  71832. });
  71833. }
  71834. /**
  71835. * @private
  71836. * @function mapboxgl.supermap.WebMap.prototype._handleMultyPolygon
  71837. * @description 处理复杂面情况
  71838. */
  71839. _handleMultyPolygon(features) {
  71840. features.forEach(feature => {
  71841. if (feature.geometry.type !== 'Polygon') {
  71842. return;
  71843. }
  71844. let coords = feature.geometry.coordinates;
  71845. if (coords.length > 1) {
  71846. let coordinates = [];
  71847. coords.forEach(coord => {
  71848. coordinates.push([coord]);
  71849. });
  71850. feature.geometry.coordinates = coordinates;
  71851. feature.geometry.type = 'MultiPolygon';
  71852. }
  71853. });
  71854. return features;
  71855. }
  71856. _transformScaleToZoom(scale, crs) {
  71857. let scale_0 = 295829515.2024169;
  71858. if ((crs || this.map.getCRS()).epsgCode !== 'EPSG:3857') {
  71859. scale_0 = 295295895;
  71860. }
  71861. const scaleDenominator = scale.split(':')[1];
  71862. return Math.min(24, +Math.log2(scale_0 / +scaleDenominator).toFixed(2));
  71863. }
  71864. _getResolution(bounds, tileSize = 512.0) {
  71865. if (bounds.leftBottom && bounds.rightTop) {
  71866. return Math.max(bounds.rightTop.x - bounds.leftBottom.x, bounds.rightTop.y - bounds.leftBottom.y) / tileSize;
  71867. }
  71868. return Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) / tileSize;
  71869. }
  71870. }
  71871. (external_mapboxgl_default()).supermap.WebMap = WebMap;
  71872. ;// CONCATENATED MODULE: ./src/mapboxgl/mapping/index.js
  71873. ;// CONCATENATED MODULE: ./src/mapboxgl/index.js
  71874. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71875. * This program are made available under the terms of the Apache License, Version 2.0
  71876. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71877. })();
  71878. (() => {
  71879. "use strict";
  71880. })();
  71881. /******/ })()
  71882. ;